Bug 1569701 Part 1 - Make BlockReflowInput::mConsumedBSize a constant, and delete it assessor method. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 15 Aug 2019 16:49:14 +0000
changeset 488287 6d5655c8638d8683fe22521583bddd575c668575
parent 488286 e56e6ed91e5af309cbca9ce38252f03530d81b79
child 488288 e9611b9cff9a7a9bf7ce21a1384d017bf9c02fbe
push id113906
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 04:07:24 +0000
treeherdermozilla-inbound@d887276421d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1569701, 1506293
milestone70.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 1569701 Part 1 - Make BlockReflowInput::mConsumedBSize a constant, and delete it assessor method. r=dbaron We always pass consumed block-size into BlockReflowInput's constructor in nsBlockFrame::Reflow(). By making mConsumedBSize a constant, its assessor method becomes redundant. Update the documentation to reflect the reality that ConsumedBSize() accumulates content block-size from all previous *continuations*, which was done in Bug 1506293 Part 2. Differential Revision: https://phabricator.services.mozilla.com/D41906
layout/generic/BlockReflowInput.cpp
layout/generic/BlockReflowInput.h
layout/generic/nsBlockFrame.cpp
layout/generic/nsSplittableFrame.h
layout/reftests/bugs/reftest.list
layout/reftests/pagination/reftest.list
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -38,16 +38,19 @@ BlockReflowInput::BlockReflowInput(const
       mContentArea(aReflowInput.GetWritingMode()),
       mPushedFloats(nullptr),
       mOverflowTracker(nullptr),
       mBorderPadding(mReflowInput.ComputedLogicalBorderPadding()),
       mPrevBEndMargin(),
       mLineNumber(0),
       mFloatBreakType(StyleClear::None),
       mConsumedBSize(aConsumedBSize) {
+  NS_ASSERTION(mConsumedBSize != NS_UNCONSTRAINEDSIZE,
+               "The consumed block-size should be constrained!");
+
   WritingMode wm = aReflowInput.GetWritingMode();
   mFlags.mIsFirstInflow = !aFrame->GetPrevInFlow();
   mFlags.mIsOverflowContainer = IS_TRUE_OVERFLOW_CONTAINER(aFrame);
 
   nsIFrame::LogicalSides logicalSkipSides =
       aFrame->GetLogicalSkipSides(&aReflowInput);
   mBorderPadding.ApplySkipSides(logicalSkipSides);
 
@@ -132,24 +135,16 @@ BlockReflowInput::BlockReflowInput(const
   mBCoord = mContentArea.BStart(wm) = mBorderPadding.BStart(wm);
 
   mPrevChild = nullptr;
   mCurrentLine = aFrame->LinesEnd();
 
   mMinLineHeight = aReflowInput.CalcLineHeight();
 }
 
-nscoord BlockReflowInput::ConsumedBSize() {
-  if (mConsumedBSize == NS_UNCONSTRAINEDSIZE) {
-    mConsumedBSize = mBlock->ConsumedBSize(mReflowInput.GetWritingMode());
-  }
-
-  return mConsumedBSize;
-}
-
 void BlockReflowInput::ComputeReplacedBlockOffsetsForFloats(
     nsIFrame* aFrame, const LogicalRect& aFloatAvailableSpace,
     nscoord& aIStartResult, nscoord& aIEndResult) const {
   WritingMode wm = mReflowInput.GetWritingMode();
   // The frame is clueless about the float manager and therefore we
   // only give it free space. An example is a table frame - the
   // tables do not flow around floats.
   // However, we can let its margins intersect floats.
--- a/layout/generic/BlockReflowInput.h
+++ b/layout/generic/BlockReflowInput.h
@@ -194,22 +194,16 @@ class BlockReflowInput {
     return mBCoord == mBorderPadding.BStart(mReflowInput.GetWritingMode());
   }
 
   /**
    * Return mBlock's computed physical border+padding with GetSkipSides applied.
    */
   const mozilla::LogicalMargin& BorderPadding() const { return mBorderPadding; }
 
-  /**
-   * Retrieve the block-axis content size "consumed" by any prev-in-flows.
-   * @note the value is cached so subsequent calls will return the same value
-   */
-  nscoord ConsumedBSize();
-
   // Reconstruct the previous block-end margin that goes before |aLine|.
   void ReconstructMarginBefore(nsLineList::iterator aLine);
 
   // Caller must have called GetFloatAvailableSpace for the correct position
   // (which need not be the current mBCoord).
   void ComputeReplacedBlockOffsetsForFloats(
       nsIFrame* aFrame, const mozilla::LogicalRect& aFloatAvailableSpace,
       nscoord& aIStartResult, nscoord& aIEndResult) const;
@@ -379,19 +373,19 @@ class BlockReflowInput {
   nscoord mMinLineHeight;
 
   int32_t mLineNumber;
 
   Flags mFlags;
 
   StyleClear mFloatBreakType;
 
-  // The amount of computed block-direction size "consumed" by
-  // previous-in-flows.
-  nscoord mConsumedBSize;
+  // The amount of computed content block-size "consumed" by our previous
+  // continuations.
+  const nscoord mConsumedBSize;
 
   // Cache the current line's BSize if nsBlockFrame::PlaceLine() fails to
   // place the line. When redoing the line, it will be used to query the
   // accurate float available space in AddFloat() and
   // nsBlockFrame::PlaceLine().
   mozilla::Maybe<nscoord> mLineBSize;
 
  private:
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1774,17 +1774,17 @@ void nsBlockFrame::ComputeFinalSize(cons
 
   if (NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize() &&
       (!GetParent()->IsColumnSetFrame() ||
        aReflowInput.mParentReflowInput->AvailableBSize() ==
            NS_UNCONSTRAINEDSIZE)) {
     finalSize.BSize(wm) =
         ComputeFinalBSize(aReflowInput, aState.mReflowStatus,
                           aState.mBCoord + nonCarriedOutBDirMargin,
-                          borderPadding, aState.ConsumedBSize());
+                          borderPadding, aState.mConsumedBSize);
 
     // Don't carry out a block-end margin when our BSize is fixed.
     aMetrics.mCarriedOutBEndMargin.Zero();
   } else if (!IsComboboxControlFrame() &&
              aReflowInput.mStyleDisplay->IsContainSize()) {
     // If we're size-containing and we don't have a specified size, then our
     // final size should actually be computed from only our border and padding,
     // as though we were empty.
--- a/layout/generic/nsSplittableFrame.h
+++ b/layout/generic/nsSplittableFrame.h
@@ -73,29 +73,31 @@ class nsSplittableFrame : public nsFrame
  protected:
   nsSplittableFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                     ClassID aID)
       : nsFrame(aStyle, aPresContext, aID),
         mPrevContinuation(nullptr),
         mNextContinuation(nullptr) {}
 
   /**
-   * Return the sum of the block-axis content size of our prev-in-flows.
+   * Return the sum of the block-axis content size of our previous
+   * continuations.
+   *
    * @param aWM a writing-mode to determine the block-axis
    *
-   * @note (bz) This makes laying out a splittable frame with N in-flows
+   * @note (bz) This makes laying out a splittable frame with N continuations
    *       O(N^2)! So, use this function with caution and minimize the number
    *       of calls to this method.
    */
   nscoord ConsumedBSize(mozilla::WritingMode aWM) const;
 
   /**
    * Retrieve the effective computed block size of this frame, which is the
    * computed block size, minus the block size consumed by any previous
-   * in-flows.
+   * continuations.
    */
   nscoord GetEffectiveComputedBSize(
       const ReflowInput& aReflowInput,
       nscoord aConsumed = NS_UNCONSTRAINEDSIZE) const;
 
   /**
    * @see nsIFrame::GetLogicalSkipSides()
    */
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1020,17 +1020,17 @@ fuzzy-if(Android,0-11,0-17) fuzzy-if(web
 == chrome://reftest/content/bugs/421203-6.xul chrome://reftest/content/bugs/321402-6-ref.xul
 == 421234-1.html 421234-1-ref.html
 == 421239-1.html 421239-1-ref.html
 == 421239-2.html 421239-2-ref.html
 == 421419-1.html 421419-1-ref.html
 == 421436-1a.html 421436-1-ref.html
 == 421436-1b.html 421436-1-ref.html
 fuzzy-if(skiaContent,0-1,0-40) == 421632-1.html 421632-1-ref.html
-!= 421710-1.html about:blank
+asserts(1-1) != 421710-1.html about:blank # Bug 1574046
 fails-if(Android) fuzzy-if(webrender,63-64,1024-1024) fails-if(usesRepeatResampling&&!(webrender&&winWidget)) == 421885-1.xml 421885-1-ref.xml
 == 421955-1.html 421955-1-ref.html
 == 422249-1.html 422249-1-ref.html
 == 422394-1.html 422394-1-ref.html
 == 422678-1.html 422678-1-ref.html
 == 423130-1.html 423130-1-ref.html
 == 423385-1.html 423385-1-ref.html
 random-if(gtkWidget) == 423599-1.html 423599-1-ref.html # bug 1309095
--- a/layout/reftests/pagination/reftest.list
+++ b/layout/reftests/pagination/reftest.list
@@ -30,21 +30,21 @@ fails == border-breaking-004-cols.xhtml 
 == content-inserted-004.xhtml content-inserted-002.ref.xhtml
 == content-inserted-005.xhtml content-inserted-002.ref.xhtml
 == content-inserted-006.xhtml content-inserted-002.ref.xhtml
 == content-inserted-007.xhtml content-inserted-002.ref.xhtml
 == content-inserted-008.xhtml content-inserted-001.ref.xhtml
 == content-inserted-009.xhtml content-inserted-002.ref.xhtml
 == dynamic-abspos-overflow-01-cols.xhtml dynamic-abspos-overflow-01-cols.ref.xhtml
 == float-clear-000.html float-clear-000.ref.html
-fails == float-clear-001.html float-clear-000.ref.html
+asserts(4-4) fails == float-clear-001.html float-clear-000.ref.html # Bug 1574046
 == float-clear-002.html float-clear-000.ref.html
 fails == float-clear-003.html float-clear-000.ref.html
 == float-clear-000-print.html float-clear-000-print.ref.html
-== float-clear-001-print.html float-clear-000-print.ref.html
+asserts(1-1) == float-clear-001-print.html float-clear-000-print.ref.html # Bug 1574046
 == float-clear-002-print.html float-clear-000-print.ref.html
 == float-clear-003-print.html float-clear-000-print.ref.html
 fails == float-continuations-000.html float-continuations-000.ref.html
 fuzzy-if(skiaContent,0-1,0-21) == resize-reflow-000.html resize-reflow-000.ref.html
 fuzzy-if(skiaContent,0-1,0-23) == resize-reflow-001.html resize-reflow-001.ref.html
 == table-page-break-before-auto-1.html table-page-break-before-auto-1-ref.html
 #== table-page-break-before-auto-2.html table-page-break-before-auto-2-ref.html bug 563280
 == table-page-break-before-always-1.html table-page-break-before-auto-2-ref.html