зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1777627 Part 1 - Improve BlockReflowState::IsAdjacentWithTop(). r=emilio
I rename and add a comment to the helper, and rewrite it to make it closer to what the comment describes. The behavior is the same because `mBCoord` and `mContentArea.BStart(wm)` are both initialized as `mBorderPadding.BStart(wm)` [1]. Note `isAdjacentWithTop` local variable in ReflowFloat() is not changed because it's going to be removed in the next patch. [1] https://searchfox.org/mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b/layout/generic/BlockReflowState.cpp#142 Differential Revision: https://phabricator.services.mozilla.com/D150831
This commit is contained in:
Родитель
4191f0cef6
Коммит
6e0a1ac033
|
@ -781,7 +781,8 @@ bool BlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat) {
|
|||
// Are we required to place at least part of the float because we're
|
||||
// at the top of the page (to avoid an infinite loop of pushing and
|
||||
// breaking).
|
||||
bool mustPlaceFloat = mReflowInput.mFlags.mIsTopOfPage && IsAdjacentWithTop();
|
||||
bool mustPlaceFloat =
|
||||
mReflowInput.mFlags.mIsTopOfPage && IsAdjacentWithBStart();
|
||||
|
||||
for (;;) {
|
||||
if (mReflowInput.AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
|
||||
|
|
|
@ -195,9 +195,10 @@ class BlockReflowState {
|
|||
nsIFrame* aFloatAvoidingBlock,
|
||||
const nsFlowAreaRect& aFloatAvailableSpace) const;
|
||||
|
||||
bool IsAdjacentWithTop() const {
|
||||
return mBCoord == mBorderPadding.BStart(mReflowInput.GetWritingMode());
|
||||
}
|
||||
// True if the current block-direction coordinate, for placing the children
|
||||
// within the content area, is still adjacent with the block-start of the
|
||||
// content area.
|
||||
bool IsAdjacentWithBStart() const { return mBCoord == ContentBStart(); }
|
||||
|
||||
/**
|
||||
* Return mBlock's computed physical border+padding with GetSkipSides applied.
|
||||
|
|
|
@ -3534,7 +3534,7 @@ bool nsBlockFrame::ShouldApplyBStartMargin(BlockReflowState& aState,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!aState.IsAdjacentWithTop()) {
|
||||
if (!aState.IsAdjacentWithBStart()) {
|
||||
// If we aren't at the start block-coordinate then something of non-zero
|
||||
// height must have been placed. Therefore the childs block-start margin
|
||||
// applies.
|
||||
|
@ -3904,7 +3904,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||
|
||||
frameReflowStatus.Reset();
|
||||
brc.ReflowBlock(availSpace, applyBStartMargin, aState.mPrevBEndMargin,
|
||||
clearance, aState.IsAdjacentWithTop(), aLine.get(),
|
||||
clearance, aState.IsAdjacentWithBStart(), aLine.get(),
|
||||
*childReflowInput, frameReflowStatus, aState);
|
||||
|
||||
if (frameReflowStatus.IsInlineBreakBefore()) {
|
||||
|
@ -4048,7 +4048,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
|
|||
// 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 &&
|
||||
bool forceFit = aState.IsAdjacentWithBStart() && clearance <= 0 &&
|
||||
!floatAvailableSpace.HasFloats();
|
||||
nsCollapsingMargin collapsedBEndMargin;
|
||||
OverflowAreas overflowAreas;
|
||||
|
@ -6688,7 +6688,7 @@ void nsBlockFrame::ReflowFloat(BlockReflowState& aState,
|
|||
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);
|
||||
|
||||
// Reflow the float
|
||||
bool isAdjacentWithTop = aState.IsAdjacentWithTop();
|
||||
bool isAdjacentWithTop = aState.IsAdjacentWithBStart();
|
||||
|
||||
nsIFrame* clearanceFrame = nullptr;
|
||||
do {
|
||||
|
|
Загрузка…
Ссылка в новой задаче