Bug 1546223 Part 2 - Use in-class member initializer for those which were in constructor body. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 24 Apr 2019 00:20:05 +0000
changeset 530041 7bfdaa5f19d8731fc0375a2a4d8adccf946a16c1
parent 530040 3cd891607bf6137193b4f9975e27436e2c34e0cf
child 530042 d59741bdae0bb0a23bf3dc77ea3929bde1ccfeca
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1546223
milestone68.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 1546223 Part 2 - Use in-class member initializer for those which were in constructor body. r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D28428
layout/generic/ReflowInput.cpp
layout/generic/ReflowInput.h
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -52,23 +52,18 @@ static eNormalLineHeightControl sNormalL
 ReflowInput::ReflowInput(nsPresContext* aPresContext, nsIFrame* aFrame,
                          gfxContext* aRenderingContext,
                          const LogicalSize& aAvailableSpace, uint32_t aFlags)
     : SizeComputationInput(aFrame, aRenderingContext) {
   MOZ_ASSERT(aRenderingContext, "no rendering context");
   MOZ_ASSERT(aPresContext, "no pres context");
   MOZ_ASSERT(aFrame, "no frame");
   MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
-  mParentReflowInput = nullptr;
   AvailableISize() = aAvailableSpace.ISize(mWritingMode);
   AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
-  mFloatManager = nullptr;
-  mLineLayout = nullptr;
-  mDiscoveredClearance = nullptr;
-  mPercentBSizeObserver = nullptr;
 
   if (aFlags & DUMMY_PARENT_REFLOW_INPUT) {
     mFlags.mDummyParentReflowInput = true;
   }
   if (aFlags & COMPUTE_SIZE_SHRINK_WRAP) {
     mFlags.mShrinkWrap = true;
   }
   if (aFlags & COMPUTE_SIZE_USE_AUTO_BSIZE) {
@@ -167,45 +162,47 @@ SizeComputationInput::SizeComputationInp
 // is copied from the parent reflow input; the remaining state is
 // computed.
 ReflowInput::ReflowInput(nsPresContext* aPresContext,
                          const ReflowInput& aParentReflowInput,
                          nsIFrame* aFrame, const LogicalSize& aAvailableSpace,
                          const LogicalSize* aContainingBlockSize,
                          uint32_t aFlags)
     : SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext),
+      mParentReflowInput(&aParentReflowInput),
+      mFloatManager(aParentReflowInput.mFloatManager),
+      mLineLayout(mFrame->IsFrameOfType(nsIFrame::eLineParticipant)
+                      ? aParentReflowInput.mLineLayout
+                      : nullptr),
+      mPercentBSizeObserver(
+          (aParentReflowInput.mPercentBSizeObserver &&
+           aParentReflowInput.mPercentBSizeObserver->NeedsToObserve(*this))
+              ? aParentReflowInput.mPercentBSizeObserver
+              : nullptr),
       mFlags(aParentReflowInput.mFlags),
       mReflowDepth(aParentReflowInput.mReflowDepth + 1) {
   MOZ_ASSERT(aPresContext, "no pres context");
   MOZ_ASSERT(aFrame, "no frame");
   MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
   MOZ_ASSERT(!mFlags.mSpecialBSizeReflow || !NS_SUBTREE_DIRTY(aFrame),
              "frame should be clean when getting special bsize reflow");
 
-  mParentReflowInput = &aParentReflowInput;
-
   AvailableISize() = aAvailableSpace.ISize(mWritingMode);
   AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
 
   if (mWritingMode.IsOrthogonalTo(aParentReflowInput.GetWritingMode())) {
     // If we're setting up for an orthogonal flow, and the parent reflow input
     // had a constrained ComputedBSize, we can use that as our AvailableISize
     // in preference to leaving it unconstrained.
     if (AvailableISize() == NS_UNCONSTRAINEDSIZE &&
         aParentReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
       AvailableISize() = aParentReflowInput.ComputedBSize();
     }
   }
 
-  mFloatManager = aParentReflowInput.mFloatManager;
-  if (mFrame->IsFrameOfType(nsIFrame::eLineParticipant))
-    mLineLayout = aParentReflowInput.mLineLayout;
-  else
-    mLineLayout = nullptr;
-
   // Note: mFlags was initialized as a copy of aParentReflowInput.mFlags up in
   // this constructor's init list, so the only flags that we need to explicitly
   // initialize here are those that may need a value other than our parent's.
   mFlags.mNextInFlowUntouched =
       aParentReflowInput.mFlags.mNextInFlowUntouched &&
       CheckNextInFlowParenthood(aFrame, aParentReflowInput.mFrame);
   mFlags.mAssumingHScrollbar = mFlags.mAssumingVScrollbar = false;
   mFlags.mIsColumnBalancing = false;
@@ -214,23 +211,16 @@ ReflowInput::ReflowInput(nsPresContext* 
   mFlags.mShrinkWrap = !!(aFlags & COMPUTE_SIZE_SHRINK_WRAP);
   mFlags.mUseAutoBSize = !!(aFlags & COMPUTE_SIZE_USE_AUTO_BSIZE);
   mFlags.mStaticPosIsCBOrigin = !!(aFlags & STATIC_POS_IS_CB_ORIGIN);
   mFlags.mIOffsetsNeedCSSAlign = mFlags.mBOffsetsNeedCSSAlign = false;
   mFlags.mIClampMarginBoxMinSize = !!(aFlags & I_CLAMP_MARGIN_BOX_MIN_SIZE);
   mFlags.mBClampMarginBoxMinSize = !!(aFlags & B_CLAMP_MARGIN_BOX_MIN_SIZE);
   mFlags.mApplyAutoMinSize = !!(aFlags & I_APPLY_AUTO_MIN_SIZE);
 
-  mDiscoveredClearance = nullptr;
-  mPercentBSizeObserver =
-      (aParentReflowInput.mPercentBSizeObserver &&
-       aParentReflowInput.mPercentBSizeObserver->NeedsToObserve(*this))
-          ? aParentReflowInput.mPercentBSizeObserver
-          : nullptr;
-
   if ((aFlags & DUMMY_PARENT_REFLOW_INPUT) ||
       (mParentReflowInput->mFlags.mDummyParentReflowInput &&
        mFrame->IsTableFrame())) {
     mFlags.mDummyParentReflowInput = true;
   }
 
   if (!(aFlags & CALLER_WILL_INIT)) {
     Init(aPresContext, aContainingBlockSize);
--- a/layout/generic/ReflowInput.h
+++ b/layout/generic/ReflowInput.h
@@ -347,24 +347,24 @@ struct SizeComputationInput {
  * XXX Refactor so only a base class (nsSizingState?) is used for intrinsic
  * size calculation.
  *
  * @see nsIFrame#Reflow()
  */
 struct ReflowInput : public SizeComputationInput {
   // the reflow inputs are linked together. this is the pointer to the
   // parent's reflow input
-  const ReflowInput* mParentReflowInput;
+  const ReflowInput* mParentReflowInput = nullptr;
 
   // A non-owning pointer to the float manager associated with this area,
   // which points to the object owned by nsAutoFloatManager::mNew.
-  nsFloatManager* mFloatManager;
+  nsFloatManager* mFloatManager = nullptr;
 
   // LineLayout object (only for inline reflow; set to nullptr otherwise)
-  nsLineLayout* mLineLayout;
+  nsLineLayout* mLineLayout = nullptr;
 
   // The appropriate reflow input for the containing block (for
   // percentage widths, etc.) of this reflow input's frame. It will be setup
   // properly in InitCBReflowInput().
   const ReflowInput* mCBReflowInput = nullptr;
 
   // The type of frame, from css's perspective. This value is
   // initialized by the Init method below.
@@ -642,24 +642,24 @@ struct ReflowInput : public SizeComputat
   const nsStyleText* mStyleText;
 
   bool IsFloating() const;
 
   mozilla::StyleDisplay GetDisplay() const;
 
   // a frame (e.g. nsTableCellFrame) which may need to generate a special
   // reflow for percent bsize calculations
-  nsIPercentBSizeObserver* mPercentBSizeObserver;
+  nsIPercentBSizeObserver* mPercentBSizeObserver = nullptr;
 
   // CSS margin collapsing sometimes requires us to reflow
   // optimistically assuming that margins collapse to see if clearance
   // 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;
+  nsIFrame** mDiscoveredClearance = nullptr;
 
   ReflowInputFlags mFlags;
 
   // This value keeps track of how deeply nested a given reflow input
   // is from the top of the frame tree.
   int16_t mReflowDepth = 0;
 
   // Logical and physical accessors for the resize flags. All users should go