Bug 1569701 Part 1 - Make BlockReflowInput::mConsumedBSize a constant, and delete it assessor method. r=dbaron

We always pass consumed block-size into BlockReflowInput's constructor
in nsBlockFrame::Reflow(). By making mConsumedBSize a constant, its
assessor method becomes redundant.

Update the documentation to reflect the reality that ConsumedBSize()
accumulates content block-size from all previous *continuations*, which
was done in Bug 1506293 Part 2.

Differential Revision: https://phabricator.services.mozilla.com/D41906

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-08-15 16:49:14 +00:00
parent e4c1298151
commit 0bc5f5330e
6 changed files with 15 additions and 24 deletions

View File

@ -43,6 +43,9 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowInput,
mLineNumber(0),
mFloatBreakType(StyleClear::None),
mConsumedBSize(aConsumedBSize) {
NS_ASSERTION(mConsumedBSize != NS_UNCONSTRAINEDSIZE,
"The consumed block-size should be constrained!");
WritingMode wm = aReflowInput.GetWritingMode();
mFlags.mIsFirstInflow = !aFrame->GetPrevInFlow();
mFlags.mIsOverflowContainer = IS_TRUE_OVERFLOW_CONTAINER(aFrame);
@ -137,14 +140,6 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowInput,
mMinLineHeight = aReflowInput.CalcLineHeight();
}
nscoord BlockReflowInput::ConsumedBSize() {
if (mConsumedBSize == NS_UNCONSTRAINEDSIZE) {
mConsumedBSize = mBlock->ConsumedBSize(mReflowInput.GetWritingMode());
}
return mConsumedBSize;
}
void BlockReflowInput::ComputeReplacedBlockOffsetsForFloats(
nsIFrame* aFrame, const LogicalRect& aFloatAvailableSpace,
nscoord& aIStartResult, nscoord& aIEndResult) const {

View File

@ -199,12 +199,6 @@ class BlockReflowInput {
*/
const mozilla::LogicalMargin& BorderPadding() const { return mBorderPadding; }
/**
* Retrieve the block-axis content size "consumed" by any prev-in-flows.
* @note the value is cached so subsequent calls will return the same value
*/
nscoord ConsumedBSize();
// Reconstruct the previous block-end margin that goes before |aLine|.
void ReconstructMarginBefore(nsLineList::iterator aLine);
@ -384,9 +378,9 @@ class BlockReflowInput {
StyleClear mFloatBreakType;
// The amount of computed block-direction size "consumed" by
// previous-in-flows.
nscoord mConsumedBSize;
// The amount of computed content block-size "consumed" by our previous
// continuations.
const nscoord mConsumedBSize;
// Cache the current line's BSize if nsBlockFrame::PlaceLine() fails to
// place the line. When redoing the line, it will be used to query the

View File

@ -1779,7 +1779,7 @@ void nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
finalSize.BSize(wm) =
ComputeFinalBSize(aReflowInput, aState.mReflowStatus,
aState.mBCoord + nonCarriedOutBDirMargin,
borderPadding, aState.ConsumedBSize());
borderPadding, aState.mConsumedBSize);
// Don't carry out a block-end margin when our BSize is fixed.
aMetrics.mCarriedOutBEndMargin.Zero();

View File

@ -78,10 +78,12 @@ class nsSplittableFrame : public nsFrame {
mNextContinuation(nullptr) {}
/**
* Return the sum of the block-axis content size of our prev-in-flows.
* Return the sum of the block-axis content size of our previous
* continuations.
*
* @param aWM a writing-mode to determine the block-axis
*
* @note (bz) This makes laying out a splittable frame with N in-flows
* @note (bz) This makes laying out a splittable frame with N continuations
* O(N^2)! So, use this function with caution and minimize the number
* of calls to this method.
*/
@ -90,7 +92,7 @@ class nsSplittableFrame : public nsFrame {
/**
* Retrieve the effective computed block size of this frame, which is the
* computed block size, minus the block size consumed by any previous
* in-flows.
* continuations.
*/
nscoord GetEffectiveComputedBSize(
const ReflowInput& aReflowInput,

View File

@ -1025,7 +1025,7 @@ fuzzy-if(Android,0-11,0-17) fuzzy-if(webrender,0-1,0-10) == 413361-1.html 413361
== 421436-1a.html 421436-1-ref.html
== 421436-1b.html 421436-1-ref.html
fuzzy-if(skiaContent,0-1,0-40) == 421632-1.html 421632-1-ref.html
!= 421710-1.html about:blank
asserts(1-1) != 421710-1.html about:blank # Bug 1574046
fails-if(Android) fuzzy-if(webrender,63-64,1024-1024) fails-if(usesRepeatResampling&&!(webrender&&winWidget)) == 421885-1.xml 421885-1-ref.xml
== 421955-1.html 421955-1-ref.html
== 422249-1.html 422249-1-ref.html

View File

@ -35,11 +35,11 @@ fails == border-breaking-004-cols.xhtml border-breaking-002-cols.ref.xhtml
== content-inserted-009.xhtml content-inserted-002.ref.xhtml
== dynamic-abspos-overflow-01-cols.xhtml dynamic-abspos-overflow-01-cols.ref.xhtml
== float-clear-000.html float-clear-000.ref.html
fails == float-clear-001.html float-clear-000.ref.html
asserts(4-4) fails == float-clear-001.html float-clear-000.ref.html # Bug 1574046
== float-clear-002.html float-clear-000.ref.html
fails == float-clear-003.html float-clear-000.ref.html
== float-clear-000-print.html float-clear-000-print.ref.html
== float-clear-001-print.html float-clear-000-print.ref.html
asserts(1-1) == float-clear-001-print.html float-clear-000-print.ref.html # Bug 1574046
== float-clear-002-print.html float-clear-000-print.ref.html
== float-clear-003-print.html float-clear-000-print.ref.html
fails == float-continuations-000.html float-continuations-000.ref.html