Bug 812687 part 2: Rename GridItemCSSOrderIterator to CSSOrderAwareFrameIterator (& similar for its Reverse form). r=mats
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 05 Apr 2017 19:31:47 -0700
changeset 351427 1732e9dd1f9e28ec85eecb1ae45730a3d36e2dd5
parent 351426 5a6f0d546c631ada21d8109eccbb48b64b3be048
child 351428 947d5e737c2d05f038f01ddc2f02a01289db7ba8
push id88868
push userdholbert@mozilla.com
push dateThu, 06 Apr 2017 02:32:04 +0000
treeherdermozilla-inbound@001fd3755ac1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs812687
milestone55.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 812687 part 2: Rename GridItemCSSOrderIterator to CSSOrderAwareFrameIterator (& similar for its Reverse form). r=mats This patch is purely type-renames, so it should not affect our behavior at all. MozReview-Commit-ID: 51zRGFyVDtT
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsGridContainerFrame.h
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -579,57 +579,57 @@ private:
   // Skip placeholder children in the iteration?
   bool mSkipPlaceholders;
 #ifdef DEBUG
   nsIFrame* mContainer;
   nsIFrame::ChildListID mListID;
 #endif
 };
 
-using GridItemCSSOrderIterator = nsGridContainerFrame::GridItemCSSOrderIterator;
-using ReverseGridItemCSSOrderIterator = nsGridContainerFrame::ReverseGridItemCSSOrderIterator;
+using CSSOrderAwareFrameIterator = nsGridContainerFrame::CSSOrderAwareFrameIterator;
+using ReverseCSSOrderAwareFrameIterator = nsGridContainerFrame::ReverseCSSOrderAwareFrameIterator;
 
 template<>
 bool
-GridItemCSSOrderIterator::CSSOrderComparator(nsIFrame* const& a,
-                                             nsIFrame* const& b)
+CSSOrderAwareFrameIterator::CSSOrderComparator(nsIFrame* const& a,
+                                               nsIFrame* const& b)
 { return a->StylePosition()->mOrder < b->StylePosition()->mOrder; }
 
 template<>
 bool
-GridItemCSSOrderIterator::IsForward() const { return true; }
+CSSOrderAwareFrameIterator::IsForward() const { return true; }
 
 template<>
 nsFrameList::iterator
-GridItemCSSOrderIterator::begin(const nsFrameList& aList)
+CSSOrderAwareFrameIterator::begin(const nsFrameList& aList)
 { return aList.begin(); }
 
 template<>
-nsFrameList::iterator GridItemCSSOrderIterator::end(const nsFrameList& aList)
+nsFrameList::iterator CSSOrderAwareFrameIterator::end(const nsFrameList& aList)
 { return aList.end(); }
 
 template<>
 bool
-ReverseGridItemCSSOrderIterator::CSSOrderComparator(nsIFrame* const& a,
-                                                    nsIFrame* const& b)
+ReverseCSSOrderAwareFrameIterator::CSSOrderComparator(nsIFrame* const& a,
+                                                      nsIFrame* const& b)
 { return a->StylePosition()->mOrder > b->StylePosition()->mOrder; }
 
 template<>
 bool
-ReverseGridItemCSSOrderIterator::IsForward() const
+ReverseCSSOrderAwareFrameIterator::IsForward() const
 { return false; }
 
 template<>
 nsFrameList::reverse_iterator
-ReverseGridItemCSSOrderIterator::begin(const nsFrameList& aList)
+ReverseCSSOrderAwareFrameIterator::begin(const nsFrameList& aList)
 { return aList.rbegin(); }
 
 template<>
 nsFrameList::reverse_iterator
