diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 6139f7e094d8..c377f9bba6bf 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -684,7 +684,7 @@ nsFlexContainerFrame::AppendFlexItemForChild( aChildFrame, nsSize(aParentReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE), - -1, -1, nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); childRSForMeasuringHeight.mFlags.mIsFlexContainerMeasuringHeight = true; childRSForMeasuringHeight.Init(aPresContext); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 8f0270d34161..85ddcd58c815 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -419,7 +419,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState, nsHTMLReflowState kidReflowState(presContext, aState->mReflowState, mInner.mScrolledFrame, nsSize(availWidth, NS_UNCONSTRAINEDSIZE), - -1, -1, nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); kidReflowState.Init(presContext, -1, -1, nullptr, &aState->mReflowState.mComputedPadding); kidReflowState.mFlags.mAssumingHScrollbar = aAssumeHScroll; diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 27e7bcf4a7b2..99ed8e875044 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -49,7 +49,7 @@ static eNormalLineHeightControl sNormalLineHeightControl = eUninitialized; // use for measuring things. nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext, nsIFrame* aFrame, - nsRenderingContext* aRenderingContext, + nsRenderingContext* aRenderingContext, const nsSize& aAvailableSpace, uint32_t aFlags) : nsCSSOffsetState(aFrame, aRenderingContext) @@ -72,9 +72,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext, mFlags.mDummyParentReflowState = true; } - if (!(aFlags & CALLER_WILL_INIT)) { - Init(aPresContext); - } + Init(aPresContext); } static bool CheckNextInFlowParenthood(nsIFrame* aFrame, nsIFrame* aParent) @@ -123,7 +121,6 @@ FontSizeInflationListMarginAdjustment(const nsIFrame* aFrame) return 0; } - // Initialize a reflow state for a child frames reflow. Some state // is copied from the parent reflow state; the remaining state is // computed. @@ -133,7 +130,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext, const nsSize& aAvailableSpace, nscoord aContainingBlockWidth, nscoord aContainingBlockHeight, - uint32_t aFlags) + bool aInit) : nsCSSOffsetState(aFrame, aParentReflowState.rendContext) , mBlockDelta(0) , mReflowDepth(aParentReflowState.mReflowDepth + 1) @@ -178,15 +175,11 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext, mFlags.mDummyParentReflowState = false; mDiscoveredClearance = nullptr; - mPercentHeightObserver = (aParentReflowState.mPercentHeightObserver && - aParentReflowState.mPercentHeightObserver->NeedsToObserve(*this)) + mPercentHeightObserver = (aParentReflowState.mPercentHeightObserver && + aParentReflowState.mPercentHeightObserver->NeedsToObserve(*this)) ? aParentReflowState.mPercentHeightObserver : nullptr; - if (aFlags & DUMMY_PARENT_REFLOW_STATE) { - mFlags.mDummyParentReflowState = true; - } - - if (!(aFlags & CALLER_WILL_INIT)) { + if (aInit) { Init(aPresContext, aContainingBlockWidth, aContainingBlockHeight); } } diff --git a/layout/generic/nsHTMLReflowState.h b/layout/generic/nsHTMLReflowState.h index ae6fd31dfb35..95ac50ae5250 100644 --- a/layout/generic/nsHTMLReflowState.h +++ b/layout/generic/nsHTMLReflowState.h @@ -380,59 +380,30 @@ public: // can use that and then override specific values if you want, or you can // call Init as desired... - /** - * Initialize a ROOT reflow state. - * - * @param aPresContext Must be equal to aFrame->PresContext(). - * @param aFrame The frame for whose reflow state is being constructed. - * @param aRenderingContext The rendering context to be used for measurements. - * @param aAvailableSpace See comments for availableHeight and availableWidth - * members. - * @param aFlags A set of flags used for additional boolean parameters (see - * below). - */ + // Initialize a root reflow state with a rendering context to + // use for measuring things. nsHTMLReflowState(nsPresContext* aPresContext, nsIFrame* aFrame, - nsRenderingContext* aRenderingContext, + nsRenderingContext* aRenderingContext, const nsSize& aAvailableSpace, uint32_t aFlags = 0); - /** - * Initialize a reflow state for a child frame's reflow. Some parts of the - * state are copied from the parent's reflow state. The remainder is computed. - * - * @param aPresContext Must be equal to aFrame->PresContext(). - * @param aParentReflowState A reference to an nsHTMLReflowState object that - * is to be the parent of this object. - * @param aFrame The frame for whose reflow state is being constructed. - * @param aAvailableSpace See comments for availableHeight and availableWidth - * members. - * @param aContainingBlockWidth An optional width, in app units, that is used - * by absolute positioning code to override default containing block - * width. - * @param aContainingBlockHeight An optional height, in app units, that is - * used by absolute positioning code to override default containing - * block height. - * @param aFlags A set of flags used for additional boolean parameters (see - * below). - */ + // 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(nsPresContext* aPresContext, const nsHTMLReflowState& aParentReflowState, nsIFrame* aFrame, const nsSize& aAvailableSpace, + // These two are used by absolute positioning code + // to override default containing block w & h: nscoord aContainingBlockWidth = -1, nscoord aContainingBlockHeight = -1, - uint32_t aFlags = 0); + bool aInit = true); // Values for |aFlags| passed to constructor enum { - // Indicates that the parent of this reflow state is "fake" (see - // mDummyParentReflowState in mFlags). - DUMMY_PARENT_REFLOW_STATE = (1<<0), - - // Indicates that the calling function will initialize the reflow state, and - // that the constructor should not call Init(). - CALLER_WILL_INIT = (1<<1) + DUMMY_PARENT_REFLOW_STATE = (1<<0) }; // This method initializes various data members. It is automatically diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index 73d2ed79067a..877c486452bf 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -911,7 +911,7 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext, while (childFrame) { nsHTMLReflowMetrics childDesiredSize(aDesiredSize.mFlags); nsHTMLReflowState childReflowState(aPresContext, aReflowState, - childFrame, availSize, (uint32_t)0); + childFrame, availSize); nsresult rv = ReflowChild(childFrame, aPresContext, childDesiredSize, childReflowState, childStatus); //NS_ASSERTION(NS_FRAME_IS_COMPLETE(childStatus), "bad status"); diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 4d238351c85a..a09f26f8b4e7 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -2681,7 +2681,7 @@ nsTableFrame::SetupHeaderFooterChild(const nsTableReflowState& aReflowState, nsHTMLReflowState kidReflowState(presContext, aReflowState.reflowState, aFrame, nsSize(aReflowState.availSize.width, NS_UNCONSTRAINEDSIZE), - -1, -1, nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(kidReflowState); kidReflowState.mFlags.mIsTopOfPage = true; nsHTMLReflowMetrics desiredSize; @@ -2708,8 +2708,7 @@ nsTableFrame::PlaceRepeatedFooter(nsTableReflowState& aReflowState, nsHTMLReflowState footerReflowState(presContext, aReflowState.reflowState, aTfoot, kidAvailSize, - -1, -1, - nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(footerReflowState); aReflowState.y += GetCellSpacingY(); @@ -2829,8 +2828,7 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState, // Reflow the child into the available space nsHTMLReflowState kidReflowState(presContext, aReflowState.reflowState, kidFrame, kidAvailSize, - -1, -1, - nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(kidReflowState); // If this isn't the first row group, and the previous row group has a diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index a5b452e1e193..c50c822e4610 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -382,7 +382,7 @@ nsTableOuterFrame::GetChildMargin(nsPresContext* aPresContext, // XXX We really shouldn't construct a reflow state to do this. nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame, nsSize(aAvailWidth, aOuterRS.availableHeight), - -1, -1, nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(*aPresContext, childRS); aMargin = childRS.mComputedMargin; @@ -824,7 +824,7 @@ nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext, // it nsHTMLReflowState &childRS = * new (aChildRSSpace) nsHTMLReflowState(aPresContext, aOuterRS, aChildFrame, availSize, - -1, -1, nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(*aPresContext, childRS); // see if we need to reset top-of-page due to a caption diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index e3b12c1f28a4..f95da67a702a 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -28,9 +28,9 @@ struct nsTableCellReflowState : public nsHTMLReflowState const nsHTMLReflowState& aParentReflowState, nsIFrame* aFrame, const nsSize& aAvailableSpace, - uint32_t aFlags = 0) + bool aInit = true) : nsHTMLReflowState(aPresContext, aParentReflowState, aFrame, - aAvailableSpace, -1, -1, aFlags) + aAvailableSpace, -1, -1, aInit) { } @@ -810,8 +810,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // it's an unknown frame type, give it a generic reflow and ignore the results nsTableCellReflowState kidReflowState(aPresContext, aReflowState, - kidFrame, nsSize(0,0), - nsHTMLReflowState::CALLER_WILL_INIT); + kidFrame, nsSize(0,0), false); InitChildReflowState(*aPresContext, nsSize(0,0), false, kidReflowState); nsHTMLReflowMetrics desiredSize; nsReflowStatus status; @@ -890,8 +889,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // Reflow the child nsTableCellReflowState kidReflowState(aPresContext, aReflowState, - kidFrame, kidAvailSize, - nsHTMLReflowState::CALLER_WILL_INIT); + kidFrame, kidAvailSize, false); InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse, kidReflowState); @@ -1085,8 +1083,7 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext, nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this); bool borderCollapse = tableFrame->IsBorderCollapse(); nsTableCellReflowState cellReflowState(aPresContext, aReflowState, - aCellFrame, availSize, - nsHTMLReflowState::CALLER_WILL_INIT); + aCellFrame, availSize, false); InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState); cellReflowState.mFlags.mIsTopOfPage = aIsTopOfPage; diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index a02b74919220..111568584895 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -371,8 +371,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext, nsSize kidAvailSize(aReflowState.availSize.width, NS_UNCONSTRAINEDSIZE); nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame, kidAvailSize, - -1, -1, - nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(*aPresContext, borderCollapse, kidReflowState); // This can indicate that columns were resized. @@ -934,8 +933,7 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext, rowAvailSize.height = std::min(rowAvailSize.height, rowRect.height); nsHTMLReflowState rowReflowState(&aPresContext, aReflowState, row, rowAvailSize, - -1, -1, - nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(aPresContext, borderCollapse, rowReflowState); rowReflowState.mFlags.mIsTopOfPage = isTopOfPage; // set top of page @@ -1070,8 +1068,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext, nsHTMLReflowState rowReflowState(aPresContext, aReflowState, rowFrame, availSize, - -1, -1, - nsHTMLReflowState::CALLER_WILL_INIT); + -1, -1, false); InitChildReflowState(*aPresContext, borderCollapse, rowReflowState); rowReflowState.mFlags.mIsTopOfPage = isTopOfPage; // set top of page