Bug 1447166 part 1 - [css-grid] Make FindUsedFlexFraction iterate the GridItemInfo array instead of using a CSSOrderAwareFrameIterator (idempotent change). r=dholbert
authorMats Palmgren <mats@mozilla.com>
Sat, 24 Mar 2018 23:03:43 +0100
changeset 772177 fa53f0a075dc7ea19781b6a201b2057ab5dca680
parent 772176 58750ef045ca450278625f87cad3baa18a04e3fd
child 772178 2432cfe699b27428172dd0f7b40028d2ec14799d
push id103870
push userbmo:ntim.bugs@gmail.com
push dateSun, 25 Mar 2018 10:23:38 +0000
reviewersdholbert
bugs1447166
milestone61.0a1
Bug 1447166 part 1 - [css-grid] Make FindUsedFlexFraction iterate the GridItemInfo array instead of using a CSSOrderAwareFrameIterator (idempotent change). r=dholbert
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -4576,22 +4576,19 @@ nsGridContainerFrame::Tracks::FindUsedFl
     float flexFactor = aFunctions.MaxSizingFor(track).GetFlexFractionValue();
     float possiblyDividedBaseSize = (flexFactor > 1.0f)
       ? mSizes[track].mBase / flexFactor
       : mSizes[track].mBase;
     fr = std::max(fr, possiblyDividedBaseSize);
   }
   WritingMode wm = aState.mWM;
   gfxContext* rc = &aState.mRenderingContext;
-  CSSOrderAwareFrameIterator& iter = aState.mIter;
-  iter.Reset();
   // ... the result of 'finding the size of an fr' for each item that spans
   // a flex track with its max-content contribution as 'space to fill'
-  for (; !iter.AtEnd(); iter.Next()) {
-    const GridItemInfo& item = aGridItems[iter.ItemIndex()];
+  for (const GridItemInfo& item : aGridItems) {
     if (item.mState[mAxis] & ItemState::eIsFlexing) {
       // XXX optimize: bug 1194446
       auto pb = Some(aState.PercentageBasisFor(mAxis, item));
       nscoord spaceToFill = ContentContribution(item, aState, rc, wm, mAxis, pb,
                                                 nsLayoutUtils::PREF_ISIZE);
       const LineRange& range =
         mAxis == eLogicalAxisInline ? item.mArea.mCols : item.mArea.mRows;
       MOZ_ASSERT(range.Extent() >= 1);