Let generated content content nodes know when their frames go away. Bug

237975, r+sr=dbaron, a=chofmann


git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_7_BRANCH@155287 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2004-04-21 15:15:17 +00:00
parent fdcaef7a32
commit 7c0405666e

View File

@@ -122,6 +122,25 @@ nsContainerFrame::SetInitialChildList(nsIPresContext* aPresContext,
return result;
}
static void
CleanupGeneratedContentIn(nsIContent* aParent, nsIFrame* aRoot) {
nsIAtom* frameList = nsnull;
PRInt32 listIndex = 0;
do {
nsIFrame* child = aRoot->GetFirstChild(frameList);
while (child) {
nsIContent* content = child->GetContent();
if (content && content != aParent) {
content->SetParent(nsnull);
content->SetDocument(nsnull, PR_TRUE, PR_TRUE);
}
::CleanupGeneratedContentIn(aParent, child);
child = child->GetNextSibling();
}
frameList = aRoot->GetAdditionalChildListName(listIndex++);
} while (frameList);
}
NS_IMETHODIMP
nsContainerFrame::Destroy(nsIPresContext* aPresContext)
{
@@ -130,6 +149,16 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext)
GetView()->SetClientData(nsnull);
}
if (mState & NS_FRAME_GENERATED_CONTENT) {
// Make sure all the content nodes for the generated content inside
// this frame know it's going away.
// XXXbz would this be better done via a global structure in
// nsCSSFrameConstructor that could key off of
// GeneratedContentFrameRemoved or something? The problem is that
// our kids are gone by the time that's called.
::CleanupGeneratedContentIn(mContent, this);
}
// Delete the primary child list
mFrames.DestroyFrames(aPresContext);