Bug 1447166 part 2 - [css-grid] Make ResolveIntrinsicSize 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 772178 2432cfe699b27428172dd0f7b40028d2ec14799d
parent 772177 fa53f0a075dc7ea19781b6a201b2057ab5dca680
child 772179 4123057568d90c7b996608c454462e53d1fe28c8
push id103870
push userbmo:ntim.bugs@gmail.com
push dateSun, 25 Mar 2018 10:23:38 +0000
reviewersdholbert
bugs1447166
milestone61.0a1
Bug 1447166 part 2 - [css-grid] Make ResolveIntrinsicSize 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
@@ -4312,32 +4312,29 @@ nsGridContainerFrame::Tracks::ResolveInt
   struct PerSpanData {
     PerSpanData() : mItemCountWithSameSpan(0)
                   , mStateBits(TrackSize::StateBits(0)) {}
     uint32_t mItemCountWithSameSpan;
     TrackSize::StateBits mStateBits;
   };
   AutoTArray<PerSpanData, 16> perSpanData;
   nsTArray<Step2ItemData> step2Items;
-  CSSOrderAwareFrameIterator& iter = aState.mIter;
   gfxContext* rc = &aState.mRenderingContext;
   WritingMode wm = aState.mWM;
   uint32_t maxSpan = 0; // max span of the step2Items items
   // Setup track selector for step 2.2:
   const auto contentBasedMinSelector =
     aConstraint == SizingConstraint::eMinContent ?
     TrackSize::eIntrinsicMinSizing : TrackSize::eMinOrMaxContentMinSizing;
   // Setup track selector for step 2.3:
   const auto maxContentMinSelector =
     aConstraint == SizingConstraint::eMaxContent ?
     (TrackSize::eMaxContentMinSizing | TrackSize::eAutoMinSizing) :
     TrackSize::eMaxContentMinSizing;
-  iter.Reset();
-  for (; !iter.AtEnd(); iter.Next()) {
-    auto& gridItem = aGridItems[iter.ItemIndex()];
+  for (auto& gridItem : aGridItems) {
     MOZ_ASSERT(!(gridItem.mState[mAxis] &
                  (ItemState::eApplyAutoMinSize | ItemState::eIsFlexing |
                   ItemState::eClampMarginBoxMinSize)),
                "Why are any of these bits set already?");
     const GridArea& area = gridItem.mArea;
     const LineRange& lineRange = area.*aRange;
     uint32_t span = lineRange.Extent();
     if (span == 1) {
@@ -4393,17 +4390,17 @@ nsGridContainerFrame::Tracks::ResolveInt
         nscoord maxContent = 0;
         if (state & (maxContentMinSelector |                   // for 2.3
                      TrackSize::eAutoOrMaxContentMaxSizing)) { // for 2.6
           maxContent = MaxContentContribution(gridItem, aState,
                                               rc, wm, mAxis, &cache);
         }
         step2Items.AppendElement(
           Step2ItemData({span, state, lineRange, minSize,
-                         minContent, maxContent, *iter}));
+                         minContent, maxContent, gridItem.mFrame}));
       }
     }
     MOZ_ASSERT(!(gridItem.mState[mAxis] & ItemState::eClampMarginBoxMinSize) ||
                (gridItem.mState[mAxis] & ItemState::eApplyAutoMinSize),
                "clamping only applies to Automatic Minimum Size");
   }
 
   // Step 2.