Bug 847208 - Reuse RemoveFloat() in a couple of places that did manual removal of a float child frame. r=dbaron
☠☠ backed out by b9bbc1547d32 ☠ ☠
authorMats Palmgren <matspal@gmail.com>
Thu, 14 Mar 2013 14:39:26 +0100
changeset 124807 253df4cdfdb9551da36b047ae8a9832aa09306a0
parent 124806 82bfa9035c6af6f0d7a74e2d851840a0a61d9986
child 124808 4acd42c81df7b33f3f802eab828fafb2e097118c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersdbaron
bugs847208
milestone22.0a1
Bug 847208 - Reuse RemoveFloat() in a couple of places that did manual removal of a float child frame. r=dbaron
layout/generic/nsBlockFrame.cpp
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5610,29 +5610,18 @@ nsresult
 nsBlockFrame::StealFrame(nsPresContext* aPresContext,
                          nsIFrame*      aChild,
                          bool           aForceNormal)
 {
   NS_PRECONDITION(aPresContext && aChild, "null pointer");
 
   if ((aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
       aChild->IsFloating()) {
-    MOZ_ASSERT(mFloats.ContainsFrame(aChild) ||
-               (GetPushedFloats() && GetPushedFloats()->ContainsFrame(aChild)),
-               "aChild is not our child");
-    bool removed = mFloats.StartRemoveFrame(aChild);
-    if (!removed) {
-      nsFrameList* list = GetPushedFloats();
-      if (list) {
-        removed = list->ContinueRemoveFrame(aChild);
-        // XXXmats delete the property if the list is now empty?
-      }
-    }
-    MOZ_ASSERT(removed, "StealFrame failed to remove the float");
-    return removed ? NS_OK : NS_ERROR_UNEXPECTED;
+    RemoveFloat(aChild);
+    return NS_OK;
   }
 
   if ((aChild->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)
       && !aForceNormal)
     return nsContainerFrame::StealFrame(aPresContext, aChild);
 
   // Find the line and the previous sibling that contains
   // aChild; we also find the pointer to the line.
@@ -6880,38 +6869,17 @@ nsBlockFrame::DoCollectFloats(nsIFrame* 
 {
   while (aFrame) {
     // Don't descend into float containing blocks.
     if (!aFrame->IsFloatContainingBlock()) {
       nsIFrame *outOfFlowFrame =
         aFrame->GetType() == nsGkAtoms::placeholderFrame ?
           nsLayoutUtils::GetFloatFromPlaceholder(aFrame) : nullptr;
       if (outOfFlowFrame && outOfFlowFrame->GetParent() == this) {
-        // Floats live in mFloats, or in the PushedFloat or OverflowOutOfFlows
-        // frame list properties.
-#ifdef DEBUG
-        if (!mFloats.ContainsFrame(outOfFlowFrame)) {
-          nsFrameList* list = GetPushedFloats();
-          if (!list || !list->ContainsFrame(outOfFlowFrame)) {
-            list = GetOverflowOutOfFlows();
-            MOZ_ASSERT(list && list->ContainsFrame(outOfFlowFrame),
-                       "the float is not our child");
-          }
-        }
-#endif
-        bool removed = mFloats.StartRemoveFrame(outOfFlowFrame);
-        if (!removed) {
-          nsFrameList* list = GetPushedFloats();
-          removed = list && list->ContinueRemoveFrame(outOfFlowFrame);
-          if (!removed) {
-            nsAutoOOFFrameList oofs(this);
-            removed = oofs.mList.ContinueRemoveFrame(outOfFlowFrame);
-          }
-        }
-        MOZ_ASSERT(removed, "misplaced float child");
+        RemoveFloat(outOfFlowFrame);
         aList.AppendFrame(nullptr, outOfFlowFrame);
         // FIXME: By not pulling floats whose parent is one of our
         // later siblings, are we risking the pushed floats getting
         // out-of-order?
         // XXXmats nsInlineFrame's lazy reparenting depends on NOT doing that.
       }
 
       DoCollectFloats(aFrame->GetFirstPrincipalChild(), aList, true);