Bug 1548118 Part 1 - Advance the column count at the end of the while loop. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 08 May 2019 03:09:19 +0000
changeset 531813 3db2c18f995048c3c7f2dc494ce7e582e9f374c1
parent 531812 efc64ba2b311e18d16820a00e98572807ee724a0
child 531814 152fb420ffc57e19cd0015c5ca57421c535d1268
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1548118
milestone68.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 1548118 Part 1 - Advance the column count at the end of the while loop. r=dbaron We use `columnCount == aConfig.mBalanceColCount - 1` in other places to determine if we are at the last column. Advancing the column count at the end of the loop make the condition consistent. Differential Revision: https://phabricator.services.mozilla.com/D29433
layout/generic/nsColumnSetFrame.cpp
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -811,17 +811,16 @@ nsColumnSetFrame::ColumnBalanceData nsCo
     // Build a continuation column if necessary
     nsIFrame* kidNextInFlow = child->GetNextInFlow();
 
     if (aStatus.IsFullyComplete() && !aStatus.IsTruncated()) {
       NS_ASSERTION(!kidNextInFlow, "next in flow should have been deleted");
       child = nullptr;
       break;
     } else {
-      ++columnCount;
       // Make sure that the column has a next-in-flow. If not, we must
       // create one to hold the overflowing stuff, even if we're just
       // going to put it on our overflow list and let *our*
       // next in flow handle it.
       if (!kidNextInFlow) {
         NS_ASSERTION(aStatus.NextInFlowNeedsReflow(),
                      "We have to create a continuation, but the block doesn't "
                      "want us to reflow it?");
@@ -851,17 +850,17 @@ nsColumnSetFrame::ColumnBalanceData nsCo
             contentBEnd > aReflowInput.mCBReflowInput->ComputedMaxBSize())) &&
           aConfig.mIsBalancing) {
         // We overflowed vertically, but have not exceeded the number of
         // columns. We're going to go into overflow columns now, so balancing
         // no longer applies.
         colData.mHasExcessBSize = true;
       }
 
-      if (columnCount >= aConfig.mBalanceColCount) {
+      if (columnCount >= aConfig.mBalanceColCount - 1) {
         // No more columns allowed here. Stop.
         aStatus.SetNextInFlowNeedsReflow();
         kidNextInFlow->AddStateBits(NS_FRAME_IS_DIRTY);
         // Move any of our leftover columns to our overflow list. Our
         // next-in-flow will eventually pick them up.
         const nsFrameList& continuationColumns =
             mFrames.RemoveFramesAfter(child);
         if (continuationColumns.NotEmpty()) {
@@ -879,16 +878,17 @@ nsColumnSetFrame::ColumnBalanceData nsCo
       // trying to reflow the blocks (even though we know they'll interrupt
       // right after their first line), but stopping now is conceptually the
       // simplest (and probably fastest) thing.
       break;
     }
 
     // Advance to the next column
     child = child->GetNextSibling();
+    ++columnCount;
 
     if (child) {
       childOrigin.I(wm) += aConfig.mColISize + aConfig.mColGap;
 
       COLUMN_SET_LOG("%s: Next childOrigin.iCoord=%d", __func__,
                      childOrigin.I(wm));
     }
   }