author | Ting-Yu Lin <tlin@mozilla.com> |
Thu, 21 Jul 2016 18:36:39 +0800 | |
changeset 306079 | ec9c3a2f2c091f2159edd5753a1b17b4b77189ec |
parent 306078 | d1a449efbe4446e696311b21f7bdfcd709b82a26 |
child 306080 | 38d540b40e587644b29e20727a92158dafafc0c2 |
push id | 30474 |
push user | cbook@mozilla.com |
push date | Thu, 21 Jul 2016 14:25:10 +0000 |
treeherder | mozilla-central@6b180266ac16 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dbaron |
bugs | 1277129 |
milestone | 50.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
|
--- a/layout/generic/ReflowInput.cpp +++ b/layout/generic/ReflowInput.cpp @@ -1870,18 +1870,18 @@ GetBlockMarginBorderPadding(const Reflow * When we encounter scrolledContent block frames, we skip over them, * since they are guaranteed to not be useful for computing the containing block. * * See also IsQuirkContainingBlockHeight. */ static nscoord CalcQuirkContainingBlockHeight(const ReflowInput* aCBReflowInput) { - const ReflowInput* firstAncestorRS = nullptr; // a candidate for html frame - const ReflowInput* secondAncestorRS = nullptr; // a candidate for body frame + const ReflowInput* firstAncestorRI = nullptr; // a candidate for html frame + const ReflowInput* secondAncestorRI = nullptr; // a candidate for body frame // initialize the default to NS_AUTOHEIGHT as this is the containings block // computed height when this function is called. It is possible that we // don't alter this height especially if we are restricted to one level nscoord result = NS_AUTOHEIGHT; const ReflowInput* rs = aCBReflowInput; for (; rs; rs = rs->mParentReflowInput) { @@ -1889,18 +1889,18 @@ CalcQuirkContainingBlockHeight(const Ref // if the ancestor is auto height then skip it and continue up if it // is the first block frame and possibly the body/html if (nsGkAtoms::blockFrame == frameType || #ifdef MOZ_XUL nsGkAtoms::XULLabelFrame == frameType || #endif nsGkAtoms::scrollFrame == frameType) { - secondAncestorRS = firstAncestorRS; - firstAncestorRS = rs; + secondAncestorRI = firstAncestorRI; + firstAncestorRI = rs; // If the current frame we're looking at is positioned, we don't want to // go any further (see bug 221784). The behavior we want here is: 1) If // not auto-height, use this as the percentage base. 2) If auto-height, // keep looking, unless the frame is positioned. if (NS_AUTOHEIGHT == rs->ComputedHeight()) { if (rs->mFrame->IsAbsolutelyPositioned()) { break; @@ -1929,110 +1929,110 @@ CalcQuirkContainingBlockHeight(const Ref // if unconstrained - don't sutract borders - would result in huge height if (NS_AUTOHEIGHT == result) return result; // if we got to the canvas or page content frame, then subtract out // margin/border/padding for the BODY and HTML elements if ((nsGkAtoms::canvasFrame == frameType) || (nsGkAtoms::pageContentFrame == frameType)) { - result -= GetBlockMarginBorderPadding(firstAncestorRS); - result -= GetBlockMarginBorderPadding(secondAncestorRS); + result -= GetBlockMarginBorderPadding(firstAncestorRI); + result -= GetBlockMarginBorderPadding(secondAncestorRI); #ifdef DEBUG // make sure the first ancestor is the HTML and the second is the BODY - if (firstAncestorRS) { - nsIContent* frameContent = firstAncestorRS->mFrame->GetContent(); + if (firstAncestorRI) { + nsIContent* frameContent = firstAncestorRI->mFrame->GetContent(); if (frameContent) { NS_ASSERTION(frameContent->IsHTMLElement(nsGkAtoms::html), "First ancestor is not HTML"); } } - if (secondAncestorRS) { - nsIContent* frameContent = secondAncestorRS->mFrame->GetContent(); + if (secondAncestorRI) { + nsIContent* frameContent = secondAncestorRI->mFrame->GetContent(); if (frameContent) { NS_ASSERTION(frameContent->IsHTMLElement(nsGkAtoms::body), "Second ancestor is not BODY"); } } #endif } // if we got to the html frame (a block child of the canvas) ... else if (nsGkAtoms::blockFrame == frameType && rs->mParentReflowInput && nsGkAtoms::canvasFrame == rs->mParentReflowInput->mFrame->GetType()) { // ... then subtract out margin/border/padding for the BODY element - result -= GetBlockMarginBorderPadding(secondAncestorRS); + result -= GetBlockMarginBorderPadding(secondAncestorRI); } break; } // Make sure not to return a negative height here! return std::max(result, 0); } // Called by InitConstraints() to compute the containing block rectangle for // the element. Handles the special logic for absolutely positioned elements LogicalSize ReflowInput::ComputeContainingBlockRectangle( nsPresContext* aPresContext, - const ReflowInput* aContainingBlockRS) const + const ReflowInput* aContainingBlockRI) const { // Unless the element is absolutely positioned, the containing block is // formed by the content edge of the nearest block-level ancestor - LogicalSize cbSize = aContainingBlockRS->ComputedSize(); + LogicalSize cbSize = aContainingBlockRI->ComputedSize(); - WritingMode wm = aContainingBlockRS->GetWritingMode(); + WritingMode wm = aContainingBlockRI->GetWritingMode(); // mFrameType for abs-pos tables is NS_CSS_FRAME_TYPE_BLOCK, so we need to // special case them here. if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE || (mFrame->GetType() == nsGkAtoms::tableFrame && mFrame->IsAbsolutelyPositioned() && (mFrame->GetParent()->GetStateBits() & NS_FRAME_OUT_OF_FLOW))) { // See if the ancestor is block-level or inline-level - if (NS_FRAME_GET_TYPE(aContainingBlockRS->mFrameType) == NS_CSS_FRAME_TYPE_INLINE) { + if (NS_FRAME_GET_TYPE(aContainingBlockRI->mFrameType) == NS_CSS_FRAME_TYPE_INLINE) { // Base our size on the actual size of the frame. In cases when this is // completely bogus (eg initial reflow), this code shouldn't even be // called, since the code in nsInlineFrame::Reflow will pass in // the containing block dimensions to our constructor. // XXXbz we should be taking the in-flows into account too, but // that's very hard. LogicalMargin computedBorder = - aContainingBlockRS->ComputedLogicalBorderPadding() - - aContainingBlockRS->ComputedLogicalPadding(); - cbSize.ISize(wm) = aContainingBlockRS->mFrame->ISize(wm) - + aContainingBlockRI->ComputedLogicalBorderPadding() - + aContainingBlockRI->ComputedLogicalPadding(); + cbSize.ISize(wm) = aContainingBlockRI->mFrame->ISize(wm) - computedBorder.IStartEnd(wm); NS_ASSERTION(cbSize.ISize(wm) >= 0, "Negative containing block isize!"); - cbSize.BSize(wm) = aContainingBlockRS->mFrame->BSize(wm) - + cbSize.BSize(wm) = aContainingBlockRI->mFrame->BSize(wm) - computedBorder.BStartEnd(wm); NS_ASSERTION(cbSize.BSize(wm) >= 0, "Negative containing block bsize!"); } else { // If the ancestor is block-level, the containing block is formed by the // padding edge of the ancestor cbSize.ISize(wm) += - aContainingBlockRS->ComputedLogicalPadding().IStartEnd(wm); + aContainingBlockRI->ComputedLogicalPadding().IStartEnd(wm); cbSize.BSize(wm) += - aContainingBlockRS->ComputedLogicalPadding().BStartEnd(wm); + aContainingBlockRI->ComputedLogicalPadding().BStartEnd(wm); } } else { // an element in quirks mode gets a containing block based on looking for a // parent with a non-auto height if the element has a percent height // Note: We don't emulate this quirk for percents in calc() or in // vertical writing modes. if (!wm.IsVertical() && NS_AUTOHEIGHT == cbSize.BSize(wm)) { if (eCompatibility_NavQuirks == aPresContext->CompatibilityMode() && mStylePosition->mHeight.GetUnit() == eStyleUnit_Percent) { - cbSize.BSize(wm) = CalcQuirkContainingBlockHeight(aContainingBlockRS); + cbSize.BSize(wm) = CalcQuirkContainingBlockHeight(aContainingBlockRI); } } } return cbSize.ConvertTo(GetWritingMode(), wm); } static eNormalLineHeightControl GetNormalLineHeightCalcControl(void)
--- a/layout/generic/ReflowInput.h +++ b/layout/generic/ReflowInput.h @@ -734,17 +734,17 @@ public: static nscoord CalcLineHeight(nsIContent* aContent, nsStyleContext* aStyleContext, nscoord aBlockBSize, float aFontSizeInflation); mozilla::LogicalSize ComputeContainingBlockRectangle( nsPresContext* aPresContext, - const ReflowInput* aContainingBlockRS) const; + const ReflowInput* aContainingBlockRI) const; /** * Apply the mComputed(Min/Max)Width constraints to the content * size computed so far. */ nscoord ApplyMinMaxWidth(nscoord aWidth) const { if (NS_UNCONSTRAINEDSIZE != ComputedMaxWidth()) { aWidth = std::min(aWidth, ComputedMaxWidth());
--- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -963,58 +963,58 @@ CalculateContainingBlockSizeForAbsolutes // frame is fully reflowed and using the resulting dimensions, even // if they're intrinsic. // In fact we should be attaching absolute children to the outermost // frame and not always sticking them in block frames. // First, find the reflow state for the outermost frame for this // content, except for fieldsets where the inner anonymous frame has // the correct padding area with the legend taken into account. - const ReflowInput* aLastRS = &aReflowInput; - const ReflowInput* lastButOneRS = &aReflowInput; - while (aLastRS->mParentReflowInput && - aLastRS->mParentReflowInput->mFrame->GetContent() == frame->GetContent() && - aLastRS->mParentReflowInput->mFrame->GetType() != nsGkAtoms::fieldSetFrame) { - lastButOneRS = aLastRS; - aLastRS = aLastRS->mParentReflowInput; - } - if (aLastRS != &aReflowInput) { + const ReflowInput* aLastRI = &aReflowInput; + const ReflowInput* lastButOneRI = &aReflowInput; + while (aLastRI->mParentReflowInput && + aLastRI->mParentReflowInput->mFrame->GetContent() == frame->GetContent() && + aLastRI->mParentReflowInput->mFrame->GetType() != nsGkAtoms::fieldSetFrame) { + lastButOneRI = aLastRI; + aLastRI = aLastRI->mParentReflowInput; + } + if (aLastRI != &aReflowInput) { // Scrollbars need to be specifically excluded, if present, because they are outside the // padding-edge. We need better APIs for getting the various boxes from a frame. - nsIScrollableFrame* scrollFrame = do_QueryFrame(aLastRS->mFrame); + nsIScrollableFrame* scrollFrame = do_QueryFrame(aLastRI->mFrame); nsMargin scrollbars(0,0,0,0); if (scrollFrame) { scrollbars = - scrollFrame->GetDesiredScrollbarSizes(aLastRS->mFrame->PresContext(), - aLastRS->mRenderingContext); - if (!lastButOneRS->mFlags.mAssumingHScrollbar) { + scrollFrame->GetDesiredScrollbarSizes(aLastRI->mFrame->PresContext(), + aLastRI->mRenderingContext); + if (!lastButOneRI->mFlags.mAssumingHScrollbar) { scrollbars.top = scrollbars.bottom = 0; } - if (!lastButOneRS->mFlags.mAssumingVScrollbar) { + if (!lastButOneRI->mFlags.mAssumingVScrollbar) { scrollbars.left = scrollbars.right = 0; } } // We found a reflow state for the outermost wrapping frame, so use // its computed metrics if available, converted to our writing mode - WritingMode lastWM = aLastRS->GetWritingMode(); - LogicalSize lastRSSize = + WritingMode lastWM = aLastRI->GetWritingMode(); + LogicalSize lastRISize = LogicalSize(lastWM, - aLastRS->ComputedISize(), - aLastRS->ComputedBSize()).ConvertTo(aWM, lastWM); - LogicalMargin lastRSPadding = - aLastRS->ComputedLogicalPadding().ConvertTo(aWM, lastWM); + aLastRI->ComputedISize(), + aLastRI->ComputedBSize()).ConvertTo(aWM, lastWM); + LogicalMargin lastRIPadding = + aLastRI->ComputedLogicalPadding().ConvertTo(aWM, lastWM); LogicalMargin logicalScrollbars(aWM, scrollbars); - if (lastRSSize.ISize(aWM) != NS_UNCONSTRAINEDSIZE) { - cbSize.ISize(aWM) = std::max(0, lastRSSize.ISize(aWM) + - lastRSPadding.IStartEnd(aWM) - + if (lastRISize.ISize(aWM) != NS_UNCONSTRAINEDSIZE) { + cbSize.ISize(aWM) = std::max(0, lastRISize.ISize(aWM) + + lastRIPadding.IStartEnd(aWM) - logicalScrollbars.IStartEnd(aWM)); } - if (lastRSSize.BSize(aWM) != NS_UNCONSTRAINEDSIZE) { - cbSize.BSize(aWM) = std::max(0, lastRSSize.BSize(aWM) + - lastRSPadding.BStartEnd(aWM) - + if (lastRISize.BSize(aWM) != NS_UNCONSTRAINEDSIZE) { + cbSize.BSize(aWM) = std::max(0, lastRISize.BSize(aWM) + + lastRIPadding.BStartEnd(aWM) - logicalScrollbars.BStartEnd(aWM)); } } } return cbSize; } @@ -3350,18 +3350,18 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl aState.mBCoord -= bStartMargin; availSpace.BStart(wm) -= bStartMargin; if (NS_UNCONSTRAINEDSIZE != availSpace.BSize(wm)) { availSpace.BSize(wm) += bStartMargin; } // construct the html reflow state for the block. ReflowBlock // will initialize it. - Maybe<ReflowInput> blockHtmlRS; - blockHtmlRS.emplace( + Maybe<ReflowInput> blockHtmlRI; + blockHtmlRI.emplace( aState.mPresContext, aState.mReflowInput, frame, availSpace.Size(wm).ConvertTo(frame->GetWritingMode(), wm)); nsFloatManager::SavedState floatManagerState; nsReflowStatus frameReflowStatus; do { if (floatAvailableSpace.mHasFloats) { // Set if floatAvailableSpace.mHasFloats is true for any @@ -3378,26 +3378,26 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl !*aState.mReflowInput.mDiscoveredClearance; // Reflow the block into the available space if (mayNeedRetry || replacedBlock) { aState.mFloatManager->PushState(&floatManagerState); } if (mayNeedRetry) { - blockHtmlRS->mDiscoveredClearance = &clearanceFrame; + blockHtmlRI->mDiscoveredClearance = &clearanceFrame; } else if (!applyBStartMargin) { - blockHtmlRS->mDiscoveredClearance = + blockHtmlRI->mDiscoveredClearance = aState.mReflowInput.mDiscoveredClearance; } frameReflowStatus = NS_FRAME_COMPLETE; brc.ReflowBlock(availSpace, applyBStartMargin, aState.mPrevBEndMargin, clearance, aState.IsAdjacentWithTop(), - aLine.get(), *blockHtmlRS, frameReflowStatus, aState); + aLine.get(), *blockHtmlRI, frameReflowStatus, aState); // Now the block has a height. Using that height, get the // available space again and call ComputeBlockAvailSpace again. // If ComputeBlockAvailSpace gives a different result, we need to // reflow again. if (!replacedBlock) { break; } @@ -3474,32 +3474,32 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl // This should never cause us to move up since the call to // GetFloatAvailableSpaceForBSize above included the margin. applyBStartMargin = false; bStartMargin = 0; treatWithClearance = true; // avoid hitting test above clearance = 0; } - blockHtmlRS.reset(); - blockHtmlRS.emplace( + blockHtmlRI.reset(); + blockHtmlRI.emplace( aState.mPresContext, aState.mReflowInput, frame, availSpace.Size(wm).ConvertTo(frame->GetWritingMode(), wm)); } while (true); if (mayNeedRetry && clearanceFrame) { aState.mFloatManager->PopState(&floatManagerState); aState.mBCoord = startingBCoord; aState.mPrevBEndMargin = incomingMargin; continue; } aState.mPrevChild = frame; - if (blockHtmlRS->WillReflowAgainForClearance()) { + if (blockHtmlRI->WillReflowAgainForClearance()) { // If an ancestor of ours is going to reflow for clearance, we // need to avoid calling PlaceBlock, because it unsets dirty bits // on the child block (both itself, and through its call to // nsFrame::DidReflow), and those dirty bits imply dirtiness for // all of the child block, including the lines it didn't reflow. NS_ASSERTION(originalPosition == frame->GetPosition(), "we need to call PositionChildViews"); return; @@ -3527,17 +3527,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl // pushing it to the next page would give it more room. // Don't force the block to fit if it's impacted by a float. If it is, // then pushing it to the next page would give it more room. Note that // isImpacted doesn't include impact from the block's own floats. bool forceFit = aState.IsAdjacentWithTop() && clearance <= 0 && !floatAvailableSpace.mHasFloats; nsCollapsingMargin collapsedBEndMargin; nsOverflowAreas overflowAreas; - *aKeepReflowGoing = brc.PlaceBlock(*blockHtmlRS, forceFit, aLine.get(), + *aKeepReflowGoing = brc.PlaceBlock(*blockHtmlRI, forceFit, aLine.get(), collapsedBEndMargin, overflowAreas, frameReflowStatus); if (!NS_FRAME_IS_FULLY_COMPLETE(frameReflowStatus) && ShouldAvoidBreakInside(aState.mReflowInput)) { *aKeepReflowGoing = false; }
--- a/layout/generic/nsBlockReflowContext.cpp +++ b/layout/generic/nsBlockReflowContext.cpp @@ -45,49 +45,49 @@ static nsIFrame* DescendIntoBlockLevelFr if (child) { return DescendIntoBlockLevelFrame(child); } } return aFrame; } bool -nsBlockReflowContext::ComputeCollapsedBStartMargin(const ReflowInput& aRS, +nsBlockReflowContext::ComputeCollapsedBStartMargin(const ReflowInput& aRI, nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame, bool* aMayNeedRetry, bool* aBlockIsEmpty) { - WritingMode wm = aRS.GetWritingMode(); + WritingMode wm = aRI.GetWritingMode(); WritingMode parentWM = mMetrics.GetWritingMode(); // Include block-start element of frame's margin - aMargin->Include(aRS.ComputedLogicalMargin().ConvertTo(parentWM, wm).BStart(parentWM)); + aMargin->Include(aRI.ComputedLogicalMargin().ConvertTo(parentWM, wm).BStart(parentWM)); // The inclusion of the block-end margin when empty is done by the caller // since it doesn't need to be done by the top-level (non-recursive) // caller. #ifdef NOISY_BLOCKDIR_MARGINS - nsFrame::ListTag(stdout, aRS.mFrame); - printf(": %d => %d\n", aRS.ComputedLogicalMargin().BStart(wm), aMargin->get()); + nsFrame::ListTag(stdout, aRI.mFrame); + printf(": %d => %d\n", aRI.ComputedLogicalMargin().BStart(wm), aMargin->get()); #endif bool dirtiedLine = false; bool setBlockIsEmpty = false; // Calculate the frame's generational block-start-margin from its child // blocks. Note that if the frame has a non-zero block-start-border or // block-start-padding then this step is skipped because it will be a margin // root. It is also skipped if the frame is a margin root for other // reasons. - nsIFrame* frame = DescendIntoBlockLevelFrame(aRS.mFrame); + nsIFrame* frame = DescendIntoBlockLevelFrame(aRI.mFrame); nsPresContext* prescontext = frame->PresContext(); nsBlockFrame* block = nullptr; - if (0 == aRS.ComputedLogicalBorderPadding().BStart(wm)) { + if (0 == aRI.ComputedLogicalBorderPadding().BStart(wm)) { block = nsLayoutUtils::GetAsBlock(frame); if (block) { bool bStartMarginRoot, unused; block->IsMarginRoot(&bStartMarginRoot, &unused); if (bStartMarginRoot) { block = nullptr; } } @@ -147,23 +147,23 @@ nsBlockReflowContext::ComputeCollapsedBS // child blocks margin and so in so that we can look into // it. For its margins to be computed we need to have a reflow // state for it. // We may have to construct an extra reflow state here if // we drilled down through a block wrapper. At the moment // we can only drill down one level so we only have to support // one extra reflow state. - const ReflowInput* outerReflowInput = &aRS; - if (frame != aRS.mFrame) { - NS_ASSERTION(frame->GetParent() == aRS.mFrame, + const ReflowInput* outerReflowInput = &aRI; + if (frame != aRI.mFrame) { + NS_ASSERTION(frame->GetParent() == aRI.mFrame, "Can only drill through one level of block wrapper"); - LogicalSize availSpace = aRS.ComputedSize(frame->GetWritingMode()); + LogicalSize availSpace = aRI.ComputedSize(frame->GetWritingMode()); outerReflowInput = new ReflowInput(prescontext, - aRS, frame, availSpace); + aRI, frame, availSpace); } { LogicalSize availSpace = outerReflowInput->ComputedSize(kid->GetWritingMode()); ReflowInput innerReflowInput(prescontext, *outerReflowInput, kid, availSpace); // Record that we're being optimistic by assuming the kid @@ -180,90 +180,90 @@ nsBlockReflowContext::ComputeCollapsedBS } if (isEmpty) { WritingMode innerWM = innerReflowInput.GetWritingMode(); LogicalMargin innerMargin = innerReflowInput.ComputedLogicalMargin().ConvertTo(parentWM, innerWM); aMargin->Include(innerMargin.BEnd(parentWM)); } } - if (outerReflowInput != &aRS) { + if (outerReflowInput != &aRI) { delete const_cast<ReflowInput*>(outerReflowInput); } } if (!isEmpty) { if (!setBlockIsEmpty && aBlockIsEmpty) { setBlockIsEmpty = true; *aBlockIsEmpty = false; } goto done; } } if (!setBlockIsEmpty && aBlockIsEmpty) { // The first time we reach here is when this is the first block // and we have processed all its normal lines. setBlockIsEmpty = true; // All lines are empty, or we wouldn't be here! - *aBlockIsEmpty = aRS.mFrame->IsSelfEmpty(); + *aBlockIsEmpty = aRI.mFrame->IsSelfEmpty(); } } } done: if (!setBlockIsEmpty && aBlockIsEmpty) { - *aBlockIsEmpty = aRS.mFrame->IsEmpty(); + *aBlockIsEmpty = aRI.mFrame->IsEmpty(); } #ifdef NOISY_BLOCKDIR_MARGINS - nsFrame::ListTag(stdout, aRS.mFrame); + nsFrame::ListTag(stdout, aRI.mFrame); printf(": => %d\n", aMargin->get()); #endif return dirtiedLine; } void nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace, bool aApplyBStartMargin, nsCollapsingMargin& aPrevMargin, nscoord aClearance, bool aIsAdjacentWithBStart, nsLineBox* aLine, - ReflowInput& aFrameRS, + ReflowInput& aFrameRI, nsReflowStatus& aFrameReflowStatus, BlockReflowInput& aState) { - mFrame = aFrameRS.mFrame; + mFrame = aFrameRI.mFrame; mWritingMode = aState.mReflowInput.GetWritingMode(); mContainerSize = aState.ContainerSize(); mSpace = aSpace; if (!aIsAdjacentWithBStart) { - aFrameRS.mFlags.mIsTopOfPage = false; // make sure this is cleared + aFrameRI.mFlags.mIsTopOfPage = false; // make sure this is cleared } if (aApplyBStartMargin) { mBStartMargin = aPrevMargin; #ifdef NOISY_BLOCKDIR_MARGINS nsFrame::ListTag(stdout, mOuterReflowInput.mFrame); printf(": reflowing "); nsFrame::ListTag(stdout, mFrame); printf(" margin => %d, clearance => %d\n", mBStartMargin.get(), aClearance); #endif // Adjust the available size if it's constrained so that the // child frame doesn't think it can reflow into its margin area. if (mWritingMode.IsOrthogonalTo(mFrame->GetWritingMode())) { - if (NS_UNCONSTRAINEDSIZE != aFrameRS.AvailableISize()) { - aFrameRS.AvailableISize() -= mBStartMargin.get() + aClearance; + if (NS_UNCONSTRAINEDSIZE != aFrameRI.AvailableISize()) { + aFrameRI.AvailableISize() -= mBStartMargin.get() + aClearance; } } else { - if (NS_UNCONSTRAINEDSIZE != aFrameRS.AvailableBSize()) { - aFrameRS.AvailableBSize() -= mBStartMargin.get() + aClearance; + if (NS_UNCONSTRAINEDSIZE != aFrameRI.AvailableBSize()) { + aFrameRI.AvailableBSize() -= mBStartMargin.get() + aClearance; } } } else { // nsBlockFrame::ReflowBlock might call us multiple times with // *different* values of aApplyBStartMargin. mBStartMargin.Zero(); } @@ -273,42 +273,42 @@ nsBlockReflowContext::ReflowBlock(const // manager, so tI and tB don't matter. mICoord and mBCoord don't // matter becacuse they are only used in PlaceBlock, which is not used // for floats. if (aLine) { // Compute inline/block coordinate where reflow will begin. Use the // rules from 10.3.3 to determine what to apply. At this point in the // reflow auto inline-start/end margins will have a zero value. - WritingMode frameWM = aFrameRS.GetWritingMode(); + WritingMode frameWM = aFrameRI.GetWritingMode(); LogicalMargin usedMargin = - aFrameRS.ComputedLogicalMargin().ConvertTo(mWritingMode, frameWM); + aFrameRI.ComputedLogicalMargin().ConvertTo(mWritingMode, frameWM); mICoord = mSpace.IStart(mWritingMode) + usedMargin.IStart(mWritingMode); mBCoord = mSpace.BStart(mWritingMode) + mBStartMargin.get() + aClearance; LogicalRect space(mWritingMode, mICoord, mBCoord, mSpace.ISize(mWritingMode) - usedMargin.IStartEnd(mWritingMode), mSpace.BSize(mWritingMode) - usedMargin.BStartEnd(mWritingMode)); tI = space.LineLeft(mWritingMode, mContainerSize); tB = mBCoord; if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0) - aFrameRS.mBlockDelta = + aFrameRI.mBlockDelta = mOuterReflowInput.mBlockDelta + mBCoord - aLine->BStart(); } #ifdef DEBUG mMetrics.ISize(mWritingMode) = nscoord(0xdeadbeef); mMetrics.BSize(mWritingMode) = nscoord(0xdeadbeef); #endif mOuterReflowInput.mFloatManager->Translate(tI, tB); - mFrame->Reflow(mPresContext, mMetrics, aFrameRS, aFrameReflowStatus); + mFrame->Reflow(mPresContext, mMetrics, aFrameRI, aFrameReflowStatus); mOuterReflowInput.mFloatManager->Translate(-tI, -tB); #ifdef DEBUG if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { if ((CRAZY_SIZE(mMetrics.ISize(mWritingMode)) || CRAZY_SIZE(mMetrics.BSize(mWritingMode))) && !mFrame->GetParent()->IsCrazySizeAssertSuppressed()) { printf("nsBlockReflowContext: ");
--- a/layout/generic/nsBlockReflowContext.h +++ b/layout/generic/nsBlockReflowContext.h @@ -53,34 +53,34 @@ public: } const ReflowOutput& GetMetrics() const { return mMetrics; } /** * Computes the collapsed block-start margin (in the context's parent's - * writing mode) for a block whose reflow state is in aRS. + * writing mode) for a block whose reflow state is in aRI. * The computed margin is added into aMargin, whose writing mode is the * parent's mode as found in mMetrics.GetWritingMode(); note this may not be - * the block's own writing mode as found in aRS. + * the block's own writing mode as found in aRI. * If aClearanceFrame is null then this is the first optimistic pass which * shall assume that no frames have clearance, and we clear the HasClearance * on all frames encountered. * If non-null, this is the second pass and the caller has decided * aClearanceFrame needs clearance (and we will therefore stop collapsing * there); also, this function is responsible for marking it with * SetHasClearance. * If in the optimistic pass any frame is encountered that might possibly * need clearance (i.e., if we really needed the optimism assumption) then * we set aMayNeedRetry to true. * We return true if we changed the clearance state of any line and marked it * dirty. */ - bool ComputeCollapsedBStartMargin(const ReflowInput& aRS, + bool ComputeCollapsedBStartMargin(const ReflowInput& aRI, nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame, bool* aMayNeedRetry, bool* aIsEmpty = nullptr); protected: nsPresContext* mPresContext; const ReflowInput& mOuterReflowInput;
--- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -1183,63 +1183,63 @@ nsFlexContainerFrame::GenerateFlexItemFo nsIFrame* aChildFrame, const ReflowInput& aParentReflowInput, const FlexboxAxisTracker& aAxisTracker) { // Create temporary reflow state just for sizing -- to get hypothetical // main-size and the computed values of min / max main-size property. // (This reflow state will _not_ be used for reflow.) ReflowInput - childRS(aPresContext, aParentReflowInput, aChildFrame, + childRI(aPresContext, aParentReflowInput, aChildFrame, aParentReflowInput.ComputedSize(aChildFrame->GetWritingMode())); // FLEX GROW & SHRINK WEIGHTS // -------------------------- float flexGrow, flexShrink; if (IsLegacyBox(aParentReflowInput.mStyleDisplay, mStyleContext)) { flexGrow = flexShrink = aChildFrame->StyleXUL()->mBoxFlex; } else { const nsStylePosition* stylePos = aChildFrame->StylePosition(); flexGrow = stylePos->mFlexGrow; flexShrink = stylePos->mFlexShrink; } - WritingMode childWM = childRS.GetWritingMode(); + WritingMode childWM = childRI.GetWritingMode(); // MAIN SIZES (flex base size, min/max size) // ----------------------------------------- nscoord flexBaseSize = GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, childWM, - childRS.ComputedISize(), - childRS.ComputedBSize()); + childRI.ComputedISize(), + childRI.ComputedBSize()); nscoord mainMinSize = GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, childWM, - childRS.ComputedMinISize(), - childRS.ComputedMinBSize()); + childRI.ComputedMinISize(), + childRI.ComputedMinBSize()); nscoord mainMaxSize = GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, childWM, - childRS.ComputedMaxISize(), - childRS.ComputedMaxBSize()); + childRI.ComputedMaxISize(), + childRI.ComputedMaxBSize()); // This is enforced by the ReflowInput where these values come from: MOZ_ASSERT(mainMinSize <= mainMaxSize, "min size is larger than max size"); // CROSS SIZES (tentative cross size, min/max cross size) // ------------------------------------------------------ // Grab the cross size from the reflow state. This might be the right value, // or we might resolve it to something else in SizeItemInCrossAxis(); hence, // it's tentative. See comment under "Cross Size Determination" for more. nscoord tentativeCrossSize = GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, childWM, - childRS.ComputedISize(), - childRS.ComputedBSize()); + childRI.ComputedISize(), + childRI.ComputedBSize()); nscoord crossMinSize = GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, childWM, - childRS.ComputedMinISize(), - childRS.ComputedMinBSize()); + childRI.ComputedMinISize(), + childRI.ComputedMinBSize()); nscoord crossMaxSize = GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, childWM, - childRS.ComputedMaxISize(), - childRS.ComputedMaxBSize()); + childRI.ComputedMaxISize(), + childRI.ComputedMaxBSize()); // SPECIAL-CASE FOR WIDGET-IMPOSED SIZES // Check if we're a themed widget, in which case we might have a minimum // main & cross size imposed by our widget (which we can't go below), or // (more severe) our widget might have only a single valid size. bool isFixedSizeWidget = false; const nsStyleDisplay* disp = aChildFrame->StyleDisplay(); if (aChildFrame->IsThemed(disp)) { @@ -1254,17 +1254,17 @@ nsFlexContainerFrame::GenerateFlexItemFo aPresContext->DevPixelsToAppUnits( aAxisTracker.GetMainComponent(widgetMinSize)); nscoord widgetCrossMinSize = aPresContext->DevPixelsToAppUnits( aAxisTracker.GetCrossComponent(widgetMinSize)); // GMWS() returns border-box. We need content-box, so subtract // borderPadding (but don't let that push our min sizes below 0). - nsMargin& bp = childRS.ComputedPhysicalBorderPadding(); + nsMargin& bp = childRI.ComputedPhysicalBorderPadding(); widgetMainMinSize = std::max(widgetMainMinSize - aAxisTracker.GetMarginSizeInMainAxis(bp), 0); widgetCrossMinSize = std::max(widgetCrossMinSize - aAxisTracker.GetMarginSizeInCrossAxis(bp), 0); if (!canOverride) { // Fixed-size widget: freeze our main-size at the widget's mandated size. // (Set min and max main-sizes to that size, too, to keep us from @@ -1282,34 +1282,34 @@ nsFlexContainerFrame::GenerateFlexItemFo tentativeCrossSize = std::max(tentativeCrossSize, widgetCrossMinSize); } crossMinSize = std::max(crossMinSize, widgetCrossMinSize); crossMaxSize = std::max(crossMaxSize, widgetCrossMinSize); } } // Construct the flex item! - auto item = MakeUnique<FlexItem>(childRS, + auto item = MakeUnique<FlexItem>(childRI, flexGrow, flexShrink, flexBaseSize, mainMinSize, mainMaxSize, tentativeCrossSize, crossMinSize, crossMaxSize, aAxisTracker); // If we're inflexible, we can just freeze to our hypothetical main-size // up-front. Similarly, if we're a fixed-size widget, we only have one // valid size, so we freeze to keep ourselves from flexing. if (isFixedSizeWidget || (flexGrow == 0.0f && flexShrink == 0.0f)) { item->Freeze(); } // Resolve "flex-basis:auto" and/or "min-[width|height]:auto" (which might // require us to reflow the item to measure content height) ResolveAutoFlexBasisAndMinSize(aPresContext, *item, - childRS, aAxisTracker); + childRI, aAxisTracker); return item; } // Static helper-functions for ResolveAutoFlexBasisAndMinSize(): // ------------------------------------------------------------- // Indicates whether the cross-size property is set to something definite. // The logic here should be similar to the logic for isAutoWidth/isAutoHeight // in nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(). @@ -1513,26 +1513,26 @@ nsFlexContainerFrame:: // (e.g. using it as a contstraint when measuring our content in the // main axis, or using it with the intrinsic ratio to obtain a main size). // BEFORE WE DO THAT, we need let the item "pre-stretch" its cross size (if // it's got 'align-self:stretch'), for a certain case where the spec says // the stretched cross size is considered "definite". That case is if we // have a single-line (nowrap) flex container which itself has a definite // cross-size. Otherwise, we'll wait to do stretching, since (in other // cases) we don't know how much the item should stretch yet. - const ReflowInput* flexContainerRS = aItemReflowInput.mParentReflowInput; - MOZ_ASSERT(flexContainerRS, + const ReflowInput* flexContainerRI = aItemReflowInput.mParentReflowInput; + MOZ_ASSERT(flexContainerRI, "flex item's reflow state should have ptr to container's state"); - if (NS_STYLE_FLEX_WRAP_NOWRAP == flexContainerRS->mStylePosition->mFlexWrap) { + if (NS_STYLE_FLEX_WRAP_NOWRAP == flexContainerRI->mStylePosition->mFlexWrap) { // XXXdholbert Maybe this should share logic with ComputeCrossSize()... // Alternately, maybe tentative container cross size should be passed down. nscoord containerCrossSize = GET_CROSS_COMPONENT_LOGICAL(aAxisTracker, aAxisTracker.GetWritingMode(), - flexContainerRS->ComputedISize(), - flexContainerRS->ComputedBSize()); + flexContainerRI->ComputedISize(), + flexContainerRI->ComputedBSize()); // Is container's cross size "definite"? // (Container's cross size is definite if cross-axis is horizontal, or if // cross-axis is vertical and the cross-size is not NS_AUTOHEIGHT.) if (aAxisTracker.IsCrossAxisHorizontal() || containerCrossSize != NS_AUTOHEIGHT) { aFlexItem.ResolveStretchedCrossSize(containerCrossSize, aAxisTracker); } } @@ -1589,17 +1589,17 @@ nsFlexContainerFrame:: bool forceVerticalResizeForMeasuringReflow = !aFlexItem.IsFrozen() || // Is the item flexible? !flexBasisNeedsToMeasureContent; // Are we *only* measuring it for // 'min-height:auto'? nscoord contentHeight = MeasureFlexItemContentHeight(aPresContext, aFlexItem, forceVerticalResizeForMeasuringReflow, - *flexContainerRS); + *flexContainerRI); if (minSizeNeedsToMeasureContent) { resolvedMinSize = std::min(resolvedMinSize, contentHeight); } if (flexBasisNeedsToMeasureContent) { aFlexItem.SetFlexBaseSizeAndMainSize(contentHeight); } } } @@ -1616,60 +1616,60 @@ nsFlexContainerFrame:: bool aForceVerticalResizeForMeasuringReflow, const ReflowInput& aParentReflowInput) { // Set up a reflow state for measuring the flex item's auto-height: WritingMode wm = aFlexItem.Frame()->GetWritingMode(); LogicalSize availSize = aParentReflowInput.ComputedSize(wm); availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE; ReflowInput - childRSForMeasuringHeight(aPresContext, aParentReflowInput, + childRIForMeasuringHeight(aPresContext, aParentReflowInput, aFlexItem.Frame(), availSize, nullptr, ReflowInput::CALLER_WILL_INIT); - childRSForMeasuringHeight.mFlags.mIsFlexContainerMeasuringHeight = true; - childRSForMeasuringHeight.Init(aPresContext); + childRIForMeasuringHeight.mFlags.mIsFlexContainerMeasuringHeight = true; + childRIForMeasuringHeight.Init(aPresContext); if (aFlexItem.IsStretched()) { - childRSForMeasuringHeight.SetComputedWidth(aFlexItem.GetCrossSize()); - childRSForMeasuringHeight.SetHResize(true); + childRIForMeasuringHeight.SetComputedWidth(aFlexItem.GetCrossSize()); + childRIForMeasuringHeight.SetHResize(true); } if (aForceVerticalResizeForMeasuringReflow) { - childRSForMeasuringHeight.SetVResize(true); + childRIForMeasuringHeight.SetVResize(true); } - ReflowOutput childDesiredSize(childRSForMeasuringHeight); + ReflowOutput childDesiredSize(childRIForMeasuringHeight); nsReflowStatus childReflowStatus; const uint32_t flags = NS_FRAME_NO_MOVE_FRAME; ReflowChild(aFlexItem.Frame(), aPresContext, - childDesiredSize, childRSForMeasuringHeight, + childDesiredSize, childRIForMeasuringHeight, 0, 0, flags, childReflowStatus); MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus), "We gave flex item unconstrained available height, so it " "should be complete"); FinishReflowChild(aFlexItem.Frame(), aPresContext, - childDesiredSize, &childRSForMeasuringHeight, + childDesiredSize, &childRIForMeasuringHeight, 0, 0, flags); aFlexItem.SetHadMeasuringReflow(); // If this is the first child, save its ascent, since it may be what // establishes the container's baseline. Also save the ascent if this child // needs to be baseline-aligned. (Else, we don't care about ascent/baseline.) if (aFlexItem.Frame() == mFrames.FirstChild() || aFlexItem.GetAlignSelf() == NS_STYLE_ALIGN_BASELINE) { aFlexItem.SetAscent(childDesiredSize.BlockStartAscent()); } // Subtract border/padding in vertical axis, to get _just_ // the effective computed value of the "height" property. nscoord childDesiredHeight = childDesiredSize.Height() - - childRSForMeasuringHeight.ComputedPhysicalBorderPadding().TopBottom(); + childRIForMeasuringHeight.ComputedPhysicalBorderPadding().TopBottom(); return std::max(0, childDesiredHeight); } FlexItem::FlexItem(ReflowInput& aFlexItemReflowInput, float aFlexGrow, float aFlexShrink, nscoord aFlexBaseSize, nscoord aMainMinSize, nscoord aMainMaxSize, nscoord aTentativeCrossSize,
--- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -9080,41 +9080,41 @@ nsFrame::BoxReflow(nsBoxLayoutState& parentReflowInput.ComputedPhysicalBorderPadding() += parentReflowInput.ComputedPhysicalPadding(); // Construct the parent chain manually since constructing it normally // messes up dimensions. const ReflowInput *outerReflowInput = aState.OuterReflowInput(); NS_ASSERTION(!outerReflowInput || outerReflowInput->mFrame != this, "in and out of XUL on a single frame?"); - const ReflowInput* parentRS; + const ReflowInput* parentRI; if (outerReflowInput && outerReflowInput->mFrame == parentFrame) { // We're a frame (such as a text control frame) that jumps into // box reflow and then straight out of it on the child frame. // This means we actually have a real parent reflow state. // nsLayoutUtils::InflationMinFontSizeFor used to need this to be // linked up correctly for text control frames, so do so here). - parentRS = outerReflowInput; + parentRI = outerReflowInput; } else { - parentRS = &parentReflowInput; + parentRI = &parentReflowInput; } // XXX Is it OK that this reflow state has only one ancestor? // (It used to have a bogus parent, skipping all the boxes). WritingMode wm = GetWritingMode(); LogicalSize logicalSize(wm, nsSize(aWidth, aHeight)); logicalSize.BSize(wm) = NS_INTRINSICSIZE; - ReflowInput reflowInput(aPresContext, *parentRS, this, + ReflowInput reflowInput(aPresContext, *parentRI, this, logicalSize, nullptr, ReflowInput::DUMMY_PARENT_REFLOW_STATE); // XXX_jwir3: This is somewhat fishy. If this is actually changing the value // here (which it might be), then we should make sure that it's // correct the first time around, rather than changing it later. - reflowInput.mCBReflowInput = parentRS; + reflowInput.mCBReflowInput = parentRI; reflowInput.mReflowDepth = aState.GetReflowDepth(); // mComputedWidth and mComputedHeight are content-box, not // border-box if (aWidth != NS_INTRINSICSIZE) { nscoord computedWidth = aWidth - reflowInput.ComputedPhysicalBorderPadding().LeftRight(); @@ -10218,18 +10218,18 @@ void DR_State::FindMatchingRule(DR_Frame } DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame, const ReflowInput* aReflowInput) { // find the frame of the parent reflow state (usually just the parent of aFrame) nsIFrame* parentFrame; if (aReflowInput) { - const ReflowInput* parentRS = aReflowInput->mParentReflowInput; - parentFrame = (parentRS) ? parentRS->mFrame : nullptr; + const ReflowInput* parentRI = aReflowInput->mParentReflowInput; + parentFrame = (parentRI) ? parentRI->mFrame : nullptr; } else { parentFrame = aFrame->GetParent(); } // find the parent tree node leaf DR_FrameTreeNode* parentNode = nullptr; DR_FrameTreeNode* lastLeaf = nullptr;
--- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -1666,19 +1666,19 @@ struct nsGridContainerFrame::SharedGridD * GridReflowInput from it. */ NS_DECLARE_FRAME_PROPERTY_DELETABLE(Prop, SharedGridData) }; struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput { GridReflowInput(nsGridContainerFrame* aFrame, - const ReflowInput& aRS) - : GridReflowInput(aFrame, *aRS.mRenderingContext, &aRS, aRS.mStylePosition, - aRS.GetWritingMode()) + const ReflowInput& aRI) + : GridReflowInput(aFrame, *aRI.mRenderingContext, &aRI, aRI.mStylePosition, + aRI.GetWritingMode()) {} GridReflowInput(nsGridContainerFrame* aFrame, nsRenderingContext& aRC) : GridReflowInput(aFrame, aRC, nullptr, aFrame->StylePosition(), aFrame->GetWritingMode()) {} /** @@ -2304,17 +2304,17 @@ SpaceToFill(WritingMode aWM, const Logic : aSize.ISize(aWM); return aCBSize - (size + aMargin); } // Align an item's margin box in its aAxis inside aCBSize. static void AlignJustifySelf(uint8_t aAlignment, bool aOverflowSafe, LogicalAxis aAxis, bool aSameSide, nscoord aBaselineAdjust, nscoord aCBSize, - const ReflowInput& aRS, const LogicalSize& aChildSize, + const ReflowInput& aRI, const LogicalSize& aChildSize, LogicalPoint* aPos) { MOZ_ASSERT(aAlignment != NS_STYLE_ALIGN_AUTO, "unexpected 'auto' " "computed value for normal flow grid item"); MOZ_ASSERT(aAlignment != NS_STYLE_ALIGN_LEFT && aAlignment != NS_STYLE_ALIGN_RIGHT, "caller should map that to the corresponding START/END"); @@ -2335,18 +2335,18 @@ AlignJustifySelf(uint8_t aAlignment, boo aAlignment = NS_STYLE_ALIGN_END; break; } // XXX try to condense this code a bit by adding the necessary convenience // methods? (bug 1209710) // Get the item's margin corresponding to the container's start/end side. - const LogicalMargin margin = aRS.ComputedLogicalMargin(); - WritingMode wm = aRS.GetWritingMode(); + const LogicalMargin margin = aRI.ComputedLogicalMargin(); + WritingMode wm = aRI.GetWritingMode(); nscoord marginStart, marginEnd; if (aAxis == eLogicalAxisBlock) { if (MOZ_LIKELY(aSameSide)) { marginStart = margin.BStart(wm); marginEnd = margin.BEnd(wm); } else { marginStart = margin.BEnd(wm); marginEnd = margin.BStart(wm); @@ -2356,17 +2356,17 @@ AlignJustifySelf(uint8_t aAlignment, boo marginStart = margin.IStart(wm); marginEnd = margin.IEnd(wm); } else { marginStart = margin.IEnd(wm); marginEnd = margin.IStart(wm); } } - const auto& styleMargin = aRS.mStyleMargin->mMargin; + const auto& styleMargin = aRI.mStyleMargin->mMargin; bool hasAutoMarginStart; bool hasAutoMarginEnd; if (aAxis == eLogicalAxisBlock) { hasAutoMarginStart = styleMargin.GetBStartUnit(wm) == eStyleUnit_Auto; hasAutoMarginEnd = styleMargin.GetBEndUnit(wm) == eStyleUnit_Auto; } else { hasAutoMarginStart = styleMargin.GetIStartUnit(wm) == eStyleUnit_Auto; hasAutoMarginEnd = styleMargin.GetIEndUnit(wm) == eStyleUnit_Auto; @@ -2441,60 +2441,60 @@ SameSide(WritingMode aContainerWM, Logic aChildWM.PhysicalAxis(GetAxis(aChildSide))); return aContainerWM.PhysicalSide(aContainerSide) == aChildWM.PhysicalSide(aChildSide); } static void AlignSelf(const nsGridContainerFrame::GridItemInfo& aGridItem, uint8_t aAlignSelf, nscoord aCBSize, const WritingMode aCBWM, - const ReflowInput& aRS, const LogicalSize& aSize, + const ReflowInput& aRI, const LogicalSize& aSize, LogicalPoint* aPos) { auto alignSelf = aAlignSelf; bool overflowSafe = alignSelf & NS_STYLE_ALIGN_SAFE; alignSelf &= ~NS_STYLE_ALIGN_FLAG_BITS; // Grid's 'align-self' axis is never parallel to the container's inline axis. if (alignSelf == NS_STYLE_ALIGN_LEFT || alignSelf == NS_STYLE_ALIGN_RIGHT) { alignSelf = NS_STYLE_ALIGN_START; } if (MOZ_LIKELY(alignSelf == NS_STYLE_ALIGN_NORMAL)) { alignSelf = NS_STYLE_ALIGN_STRETCH; } - WritingMode childWM = aRS.GetWritingMode(); + WritingMode childWM = aRI.GetWritingMode(); bool isOrthogonal = aCBWM.IsOrthogonalTo(childWM); // |sameSide| is true if the container's start side in this axis is the same // as the child's start side, in the child's parallel axis. bool sameSide = SameSide(aCBWM, eLogicalSideBStart, childWM, isOrthogonal ? eLogicalSideIStart : eLogicalSideBStart); nscoord baselineAdjust = 0; if (alignSelf == NS_STYLE_ALIGN_BASELINE || alignSelf == NS_STYLE_ALIGN_LAST_BASELINE) { alignSelf = aGridItem.GetSelfBaseline(alignSelf, eLogicalAxisBlock, &baselineAdjust); } LogicalAxis axis = isOrthogonal ? eLogicalAxisInline : eLogicalAxisBlock; AlignJustifySelf(alignSelf, overflowSafe, axis, sameSide, baselineAdjust, - aCBSize, aRS, aSize, aPos); + aCBSize, aRI, aSize, aPos); } static void JustifySelf(const nsGridContainerFrame::GridItemInfo& aGridItem, uint8_t aJustifySelf, nscoord aCBSize, const WritingMode aCBWM, - const ReflowInput& aRS, const LogicalSize& aSize, + const ReflowInput& aRI, const LogicalSize& aSize, LogicalPoint* aPos) { auto justifySelf = aJustifySelf; bool overflowSafe = justifySelf & NS_STYLE_JUSTIFY_SAFE; justifySelf &= ~NS_STYLE_JUSTIFY_FLAG_BITS; if (MOZ_LIKELY(justifySelf == NS_STYLE_ALIGN_NORMAL)) { justifySelf = NS_STYLE_ALIGN_STRETCH; } - WritingMode childWM = aRS.GetWritingMode(); + WritingMode childWM = aRI.GetWritingMode(); bool isOrthogonal = aCBWM.IsOrthogonalTo(childWM); // |sameSide| is true if the container's start side in this axis is the same // as the child's start side, in the child's parallel axis. bool sameSide = SameSide(aCBWM, eLogicalSideIStart, childWM, isOrthogonal ? eLogicalSideBStart : eLogicalSideIStart); nscoord baselineAdjust = 0; // Grid's 'justify-self' axis is always parallel to the container's inline @@ -2512,17 +2512,17 @@ JustifySelf(const nsGridContainerFrame:: case NS_STYLE_JUSTIFY_LAST_BASELINE: justifySelf = aGridItem.GetSelfBaseline(justifySelf, eLogicalAxisInline, &baselineAdjust); break; } LogicalAxis axis = isOrthogonal ? eLogicalAxisBlock : eLogicalAxisInline; AlignJustifySelf(justifySelf, overflowSafe, axis, sameSide, baselineAdjust, - aCBSize, aRS, aSize, aPos); + aCBSize, aRI, aSize, aPos); } static uint16_t GetAlignJustifyValue(uint16_t aAlignment, const WritingMode aWM, const bool aIsAlign, bool* aOverflowSafe) { *aOverflowSafe = aAlignment & NS_STYLE_ALIGN_SAFE; aAlignment &= (NS_STYLE_ALIGN_ALL_BITS & ~NS_STYLE_ALIGN_FLAG_BITS); @@ -3436,26 +3436,26 @@ MeasuringReflow(nsIFrame* ReflowInput::DUMMY_PARENT_REFLOW_STATE); rs = dummyParentState.ptr(); } #ifdef DEBUG // This will suppress various CRAZY_SIZE warnings for this reflow. parent->Properties().Set( nsContainerFrame::DebugReflowingWithInfiniteISize(), true); #endif - ReflowInput childRS(pc, *rs, aChild, aAvailableSize, nullptr, + ReflowInput childRI(pc, *rs, aChild, aAvailableSize, nullptr, ReflowInput::COMPUTE_SIZE_SHRINK_WRAP | ReflowInput::COMPUTE_SIZE_USE_AUTO_BSIZE); - ReflowOutput childSize(childRS); + ReflowOutput childSize(childRI); nsReflowStatus childStatus; const uint32_t flags = NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_SIZE_VIEW; - WritingMode wm = childRS.GetWritingMode(); - parent->ReflowChild(aChild, pc, childSize, childRS, wm, + WritingMode wm = childRI.GetWritingMode(); + parent->ReflowChild(aChild, pc, childSize, childRI, wm, LogicalPoint(wm), nsSize(), flags, childStatus); - parent->FinishReflowChild(aChild, pc, childSize, &childRS, wm, + parent->FinishReflowChild(aChild, pc, childSize, &childRI, wm, LogicalPoint(wm), nsSize(), flags); #ifdef DEBUG parent->Properties().Delete(nsContainerFrame::DebugReflowingWithInfiniteISize()); #endif return childSize.BSize(wm); } /** @@ -4559,45 +4559,45 @@ nsGridContainerFrame::GridReflowInput::C * continue traversing the ancestor chain as long as the CBs have * the same writing-mode and have overflow:visible. */ Maybe<nsGridContainerFrame::Fragmentainer> nsGridContainerFrame::GetNearestFragmentainer(const GridReflowInput& aState) const { Maybe<nsGridContainerFrame::Fragmentainer> data; WritingMode wm = aState.mWM; - const ReflowInput* gridRS = aState.mReflowInput; - const ReflowInput* cbRS = gridRS->mCBReflowInput; + const ReflowInput* gridRI = aState.mReflowInput; + const ReflowInput* cbRS = gridRI->mCBReflowInput; for ( ; cbRS; cbRS = cbRS->mCBReflowInput) { nsIScrollableFrame* sf = do_QueryFrame(cbRS->mFrame); if (sf) { break; } if (wm.IsOrthogonalTo(cbRS->GetWritingMode())) { break; } nsIAtom* frameType = cbRS->mFrame->GetType(); if ((frameType == nsGkAtoms::canvasFrame && PresContext()->IsPaginated()) || frameType == nsGkAtoms::columnSetFrame) { data.emplace(); - data->mIsTopOfPage = gridRS->mFlags.mIsTopOfPage; + data->mIsTopOfPage = gridRI->mFlags.mIsTopOfPage; data->mToFragmentainerEnd = aState.mFragBStart + - gridRS->AvailableBSize() - aState.mBorderPadding.BStart(wm); + gridRI->AvailableBSize() - aState.mBorderPadding.BStart(wm); const auto numRows = aState.mRows.mSizes.Length(); data->mCanBreakAtStart = numRows > 0 && aState.mRows.mSizes[0].mPosition > 0; - nscoord bSize = gridRS->ComputedBSize(); + nscoord bSize = gridRI->ComputedBSize(); data->mIsAutoBSize = bSize == NS_AUTOHEIGHT; if (data->mIsAutoBSize) { - bSize = gridRS->ComputedMinBSize(); + bSize = gridRI->ComputedMinBSize(); } else { bSize = NS_CSS_MINMAX(bSize, - gridRS->ComputedMinBSize(), - gridRS->ComputedMaxBSize()); + gridRI->ComputedMinBSize(), + gridRI->ComputedMaxBSize()); } nscoord gridEnd = aState.mRows.GridLineEdge(numRows, GridLineSide::eBeforeGridGap); data->mCanBreakAtEnd = bSize > gridEnd && bSize > aState.mFragBStart; break; } } @@ -4688,78 +4688,78 @@ nsGridContainerFrame::ReflowInFlowChild( reflowSize.BSize(wm) = toFragmentainerEnd; } LogicalSize childCBSize = reflowSize.ConvertTo(childWM, wm); if (!isConstrainedBSize) { childCBSize.BSize(childWM) = NS_UNCONSTRAINEDSIZE; } LogicalSize percentBasis(cb.Size(wm).ConvertTo(childWM, wm)); - ReflowInput childRS(pc, *aState.mReflowInput, aChild, childCBSize, + ReflowInput childRI(pc, *aState.mReflowInput, aChild, childCBSize, &percentBasis); - childRS.mFlags.mIsTopOfPage = aFragmentainer ? aFragmentainer->mIsTopOfPage : false; + childRI.mFlags.mIsTopOfPage = aFragmentainer ? aFragmentainer->mIsTopOfPage : false; // If the child is stretching in its block axis, and we might be fragmenting // it in that axis, then setup a frame property to tell // nsBlockFrame::ComputeFinalSize the size. if (isConstrainedBSize && !wm.IsOrthogonalTo(childWM)) { bool stretch = false; - if (!childRS.mStyleMargin->HasBlockAxisAuto(childWM) && - childRS.mStylePosition->BSize(childWM).GetUnit() == eStyleUnit_Auto) { + if (!childRI.mStyleMargin->HasBlockAxisAuto(childWM) && + childRI.mStylePosition->BSize(childWM).GetUnit() == eStyleUnit_Auto) { auto blockAxisAlignment = - childRS.mStylePosition->ComputedAlignSelf(StyleContext()); + childRI.mStylePosition->ComputedAlignSelf(StyleContext()); if (blockAxisAlignment == NS_STYLE_ALIGN_NORMAL || blockAxisAlignment == NS_STYLE_ALIGN_STRETCH) { stretch = true; } } if (stretch) { aChild->Properties().Set(FragStretchBSizeProperty(), *aStretchBSize); } else { aChild->Properties().Delete(FragStretchBSizeProperty()); } } // We need the width of the child before we can correctly convert // the writing-mode of its origin, so we reflow at (0, 0) using a dummy // aContainerSize, and then pass the correct position to FinishReflowChild. - ReflowOutput childSize(childRS); + ReflowOutput childSize(childRI); const nsSize dummyContainerSize; - ReflowChild(aChild, pc, childSize, childRS, childWM, LogicalPoint(childWM), + ReflowChild(aChild, pc, childSize, childRI, childWM, LogicalPoint(childWM), dummyContainerSize, 0, aStatus); LogicalPoint childPos = cb.Origin(wm).ConvertTo(childWM, wm, aContainerSize - childSize.PhysicalSize()); // Apply align/justify-self and reflow again if that affects the size. if (MOZ_LIKELY(isGridItem)) { LogicalSize size = childSize.Size(childWM); // from the ReflowChild() if (NS_FRAME_IS_COMPLETE(aStatus)) { - auto align = childRS.mStylePosition->ComputedAlignSelf(containerSC); + auto align = childRI.mStylePosition->ComputedAlignSelf(containerSC); auto state = aGridItemInfo->mState[eLogicalAxisBlock]; if (state & ItemState::eContentBaseline) { align = (state & ItemState::eFirstBaseline) ? NS_STYLE_ALIGN_SELF_START : NS_STYLE_ALIGN_SELF_END; } nscoord cbsz = cb.BSize(wm) - consumedGridAreaBSize; - AlignSelf(*aGridItemInfo, align, cbsz, wm, childRS, size, &childPos); - } - auto justify = childRS.mStylePosition->ComputedJustifySelf(containerSC); + AlignSelf(*aGridItemInfo, align, cbsz, wm, childRI, size, &childPos); + } + auto justify = childRI.mStylePosition->ComputedJustifySelf(containerSC); auto state = aGridItemInfo->mState[eLogicalAxisInline]; if (state & ItemState::eContentBaseline) { justify = (state & ItemState::eFirstBaseline) ? NS_STYLE_JUSTIFY_SELF_START : NS_STYLE_JUSTIFY_SELF_END; } nscoord cbsz = cb.ISize(wm); - JustifySelf(*aGridItemInfo, justify, cbsz, wm, childRS, size, &childPos); + JustifySelf(*aGridItemInfo, justify, cbsz, wm, childRI, size, &childPos); } else { // Put a placeholder at the padding edge, in case an ancestor is its CB. childPos -= padStart; } - childRS.ApplyRelativePositioning(&childPos, aContainerSize); - FinishReflowChild(aChild, pc, childSize, &childRS, childWM, childPos, + childRI.ApplyRelativePositioning(&childPos, aContainerSize); + FinishReflowChild(aChild, pc, childSize, &childRI, childWM, childPos, aContainerSize, 0); ConsiderChildOverflow(aDesiredSize.mOverflowAreas, aChild); } nscoord nsGridContainerFrame::ReflowInFragmentainer(GridReflowInput& aState, const LogicalRect& aContentArea, ReflowOutput& aDesiredSize,
--- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -58,17 +58,17 @@ nsLineLayout::nsLineLayout(nsPresContext const nsLineList::iterator* aLine, nsLineLayout* aBaseLineLayout) : mPresContext(aPresContext), mFloatManager(aFloatManager), mBlockReflowInput(aOuterReflowInput), mBaseLineLayout(aBaseLineLayout), mLastOptionalBreakFrame(nullptr), mForceBreakFrame(nullptr), - mBlockRS(nullptr),/* XXX temporary */ + mBlockRI(nullptr),/* XXX temporary */ mLastOptionalBreakPriority(gfxBreakPriority::eNoBreak), mLastOptionalBreakFrameOffset(-1), mForceBreakFrameOffset(-1), mMinLineBSize(0), mTextIndent(0), mFirstLetterStyleOK(false), mIsTopOfPage(false), mImpactedByFloats(false),
--- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -41,17 +41,17 @@ public: nsFloatManager* aFloatManager, const ReflowInput* aOuterReflowInput, const nsLineList::iterator* aLine, nsLineLayout* aBaseLineLayout); ~nsLineLayout(); void Init(BlockReflowInput* aState, nscoord aMinLineBSize, int32_t aLineNumber) { - mBlockRS = aState; + mBlockRI = aState; mMinLineBSize = aMinLineBSize; mLineNumber = aLineNumber; } int32_t GetLineNumber() const { return mLineNumber; } @@ -179,20 +179,20 @@ public: // Inform the line-layout about the presence of a floating frame // XXX get rid of this: use get-frame-type? bool AddFloat(nsIFrame* aFloat, nscoord aAvailableISize) { // When reflowing ruby text frames, no block reflow state is // provided to the line layout. However, floats should never be // associated with ruby text containers, hence this method should // not be called in that case. - MOZ_ASSERT(mBlockRS, + MOZ_ASSERT(mBlockRI, "Should not call this method if there is no block reflow state " "available"); - return mBlockRS->AddFloat(this, aFloat, aAvailableISize); + return mBlockRI->AddFloat(this, aFloat, aAvailableISize); } void SetTrimmableISize(nscoord aTrimmableISize) { mTrimmableISize = aTrimmableISize; } //---------------------------------------- @@ -338,17 +338,17 @@ public: } /** * This can't be null. It usually returns a block frame but may return * some other kind of frame when inline frames are reflowed in a non-block * context (e.g. MathML or floating first-letter). */ nsIFrame* LineContainerFrame() const { return mBlockReflowInput->mFrame; } - const ReflowInput* LineContainerRS() const { return mBlockReflowInput; } + const ReflowInput* LineContainerRI() const { return mBlockReflowInput; } const nsLineList::iterator* GetLine() const { return mGotLineBox ? &mLineBox : nullptr; } nsLineList::iterator* GetLine() { return mGotLineBox ? &mLineBox : nullptr; } /** @@ -407,17 +407,17 @@ protected: // XXX remove this when landing bug 154892 (splitting absolute positioned frames) friend class nsInlineFrame; // XXX Take care that nsRubyBaseContainer would give nullptr to this // member. It should not be a problem currently, since the only // code use it is handling float, which does not affect ruby. // See comment in nsLineLayout::AddFloat - BlockReflowInput* mBlockRS;/* XXX hack! */ + BlockReflowInput* mBlockRI;/* XXX hack! */ nsLineList::iterator mLineBox; // Per-frame data recorded by the line-layout reflow logic. This // state is the state needed to post-process the line after reflow // has completed (block-direction alignment, inline-direction alignment, // justification and relative positioning).
--- a/layout/generic/nsRubyBaseContainerFrame.cpp +++ b/layout/generic/nsRubyBaseContainerFrame.cpp @@ -355,17 +355,17 @@ nsRubyBaseContainerFrame::Reflow(nsPresC reflowInput->mFloatManager, reflowInput, nullptr, aReflowInput.mLineLayout); lineLayout->SetSuppressLineWrap(true); lineLayouts.AppendElement(lineLayout); // Line number is useless for ruby text // XXX nullptr here may cause problem, see comments for - // nsLineLayout::mBlockRS and nsLineLayout::AddFloat + // nsLineLayout::mBlockRI and nsLineLayout::AddFloat lineLayout->Init(nullptr, reflowInput->CalcLineHeight(), -1); reflowInput->mLineLayout = lineLayout; // Border and padding are suppressed on ruby text containers. // If the writing mode is vertical-rl, the horizontal position of // rt frames will be updated when reflowing this text container, // hence leave container size 0 here for now. lineLayout->BeginLineReflow(0, 0, reflowInput->ComputedISize(),
--- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -9162,17 +9162,17 @@ nsTextFrame::ReflowText(nsLineLayout& aL boundingBox.y += mAscent; } aMetrics.SetOverflowAreasToDesiredBounds(); aMetrics.VisualOverflow().UnionRect(aMetrics.VisualOverflow(), boundingBox); // When we have text decorations, we don't need to compute their overflow now // because we're guaranteed to do it later // (see nsLineLayout::RelativePositionFrames) - UnionAdditionalOverflow(presContext, aLineLayout.LineContainerRS()->mFrame, + UnionAdditionalOverflow(presContext, aLineLayout.LineContainerRI()->mFrame, provider, &aMetrics.VisualOverflow(), false); ///////////////////////////////////////////////////////////////////// // Clean up, update state ///////////////////////////////////////////////////////////////////// // If all our characters are discarded or collapsed, then trimmable width // from the last textframe should be preserved. Otherwise the trimmable width
--- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -113,41 +113,41 @@ nsTableCellFrame::NotifyPercentBSize(con // ReflowInput ensures the mCBReflowInput of blocks inside a // cell is the cell frame, not the inner-cell block, and that the // containing block of an inner table is the containing block of its // table wrapper. // XXXldb Given the now-stricter |NeedsToObserve|, many if not all of // these tests are probably unnecessary. // Maybe the cell reflow state; we sure if we're inside the |if|. - const ReflowInput *cellRS = aReflowInput.mCBReflowInput; + const ReflowInput *cellRI = aReflowInput.mCBReflowInput; - if (cellRS && cellRS->mFrame == this && - (cellRS->ComputedBSize() == NS_UNCONSTRAINEDSIZE || - cellRS->ComputedBSize() == 0)) { // XXXldb Why 0? + if (cellRI && cellRI->mFrame == this && + (cellRI->ComputedBSize() == NS_UNCONSTRAINEDSIZE || + cellRI->ComputedBSize() == 0)) { // XXXldb Why 0? // This is a percentage bsize on a frame whose percentage bsizes // are based on the bsize of the cell, since its containing block // is the inner cell frame. // We'll only honor the percent bsize if sibling-cells/ancestors // have specified/pct bsize. (Also, siblings only count for this if // both this cell and the sibling cell span exactly 1 row.) - if (nsTableFrame::AncestorsHaveStyleBSize(*cellRS) || + if (nsTableFrame::AncestorsHaveStyleBSize(*cellRI) || (GetTableFrame()->GetEffectiveRowSpan(*this) == 1 && - cellRS->mParentReflowInput->mFrame-> + cellRI->mParentReflowInput->mFrame-> HasAnyStateBits(NS_ROW_HAS_CELL_WITH_STYLE_BSIZE))) { for (const ReflowInput *rs = aReflowInput.mParentReflowInput; - rs != cellRS; + rs != cellRI; rs = rs->mParentReflowInput) { rs->mFrame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE); } - nsTableFrame::RequestSpecialBSizeReflow(*cellRS); + nsTableFrame::RequestSpecialBSizeReflow(*cellRI); } } } // The cell needs to observe its block and things inside its block but nothing below that bool nsTableCellFrame::NeedsToObserve(const ReflowInput& aReflowInput) {
--- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1587,24 +1587,24 @@ nsTableRowGroupFrame::GetBSizeBasis(cons int32_t startRowIndex = GetStartRowIndex(); if ((aReflowInput.ComputedBSize() > 0) && (aReflowInput.ComputedBSize() < NS_UNCONSTRAINEDSIZE)) { nscoord cellSpacing = tableFrame->GetRowSpacing(startRowIndex, std::max(startRowIndex, startRowIndex + GetRowCount() - 1)); result = aReflowInput.ComputedBSize() - cellSpacing; } else { - const ReflowInput* parentRS = aReflowInput.mParentReflowInput; - if (parentRS && (tableFrame != parentRS->mFrame)) { - parentRS = parentRS->mParentReflowInput; + const ReflowInput* parentRI = aReflowInput.mParentReflowInput; + if (parentRI && (tableFrame != parentRI->mFrame)) { + parentRI = parentRI->mParentReflowInput; } - if (parentRS && (tableFrame == parentRS->mFrame) && - (parentRS->ComputedBSize() > 0) && (parentRS->ComputedBSize() < NS_UNCONSTRAINEDSIZE)) { + if (parentRI && (tableFrame == parentRI->mFrame) && + (parentRI->ComputedBSize() > 0) && (parentRI->ComputedBSize() < NS_UNCONSTRAINEDSIZE)) { nscoord cellSpacing = tableFrame->GetRowSpacing(-1, tableFrame->GetRowCount()); - result = parentRS->ComputedBSize() - cellSpacing; + result = parentRI->ComputedBSize() - cellSpacing; } } return result; } bool nsTableRowGroupFrame::IsSimpleRowFrame(nsTableFrame* aTableFrame,
--- a/layout/tables/nsTableWrapperFrame.cpp +++ b/layout/tables/nsTableWrapperFrame.cpp @@ -245,43 +245,43 @@ nsTableWrapperFrame::InitChildReflowInpu } aReflowInput.Init(&aPresContext, nullptr, pCollapseBorder, pCollapsePadding); } // get the margin and padding data. ReflowInput doesn't handle the // case of auto margins void nsTableWrapperFrame::GetChildMargin(nsPresContext* aPresContext, - const ReflowInput& aOuterRS, + const ReflowInput& aOuterRI, nsIFrame* aChildFrame, nscoord aAvailISize, LogicalMargin& aMargin) { NS_ASSERTION(!aChildFrame->IsTableCaption(), "didn't expect caption frame; writing-mode may be wrong!"); // construct a reflow state to compute margin and padding. Auto margins // will not be computed at this time. // create and init the child reflow state // XXX We really shouldn't construct a reflow state to do this. - WritingMode wm = aOuterRS.GetWritingMode(); - LogicalSize availSize(wm, aAvailISize, aOuterRS.AvailableSize(wm).BSize(wm)); - ReflowInput childRS(aPresContext, aOuterRS, aChildFrame, availSize, + WritingMode wm = aOuterRI.GetWritingMode(); + LogicalSize availSize(wm, aAvailISize, aOuterRI.AvailableSize(wm).BSize(wm)); + ReflowInput childRI(aPresContext, aOuterRI, aChildFrame, availSize, nullptr, ReflowInput::CALLER_WILL_INIT); - InitChildReflowInput(*aPresContext, childRS); + InitChildReflowInput(*aPresContext, childRI); - aMargin = childRS.ComputedLogicalMargin(); + aMargin = childRI.ComputedLogicalMargin(); } static nsSize -GetContainingBlockSize(const ReflowInput& aOuterRS) +GetContainingBlockSize(const ReflowInput& aOuterRI) { nsSize size(0,0); - const ReflowInput* containRS = aOuterRS.mCBReflowInput; + const ReflowInput* containRS = aOuterRI.mCBReflowInput; if (containRS) { size.width = containRS->ComputedWidth(); if (NS_UNCONSTRAINEDSIZE == size.width) { size.width = 0; } size.height = containRS->ComputedHeight(); if (NS_UNCONSTRAINEDSIZE == size.height) { @@ -727,122 +727,122 @@ nsTableWrapperFrame::GetInnerOrigin(uint break; } return NS_OK; } void nsTableWrapperFrame::OuterBeginReflowChild(nsPresContext* aPresContext, nsIFrame* aChildFrame, - const ReflowInput& aOuterRS, - Maybe<ReflowInput>& aChildRS, + const ReflowInput& aOuterRI, + Maybe<ReflowInput>& aChildRI, nscoord aAvailISize) { // work around pixel rounding errors, round down to ensure we don't exceed the avail height in WritingMode wm = aChildFrame->GetWritingMode(); - LogicalSize outerSize = aOuterRS.AvailableSize(wm); + LogicalSize outerSize = aOuterRI.AvailableSize(wm); nscoord availBSize = outerSize.BSize(wm); if (NS_UNCONSTRAINEDSIZE != availBSize) { if (mCaptionFrames.FirstChild() == aChildFrame) { availBSize = NS_UNCONSTRAINEDSIZE; } else { LogicalMargin margin(wm); - GetChildMargin(aPresContext, aOuterRS, aChildFrame, + GetChildMargin(aPresContext, aOuterRI, aChildFrame, outerSize.ISize(wm), margin); NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.BStart(wm), "No unconstrainedsize arithmetic, please"); availBSize -= margin.BStart(wm); NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.BEnd(wm), "No unconstrainedsize arithmetic, please"); availBSize -= margin.BEnd(wm); } } LogicalSize availSize(wm, aAvailISize, availBSize); // create and init the child reflow state, using passed-in Maybe<>, // so that caller can use it after we return. - aChildRS.emplace(aPresContext, aOuterRS, aChildFrame, availSize, + aChildRI.emplace(aPresContext, aOuterRI, aChildFrame, availSize, nullptr, ReflowInput::CALLER_WILL_INIT); - InitChildReflowInput(*aPresContext, *aChildRS); + InitChildReflowInput(*aPresContext, *aChildRI); // see if we need to reset top-of-page due to a caption - if (aChildRS->mFlags.mIsTopOfPage && + if (aChildRI->mFlags.mIsTopOfPage && mCaptionFrames.FirstChild() == aChildFrame) { uint8_t captionSide = GetCaptionSide(); if (captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM || captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE) { - aChildRS->mFlags.mIsTopOfPage = false; + aChildRI->mFlags.mIsTopOfPage = false; } } } void nsTableWrapperFrame::OuterDoReflowChild(nsPresContext* aPresContext, nsIFrame* aChildFrame, - const ReflowInput& aChildRS, + const ReflowInput& aChildRI, ReflowOutput& aMetrics, nsReflowStatus& aStatus) { // Using zero as containerSize here because we want consistency between // the GetLogicalPosition and ReflowChild calls, to avoid unnecessarily // changing the frame's coordinates; but we don't yet know its final // position anyway so the actual value is unimportant. const nsSize zeroCSize; - WritingMode wm = aChildRS.GetWritingMode(); + WritingMode wm = aChildRI.GetWritingMode(); // Use the current position as a best guess for placement. LogicalPoint childPt = aChildFrame->GetLogicalPosition(wm, zeroCSize); uint32_t flags = NS_FRAME_NO_MOVE_FRAME; // We don't want to delete our next-in-flow's child if it's an inner table // frame, because table wrapper frames always assume that their inner table // frames don't go away. If a table wrapper frame is removed because it is // a next-in-flow of an already complete table wrapper frame, then it will // take care of removing it's inner table frame. if (aChildFrame == InnerTableFrame()) { flags |= NS_FRAME_NO_DELETE_NEXT_IN_FLOW_CHILD; } - ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRS, + ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRI, wm, childPt, zeroCSize, flags, aStatus); } void nsTableWrapperFrame::UpdateOverflowAreas(ReflowOutput& aMet) { aMet.SetOverflowAreasToDesiredBounds(); ConsiderChildOverflow(aMet.mOverflowAreas, InnerTableFrame()); if (mCaptionFrames.NotEmpty()) { ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild()); } } void nsTableWrapperFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, - const ReflowInput& aOuterRS, + const ReflowInput& aOuterRI, nsReflowStatus& aStatus) { MarkInReflow(); DO_GLOBAL_REFLOW_COUNT("nsTableWrapperFrame"); - DISPLAY_REFLOW(aPresContext, this, aOuterRS, aDesiredSize, aStatus); + DISPLAY_REFLOW(aPresContext, this, aOuterRI, aDesiredSize, aStatus); // Initialize out parameters aDesiredSize.ClearSize(); aStatus = NS_FRAME_COMPLETE; if (!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) { // Set up our kids. They're already present, on an overflow list, // or there are none so we'll create them now MoveOverflowToChildList(); } - Maybe<ReflowInput> captionRS; - Maybe<ReflowInput> innerRS; + Maybe<ReflowInput> captionRI; + Maybe<ReflowInput> innerRI; nsRect origInnerRect = InnerTableFrame()->GetRect(); nsRect origInnerVisualOverflow = InnerTableFrame()->GetVisualOverflowRect(); bool innerFirstReflow = InnerTableFrame()->HasAnyStateBits(NS_FRAME_FIRST_REFLOW); nsRect origCaptionRect; nsRect origCaptionVisualOverflow; bool captionFirstReflow; @@ -850,110 +850,110 @@ nsTableWrapperFrame::Reflow(nsPresContex origCaptionRect = mCaptionFrames.FirstChild()->GetRect(); origCaptionVisualOverflow = mCaptionFrames.FirstChild()->GetVisualOverflowRect(); captionFirstReflow = mCaptionFrames.FirstChild()->HasAnyStateBits(NS_FRAME_FIRST_REFLOW); } // ComputeAutoSize has to match this logic. - WritingMode wm = aOuterRS.GetWritingMode(); + WritingMode wm = aOuterRI.GetWritingMode(); uint8_t captionSide = GetCaptionSide(); WritingMode captionWM = wm; // will be changed below if necessary if (captionSide == NO_SIDE) { // We don't have a caption. - OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS, - innerRS, aOuterRS.ComputedSize(wm).ISize(wm)); + OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRI, + innerRI, aOuterRI.ComputedSize(wm).ISize(wm)); } else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT || captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) { // ComputeAutoSize takes care of making side captions small. Compute // the caption's size first, and tell the table to fit in what's left. - OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS, - captionRS, aOuterRS.ComputedSize(wm).ISize(wm)); - captionWM = captionRS->GetWritingMode(); - nscoord innerAvailISize = aOuterRS.ComputedSize(wm).ISize(wm) - - captionRS->ComputedSizeWithMarginBorderPadding(wm).ISize(wm); - OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS, - innerRS, innerAvailISize); + OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRI, + captionRI, aOuterRI.ComputedSize(wm).ISize(wm)); + captionWM = captionRI->GetWritingMode(); + nscoord innerAvailISize = aOuterRI.ComputedSize(wm).ISize(wm) - + captionRI->ComputedSizeWithMarginBorderPadding(wm).ISize(wm); + OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRI, + innerRI, innerAvailISize); } else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP || captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) { // Compute the table's size first, and then prevent the caption from // being larger in the inline dir unless it has to be. // // Note that CSS 2.1 (but not 2.0) says: // The width of the anonymous box is the border-edge width of the // table box inside it // We don't actually make our anonymous box that isize (if we did, // it would break 'auto' margins), but this effectively does that. - OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS, - innerRS, aOuterRS.ComputedSize(wm).ISize(wm)); + OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRI, + innerRI, aOuterRI.ComputedSize(wm).ISize(wm)); // It's good that CSS 2.1 says not to include margins, since we // can't, since they already been converted so they exactly // fill the available isize (ignoring the margin on one side if // neither are auto). (We take advantage of that later when we call // GetCaptionOrigin, though.) nscoord innerBorderISize = - innerRS->ComputedSizeWithBorderPadding(wm).ISize(wm); - OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS, - captionRS, innerBorderISize); - captionWM = captionRS->GetWritingMode(); + innerRI->ComputedSizeWithBorderPadding(wm).ISize(wm); + OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRI, + captionRI, innerBorderISize); + captionWM = captionRI->GetWritingMode(); } else { NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE || captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE, "unexpected caption-side"); // Size the table and the caption independently. captionWM = mCaptionFrames.FirstChild()->GetWritingMode(); OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), - aOuterRS, captionRS, - aOuterRS.ComputedSize(captionWM).ISize(captionWM)); - OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS, - innerRS, aOuterRS.ComputedSize(wm).ISize(wm)); + aOuterRI, captionRI, + aOuterRI.ComputedSize(captionWM).ISize(captionWM)); + OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRI, + innerRI, aOuterRI.ComputedSize(wm).ISize(wm)); } // First reflow the caption. Maybe<ReflowOutput> captionMet; LogicalSize captionSize(wm); LogicalMargin captionMargin(wm); if (mCaptionFrames.NotEmpty()) { captionMet.emplace(wm); nsReflowStatus capStatus; // don't let the caption cause incomplete OuterDoReflowChild(aPresContext, mCaptionFrames.FirstChild(), - *captionRS, *captionMet, capStatus); + *captionRI, *captionMet, capStatus); captionSize.ISize(wm) = captionMet->ISize(wm); captionSize.BSize(wm) = captionMet->BSize(wm); captionMargin = - captionRS->ComputedLogicalMargin().ConvertTo(wm, captionWM); + captionRI->ComputedLogicalMargin().ConvertTo(wm, captionWM); // Now that we know the bsize of the caption, reduce the available bsize // for the table frame if we are bsize constrained and the caption is above // or below the inner table. - if (NS_UNCONSTRAINEDSIZE != aOuterRS.AvailableBSize()) { + if (NS_UNCONSTRAINEDSIZE != aOuterRI.AvailableBSize()) { nscoord captionBSize = 0; switch (captionSide) { case NS_STYLE_CAPTION_SIDE_TOP: case NS_STYLE_CAPTION_SIDE_BOTTOM: case NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE: case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: captionBSize = captionSize.BSize(wm) + captionMargin.BStartEnd(wm); break; } - innerRS->AvailableBSize() = - std::max(0, innerRS->AvailableBSize() - captionBSize); + innerRI->AvailableBSize() = + std::max(0, innerRI->AvailableBSize() - captionBSize); } } // Then, now that we know how much to reduce the isize of the inner // table to account for side captions, reflow the inner table. - ReflowOutput innerMet(innerRS->GetWritingMode()); - OuterDoReflowChild(aPresContext, InnerTableFrame(), *innerRS, + ReflowOutput innerMet(innerRI->GetWritingMode()); + OuterDoReflowChild(aPresContext, InnerTableFrame(), *innerRI, innerMet, aStatus); LogicalSize innerSize(wm, innerMet.ISize(wm), innerMet.BSize(wm)); - LogicalMargin innerMargin = innerRS->ComputedLogicalMargin(); + LogicalMargin innerMargin = innerRI->ComputedLogicalMargin(); - LogicalSize containSize(wm, GetContainingBlockSize(aOuterRS)); + LogicalSize containSize(wm, GetContainingBlockSize(aOuterRI)); // Now that we've reflowed both we can place them. // XXXldb Most of the input variables here are now uninitialized! // XXX Need to recompute inner table's auto margins for the case of side // captions. (Caption's are broken too, but that should be fixed earlier.) // Compute the desiredSize so that we can use it as the containerSize @@ -967,52 +967,52 @@ nsTableWrapperFrame::Reflow(nsPresContex // XXX It's possible for this to be NS_UNCONSTRAINEDSIZE, which will result // in assertions from FinishReflowChild. if (mCaptionFrames.NotEmpty()) { LogicalPoint captionOrigin(wm); GetCaptionOrigin(captionSide, containSize, innerSize, innerMargin, captionSize, captionMargin, captionOrigin, wm); FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, *captionMet, - captionRS.ptr(), wm, captionOrigin, containerSize, 0); - captionRS.reset(); + captionRI.ptr(), wm, captionOrigin, containerSize, 0); + captionRI.reset(); } // XXX If the bsize is constrained then we need to check whether // everything still fits... LogicalPoint innerOrigin(wm); GetInnerOrigin(captionSide, containSize, captionSize, captionMargin, innerSize, innerMargin, innerOrigin, wm); - FinishReflowChild(InnerTableFrame(), aPresContext, innerMet, innerRS.ptr(), + FinishReflowChild(InnerTableFrame(), aPresContext, innerMet, innerRI.ptr(), wm, innerOrigin, containerSize, 0); - innerRS.reset(); + innerRI.reset(); nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect, origInnerVisualOverflow, innerFirstReflow); if (mCaptionFrames.NotEmpty()) { nsTableFrame::InvalidateTableFrame(mCaptionFrames.FirstChild(), origCaptionRect, origCaptionVisualOverflow, captionFirstReflow); } UpdateOverflowAreas(aDesiredSize); if (GetPrevInFlow()) { - ReflowOverflowContainerChildren(aPresContext, aOuterRS, + ReflowOverflowContainerChildren(aPresContext, aOuterRI, aDesiredSize.mOverflowAreas, 0, aStatus); } - FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRS, aStatus); + FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRI, aStatus); // Return our desired rect - NS_FRAME_SET_TRUNCATION(aStatus, aOuterRS, aDesiredSize); + NS_FRAME_SET_TRUNCATION(aStatus, aOuterRI, aDesiredSize); } nsIAtom* nsTableWrapperFrame::GetType() const { return nsGkAtoms::tableWrapperFrame; }
--- a/layout/tables/nsTableWrapperFrame.h +++ b/layout/tables/nsTableWrapperFrame.h @@ -226,32 +226,32 @@ protected: const mozilla::LogicalSize& aInnerSize, mozilla::LogicalMargin& aInnerMargin, mozilla::LogicalPoint& aOrigin, mozilla::WritingMode aWM); // reflow the child (caption or innertable frame) void OuterBeginReflowChild(nsPresContext* aPresContext, nsIFrame* aChildFrame, - const ReflowInput& aOuterRS, - mozilla::Maybe<ReflowInput>& aChildRS, + const ReflowInput& aOuterRI, + mozilla::Maybe<ReflowInput>& aChildRI, nscoord aAvailISize); void OuterDoReflowChild(nsPresContext* aPresContext, nsIFrame* aChildFrame, - const ReflowInput& aChildRS, + const ReflowInput& aChildRI, ReflowOutput& aMetrics, nsReflowStatus& aStatus); // Set the overflow areas in our reflow metrics void UpdateOverflowAreas(ReflowOutput& aMet); // Get the margin. void GetChildMargin(nsPresContext* aPresContext, - const ReflowInput& aOuterRS, + const ReflowInput& aOuterRI, nsIFrame* aChildFrame, nscoord aAvailableWidth, mozilla::LogicalMargin& aMargin); virtual bool IsFrameOfType(uint32_t aFlags) const override { return nsContainerFrame::IsFrameOfType(aFlags & (~eCanContainOverflowContainers));