diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 6c623525fb31..0a6e6ff2f058 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -46,14 +46,14 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_ISOVERFLOWCONTAINER, IS_TRUE_OVERFLOW_CONTAINER(aFrame)); - const nsMargin& borderPadding = BorderPadding(); - mContainerWidth = aReflowState.ComputedWidth() + - aReflowState.ComputedPhysicalBorderPadding().LeftRight(); + mBorderPadding = mReflowState.ComputedPhysicalBorderPadding(); + aFrame->ApplySkipSides(mBorderPadding, &aReflowState); + mContainerWidth = aReflowState.ComputedWidth() + mBorderPadding.LeftRight(); - if (aTopMarginRoot || 0 != aReflowState.ComputedPhysicalBorderPadding().top) { + if (aTopMarginRoot || 0 != mBorderPadding.top) { SetFlag(BRS_ISTOPMARGINROOT, true); } - if (aBottomMarginRoot || 0 != aReflowState.ComputedPhysicalBorderPadding().bottom) { + if (aBottomMarginRoot || 0 != mBorderPadding.bottom) { SetFlag(BRS_ISBOTTOMMARGINROOT, true); } if (GetFlag(BRS_ISTOPMARGINROOT)) { @@ -93,8 +93,8 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, // We are in a paginated situation. The bottom edge is just inside // the bottom border and padding. The content area height doesn't // include either border or padding edge. - mBottomEdge = aReflowState.AvailableHeight() - borderPadding.bottom; - mContentArea.height = std::max(0, mBottomEdge - borderPadding.top); + mBottomEdge = aReflowState.AvailableHeight() - mBorderPadding.bottom; + mContentArea.height = std::max(0, mBottomEdge - mBorderPadding.top); } else { // When we are not in a paginated situation then we always use @@ -102,8 +102,8 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_UNCONSTRAINEDHEIGHT, true); mContentArea.height = mBottomEdge = NS_UNCONSTRAINEDSIZE; } - mContentArea.x = borderPadding.left; - mY = mContentArea.y = borderPadding.top; + mContentArea.x = mBorderPadding.left; + mY = mContentArea.y = mBorderPadding.top; mPrevChild = nullptr; mCurrentLine = aFrame->end_lines(); diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index 02163fa604ed..45141ceef4ef 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -92,23 +92,14 @@ public: uint32_t aFlags = 0); bool IsAdjacentWithTop() const { - return mY == - ((mFlags & BRS_ISFIRSTINFLOW) ? mReflowState.ComputedPhysicalBorderPadding().top : 0); + return mY == mBorderPadding.top; } /** - * Adjusts the border/padding to return 0 for the top if - * we are not the first in flow. + * Return mBlock's computed physical border+padding with GetSkipSides applied. */ - nsMargin BorderPadding() const { - nsMargin result = mReflowState.ComputedPhysicalBorderPadding(); - if (!(mFlags & BRS_ISFIRSTINFLOW)) { - result.top = 0; - if (mFlags & BRS_ISOVERFLOWCONTAINER) { - result.bottom = 0; - } - } - return result; + const nsMargin& BorderPadding() const { + return mBorderPadding; } /** @@ -222,6 +213,9 @@ public: // The current Y coordinate in the block nscoord mY; + // mBlock's computed physical border+padding with GetSkipSides applied. + nsMargin mBorderPadding; + // The overflow areas of all floats placed so far nsOverflowAreas mFloatOverflowAreas;