Backed out changeset 253df4cdfdb9 (bug 847208)
authorEd Morley <emorley@mozilla.com>
Thu, 14 Mar 2013 15:18:33 +0000
changeset 124812 b9bbc1547d3215ca103cf526f9dee9fe5324d46f
parent 124811 a9984c7bfb50e7e9d0ed82c923c22c3809a711c6
child 124813 b7db07693ac549eb2898ecd059f74c99565b95dd
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs847208
milestone22.0a1
backs out253df4cdfdb9551da36b047ae8a9832aa09306a0
Backed out changeset 253df4cdfdb9 (bug 847208)
layout/generic/nsBlockFrame.cpp
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5610,18 +5610,29 @@ 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()) {
-    RemoveFloat(aChild);
-    return NS_OK;
+    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;
   }
 
   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.
@@ -6869,17 +6880,38 @@ 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) {
-        RemoveFloat(outOfFlowFrame);
+        // 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");
         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);