Bug 1144096 part 2 - [css-grid] Make GridItemInfo::mFrame available also in non-DEBUG builds since we'll need it to support fragmentation. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Fri, 11 Mar 2016 17:39:26 +0100
changeset 288294 3737062990186ca27ee7fd31c2afd2fabfedab5c
parent 288293 a8b7c33f5687a244a3abffb7b02b7c2ca231b7f8
child 288295 7e7ff8ae121607a8d3c5c0439faf836a726dc552
push id30079
push userryanvm@gmail.com
push dateSat, 12 Mar 2016 20:24:19 +0000
treeherdermozilla-central@d1d47ba19ce9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1144096
milestone48.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 1144096 part 2 - [css-grid] Make GridItemInfo::mFrame available also in non-DEBUG builds since we'll need it to support fragmentation. r=dholbert
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsGridContainerFrame.h
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -2339,25 +2339,23 @@ nsGridContainerFrame::Grid::PlaceGridIte
   // http://dev.w3.org/csswg/css-grid/#line-placement
   // Resolve definite positions per spec chap 9.2.
   int32_t minCol = 1;
   int32_t minRow = 1;
   aState.mGridItems.ClearAndRetainStorage();
   for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
     nsIFrame* child = *aState.mIter;
     GridItemInfo* info =
-      aState.mGridItems.AppendElement(GridItemInfo(PlaceDefinite(child,
-                                                                 colLineNameMap,
-                                                                 rowLineNameMap,
-                                                                 gridStyle)));
-#ifdef DEBUG
+        aState.mGridItems.AppendElement(GridItemInfo(child,
+                                          PlaceDefinite(child,
+                                                        colLineNameMap,
+                                                        rowLineNameMap,
+                                                        gridStyle)));
     MOZ_ASSERT(aState.mIter.GridItemIndex() == aState.mGridItems.Length() - 1,
                "GridItemIndex() is broken");
-    info->mFrame = child;
-#endif
     GridArea& area = info->mArea;
     if (area.mCols.IsDefinite()) {
       minCol = std::min(minCol, area.mCols.mUntranslatedStart);
     }
     if (area.mRows.IsDefinite()) {
       minRow = std::min(minRow, area.mRows.mUntranslatedStart);
     }
   }
@@ -2496,23 +2494,21 @@ nsGridContainerFrame::Grid::PlaceGridIte
     AutoRestore<uint32_t> save2(mGridRowEnd);
     mGridColEnd -= offsetToColZero;
     mGridRowEnd -= offsetToRowZero;
     aState.mAbsPosItems.ClearAndRetainStorage();
     size_t i = 0;
     for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next(), ++i) {
       nsIFrame* child = e.get();
       GridItemInfo* info =
-        aState.mAbsPosItems.AppendElement(GridItemInfo(PlaceAbsPos(child,
-                                                                   colLineNameMap,
-                                                                   rowLineNameMap,
-                                                                   gridStyle)));
-#ifdef DEBUG
-      info->mFrame = child;
-#endif
+          aState.mAbsPosItems.AppendElement(GridItemInfo(child,
+                                              PlaceAbsPos(child,
+                                                          colLineNameMap,
+                                                          rowLineNameMap,
+                                                          gridStyle)));
       GridArea& area = info->mArea;
       if (area.mCols.mUntranslatedStart != int32_t(kAutoLine)) {
         area.mCols.mStart = area.mCols.mUntranslatedStart + offsetToColZero;
       }
       if (area.mCols.mUntranslatedEnd != int32_t(kAutoLine)) {
         area.mCols.mEnd = area.mCols.mUntranslatedEnd + offsetToColZero;
       }
       if (area.mRows.mUntranslatedStart != int32_t(kAutoLine)) {
--- a/layout/generic/nsGridContainerFrame.h
+++ b/layout/generic/nsGridContainerFrame.h
@@ -325,30 +325,29 @@ protected:
     GridArea(const LineRange& aCols, const LineRange& aRows)
       : mCols(aCols), mRows(aRows) {}
     bool IsDefinite() const { return mCols.IsDefinite() && mRows.IsDefinite(); }
     LineRange mCols;
     LineRange mRows;
   };
 
   struct GridItemInfo {
-    explicit GridItemInfo(const GridArea& aArea)
-      : mArea(aArea)
+    GridItemInfo(nsIFrame* aFrame, const GridArea& aArea)
+      : mFrame(aFrame)
+      , mArea(aArea)
     {
       mIsFlexing[0] = false;
       mIsFlexing[1] = false;
     }
 
+    nsIFrame* mFrame;
     GridArea mArea;
     bool mIsFlexing[2]; // does the item span a flex track? (LogicalAxis index)
     static_assert(mozilla::eLogicalAxisBlock == 0, "unexpected index value");
     static_assert(mozilla::eLogicalAxisInline == 1, "unexpected index value");
-#ifdef DEBUG
-    nsIFrame* mFrame;
-#endif
   };
 
   /**
    * XXX temporary - move the ImplicitNamedAreas stuff to the style system.
    * The implicit area names that come from x-start .. x-end lines in
    * grid-template-columns / grid-template-rows are stored in this frame
    * property when needed, as a ImplicitNamedAreas* value.
    */