Transfer floats changed to be used with any float containing blocks (not just top level blocks) draft
authorNeerja Pancholi <npancholi@mozilla.com>
Fri, 22 Sep 2017 18:36:35 -0700
changeset 698696 dc05a58580f4abb6d1db373c08907808a47fbf4b
parent 698695 ef10e1f9041c41dead68ef99d1d50c2399696c0d
child 698697 19cfac8892335208d53353430859e17eca07e594
push id89334
push userbmo:npancholi@mozilla.com
push dateThu, 16 Nov 2017 00:39:30 +0000
milestone59.0a1
Transfer floats changed to be used with any float containing blocks (not just top level blocks) MozReview-Commit-ID: DiAhSEIffST
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsBlockFrame.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -12329,16 +12329,19 @@ ProcessColumnSpan(nsFrameConstructorStat
                 "Grandparent cannot be columnSetWrapper! In that case newFrame==gparent");
 
     nsFrameItems splitChildren;
     SplitBlocks(aState, aOldParent, aChildItems, splitChildren);
     MOZ_ASSERT(splitChildren.NotEmpty(), "Child items cannot be empty here!");
 
     // Clean up the aOldParent and its placeholder, if present
     aFrameItems.RemoveFrame(aOldParent);
+    //aOldParent is guaranteed to be a block here
+    nsBlockFrame* oldBlockParent = static_cast<nsBlockFrame*>(aOldParent);
+    oldBlockParent->TransferFloats();
 //    if (aOldParent->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
 //      nsIFrame* placeholder = aOldParent->GetPlaceholderFrame();
 //      if (placeholder) {
 //        if (aFrameItems.ContainsFrame(placeholder)) {
 //          aFrameItems.RemoveFrame(placeholder);
 //        }
 //        placeholder->Destroy();
 //      }
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5678,22 +5678,22 @@ nsBlockFrame::UpdateFirstLetterStyle(Ser
 void
 nsBlockFrame::TransferFloats()
 {
   for (nsIFrame* floatFrame : mFloats) {
     nsIFrame* placeholder = floatFrame->GetPlaceholderFrame();
     if (placeholder) {
       // Find the topmost block parent this placeholder belongs to
       nsIFrame* finalParent = placeholder->GetParent();
-      while (finalParent->Type() != LayoutFrameType::ColumnSet) {
+      while (!finalParent->IsFloatContainingBlock()) {
         finalParent = finalParent->GetParent();
       }
       // We can guarantee that ColumnSetFrame will only have one
       // block child here.
-      finalParent = finalParent->PrincipalChildList().FirstChild();
+      //finalParent = finalParent->PrincipalChildList().FirstChild();
 
       RemoveFloat(floatFrame);
 
       // Add this float to the float list of its new and final parent
       nsFrameList temp(floatFrame, floatFrame);
       nsBlockFrame* finalBlockParent = static_cast<nsBlockFrame*>(finalParent);
       finalBlockParent->AppendFrames(nsIFrame::kFloatList, temp);
       floatFrame->SetParent(finalBlockParent);