Bug 1485430 - Simplify PlaceBelowCurrentFloats. r=dbaron,mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 22 Aug 2018 23:29:22 +0000
changeset 481474 975546ce7e13698d4e9a31aef70e89c8b2ded1e1
parent 481473 83488f147740483a4e59be8a0c4934303032d131
child 481475 68ddeae44caaea1f9441fc19843109be5b4a332e
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersdbaron, mats
bugs1485430
milestone63.0a1
Bug 1485430 - Simplify PlaceBelowCurrentFloats. r=dbaron,mats No reason to pass our own member as an argument. Differential Revision: https://phabricator.services.mozilla.com/D4000
layout/generic/BlockReflowInput.cpp
layout/generic/BlockReflowInput.h
layout/generic/nsBlockFrame.cpp
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -1060,39 +1060,40 @@ BlockReflowInput::PushFloatPastBreak(nsI
   AppendPushedFloatChain(aFloat);
   mReflowStatus.SetOverflowIncomplete();
 }
 
 /**
  * Place below-current-line floats.
  */
 void
-BlockReflowInput::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList,
-                                                nsLineBox* aLine)
+BlockReflowInput::PlaceBelowCurrentLineFloats(nsLineBox* aLine)
 {
-  nsFloatCache* fc = aList.Head();
+  MOZ_ASSERT(mBelowCurrentLineFloats.NotEmpty());
+  nsFloatCache* fc = mBelowCurrentLineFloats.Head();
   while (fc) {
 #ifdef DEBUG
     if (nsBlockFrame::gNoisyReflow) {
       nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
       printf("placing bcl float: ");
       nsFrame::ListTag(stdout, fc->mFloat);
       printf("\n");
     }
 #endif
     // Place the float
     bool placed = FlowAndPlaceFloat(fc->mFloat);
     nsFloatCache *next = fc->Next();
     if (!placed) {
-      aList.Remove(fc);
+      mBelowCurrentLineFloats.Remove(fc);
       delete fc;
       aLine->SetHadFloatPushed();
     }
     fc = next;
   }
+  aLine->AppendFloats(mBelowCurrentLineFloats);
 }
 
 nscoord
 BlockReflowInput::ClearFloats(nscoord aBCoord, StyleClear aBreakType,
                                 nsIFrame *aReplacedBlock,
                                 uint32_t aFlags)
 {
 #ifdef DEBUG
--- a/layout/generic/BlockReflowInput.h
+++ b/layout/generic/BlockReflowInput.h
@@ -149,18 +149,17 @@ public:
    * they are not associated with a line box).
    */
   bool AddFloat(nsLineLayout*       aLineLayout,
                 nsIFrame*           aFloat,
                 nscoord             aAvailableISize);
 
   bool FlowAndPlaceFloat(nsIFrame* aFloat);
 
-  void PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aFloats,
-                                   nsLineBox* aLine);
+  void PlaceBelowCurrentLineFloats(nsLineBox* aLine);
 
   // Returns the first coordinate >= aBCoord that clears the
   // floats indicated by aBreakType and has enough inline size between floats
   // (or no floats remaining) to accomodate aReplacedBlock.
   nscoord ClearFloats(nscoord aBCoord, mozilla::StyleClear aBreakType,
                       nsIFrame *aReplacedBlock = nullptr,
                       uint32_t aFlags = 0);
 
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -4797,18 +4797,17 @@ nsBlockFrame::PlaceLine(BlockReflowInput
 
   // Add the already placed current-line floats to the line
   aLine->AppendFloats(aState.mCurrentLineFloats);
 
   // Any below current line floats to place?
   if (aState.mBelowCurrentLineFloats.NotEmpty()) {
     // Reflow the below-current-line floats, which places on the line's
     // float list.
-    aState.PlaceBelowCurrentLineFloats(aState.mBelowCurrentLineFloats, aLine);
-    aLine->AppendFloats(aState.mBelowCurrentLineFloats);
+    aState.PlaceBelowCurrentLineFloats(aLine);
   }
 
   // When a line has floats, factor them into the combined-area
   // computations.
   if (aLine->HasFloats()) {
     // Combine the float combined area (stored in aState) and the
     // value computed by the line layout code.
     nsOverflowAreas lineOverflowAreas;