Bug 1256429 part 1 - Move the ReflowStateFlags type to nsCSSOffsetState and add a 'ReflowStateFlags aFlags' param to nsCSSOffsetState::InitOffsets for later use (idempotent patch). r=dholbert
authorMats Palmgren <mats@mozilla.com>
Thu, 02 Jun 2016 17:46:59 +0200
changeset 341235 7294fad22949eef3cf91c5e484f5c8a02e4a105b
parent 341234 be927454459860da4b24bf174312ae72b62c7e15
child 341236 7ea32b5e7ecfe284bb739dbe65c96f80a36f4f31
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1256429
milestone49.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 1256429 part 1 - Move the ReflowStateFlags type to nsCSSOffsetState and add a 'ReflowStateFlags aFlags' param to nsCSSOffsetState::InitOffsets for later use (idempotent patch). r=dholbert
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsHTMLReflowState.h
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -67,17 +67,16 @@ nsHTMLReflowState::nsHTMLReflowState(nsP
   MOZ_ASSERT(aPresContext, "no pres context");
   MOZ_ASSERT(aFrame, "no frame");
   MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
   mParentReflowState = nullptr;
   AvailableISize() = aAvailableSpace.ISize(mWritingMode);
   AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
   mFloatManager = nullptr;
   mLineLayout = nullptr;
-  memset(&mFlags, 0, sizeof(mFlags));
   mDiscoveredClearance = nullptr;
   mPercentBSizeObserver = nullptr;
 
   if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
     mFlags.mDummyParentReflowState = true;
   }
   if (aFlags & COMPUTE_SIZE_SHRINK_WRAP) {
     mFlags.mShrinkWrap = true;
@@ -160,17 +159,18 @@ nsCSSOffsetState::nsCSSOffsetState(nsIFr
   , mWritingMode(aFrame->GetWritingMode())
 {
   MOZ_ASSERT(!aFrame->IsFlexOrGridItem(),
              "We're about to resolve percent margin & padding "
              "values against CB inline size, which is incorrect for "
              "flex/grid items");
   LogicalSize cbSize(aContainingBlockWritingMode, aContainingBlockISize,
                      aContainingBlockISize);
-  InitOffsets(aContainingBlockWritingMode, cbSize, frame->GetType());
+  ReflowStateFlags flags;
+  InitOffsets(aContainingBlockWritingMode, cbSize, frame->GetType(), flags);
 }
 
 // Initialize a reflow state for a child frame's reflow. Some state
 // is copied from the parent reflow state; the remaining state is
 // computed.
 nsHTMLReflowState::nsHTMLReflowState(
                      nsPresContext*           aPresContext,
                      const nsHTMLReflowState& aParentReflowState,
@@ -2121,17 +2121,17 @@ nsHTMLReflowState::InitConstraints(nsPre
                            aContainingBlockSize.BSize(wm),
                            aBorder, aPadding);
 
   // If this is a reflow root, then set the computed width and
   // height equal to the available space
   if (nullptr == mParentReflowState || mFlags.mDummyParentReflowState) {
     // XXXldb This doesn't mean what it used to!
     InitOffsets(wm, OffsetPercentBasis(frame, wm, aContainingBlockSize),
-                aFrameType, aBorder, aPadding);
+                aFrameType, mFlags, aBorder, aPadding);
     // Override mComputedMargin since reflow roots start from the
     // frame's boundary, which is inside the margin.
     ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
     ComputedPhysicalOffsets().SizeTo(0, 0, 0, 0);
 
     ComputedISize() =
       AvailableISize() - ComputedLogicalBorderPadding().IStartEnd(wm);
     if (ComputedISize() < 0) {
@@ -2179,17 +2179,17 @@ nsHTMLReflowState::InitConstraints(nsPre
     // XXX Might need to also pass the CB height (not width) for page boxes,
     // too, if we implement them.
 
     // For calculating positioning offsets, margins, borders and
     // padding, we use the writing mode of the containing block
     WritingMode cbwm = cbrs->GetWritingMode();
     InitOffsets(cbwm, OffsetPercentBasis(frame, cbwm,
                                          cbSize.ConvertTo(cbwm, wm)),
-                aFrameType, aBorder, aPadding);
+                aFrameType, mFlags, aBorder, aPadding);
 
     // For calculating the size of this box, we use its own writing mode
     const nsStyleCoord &blockSize = mStylePosition->BSize(wm);
     nsStyleUnit blockSizeUnit = blockSize.GetUnit();
 
     // Check for a percentage based block size and a containing block
     // block size that depends on the content block size
     // XXX twiddling blockSizeUnit doesn't help anymore
@@ -2433,18 +2433,19 @@ UpdateProp(FrameProperties& aProps,
     aProps.Delete(aProperty);
   }
 }
 
 void
 nsCSSOffsetState::InitOffsets(WritingMode aWM,
                               const LogicalSize& aPercentBasis,
                               nsIAtom* aFrameType,
-                              const nsMargin *aBorder,
-                              const nsMargin *aPadding)
+                              ReflowStateFlags aFlags,
+                              const nsMargin* aBorder,
+                              const nsMargin* aPadding)
 {
   DISPLAY_INIT_OFFSETS(frame, this, aPercentBasis, aBorder, aPadding);
 
   // Since we are in reflow, we don't need to store these properties anymore
   // unless they are dependent on width, in which case we store the new value.
   nsPresContext *presContext = frame->PresContext();
   FrameProperties props(presContext->PropertyTable(), frame);
   props.Delete(nsIFrame::UsedBorderProperty());
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -168,16 +168,61 @@ public:
     , mWritingMode(aFrame->GetWritingMode())
   {
   }
 
   nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
                    mozilla::WritingMode aContainingBlockWritingMode,
                    nscoord aContainingBlockISize);
 
+  struct ReflowStateFlags {
+    ReflowStateFlags() { memset(this, 0, sizeof(*this)); }
+    uint16_t mSpecialBSizeReflow:1;  // used by tables to communicate special reflow (in process) to handle
+                                     // percent bsize frames inside cells which may not have computed bsizes
+    uint16_t mNextInFlowUntouched:1; // nothing in the frame's next-in-flow (or its descendants)
+                                     // is changing
+    uint16_t mIsTopOfPage:1;         // Is the current context at the top of a
+                                     // page?  When true, we force something
+                                     // that's too tall for a page/column to
+                                     // fit anyway to avoid infinite loops.
+    uint16_t mAssumingHScrollbar:1;  // parent frame is an nsIScrollableFrame and it
+                                     // is assuming a horizontal scrollbar
+    uint16_t mAssumingVScrollbar:1;  // parent frame is an nsIScrollableFrame and it
+                                     // is assuming a vertical scrollbar
+
+    uint16_t mIsIResize:1;           // Is frame (a) not dirty and (b) a
+                                     // different inline-size than before?
+
+    uint16_t mIsBResize:1;           // Is frame (a) not dirty and (b) a
+                                     // different block-size than before or
+                                     // (potentially) in a context where
+                                     // percent block-sizes have a different
+                                     // basis?
+    uint16_t mTableIsSplittable:1;   // tables are splittable, this should happen only inside a page
+                                     // and never insider a column frame
+    uint16_t mHeightDependsOnAncestorCell:1;   // Does frame height depend on
+                                               // an ancestor table-cell?
+    uint16_t mIsColumnBalancing:1;   // nsColumnSetFrame is balancing columns
+    uint16_t mIsFlexContainerMeasuringHeight:1; // nsFlexContainerFrame is
+                                                // reflowing this child to
+                                                // measure its intrinsic height.
+    uint16_t mDummyParentReflowState:1; // a "fake" reflow state made
+                                        // in order to be the parent
+                                        // of a real one
+    uint16_t mMustReflowPlaceholders:1; // Should this frame reflow its place-
+                                        // holder children? If the available
+                                        // height of this frame didn't change,
+                                        // but its in a paginated environment
+                                        // (e.g. columns), it should always
+                                        // reflow its placeholder children.
+    uint16_t mShrinkWrap:1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
+    uint16_t mUseAutoBSize:1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
+    uint16_t mStaticPosIsCBOrigin:1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
+  };
+
 #ifdef DEBUG
   // Reflow trace methods.  Defined in nsFrame.cpp so they have access
   // to the display-reflow infrastructure.
   static void* DisplayInitOffsetsEnter(
                                      nsIFrame* aFrame,
                                      nsCSSOffsetState* aState,
                                      const mozilla::LogicalSize& aPercentBasis,
                                      const nsMargin* aBorder,
@@ -229,18 +274,19 @@ private:
                       const mozilla::LogicalSize& aPercentBasis,
                       nsIAtom* aFrameType);
 
 protected:
 
   void InitOffsets(mozilla::WritingMode aWM,
                    const mozilla::LogicalSize& aPercentBasis,
                    nsIAtom* aFrameType,
-                   const nsMargin *aBorder = nullptr,
-                   const nsMargin *aPadding = nullptr);
+                   ReflowStateFlags aFlags,
+                   const nsMargin* aBorder = nullptr,
+                   const nsMargin* aPadding = nullptr);
 
   /*
    * Convert nsStyleCoord to nscoord when percentages depend on the
    * inline size of the containing block, and enumerated values are for
    * inline size, min-inline-size, or max-inline-size.  Does not handle
    * auto inline sizes.
    */
   inline nscoord ComputeISizeValue(nscoord aContainingBlockISize,
@@ -538,60 +584,17 @@ public:
   // is required. When we discover that clearance is required, we
   // store the frame in which clearance was discovered to the location
   // requested here.
   nsIFrame** mDiscoveredClearance;
 
   // This value keeps track of how deeply nested a given reflow state
   // is from the top of the frame tree.
   int16_t mReflowDepth;
-
-  struct ReflowStateFlags {
-    uint16_t mSpecialBSizeReflow:1;  // used by tables to communicate special reflow (in process) to handle
-                                     // percent bsize frames inside cells which may not have computed bsizes
-    uint16_t mNextInFlowUntouched:1; // nothing in the frame's next-in-flow (or its descendants)
-                                     // is changing
-    uint16_t mIsTopOfPage:1;         // Is the current context at the top of a
-                                     // page?  When true, we force something
-                                     // that's too tall for a page/column to
-                                     // fit anyway to avoid infinite loops.
-    uint16_t mAssumingHScrollbar:1;  // parent frame is an nsIScrollableFrame and it
-                                     // is assuming a horizontal scrollbar
-    uint16_t mAssumingVScrollbar:1;  // parent frame is an nsIScrollableFrame and it
-                                     // is assuming a vertical scrollbar
-
-    uint16_t mIsIResize:1;           // Is frame (a) not dirty and (b) a
-                                     // different inline-size than before?
-
-    uint16_t mIsBResize:1;           // Is frame (a) not dirty and (b) a
-                                     // different block-size than before or
-                                     // (potentially) in a context where
-                                     // percent block-sizes have a different
-                                     // basis?
-    uint16_t mTableIsSplittable:1;   // tables are splittable, this should happen only inside a page
-                                     // and never insider a column frame
-    uint16_t mHeightDependsOnAncestorCell:1;   // Does frame height depend on
-                                               // an ancestor table-cell?
-    uint16_t mIsColumnBalancing:1;   // nsColumnSetFrame is balancing columns
-    uint16_t mIsFlexContainerMeasuringHeight:1; // nsFlexContainerFrame is
-                                                // reflowing this child to
-                                                // measure its intrinsic height.
-    uint16_t mDummyParentReflowState:1; // a "fake" reflow state made
-                                        // in order to be the parent
-                                        // of a real one
-    uint16_t mMustReflowPlaceholders:1; // Should this frame reflow its place-
-                                        // holder children? If the available
-                                        // height of this frame didn't change,
-                                        // but its in a paginated environment
-                                        // (e.g. columns), it should always
-                                        // reflow its placeholder children.
-    uint16_t mShrinkWrap:1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
-    uint16_t mUseAutoBSize:1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
-    uint16_t mStaticPosIsCBOrigin:1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
-  } mFlags;
+  ReflowStateFlags mFlags;
 
   // Logical and physical accessors for the resize flags. All users should go
   // via these accessors, so that in due course we can change the storage from
   // physical to logical.
   bool IsHResize() const {
     return mWritingMode.IsVertical() ? mFlags.mIsBResize : mFlags.mIsIResize;
   }
   bool IsVResize() const {