-ReverseGridItemCSSOrderIterator::end(const nsFrameList& aList)
+ReverseCSSOrderAwareFrameIterator::end(const nsFrameList& aList)
 { return aList.rend(); }
 
 /**
  * A LineRange can be definite or auto - when it's definite it represents
  * a consecutive set of tracks between a starting line and an ending line.
  * Before it's definite it can also represent an auto position with a span,
  * where mStart == kAutoLine and mEnd is the (non-zero positive) span.
  * For normal-flow items, the invariant mStart < mEnd holds when both
@@ -2100,17 +2100,17 @@ struct MOZ_STACK_CLASS nsGridContainerFr
    * containing block on that side.
    * @param aGridOrigin the origin of the grid
    * @param aGridCB the grid container containing block (its padding area)
    */
   LogicalRect ContainingBlockForAbsPos(const GridArea&     aArea,
                                        const LogicalPoint& aGridOrigin,
                                        const LogicalRect&  aGridCB) const;
 
-  GridItemCSSOrderIterator mIter;
+  CSSOrderAwareFrameIterator mIter;
   const nsStylePosition* const mGridStyle;
   Tracks mCols;
   Tracks mRows;
   TrackSizingFunctions mColFunctions;
   TrackSizingFunctions mRowFunctions;
   /**
    * Info about each (normal flow) grid item.
    */
