aFrameManager->ClearAllUndisplayedContentIn(content);
DeletingFrameSubtree(nsIPresContext*  aPresContext,                     nsIPresShell*    aPresShell,                     nsIFrameManager* aFrameManager,                     nsIFrame*        aRemovedFrame,                     nsIFrame*        aFrame){  // If there's no frame manager it's probably because the pres shell is  // being destroyed  if (aFrameManager) {    // Remove the mapping from the content object to its frame    nsCOMPtr<nsIContent> content;    aFrame->GetContent(getter_AddRefs(content));    aFrameManager->SetPrimaryFrameFor(content, nsnull);        // Recursively walk aFrame's child frames looking for placeholder frames    nsIFrame* childFrame;    aFrame->FirstChild(nsnull, &childFrame);    while (childFrame) {      nsIAtom*  frameType;      PRBool    isPlaceholder;        // See if it's a placeholder frame      childFrame->GetFrameType(&frameType);      isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType);      NS_IF_RELEASE(frameType);        if (isPlaceholder) {        // Get the out-of-flow frame        nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)childFrame)->GetOutOfFlowFrame();        NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame");          // Remove the mapping from the out-of-flow frame to its placeholder        aFrameManager->SetPlaceholderFrameFor(outOfFlowFrame, nsnull);                // Recursively find and delete any of its out-of-flow frames, and remove        // the mapping from content objects to frames        DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, aRemovedFrame,                             outOfFlowFrame);                // Don't delete the out-of-flow frame if aRemovedFrame is one of its        // ancestor frames, because when aRemovedFrame is deleted it will delete        // its child frames including this out-of-flow frame        if (!IsAncestorFrame(outOfFlowFrame, aRemovedFrame)) {          // Get the out-of-flow frame's parent          nsIFrame* parentFrame;          outOfFlowFrame->GetParent(&parentFrame);            // Get the child list name for the out-of-flow frame          nsIAtom* listName;          GetChildListNameFor(parentFrame, outOfFlowFrame, &listName);            // Ask the parent to delete the out-of-flow frame          aFrameManager->RemoveFrame(*aPresContext, *aPresShell, parentFrame,                                     listName, outOfFlowFrame);          NS_IF_RELEASE(listName);        }        } else {        // Recursively find and delete any of its out-of-flow frames, and remove        // the mapping from content objects to frames        DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, aRemovedFrame,                             childFrame);      }        // Get the next sibling child frame      childFrame->GetNextSibling(&childFrame);    }  }  return NS_OK;}