Bug 405721. nsContainerFrame::RemoveFrame should search the frame's overflow list if the frame isn't found in the main child list. r+sr=bzbarsky
authorroc+@cs.cmu.edu
Mon, 14 Jan 2008 17:12:01 -0800
changeset 10266 8829d78b3b40d89360614cb59d4c3fe43e9be031
parent 10265 772c3eeb3609e992393169f81b8d6a02ac73e5dd
child 10267 e52f9487f365dfec3d1eda54001cfe7636487e0a
push idunknown
push userunknown
push dateunknown
bugs405721
milestone1.9b3pre
Bug 405721. nsContainerFrame::RemoveFrame should search the frame's overflow list if the frame isn't found in the main child list. r+sr=bzbarsky
layout/generic/nsContainerFrame.cpp
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -212,17 +212,23 @@ nsContainerFrame::RemoveFrame(nsIAtom*  
       // remove the frame from its parents list and generate a reflow
       // command.
       nsIFrame* oldFrameNextContinuation = aOldFrame->GetNextContinuation();
       //XXXfr probably should use StealFrame here. I'm not sure if we need to
       //      check the overflow lists atm, but we'll need a prescontext lookup
       //      for overflow containers once we can split abspos elements with
       //      inline containing blocks.
       if (parent == this) {
-        parent->mFrames.DestroyFrame(aOldFrame);
+        if (!parent->mFrames.DestroyFrame(aOldFrame)) {
+          // Try to remove it from our overflow list, if we have one.
+          // The simplest way is to reuse StealFrame.
+          nsresult rv = StealFrame(PresContext(), aOldFrame, PR_TRUE);
+          NS_ASSERTION(NS_SUCCEEDED(rv), "Could not find frame to remove!");
+          aOldFrame->Destroy();
+        }
       } else {
         // This recursive call takes care of all continuations after aOldFrame,
         // so we don't need to loop anymore.
         parent->RemoveFrame(nsnull, aOldFrame);
         break;
       }
       aOldFrame = oldFrameNextContinuation;
       if (aOldFrame) {