@@ -4113,17 +4113,17 @@ nsGridContainerFrame::Tracks::Initialize
   GridReflowInput&        aState,
   nsTArray<GridItemInfo>& aGridItems)
 {
 
   nsTArray<ItemBaselineData> firstBaselineItems;
   nsTArray<ItemBaselineData> lastBaselineItems;
   WritingMode wm = aState.mWM;
   nsStyleContext* containerSC = aState.mFrame->StyleContext();
-  GridItemCSSOrderIterator& iter = aState.mIter;
+  CSSOrderAwareFrameIterator& iter = aState.mIter;
   iter.Reset();
   for (; !iter.AtEnd(); iter.Next()) {
     nsIFrame* child = *iter;
     GridItemInfo& gridItem = aGridItems[iter.ItemIndex()];
     uint32_t baselineTrack = kAutoLine;
     auto state = ItemState(0);
     auto childWM = child->GetWritingMode();
     const bool isOrthogonal = wm.IsOrthogonalTo(childWM);
@@ -4371,17 +4371,17 @@ nsGridContainerFrame::Tracks::ResolveInt
   };
 
   // Resolve Intrinsic Track Sizes
   // http://dev.w3.org/csswg/css-grid/#algo-content
   // We're also setting eIsFlexing on the item state here to speed up
   // FindUsedFlexFraction later.
   AutoTArray<TrackSize::StateBits, 16> stateBitsPerSpan;
   nsTArray<Step2ItemData> step2Items;
-  GridItemCSSOrderIterator& iter = aState.mIter;
+  CSSOrderAwareFrameIterator& iter = aState.mIter;
   nsRenderingContext* 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:
@@ -4704,17 +4704,17 @@ 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;
   nsRenderingContext* rc = &aState.mRenderingContext;
-  GridItemCSSOrderIterator& iter = aState.mIter;
+  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()];
     if (item.mState[mAxis] & ItemState::eIsFlexing) {
       // XXX optimize: bug 1194446
       nscoord spaceToFill = ContentContribution(item, aState, rc, wm, mAxis,
@@ -5342,17 +5342,17 @@ nsGridContainerFrame::ReflowInFragmentai
 {
   MOZ_ASSERT(aStatus.IsEmpty());
   MOZ_ASSERT(aState.mReflowInput);
 
   // Collect our grid items and sort them in row order.  Collect placeholders
   // and put them in a separate array.
   nsTArray<const GridItemInfo*> sortedItems(aState.mGridItems.Length());
   nsTArray<nsIFrame*> placeholders(aState.mAbsPosItems.Length());
-  aState.mIter.Reset(GridItemCSSOrderIterator::eIncludeAll);
+  aState.mIter.Reset(CSSOrderAwareFrameIterator::eIncludeAll);
   for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
     nsIFrame* child = *aState.mIter;
     if (child->GetType() != nsGkAtoms::placeholderFrame) {
       const GridItemInfo* info = &aState.mGridItems[aState.mIter.ItemIndex()];
       sortedItems.AppendElement(info);
     } else {
       placeholders.AppendElement(child);
     }
@@ -5858,17 +5858,17 @@ nsGridContainerFrame::ReflowChildren(Gri
 
   nscoord bSize = aContentArea.BSize(wm);
   Maybe<Fragmentainer> fragmentainer = GetNearestFragmentainer(aState);
   if (MOZ_UNLIKELY(fragmentainer.isSome())) {
     aState.mInFragmentainer = true;
     bSize = ReflowInFragmentainer(aState, aContentArea, aDesiredSize, aStatus,
                                   *fragmentainer, containerSize);
   } else {
-    aState.mIter.Reset(GridItemCSSOrderIterator::eIncludeAll);
+    aState.mIter.Reset(CSSOrderAwareFrameIterator::eIncludeAll);
     for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
       nsIFrame* child = *aState.mIter;
       const GridItemInfo* info = nullptr;
       if (child->GetType() != nsGkAtoms::placeholderFrame) {
         info = &aState.mGridItems[aState.mIter.ItemIndex()];
       }
       ReflowInFlowChild(*aState.mIter, info, containerSize, Nothing(), nullptr,
                         aState, aContentArea, aDesiredSize, aStatus);
@@ -6223,29 +6223,29 @@ nsGridContainerFrame::Reflow(nsPresConte
     }
     // Only compute 'last baseline' if this fragment contains the last track.
     // XXXmats maybe remove this condition? bug 1306499
     uint32_t len = gridReflowInput.mRows.mSizes.Length();
     if (gridReflowInput.mStartRow != len &&
         gridReflowInput.mNextFragmentStartRow == len) {
       baselines = BaselineSet(baselines | BaselineSet::eLast);
     }
-    Maybe<GridItemCSSOrderIterator> iter;
+    Maybe<CSSOrderAwareFrameIterator> iter;
     Maybe<nsTArray<GridItemInfo>> gridItems;
     if (baselines != BaselineSet::eNone) {
       // We need to create a new iterator and GridItemInfo array because we
       // might have pushed some children at this point.
       // Even if the gridReflowInput iterator is invalid we can reuse its
       // state about order to optimize initialization of the new iterator.
       // An ordered child list can't become unordered by pushing frames.
       // An unordered list can become ordered in a number of cases, but we
       // ignore that here and guess that the child list is still unordered.
       // XXX this is O(n^2) in the number of items in this fragment: bug 1306705
-      using Filter = GridItemCSSOrderIterator::ChildFilter;
-      using Order = GridItemCSSOrderIterator::OrderState;
+      using Filter = CSSOrderAwareFrameIterator::ChildFilter;
+      using Order = CSSOrderAwareFrameIterator::OrderState;
       bool ordered = gridReflowInput.mIter.ItemsAreAlreadyInOrder();
       auto orderState = ordered ? Order::eKnownOrdered : Order::eKnownUnordered;
       iter.emplace(this, kPrincipalList, Filter::eSkipPlaceholders, orderState);
       gridItems.emplace();
       for (; !iter->AtEnd(); iter->Next()) {
         auto child = **iter;
         for (const auto& info : gridReflowInput.mGridItems) {
           if (info.mFrame == child) {
@@ -6595,22 +6595,22 @@ nsGridContainerFrame::BuildDisplayList(n
   DisplayBorderBackgroundOutline(aBuilder, aLists);
   if (GetPrevInFlow()) {
     DisplayOverflowContainers(aBuilder, aDirtyRect, aLists);
   }
 
   // Our children are all grid-level boxes, which behave the same as
   // inline-blocks in painting, so their borders/backgrounds all go on
   // the BlockBorderBackgrounds list.
-  typedef GridItemCSSOrderIterator::OrderState OrderState;
+  typedef CSSOrderAwareFrameIterator::OrderState OrderState;
   OrderState order = HasAnyStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER)
                        ? OrderState::eKnownOrdered
                        : OrderState::eKnownUnordered;
-  GridItemCSSOrderIterator iter(this, kPrincipalList,
-                                GridItemCSSOrderIterator::eIncludeAll, order);
+  CSSOrderAwareFrameIterator iter(this, kPrincipalList,
+                                  CSSOrderAwareFrameIterator::eIncludeAll, order);
   for (; !iter.AtEnd(); iter.Next()) {
     nsIFrame* child = *iter;
     BuildDisplayListForChild(aBuilder, child, aDirtyRect, aLists,
                              ::GetDisplayFlagsForGridItem(child));
   }
 }
 
 bool
@@ -6768,17 +6768,17 @@ nsGridContainerFrame::SynthesizeBaseline
   }
   return aGroup == BaselineSharingGroup::eFirst ? start + baseline :
     aCBSize - start - size + baseline;
 }
 
 void
 nsGridContainerFrame::CalculateBaselines(
   BaselineSet                   aBaselineSet,
-  GridItemCSSOrderIterator*     aIter,
+  CSSOrderAwareFrameIterator*   aIter,
   const nsTArray<GridItemInfo>* aGridItems,
   const Tracks&    aTracks,
   uint32_t         aFragmentStartTrack,
   uint32_t         aFirstExcludedTrack,
   WritingMode      aWM,
   const nsSize&    aCBPhysicalSize,
   nscoord          aCBBorderPaddingStart,
   nscoord          aCBBorderPaddingEnd,
@@ -6817,17 +6817,17 @@ nsGridContainerFrame::CalculateBaselines
   auto lastBaseline = aTracks.mBaseline[BaselineSharingGroup::eLast];
   if (!(aBaselineSet & BaselineSet::eLast)) {
     mBaseline[axis][BaselineSharingGroup::eLast] =
       ::SynthesizeBaselineFromBorderBox(BaselineSharingGroup::eLast, aWM,
                                         aCBSize);
   } else if (lastBaseline == NS_INTRINSIC_WIDTH_UNKNOWN) {
     // For finding items for the 'last baseline' we need to create a reverse
     // iterator ('aIter' is the forward iterator from the GridReflowInput).
-    using Iter = ReverseGridItemCSSOrderIterator;
+    using Iter = ReverseCSSOrderAwareFrameIterator;
     auto orderState = aIter->ItemsAreAlreadyInOrder() ?
       Iter::OrderState::eKnownOrdered : Iter::OrderState::eKnownUnordered;
     Iter iter(this, kPrincipalList, Iter::ChildFilter::eSkipPlaceholders,
               orderState);
     iter.SetItemCount(aGridItems->Length());
     FindItemInGridOrderResult gridOrderLastItem =
       FindLastItemInGridOrder(iter, *aGridItems,
         axis == eLogicalAxisBlock ? &GridArea::mRows : &GridArea::mCols,
@@ -6911,17 +6911,17 @@ nsGridContainerFrame::MergeSortedExcessO
   } else {
     SetPropTableFrames(new (PresContext()->PresShell()) nsFrameList(aList),
                        ExcessOverflowContainersProperty());
   }
 }
 
 /* static */ nsGridContainerFrame::FindItemInGridOrderResult
 nsGridContainerFrame::FindFirstItemInGridOrder(
-  GridItemCSSOrderIterator& aIter,
+  CSSOrderAwareFrameIterator& aIter,
   const nsTArray<GridItemInfo>& aGridItems,
   LineRange GridArea::* aMajor,
   LineRange GridArea::* aMinor,
   uint32_t aFragmentStartTrack)
 {
   FindItemInGridOrderResult result = { nullptr, false };
   uint32_t minMajor = kTranslatedMaxLine + 1;
   uint32_t minMinor = kTranslatedMaxLine + 1;
@@ -6940,17 +6940,17 @@ nsGridContainerFrame::FindFirstItemInGri
       result.mIsInEdgeTrack = major == 0U;
     }
   }
   return result;
 }
 
 /* static */ nsGridContainerFrame::FindItemInGridOrderResult
 nsGridContainerFrame::FindLastItemInGridOrder(
-  ReverseGridItemCSSOrderIterator& aIter,
+  ReverseCSSOrderAwareFrameIterator& aIter,
   const nsTArray<GridItemInfo>& aGridItems,
   LineRange GridArea::* aMajor,
   LineRange GridArea::* aMinor,
   uint32_t aFragmentStartTrack,
   uint32_t aFirstExcludedTrack)
 {
   FindItemInGridOrderResult result = { nullptr, false };
   int32_t maxMajor = -1;
--- a/layout/generic/nsGridContainerFrame.h
+++ b/layout/generic/nsGridContainerFrame.h
@@ -216,19 +216,19 @@ public:
    */
   static nsGridContainerFrame* GetGridFrameWithComputedInfo(nsIFrame* aFrame);
 
   struct TrackSize;
   struct GridItemInfo;
   struct GridReflowInput;
   template<typename Iterator> class CSSOrderAwareFrameIteratorT;
   typedef CSSOrderAwareFrameIteratorT<nsFrameList::iterator>
-    GridItemCSSOrderIterator;
+    CSSOrderAwareFrameIterator;
   typedef CSSOrderAwareFrameIteratorT<nsFrameList::reverse_iterator>
-    ReverseGridItemCSSOrderIterator;
+    ReverseCSSOrderAwareFrameIterator;
   struct FindItemInGridOrderResult
   {
     // The first(last) item in (reverse) grid order.
     const GridItemInfo* mItem;
     // Does the above item span the first(last) track?
     bool mIsInEdgeTrack;
   };
 protected:
@@ -319,17 +319,17 @@ protected:
    */
   enum BaselineSet : uint32_t {
     eNone =  0x0,
     eFirst = 0x1,
     eLast  = 0x2,
     eBoth  = eFirst | eLast,
   };
   void CalculateBaselines(BaselineSet                   aBaselineSet,
-                          GridItemCSSOrderIterator*     aIter,
+                          CSSOrderAwareFrameIterator*   aIter,
                           const nsTArray<GridItemInfo>* aGridItems,
                           const Tracks&    aTracks,
                           uint32_t         aFragmentStartTrack,
                           uint32_t         aFirstExcludedTrack,
                           WritingMode      aWM,
                           const nsSize&    aCBPhysicalSize,
                           nscoord          aCBBorderPaddingStart,
                           nscoord          aCBBorderPaddingStartEnd,
@@ -346,31 +346,31 @@ protected:
                              WritingMode          aCBWM);
   /**
    * Find the first item in Grid Order in this fragment.
    * https://drafts.csswg.org/css-grid/#grid-order
    * @param aFragmentStartTrack is the first track in this fragment in the same
    * axis as aMajor.  Pass zero if that's not the axis we're fragmenting in.
    */
   static FindItemInGridOrderResult
-  FindFirstItemInGridOrder(GridItemCSSOrderIterator& aIter,
+  FindFirstItemInGridOrder(CSSOrderAwareFrameIterator& aIter,
                            const nsTArray<GridItemInfo>& aGridItems,
                            LineRange GridArea::* aMajor,
                            LineRange GridArea::* aMinor,
                            uint32_t aFragmentStartTrack);
   /**
    * Find the last item in Grid Order in this fragment.
    * @param aFragmentStartTrack is the first track in this fragment in the same
    * axis as aMajor.  Pass zero if that's not the axis we're fragmenting in.
    * @param aFirstExcludedTrack should be the first track in the next fragment
    * or one beyond the final track in the last fragment, in aMajor's axis.
    * Pass the number of tracks if that's not the axis we're fragmenting in.
    */
   static FindItemInGridOrderResult
-  FindLastItemInGridOrder(ReverseGridItemCSSOrderIterator& aIter,
+  FindLastItemInGridOrder(ReverseCSSOrderAwareFrameIterator& aIter,
                           const nsTArray<GridItemInfo>& aGridItems,
                           LineRange GridArea::* aMajor,
                           LineRange GridArea::* aMinor,
                           uint32_t aFragmentStartTrack,
                           uint32_t aFirstExcludedTrack);
 
 #ifdef DEBUG
   void SanityCheckGridItemsBeforeReflow() const;