Bug 1144096 part 5 - [css-grid] Create a couple of Grid container frame bits. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Fri, 11 Mar 2016 17:39:26 +0100
changeset 288297 6fa46d335b2817eeb4904390ab32b3ee45646a48
parent 288296 035a1dd254e1e28f2a1571332a4160101d261f3d
child 288298 738a70d91d8c7c316c35274f75e61162fbd9d30f
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 5 - [css-grid] Create a couple of Grid container frame bits. r=dholbert
layout/generic/nsFrameState.cpp
layout/generic/nsFrameStateBits.h
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsGridContainerFrame.h
--- a/layout/generic/nsFrameState.cpp
+++ b/layout/generic/nsFrameState.cpp
@@ -6,16 +6,17 @@
 /* constants for frame state bits and a type to store them in a uint64_t */
 
 #include "nsFrameState.h"
 
 #include "nsBlockFrame.h"
 #include "nsBoxFrame.h"
 #include "nsBulletFrame.h"
 #include "nsFlexContainerFrame.h"
+#include "nsGridContainerFrame.h"
 #include "nsGfxScrollFrame.h"
 #include "nsIFrame.h"
 #include "nsISVGChildFrame.h"
 #include "nsImageFrame.h"
 #include "nsInlineFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsRubyTextFrame.h"
 #include "nsRubyTextContainerFrame.h"
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -299,16 +299,27 @@ FRAME_STATE_BIT(Box, 61, NS_FRAME_MOUSE_
 // == Frame state bits that apply to flex container frames ====================
 
 FRAME_STATE_GROUP(FlexContainer, nsFlexContainerFrame)
 
 // Set for a flex container whose children have been reordered due to 'order'.
 // (Means that we have to be more thorough about checking them for sortedness.)
 FRAME_STATE_BIT(FlexContainer, 20, NS_STATE_FLEX_CHILDREN_REORDERED)
 
+// == Frame state bits that apply to grid container frames ====================
+
+FRAME_STATE_GROUP(GridContainer, nsGridContainerFrame)
+
+// True iff the normal flow children are already in CSS 'order' in the
+// order they occur in the child frame list.
+FRAME_STATE_BIT(GridContainer, 20, NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER)
+
+// True iff some first-in-flow in-flow children were pushed.
+FRAME_STATE_BIT(GridContainer, 21, NS_STATE_GRID_DID_PUSH_ITEMS)
+
 // == Frame state bits that apply to SVG frames ===============================
 
 FRAME_STATE_GROUP(SVG, nsISVGChildFrame)
 FRAME_STATE_GROUP(SVG, nsSVGContainerFrame)
 
 FRAME_STATE_BIT(SVG, 20, NS_STATE_IS_OUTER_SVG)
 
 // If this bit is set, we are a <clipPath> element or descendant.
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -3887,17 +3887,21 @@ nsGridContainerFrame::Reflow(nsPresConte
   SanityCheckAnonymousGridItems();
 #endif // DEBUG
 
   LogicalMargin bp = aReflowState.ComputedLogicalBorderPadding();
   bp.ApplySkipSides(GetLogicalSkipSides());
   const nsStylePosition* stylePos = aReflowState.mStylePosition;
   InitImplicitNamedAreas(stylePos);
   GridReflowState gridReflowState(this, aReflowState);
-  mIsNormalFlowInCSSOrder = gridReflowState.mIter.ItemsAreAlreadyInOrder();
+  if (gridReflowState.mIter.ItemsAreAlreadyInOrder()) {
+    AddStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER);
+  } else {
+    RemoveStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER);
+  }
   const nscoord computedBSize = aReflowState.ComputedBSize();
   const nscoord computedISize = aReflowState.ComputedISize();
   const WritingMode& wm = gridReflowState.mWM;
   LogicalSize computedSize(wm, computedISize, computedBSize);
 
   // ComputedMinSize is zero rather than NS_UNCONSTRAINEDSIZE when indefinite
   // (unfortunately) so we have to check the style data and parent reflow state
   // to determine if it's indefinite.
@@ -4053,18 +4057,19 @@ nsGridContainerFrame::BuildDisplayList(n
   nsDisplayList positionedDescendants;
   nsDisplayListSet childLists(aLists.BlockBorderBackgrounds(),
                               aLists.BlockBorderBackgrounds(),
                               aLists.Floats(),
                               aLists.Content(),
                               &positionedDescendants,
                               aLists.Outlines());
   typedef GridItemCSSOrderIterator::OrderState OrderState;
-  OrderState order = mIsNormalFlowInCSSOrder ? OrderState::eKnownOrdered
-                                             : OrderState::eKnownUnordered;
+  OrderState order = HasAnyStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER)
+                       ? OrderState::eKnownOrdered
+                       : OrderState::eKnownUnordered;
   GridItemCSSOrderIterator iter(this, kPrincipalList,
                                 GridItemCSSOrderIterator::eIncludeAll, order);
   for (; !iter.AtEnd(); iter.Next()) {
     nsIFrame* child = *iter;
     BuildDisplayListForChild(aBuilder, child, aDirtyRect, childLists,
                              ::GetDisplayFlagsForGridItem(child));
   }
   positionedDescendants.SortByCSSOrder();
--- a/layout/generic/nsGridContainerFrame.h
+++ b/layout/generic/nsGridContainerFrame.h
@@ -149,17 +149,11 @@ protected:
 #endif // DEBUG
 
 private:
   /**
    * Cached values to optimize GetMinISize/GetPrefISize.
    */
   nscoord mCachedMinISize;
   nscoord mCachedPrefISize;
-
-  /**
-   * True iff the normal flow children are already in CSS 'order' in the
-   * order they occur in the child frame list.
-   */
-  bool mIsNormalFlowInCSSOrder : 1;
 };
 
 #endif /* nsGridContainerFrame_h___ */