Bug 1548118 Part 1 - Advance the column count at the end of the while loop. r=dbaron
☠☠ backed out by fc6bf8a71924 ☠ ☠
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 03 May 2019 19:24:03 +0000
changeset 531617 f3821529e27617e69d4d4c2547c275a03f6a731a
parent 531616 0f7f3f92c585491b347a3f9151d8c1af152da722
child 531618 40a074be8bf08c2f8e3ca3da13ccad5328bac624
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));
     }
   }