Bug 1466231 Part 1: Change nsBlockFrame::PlaceLine to accept an nsFlowAreaRect and update flags if it shrinks the area due to a float. r=dbaron
☠☠ backed out by 5056d42de0e9 ☠ ☠
authorBrad Werth <bwerth@mozilla.com>
Wed, 06 Jun 2018 12:02:36 -0700
changeset 476928 f926e605d5a945b5af0945080f09787f8803402e
parent 476927 e77ceef3485b65252fb67f9fa5a627a39dcae3d7
child 476929 332453c76ec7d09ba10dd1858bbbbc93ef837c4a
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1466231
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466231 Part 1: Change nsBlockFrame::PlaceLine to accept an nsFlowAreaRect and update flags if it shrinks the area due to a float. r=dbaron MozReview-Commit-ID: 4stQQfboUl7
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -4079,17 +4079,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
     // past the float.
   }
   else if (LineReflowStatus::Truncated != lineReflowStatus &&
            LineReflowStatus::RedoNoPull != lineReflowStatus) {
     // If we are propagating out a break-before status then there is
     // no point in placing the line.
     if (!aState.mReflowStatus.IsInlineBreakBefore()) {
       if (!PlaceLine(aState, aLineLayout, aLine, aFloatStateBeforeLine,
-                     aFloatAvailableSpace.mRect, aAvailableSpaceBSize,
+                     aFloatAvailableSpace, aAvailableSpaceBSize,
                      aKeepReflowGoing)) {
         lineReflowStatus = LineReflowStatus::RedoMoreFloats;
         // PlaceLine already called GetAvailableSpaceForBSize for us.
       }
     }
   }
 #ifdef DEBUG
   if (gNoisyReflow) {
@@ -4469,17 +4469,17 @@ nsBlockFrame::IsLastLine(BlockReflowInpu
   return true;
 }
 
 bool
 nsBlockFrame::PlaceLine(BlockReflowInput& aState,
                         nsLineLayout& aLineLayout,
                         LineIterator aLine,
                         nsFloatManager::SavedState *aFloatStateBeforeLine,
-                        LogicalRect& aFloatAvailableSpace,
+                        nsFlowAreaRect& aFlowArea,
                         nscoord& aAvailableSpaceBSize,
                         bool* aKeepReflowGoing)
 {
   // Trim extra white-space from the line before placing the frames
   aLineLayout.TrimTrailingWhiteSpace();
 
   // Vertically align the frames on this line.
   //
@@ -4536,41 +4536,41 @@ nsBlockFrame::PlaceLine(BlockReflowInput
   // LineReflowStatus::RedoMoreFloats).  We ensure aAvailableSpaceBSize
   // never decreases, which means that we can't reduce the set of floats
   // we intersect, which means that the available space cannot grow.
   if (AvailableSpaceShrunk(wm, floatAvailableSpaceWithOldLineBSize,
                            floatAvailableSpaceWithLineBSize, false)) {
     // Prepare data for redoing the line.
     aState.mLineBSize = Some(aLine->BSize());
 
-    // Since we want to redo the line, we update aFloatAvailableSpace by
-    // using the aFloatStateBeforeLine, which is the float manager's state
-    // before the line is placed.
-    LogicalRect oldFloatAvailableSpace(aFloatAvailableSpace);
-    aFloatAvailableSpace =
-      aState.GetFloatAvailableSpaceForBSize(aLine->BStart(),
-                                            aAvailableSpaceBSize,
-                                            aFloatStateBeforeLine).mRect;
-    NS_ASSERTION(aFloatAvailableSpace.BStart(wm) ==
+    // Since we want to redo the line, we update aFlowArea by using the
+    // aFloatStateBeforeLine, which is the float manager's state before the
+    // line is placed.
+    LogicalRect oldFloatAvailableSpace(aFlowArea.mRect);
+    aFlowArea = aState.GetFloatAvailableSpaceForBSize(aLine->BStart(),
+                                                      aAvailableSpaceBSize,
+                                                      aFloatStateBeforeLine);
+
+    NS_ASSERTION(aFlowArea.mRect.BStart(wm) ==
                  oldFloatAvailableSpace.BStart(wm), "yikes");
     // Restore the BSize to the position of the next band.
-    aFloatAvailableSpace.BSize(wm) = oldFloatAvailableSpace.BSize(wm);
+    aFlowArea.mRect.BSize(wm) = oldFloatAvailableSpace.BSize(wm);
 
     // Enforce both IStart() and IEnd() never move outwards to prevent
     // infinite grow-shrink loops.
     const nscoord iStartDiff =
-      aFloatAvailableSpace.IStart(wm) - oldFloatAvailableSpace.IStart(wm);
+      aFlowArea.mRect.IStart(wm) - oldFloatAvailableSpace.IStart(wm);
     const nscoord iEndDiff =
-      aFloatAvailableSpace.IEnd(wm) - oldFloatAvailableSpace.IEnd(wm);
+      aFlowArea.mRect.IEnd(wm) - oldFloatAvailableSpace.IEnd(wm);
     if (iStartDiff < 0) {
-      aFloatAvailableSpace.IStart(wm) -= iStartDiff;
-      aFloatAvailableSpace.ISize(wm) += iStartDiff;
+      aFlowArea.mRect.IStart(wm) -= iStartDiff;
+      aFlowArea.mRect.ISize(wm) += iStartDiff;
     }
     if (iEndDiff > 0) {
-      aFloatAvailableSpace.ISize(wm) -= iEndDiff;
+      aFlowArea.mRect.ISize(wm) -= iEndDiff;
     }
 
     return false;
   }
 
 #ifdef DEBUG
   if (!GetParent()->IsCrazySizeAssertSuppressed()) {
     static nscoord lastHeight = 0;
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -700,17 +700,17 @@ protected:
 
   // Return false if it needs another reflow because of reduced space
   // between floats that are next to it (but not next to its top), and
   // return true otherwise.
   bool PlaceLine(BlockReflowInput& aState,
                  nsLineLayout& aLineLayout,
                  LineIterator aLine,
                  nsFloatManager::SavedState* aFloatStateBeforeLine,
-                 mozilla::LogicalRect& aFloatAvailableSpace, //in-out
+                 nsFlowAreaRect& aFlowArea, // in-out
                  nscoord& aAvailableSpaceBSize, // in-out
                  bool* aKeepReflowGoing);
 
   /**
     * If NS_BLOCK_LOOK_FOR_DIRTY_FRAMES is set, call MarkLineDirty
     * on any line with a child frame that is dirty.
     */
   void LazyMarkLinesDirty();