From 8197bd4fb08a4015f9f6777bb676ad0343a22659 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Tue, 5 Jul 2022 23:43:52 +0000 Subject: [PATCH] Bug 1777627 Part 2 - Remove aIsAdjacentWithBStart argument on nsBlockReflowContext::ReflowBlock(). r=emilio aIsAdjacentWithBStart is used to clear the mIsTopOfPage bit for the ReflowInput argument `aFrameRI`. However, ReflowBlock() already has aState argument to query IsAdjacentWithBStart(), so there's no need for aIsAdjacentWithBStart argument. Differential Revision: https://phabricator.services.mozilla.com/D150832 --- layout/generic/nsBlockFrame.cpp | 15 ++++----------- layout/generic/nsBlockReflowContext.cpp | 14 ++++++++------ layout/generic/nsBlockReflowContext.h | 5 ++--- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index f0e8378997b0..e200a1976d80 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -3904,8 +3904,8 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState, frameReflowStatus.Reset(); brc.ReflowBlock(availSpace, applyBStartMargin, aState.mPrevBEndMargin, - clearance, aState.IsAdjacentWithBStart(), aLine.get(), - *childReflowInput, frameReflowStatus, aState); + clearance, aLine.get(), *childReflowInput, + frameReflowStatus, aState); if (frameReflowStatus.IsInlineBreakBefore()) { // No need to retry this loop if there is a break opportunity before the @@ -6674,10 +6674,6 @@ void nsBlockFrame::ReflowFloat(BlockReflowState& aState, // input. However, when reflowing a float, if we've placed other // floats that force this float *down* or *narrower*, we should unset // the mIsTopOfPage state. - // FIXME: This is somewhat redundant with the |isAdjacentWithTop| - // variable below, which has the exact same effect. Perhaps it should - // be merged into that, except that the test for narrowing here is not - // about adjacency with the top, so it seems misleading. if (floatRS.mFlags.mIsTopOfPage && (aFloatPushedDown || aAdjustedAvailableSpace.ISize(wm) != aState.ContentISize())) { @@ -6687,9 +6683,6 @@ void nsBlockFrame::ReflowFloat(BlockReflowState& aState, // Setup a block reflow context to reflow the float. nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput); - // Reflow the float - bool isAdjacentWithTop = aState.IsAdjacentWithBStart(); - nsIFrame* clearanceFrame = nullptr; do { nsCollapsingMargin margin; @@ -6707,8 +6700,8 @@ void nsBlockFrame::ReflowFloat(BlockReflowState& aState, } } - brc.ReflowBlock(aAdjustedAvailableSpace, true, margin, 0, isAdjacentWithTop, - nullptr, floatRS, aReflowStatus, aState); + brc.ReflowBlock(aAdjustedAvailableSpace, true, margin, 0, nullptr, floatRS, + aReflowStatus, aState); } while (clearanceFrame); if (aFloat->IsLetterFrame()) { diff --git a/layout/generic/nsBlockReflowContext.cpp b/layout/generic/nsBlockReflowContext.cpp index 3090ab927981..d29e15021310 100644 --- a/layout/generic/nsBlockReflowContext.cpp +++ b/layout/generic/nsBlockReflowContext.cpp @@ -209,17 +209,19 @@ done: return dirtiedLine; } -void nsBlockReflowContext::ReflowBlock( - const LogicalRect& aSpace, bool aApplyBStartMargin, - nsCollapsingMargin& aPrevMargin, nscoord aClearance, - bool aIsAdjacentWithBStart, nsLineBox* aLine, ReflowInput& aFrameRI, - nsReflowStatus& aFrameReflowStatus, BlockReflowState& aState) { +void nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace, + bool aApplyBStartMargin, + nsCollapsingMargin& aPrevMargin, + nscoord aClearance, nsLineBox* aLine, + ReflowInput& aFrameRI, + nsReflowStatus& aFrameReflowStatus, + BlockReflowState& aState) { mFrame = aFrameRI.mFrame; mWritingMode = aState.mReflowInput.GetWritingMode(); mContainerSize = aState.ContainerSize(); mSpace = aSpace; - if (!aIsAdjacentWithBStart) { + if (!aState.IsAdjacentWithBStart()) { aFrameRI.mFlags.mIsTopOfPage = false; // make sure this is cleared } diff --git a/layout/generic/nsBlockReflowContext.h b/layout/generic/nsBlockReflowContext.h index 52ad0ddb7339..a573e644eec1 100644 --- a/layout/generic/nsBlockReflowContext.h +++ b/layout/generic/nsBlockReflowContext.h @@ -34,9 +34,8 @@ class nsBlockReflowContext { void ReflowBlock(const mozilla::LogicalRect& aSpace, bool aApplyBStartMargin, nsCollapsingMargin& aPrevMargin, nscoord aClearance, - bool aIsAdjacentWithBStart, nsLineBox* aLine, - ReflowInput& aReflowInput, nsReflowStatus& aReflowStatus, - BlockReflowState& aState); + nsLineBox* aLine, ReflowInput& aReflowInput, + nsReflowStatus& aReflowStatus, BlockReflowState& aState); bool PlaceBlock(const ReflowInput& aReflowInput, bool aForceFit, nsLineBox* aLine,