Bug 1228984 - [css-grid] Auto-placement into columns missed some unoccupied span-1 column slots. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Wed, 02 Dec 2015 14:12:24 +0100
changeset 309404 16f3eb09533de8063eb57d9855589d3adf9f31a9
parent 309403 6443e8cb46c30946e2b66cc33e15d61563d39654
child 309405 349b2d9ac5aa1a4558a92725c552b5a5b61ad73f
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1228984
milestone45.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 1228984 - [css-grid] Auto-placement into columns missed some unoccupied span-1 column slots. r=dholbert
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -1529,25 +1529,22 @@ nsGridContainerFrame::FindAutoCol(uint32
       break;
     }
     const nsTArray<CellMap::Cell>& cellsInRow = mCellMap.mCells[i];
     const uint32_t len = cellsInRow.Length();
     const uint32_t lastCandidate = candidate;
     // Find the first gap in the current row that's at least 'extent' wide.
     // ('gap' tracks how wide the current column gap is.)
     for (uint32_t j = candidate, gap = 0; j < len && gap < extent; ++j) {
-      ++gap; // tentative, but we may reset it below if a column is occupied
-      if (cellsInRow[j].mIsOccupied) {
-        // Optimization: skip as many occupied cells as we can.
-        do {
-          ++j;
-        } while (j < len && cellsInRow[j].mIsOccupied);
-        candidate = j;
-        gap = 0;
+      if (!cellsInRow[j].mIsOccupied) {
+        ++gap;
+        continue;
       }
+      candidate = j + 1;
+      gap = 0;
     }
     if (lastCandidate < candidate && i != iStart) {
       // Couldn't fit 'extent' tracks at 'lastCandidate' here so we must
       // restart from the beginning with the new 'candidate'.
       i = iStart;
     } else {
       ++i;
     }