Bug 1674931 Part 2 - Add WritingMode argument to SizeComputationInput::ComputedLogicalBorderPadding(), and adapt callers. r=jfkthame

This patch is similar to Part 1, but for ComputedLogicalBorderPadding().

Differential Revision: https://phabricator.services.mozilla.com/D95662
This commit is contained in:
Ting-Yu Lin 2020-11-03 19:57:40 +00:00
Родитель 9910d9e651
Коммит 1c052b9ff3
31 изменённых файлов: 117 добавлений и 145 удалений

Просмотреть файл

@ -9622,14 +9622,15 @@ bool PresShell::DoReflow(nsIFrame* target, bool aInterruptible,
if (size.BSize(wm) != NS_UNCONSTRAINEDSIZE) {
nscoord computedBSize =
size.BSize(wm) -
reflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
reflowInput.ComputedLogicalBorderPadding(wm).BStartEnd(wm);
computedBSize = std::max(computedBSize, 0);
reflowInput.SetComputedBSize(computedBSize);
}
NS_ASSERTION(reflowInput.ComputedISize() ==
size.ISize(wm) -
reflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
"reflow input computed incorrect inline size");
NS_ASSERTION(
reflowInput.ComputedISize() ==
size.ISize(wm) -
reflowInput.ComputedLogicalBorderPadding(wm).IStartEnd(wm),
"reflow input computed incorrect inline size");
mPresContext->ReflowStarted(aInterruptible);
mIsReflowing = true;

Просмотреть файл

@ -842,11 +842,10 @@ static bool RecomputePosition(nsIFrame* aFrame) {
availSize, Some(lcbSize));
nscoord computedISize = reflowInput.ComputedISize();
nscoord computedBSize = reflowInput.ComputedBSize();
computedISize +=
reflowInput.ComputedLogicalBorderPadding().IStartEnd(frameWM);
const auto frameBP = reflowInput.ComputedLogicalBorderPadding(frameWM);
computedISize += frameBP.IStartEnd(frameWM);
if (computedBSize != NS_UNCONSTRAINEDSIZE) {
computedBSize +=
reflowInput.ComputedLogicalBorderPadding().BStartEnd(frameWM);
computedBSize += frameBP.BStartEnd(frameWM);
}
LogicalSize logicalSize = aFrame->GetLogicalSize(frameWM);
nsSize size = aFrame->GetSize();

Просмотреть файл

@ -422,8 +422,8 @@ void nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
// both sets of mComputedBorderPadding.
nscoord forcedISize =
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm) -
kidReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
aReflowInput.ComputedLogicalBorderPadding(wm).IStartEnd(wm) -
kidReflowInput.ComputedLogicalBorderPadding(wm).IStartEnd(wm);
kidReflowInput.SetComputedISize(
std::max(kidReflowInput.ComputedISize(), forcedISize));
@ -850,12 +850,11 @@ void nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
// The button should occupy the same space as a scrollbar
nsSize containerSize = aDesiredSize.PhysicalSize();
LogicalRect buttonRect = mButtonFrame->GetLogicalRect(containerSize);
const auto borderPadding = aReflowInput.ComputedLogicalBorderPadding(wm);
buttonRect.IStart(wm) =
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm) +
mDisplayISize -
(aReflowInput.ComputedLogicalBorderPadding().IEnd(wm) -
aReflowInput.ComputedLogicalPadding().IEnd(wm));
borderPadding.IStartEnd(wm) + mDisplayISize -
(borderPadding.IEnd(wm) - aReflowInput.ComputedLogicalPadding().IEnd(wm));
buttonRect.ISize(wm) = buttonISize;
buttonRect.BStart(wm) = this->GetLogicalUsedBorder(wm).BStart(wm);
@ -1260,7 +1259,7 @@ void nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
ReflowInput state(aReflowInput);
WritingMode wm = aReflowInput.GetWritingMode();
LogicalMargin bp = state.ComputedLogicalBorderPadding();
LogicalMargin bp = state.ComputedLogicalBorderPadding(wm);
if (state.ComputedBSize() == NS_UNCONSTRAINEDSIZE) {
float inflation = nsLayoutUtils::FontSizeInflationFor(mComboBox);
// We intentionally use the combobox frame's style here, which has

Просмотреть файл

@ -99,23 +99,20 @@ void nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
// Figure out our border-box sizes as well (by adding borderPadding to
// content-box sizes):
const auto borderPadding = aReflowInput.ComputedLogicalBorderPadding(myWM);
const nscoord borderBoxISize =
contentBoxISize +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(myWM);
contentBoxISize + borderPadding.IStartEnd(myWM);
nscoord borderBoxBSize;
if (contentBoxBSize != NS_UNCONSTRAINEDSIZE) {
borderBoxBSize =
contentBoxBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
borderBoxBSize = contentBoxBSize + borderPadding.BStartEnd(myWM);
} // else, we'll figure out borderBoxBSize after we resolve contentBoxBSize.
nsIFrame* inputAreaFrame = mFrames.FirstChild();
if (!inputAreaFrame) { // display:none?
if (contentBoxBSize == NS_UNCONSTRAINEDSIZE) {
contentBoxBSize = 0;
borderBoxBSize =
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
borderBoxBSize = borderPadding.BStartEnd(myWM);
}
} else {
ReflowOutput childDesiredSize(aReflowInput);
@ -132,11 +129,8 @@ void nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
// offsets of input area frame within this frame:
LogicalPoint childOffset(
myWM,
aReflowInput.ComputedLogicalBorderPadding().IStart(myWM) +
childMargin.IStart(myWM),
aReflowInput.ComputedLogicalBorderPadding().BStart(myWM) +
childMargin.BStart(myWM));
myWM, borderPadding.IStart(myWM) + childMargin.IStart(myWM),
borderPadding.BStart(myWM) + childMargin.BStart(myWM));
nsReflowStatus childStatus;
// We initially reflow the child with a dummy containerSize; positioning
@ -166,9 +160,7 @@ void nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
NS_CSS_MINMAX(contentBoxBSize, aReflowInput.ComputedMinBSize(),
aReflowInput.ComputedMaxBSize());
borderBoxBSize =
contentBoxBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
borderBoxBSize = contentBoxBSize + borderPadding.BStartEnd(myWM);
}
// Center child in block axis

Просмотреть файл

@ -432,7 +432,7 @@ void nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
// @note |this| frame applies borders but not any padding. Our anonymous
// inner frame applies the padding (but not borders).
const auto wm = GetWritingMode();
LogicalMargin border = aReflowInput.ComputedLogicalBorderPadding() -
LogicalMargin border = aReflowInput.ComputedLogicalBorderPadding(wm) -
aReflowInput.ComputedLogicalPadding();
auto skipSides = PreReflowBlockLevelLogicalSkipSides();
border.ApplySkipSides(skipSides);
@ -561,7 +561,8 @@ void nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
StyleBoxDecorationBreak::Clone &&
(aReflowInput.ComputedBSize() == NS_UNCONSTRAINEDSIZE ||
remainingComputedBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm) >=
aReflowInput.ComputedLogicalBorderPadding(wm).BStartEnd(
wm) >=
availSize.BSize(wm))) {
innerAvailSize.BSize(wm) -= border.BEnd(wm);
}
@ -741,7 +742,7 @@ void nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
: aReflowInput.ComputedBSize();
finalSize.BSize(wm) =
contentBoxBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
aReflowInput.ComputedLogicalBorderPadding(wm).BStartEnd(wm);
}
if (aStatus.IsComplete() &&

Просмотреть файл

@ -208,7 +208,8 @@ void nsHTMLButtonControlFrame::ReflowButtonContents(
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
// shorthand for a value we need to use in a bunch of places
const LogicalMargin& clbp = aButtonReflowInput.ComputedLogicalBorderPadding();
const LogicalMargin& clbp =
aButtonReflowInput.ComputedLogicalBorderPadding(wm);
LogicalPoint childPos(wm);
childPos.I(wm) = clbp.IStart(wm);

Просмотреть файл

@ -559,7 +559,7 @@ void nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
mNumDisplayRows = 1;
mDropdownCanGrow = GetNumberOfRows() > 1;
} else {
nscoord bp = aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
nscoord bp = aReflowInput.ComputedLogicalBorderPadding(wm).BStartEnd(wm);
nscoord availableBSize = std::max(before, after) - bp;
nscoord newBSize;
uint32_t rows;

Просмотреть файл

@ -167,12 +167,10 @@ void nsRangeFrame::Reflow(nsPresContext* aPresContext,
if (computedBSize == NS_UNCONSTRAINEDSIZE) {
computedBSize = 0;
}
const auto borderPadding = aReflowInput.ComputedLogicalBorderPadding(wm);
LogicalSize finalSize(
wm,
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
computedBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm));
wm, aReflowInput.ComputedISize() + borderPadding.IStartEnd(wm),
computedBSize + borderPadding.BStartEnd(wm));
aDesiredSize.SetSize(wm, finalSize);
ReflowAnonymousContent(aPresContext, aDesiredSize, aReflowInput);

Просмотреть файл

@ -613,7 +613,7 @@ void nsTextControlFrame::ComputeBaseline(const ReflowInput& aReflowInput,
nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
mFirstBaseline = nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight,
wm.IsLineInverted()) +
aReflowInput.ComputedLogicalBorderPadding().BStart(wm);
aReflowInput.ComputedLogicalBorderPadding(wm).BStart(wm);
aDesiredSize.SetBlockStartAscent(mFirstBaseline);
}
@ -633,13 +633,7 @@ void nsTextControlFrame::Reflow(nsPresContext* aPresContext,
// set values of reflow's out parameters
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize finalSize(
wm,
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
aReflowInput.ComputedBSize() +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm));
aDesiredSize.SetSize(wm, finalSize);
aDesiredSize.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding(wm));
ComputeBaseline(aReflowInput, aDesiredSize);

Просмотреть файл

@ -39,8 +39,10 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowInput,
mContentArea(aReflowInput.GetWritingMode()),
mPushedFloats(nullptr),
mOverflowTracker(nullptr),
mBorderPadding(mReflowInput.ComputedLogicalBorderPadding().ApplySkipSides(
aFrame->GetLogicalSkipSides(&aReflowInput))),
mBorderPadding(
mReflowInput
.ComputedLogicalBorderPadding(mReflowInput.GetWritingMode())
.ApplySkipSides(aFrame->GetLogicalSkipSides(&aReflowInput))),
mPrevBEndMargin(),
mLineNumber(0),
mFloatBreakType(StyleClear::None),
@ -616,7 +618,7 @@ static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
aCBReflowInput.mRenderingContext, wm, aCBReflowInput.ComputedSize(wm),
aFloatAvailableISize,
aFloatOffsetState.ComputedLogicalMargin(wm).Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding().Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding(wm).Size(wm),
ComputeSizeFlag::ShrinkWrap);
WritingMode cbwm = aCBReflowInput.GetWritingMode();
@ -627,10 +629,7 @@ static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
return floatISize +
aFloatOffsetState.ComputedLogicalMargin(cbwm).IStartEnd(cbwm) +
aFloatOffsetState.ComputedLogicalBorderPadding()
.Size(wm)
.ConvertTo(cbwm, wm)
.ISize(cbwm);
aFloatOffsetState.ComputedLogicalBorderPadding(cbwm).IStartEnd(cbwm);
}
// A frame property that stores the last shape source / margin / etc. if there's

Просмотреть файл

@ -231,11 +231,12 @@ nscoord SizeComputationInput::ComputeISizeValue(
nscoord aContainingBlockISize, StyleBoxSizing aBoxSizing,
const SizeOrMaxSize& aSize) const {
WritingMode wm = GetWritingMode();
const auto borderPadding = ComputedLogicalBorderPadding(wm);
nscoord inside = 0;
nscoord outside = ComputedLogicalBorderPadding().IStartEnd(wm) +
ComputedLogicalMargin(wm).IStartEnd(wm);
nscoord outside =
borderPadding.IStartEnd(wm) + ComputedLogicalMargin(wm).IStartEnd(wm);
if (aBoxSizing == StyleBoxSizing::Border) {
inside = ComputedLogicalBorderPadding().IStartEnd(wm);
inside = borderPadding.IStartEnd(wm);
}
outside -= inside;
@ -248,7 +249,7 @@ nscoord SizeComputationInput::ComputeBSizeValue(
WritingMode wm = GetWritingMode();
nscoord inside = 0;
if (aBoxSizing == StyleBoxSizing::Border) {
inside = ComputedLogicalBorderPadding().BStartEnd(wm);
inside = ComputedLogicalBorderPadding(wm).BStartEnd(wm);
}
return nsLayoutUtils::ComputeBSizeValue(aContainingBlockBSize, inside, aSize);
}
@ -518,7 +519,7 @@ void ReflowInput::InitResizeFlags(nsPresContext* aPresContext,
bool isIResize =
// is the border-box resizing?
mFrame->ISize(wm) !=
ComputedISize() + ComputedLogicalBorderPadding().IStartEnd(wm) ||
ComputedISize() + ComputedLogicalBorderPadding(wm).IStartEnd(wm) ||
// or is the content-box resizing? (see comment above)
(mStylePosition->mBoxSizing != StyleBoxSizing::Content &&
mStylePadding->IsWidthDependent());
@ -661,7 +662,8 @@ void ReflowInput::InitResizeFlags(nsPresContext* aPresContext,
// We have a non-'auto' block-size, i.e., a length. Set the BResize
// flag to whether the size is actually different.
SetBResize(mFrame->BSize(wm) !=
ComputedBSize() + ComputedLogicalBorderPadding().BStartEnd(wm));
ComputedBSize() +
ComputedLogicalBorderPadding(wm).BStartEnd(wm));
}
bool dependsOnCBBSize =
@ -1036,7 +1038,7 @@ nsIFrame* ReflowInput::GetHypotheticalBoxContainer(nsIFrame* aFrame,
if (reflowInput) {
WritingMode wm = reflowInput->GetWritingMode();
NS_ASSERTION(wm == aFrame->GetWritingMode(), "unexpected writing mode");
aCBIStartEdge = reflowInput->ComputedLogicalBorderPadding().IStart(wm);
aCBIStartEdge = reflowInput->ComputedLogicalBorderPadding(wm).IStart(wm);
aCBSize = reflowInput->ComputedSize(wm);
} else {
/* Didn't find a reflow reflowInput for aFrame. Just compute the
@ -1395,7 +1397,7 @@ void ReflowInput::CalculateHypotheticalPosition(
// The specified offsets are relative to the absolute containing block's
// padding edge and our current values are relative to the border edge, so
// translate.
LogicalMargin border = aCBReflowInput->ComputedLogicalBorderPadding() -
LogicalMargin border = aCBReflowInput->ComputedLogicalBorderPadding(cbwm) -
aCBReflowInput->ComputedLogicalPadding();
border = border.ConvertTo(wm, aCBReflowInput->GetWritingMode());
aHypotheticalPos.mIStart -= border.IStart(wm);
@ -1620,7 +1622,7 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
mRenderingContext, wm, cbSize.ConvertTo(wm, cbwm),
cbSize.ConvertTo(wm, cbwm).ISize(wm), // XXX or AvailableISize()?
ComputedLogicalMargin(wm).Size(wm) + ComputedLogicalOffsets().Size(wm),
ComputedLogicalBorderPadding().Size(wm), mComputeSizeFlags);
ComputedLogicalBorderPadding(wm).Size(wm), mComputeSizeFlags);
ComputedISize() = sizeResult.mLogicalSize.ISize(wm);
ComputedBSize() = sizeResult.mLogicalSize.BSize(wm);
NS_ASSERTION(ComputedISize() >= 0, "Bogus inline-size");
@ -1639,8 +1641,7 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
// branches off of widthIsAuto?
LogicalMargin margin = ComputedLogicalMargin(cbwm);
const LogicalMargin borderPadding =
ComputedLogicalBorderPadding().ConvertTo(cbwm, wm);
const LogicalMargin borderPadding = ComputedLogicalBorderPadding(cbwm);
bool iSizeIsAuto = mStylePosition->ISize(cbwm).IsAuto();
bool marginIStartIsAuto = false;
@ -2001,7 +2002,7 @@ LogicalSize ReflowInput::ComputeContainingBlockRectangle(
// that's very hard.
LogicalMargin computedBorder =
aContainingBlockRI->ComputedLogicalBorderPadding() -
aContainingBlockRI->ComputedLogicalBorderPadding(wm) -
aContainingBlockRI->ComputedLogicalPadding();
cbSize.ISize(wm) =
aContainingBlockRI->mFrame->ISize(wm) - computedBorder.IStartEnd(wm);
@ -2093,14 +2094,13 @@ void ReflowInput::InitConstraints(
SetComputedLogicalMargin(wm, LogicalMargin(wm));
ComputedPhysicalOffsets().SizeTo(0, 0, 0, 0);
ComputedISize() =
AvailableISize() - ComputedLogicalBorderPadding().IStartEnd(wm);
const auto borderPadding = ComputedLogicalBorderPadding(wm);
ComputedISize() = AvailableISize() - borderPadding.IStartEnd(wm);
if (ComputedISize() < 0) {
ComputedISize() = 0;
}
if (AvailableBSize() != NS_UNCONSTRAINEDSIZE) {
ComputedBSize() =
AvailableBSize() - ComputedLogicalBorderPadding().BStartEnd(wm);
ComputedBSize() = AvailableBSize() - borderPadding.BStartEnd(wm);
if (ComputedBSize() < 0) {
ComputedBSize() = 0;
}
@ -2235,7 +2235,7 @@ void ReflowInput::InitConstraints(
if ((ComputedISize() != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup) {
// Internal table elements don't have margins. Only tables and
// cells have border and padding
ComputedISize() -= ComputedLogicalBorderPadding().IStartEnd(wm);
ComputedISize() -= ComputedLogicalBorderPadding(wm).IStartEnd(wm);
if (ComputedISize() < 0) ComputedISize() = 0;
}
NS_ASSERTION(ComputedISize() >= 0, "Bogus computed isize");
@ -2341,7 +2341,7 @@ void ReflowInput::InitConstraints(
auto size = mFrame->ComputeSize(
mRenderingContext, wm, cbSize, AvailableISize(),
ComputedLogicalMargin(wm).Size(wm),
ComputedLogicalBorderPadding().Size(wm), mComputeSizeFlags);
ComputedLogicalBorderPadding(wm).Size(wm), mComputeSizeFlags);
ComputedISize() = size.mLogicalSize.ISize(wm);
ComputedBSize() = size.mLogicalSize.BSize(wm);
@ -2547,8 +2547,7 @@ void ReflowInput::CalculateBlockSideMargins(LayoutFrameType aFrameType) {
"intrinsic inline-size calculation");
LogicalMargin margin = ComputedLogicalMargin(cbWM);
LogicalMargin borderPadding =
ComputedLogicalBorderPadding().ConvertTo(cbWM, mWritingMode);
LogicalMargin borderPadding = ComputedLogicalBorderPadding(cbWM);
nscoord sum = margin.IStartEnd(cbWM) + borderPadding.IStartEnd(cbWM) +
computedISizeCBWM;
if (sum == availISizeCBWM) {

Просмотреть файл

@ -130,8 +130,8 @@ struct SizeComputationInput {
LogicalMargin ComputedLogicalMargin(mozilla::WritingMode aWM) const {
return mComputedMargin.ConvertTo(aWM, mWritingMode);
}
LogicalMargin ComputedLogicalBorderPadding() const {
return mComputedBorderPadding;
LogicalMargin ComputedLogicalBorderPadding(mozilla::WritingMode aWM) const {
return mComputedBorderPadding.ConvertTo(aWM, mWritingMode);
}
LogicalMargin ComputedLogicalPadding() const { return mComputedPadding; }
@ -412,8 +412,8 @@ struct ReflowInput : public SizeComputationInput {
mozilla::LogicalSize ComputedSizeWithBorderPadding() const {
mozilla::WritingMode wm = GetWritingMode();
return mozilla::LogicalSize(
wm, ComputedISize() + ComputedLogicalBorderPadding().IStartEnd(wm),
ComputedBSize() + ComputedLogicalBorderPadding().BStartEnd(wm));
wm, ComputedISize() + ComputedLogicalBorderPadding(wm).IStartEnd(wm),
ComputedBSize() + ComputedLogicalBorderPadding(wm).BStartEnd(wm));
}
mozilla::LogicalSize ComputedSizeWithBorderPadding(
@ -426,9 +426,9 @@ struct ReflowInput : public SizeComputationInput {
return mozilla::LogicalSize(
wm,
ComputedISize() + ComputedLogicalMargin(wm).IStartEnd(wm) +
ComputedLogicalBorderPadding().IStartEnd(wm),
ComputedLogicalBorderPadding(wm).IStartEnd(wm),
ComputedBSize() + ComputedLogicalMargin(wm).BStartEnd(wm) +
ComputedLogicalBorderPadding().BStartEnd(wm));
ComputedLogicalBorderPadding(wm).BStartEnd(wm));
}
mozilla::LogicalSize ComputedSizeWithMarginBorderPadding(

Просмотреть файл

@ -73,8 +73,5 @@ void nsBackdropFrame::Reflow(nsPresContext* aPresContext,
// Note that this frame is a child of the viewport frame.
WritingMode wm = aReflowInput.GetWritingMode();
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
nscoord isize = aReflowInput.ComputedISize() + borderPadding.IStartEnd(wm);
nscoord bsize = aReflowInput.ComputedBSize() + borderPadding.BStartEnd(wm);
aDesiredSize.SetSize(wm, LogicalSize(wm, isize, bsize));
aDesiredSize.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding(wm));
}

Просмотреть файл

@ -1264,7 +1264,8 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE &&
(ShouldApplyOverflowClipping(aReflowInput.mStyleDisplay) &
physicalBlockAxis)) {
LogicalMargin blockDirExtras = aReflowInput.ComputedLogicalBorderPadding();
LogicalMargin blockDirExtras =
aReflowInput.ComputedLogicalBorderPadding(wm);
if (GetLogicalSkipSides().BStart()) {
blockDirExtras.BStart(wm) = 0;
} else {
@ -1443,7 +1444,7 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
nsLayoutUtils::GetFirstLinePosition(wm, this, &position);
nscoord lineBStart =
havePosition ? position.mBStart
: reflowInput->ComputedLogicalBorderPadding().BStart(wm);
: reflowInput->ComputedLogicalBorderPadding(wm).BStart(wm);
nsIFrame* marker = GetOutsideMarker();
ReflowOutsideMarker(marker, state, reflowOutput, lineBStart);
NS_ASSERTION(!MarkerIsEmpty() || reflowOutput.BSize(wm) == 0,
@ -1957,7 +1958,7 @@ void nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
borderPadding.BStart(wm);
// Note that |borderPadding| has GetSkipSides applied, so we ask
// aReflowInput for the actual value we'd use on a last fragment here:
bEnd += aReflowInput.ComputedLogicalBorderPadding().BEnd(wm);
bEnd += aReflowInput.ComputedLogicalBorderPadding(wm).BEnd(wm);
if (bEnd <= aReflowInput.AvailableBSize()) {
// We actually fit after applying `max-size` so we should be
// Overflow-Incomplete instead.
@ -2268,7 +2269,7 @@ void nsBlockFrame::PrepareResizeReflow(BlockReflowInput& aState) {
if (tryAndSkipLines) {
WritingMode wm = aState.mReflowInput.GetWritingMode();
nscoord newAvailISize =
aState.mReflowInput.ComputedLogicalBorderPadding().IStart(wm) +
aState.mReflowInput.ComputedLogicalBorderPadding(wm).IStart(wm) +
aState.mReflowInput.ComputedISize();
#ifdef DEBUG
@ -7446,7 +7447,7 @@ void nsBlockFrame::ReflowOutsideMarker(nsIFrame* aMarkerFrame,
// combine it with other logical values here.
LogicalMargin markerMargin = reflowInput.ComputedLogicalMargin(wm);
nscoord iStart = floatAvailSpace.IStart(wm) -
ri.ComputedLogicalBorderPadding().IStart(wm) -
ri.ComputedLogicalBorderPadding(wm).IStart(wm) -
markerMargin.IEnd(wm) - aMetrics.ISize(wm);
// Approximate the ::marker's position; vertical alignment will provide

Просмотреть файл

@ -73,7 +73,7 @@ bool nsBlockReflowContext::ComputeCollapsedBStartMargin(
nsIFrame* frame = DescendIntoBlockLevelFrame(aRI.mFrame);
nsPresContext* prescontext = frame->PresContext();
nsBlockFrame* block = nullptr;
if (0 == aRI.ComputedLogicalBorderPadding().BStart(wm)) {
if (0 == aRI.ComputedLogicalBorderPadding(wm).BStart(wm)) {
block = do_QueryFrame(frame);
if (block) {
bool bStartMarginRoot, unused;

Просмотреть файл

@ -961,7 +961,7 @@ void nsBulletFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
// Add in the border and padding; split the top/bottom between the
// ascent and descent to make things look nice
WritingMode wm = aReflowInput.GetWritingMode();
const LogicalMargin& bp = aReflowInput.ComputedLogicalBorderPadding();
const auto bp = aReflowInput.ComputedLogicalBorderPadding(wm);
mPadding.BStart(wm) += NSToCoordRound(bp.BStart(wm) * inflation);
mPadding.IEnd(wm) += NSToCoordRound(bp.IEnd(wm) * inflation);
mPadding.BEnd(wm) += NSToCoordRound(bp.BEnd(wm) * inflation);

Просмотреть файл

@ -1205,8 +1205,10 @@ void nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
"The column container should have relevant column styles!");
MOZ_ASSERT(aReflowInput.mParentReflowInput->mFrame->IsColumnSetWrapperFrame(),
"The column container should be ColumnSetWrapperFrame!");
MOZ_ASSERT(aReflowInput.ComputedLogicalBorderPadding().IsAllZero(),
"Only the column container can have border and padding!");
MOZ_ASSERT(
aReflowInput.ComputedLogicalBorderPadding(aReflowInput.GetWritingMode())
.IsAllZero(),
"Only the column container can have border and padding!");
MOZ_ASSERT(GetChildList(kOverflowContainersList).IsEmpty() &&
GetChildList(kExcessOverflowContainersList).IsEmpty(),
"ColumnSetFrame should store overflow containers in principal "

Просмотреть файл

@ -159,7 +159,7 @@ void nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
// Setup reflow input for our child
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize availSize = aReflowInput.AvailableSize();
const LogicalMargin& bp = aReflowInput.ComputedLogicalBorderPadding();
const auto bp = aReflowInput.ComputedLogicalBorderPadding(wm);
NS_ASSERTION(availSize.ISize(wm) != NS_UNCONSTRAINEDSIZE,
"should no longer use unconstrained inline size");
availSize.ISize(wm) -= bp.IStartEnd(wm);

Просмотреть файл

@ -1303,7 +1303,8 @@ FlexItem* nsFlexContainerFrame::GenerateFlexItemForChild(
flexShrink = stylePos->mFlexShrink;
}
WritingMode childWM = childRI.GetWritingMode();
const auto childWM = childRI.GetWritingMode();
const auto flexWM = aAxisTracker.GetWritingMode();
// MAIN SIZES (flex base size, min/max size)
// -----------------------------------------
@ -1352,9 +1353,8 @@ FlexItem* nsFlexContainerFrame::GenerateFlexItemForChild(
// GetMinimumWidgetSize() returns border-box. We need content-box, so
// subtract borderPadding.
const LogicalMargin bpInChildWM = childRI.ComputedLogicalBorderPadding();
const LogicalMargin bpInFlexWM =
bpInChildWM.ConvertTo(aAxisTracker.GetWritingMode(), childWM);
childRI.ComputedLogicalBorderPadding(flexWM);
widgetMainMinSize -= aAxisTracker.MarginSizeInMainAxis(bpInFlexWM);
widgetCrossMinSize -= aAxisTracker.MarginSizeInCrossAxis(bpInFlexWM);
// ... (but don't let that push these min sizes below 0).
@ -1402,8 +1402,8 @@ FlexItem* nsFlexContainerFrame::GenerateFlexItemForChild(
// 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(),
aParentReflowInput.ComputedISize(), aParentReflowInput.ComputedBSize());
aAxisTracker, flexWM, aParentReflowInput.ComputedISize(),
aParentReflowInput.ComputedBSize());
// Is container's cross size "definite"?
// - If it's column-oriented, then "yes", because its cross size is its
// inline-size which is always definite from its descendants' perspective.
@ -1626,7 +1626,7 @@ void nsFlexContainerFrame::ResolveAutoFlexBasisAndMinSize(
aItemReflowInput.mRenderingContext, itemWM,
aItemReflowInput.mContainingBlockSize, availISize,
aItemReflowInput.ComputedLogicalMargin(itemWM).Size(itemWM),
aItemReflowInput.ComputedLogicalBorderPadding().Size(itemWM),
aItemReflowInput.ComputedLogicalBorderPadding(itemWM).Size(itemWM),
{ComputeSizeFlag::UseAutoISize, ComputeSizeFlag::ShrinkWrap});
contentSizeSuggestion = aAxisTracker.MainComponent(
@ -1766,8 +1766,9 @@ class nsFlexContainerFrame::CachedBAxisMeasurement {
// (and floor at 0 in case the border/padding are too large):
WritingMode itemWM = aReflowInput.GetWritingMode();
nscoord borderBoxBSize = aReflowOutput.BSize(itemWM);
mBSize = borderBoxBSize -
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(itemWM);
mBSize =
borderBoxBSize -
aReflowInput.ComputedLogicalBorderPadding(itemWM).BStartEnd(itemWM);
mBSize = std::max(0, mBSize);
}
@ -1828,7 +1829,7 @@ class nsFlexContainerFrame::CachedFlexItemData {
mFinalReflowSize.reset();
mFinalReflowSize.emplace(
aReflowOutput.Size(wm) -
aReflowInput.ComputedLogicalBorderPadding().Size(wm));
aReflowInput.ComputedLogicalBorderPadding(wm).Size(wm));
// Save whether this reflow's BSize was considered definite vs. indefinite.
// (For a flex item "final reflow", this is 100% determined by the
// "mTreatBSizeAsIndefinite" ReflowInput flag -- when we get to this
@ -2005,9 +2006,7 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowInput, float aFlexGrow,
mWM(aFlexItemReflowInput.GetWritingMode()),
mCBWM(aAxisTracker.GetWritingMode()),
mMainAxis(aAxisTracker.MainAxis()),
mBorderPadding(
aFlexItemReflowInput.ComputedLogicalBorderPadding().ConvertTo(mCBWM,
mWM)),
mBorderPadding(aFlexItemReflowInput.ComputedLogicalBorderPadding(mCBWM)),
mMargin(aFlexItemReflowInput.ComputedLogicalMargin(mCBWM)),
mMainMinSize(aMainMinSize),
mMainMaxSize(aMainMaxSize),
@ -4396,7 +4395,7 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
// PreReflowBlockLevelLogicalSkipSides(). We will skip block-end
// border/padding when we know our content-box size after DoFlexLayout.
LogicalMargin borderPadding =
aReflowInput.ComputedLogicalBorderPadding().ApplySkipSides(
aReflowInput.ComputedLogicalBorderPadding(wm).ApplySkipSides(
PreReflowBlockLevelLogicalSkipSides());
const LogicalSize availableSizeForItems =
@ -5268,7 +5267,7 @@ void nsFlexContainerFrame::PopulateReflowOutput(
if (aReflowInput.mStyleBorder->mBoxDecorationBreak ==
StyleBoxDecorationBreak::Slice) {
blockEndContainerBP =
aReflowInput.ComputedLogicalBorderPadding().BEnd(flexWM);
aReflowInput.ComputedLogicalBorderPadding(flexWM).BEnd(flexWM);
}
}
}

Просмотреть файл

@ -3030,7 +3030,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
mInFragmentainer(false) {
MOZ_ASSERT(!aReflowInput || aReflowInput->mFrame == mFrame);
if (aReflowInput) {
mBorderPadding = aReflowInput->ComputedLogicalBorderPadding();
mBorderPadding = aReflowInput->ComputedLogicalBorderPadding(mWM);
mSkipSides = aFrame->PreReflowBlockLevelLogicalSkipSides();
mBorderPadding.ApplySkipSides(mSkipSides);
}

Просмотреть файл

@ -430,7 +430,7 @@ void nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
LogicalSize finalSize = aReflowInput.ComputedSize();
// stash this away so we can compute our inner area later
mBorderPadding = aReflowInput.ComputedLogicalBorderPadding();
mBorderPadding = aReflowInput.ComputedLogicalBorderPadding(wm);
finalSize.ISize(wm) += mBorderPadding.IStartEnd(wm);
finalSize.BSize(wm) += mBorderPadding.BStartEnd(wm);

Просмотреть файл

@ -10487,10 +10487,10 @@ void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
reflowInput.SetComputedHeight(computedHeight);
} else {
reflowInput.SetComputedHeight(
ComputeSize(aRenderingContext, wm, logicalSize,
logicalSize.ISize(wm),
reflowInput.ComputedLogicalMargin(wm).Size(wm),
reflowInput.ComputedLogicalBorderPadding().Size(wm), {})
ComputeSize(
aRenderingContext, wm, logicalSize, logicalSize.ISize(wm),
reflowInput.ComputedLogicalMargin(wm).Size(wm),
reflowInput.ComputedLogicalBorderPadding(wm).Size(wm), {})
.mLogicalSize.Height(wm));
}
}

Просмотреть файл

@ -456,7 +456,8 @@ void nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
RestyleManager* restyleManager = aPresContext->RestyleManager();
WritingMode frameWM = aReflowInput.GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->mRootSpan->mWritingMode;
LogicalMargin framePadding = aReflowInput.ComputedLogicalBorderPadding();
LogicalMargin framePadding =
aReflowInput.ComputedLogicalBorderPadding(frameWM);
nscoord startEdge = 0;
const bool boxDecorationBreakClone = MOZ_UNLIKELY(
StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Clone);

Просмотреть файл

@ -826,8 +826,7 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
}
WritingMode stateWM = reflowInput.GetWritingMode();
pfd->mMargin = reflowInput.ComputedLogicalMargin(lineWM);
pfd->mBorderPadding =
reflowInput.ComputedLogicalBorderPadding().ConvertTo(lineWM, stateWM);
pfd->mBorderPadding = reflowInput.ComputedLogicalBorderPadding(lineWM);
pfd->mRelativePos =
reflowInput.mStyleDisplay->IsRelativelyPositionedStyle();
if (pfd->mRelativePos) {

Просмотреть файл

@ -116,7 +116,8 @@ void nsRubyFrame::Reflow(nsPresContext* aPresContext,
// Begin the span for the ruby frame
WritingMode frameWM = aReflowInput.GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
LogicalMargin borderPadding =
aReflowInput.ComputedLogicalBorderPadding(frameWM);
nsLayoutUtils::SetBSizeFromFontMetrics(this, aDesiredSize, borderPadding,
lineWM, frameWM);

Просмотреть файл

@ -267,16 +267,14 @@ void nsVideoFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
const WritingMode myWM = aReflowInput.GetWritingMode();
nscoord contentBoxBSize = aReflowInput.ComputedBSize();
const auto logicalBP = aReflowInput.ComputedLogicalBorderPadding(myWM);
const nscoord borderBoxISize =
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(myWM);
aReflowInput.ComputedISize() + logicalBP.IStartEnd(myWM);
const bool isBSizeShrinkWrapping = (contentBoxBSize == NS_UNCONSTRAINEDSIZE);
nscoord borderBoxBSize;
if (!isBSizeShrinkWrapping) {
borderBoxBSize =
contentBoxBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
borderBoxBSize = contentBoxBSize + logicalBP.BStartEnd(myWM);
}
nsMargin borderPadding = aReflowInput.ComputedPhysicalBorderPadding();
@ -378,9 +376,7 @@ void nsVideoFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
contentBoxBSize =
NS_CSS_MINMAX(contentBoxBSize, aReflowInput.ComputedMinBSize(),
aReflowInput.ComputedMaxBSize());
borderBoxBSize =
contentBoxBSize +
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(myWM);
borderBoxBSize = contentBoxBSize + logicalBP.BStartEnd(myWM);
}
LogicalSize logicalDesiredSize(myWM, borderBoxISize, borderBoxBSize);

Просмотреть файл

@ -91,13 +91,11 @@ nsIFrame::SizeComputationResult nsMathMLSelectedFrame::ComputeSize(
const LogicalSize cbSize = aCBSize - aBorderPadding - aMargin;
SizeComputationInput offsetState(childFrame, aRenderingContext, aWM,
availableISize);
const auto bpSize = offsetState.ComputedLogicalBorderPadding(aWM).Size(aWM);
auto size = childFrame->ComputeSize(
aRenderingContext, aWM, cbSize, availableISize,
offsetState.ComputedLogicalMargin(aWM).Size(aWM),
offsetState.ComputedLogicalBorderPadding().Size(aWM), aFlags);
return {size.mLogicalSize +
offsetState.ComputedLogicalBorderPadding().Size(aWM),
size.mAspectRatioUsage};
offsetState.ComputedLogicalMargin(aWM).Size(aWM), bpSize, aFlags);
return {size.mLogicalSize + bpSize, size.mAspectRatioUsage};
}
return {LogicalSize(aWM), AspectRatioUsage::None};
}

Просмотреть файл

@ -1893,7 +1893,7 @@ void nsTableFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.ISize(wm) =
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
aReflowInput.ComputedLogicalBorderPadding(wm).IStartEnd(wm);
if (!haveDesiredBSize) {
CalcDesiredBSize(aReflowInput, aDesiredSize);
}
@ -2046,7 +2046,7 @@ void nsTableFrame::ReflowTable(ReflowOutput& aDesiredSize,
WritingMode wm = aReflowInput.GetWritingMode();
aDesiredSize.ISize(wm) =
aReflowInput.ComputedISize() +
aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm);
aReflowInput.ComputedLogicalBorderPadding(wm).IStartEnd(wm);
TableReflowInput reflowInput(
aReflowInput, LogicalSize(wm, aDesiredSize.ISize(wm), aAvailBSize));
ReflowChildren(reflowInput, aStatus, aLastChildReflowed,

Просмотреть файл

@ -53,7 +53,7 @@ void TableCellReflowInput::FixUp(const LogicalSize& aAvailSpace) {
if (NS_UNCONSTRAINEDSIZE != ComputedISize()) {
nscoord computedISize =
aAvailSpace.ISize(mWritingMode) -
ComputedLogicalBorderPadding().IStartEnd(mWritingMode);
ComputedLogicalBorderPadding(mWritingMode).IStartEnd(mWritingMode);
computedISize = std::max(0, computedISize);
SetComputedISize(computedISize);
}
@ -61,7 +61,7 @@ void TableCellReflowInput::FixUp(const LogicalSize& aAvailSpace) {
NS_UNCONSTRAINEDSIZE != aAvailSpace.BSize(mWritingMode)) {
nscoord computedBSize =
aAvailSpace.BSize(mWritingMode) -
ComputedLogicalBorderPadding().BStartEnd(mWritingMode);
ComputedLogicalBorderPadding(mWritingMode).BStartEnd(mWritingMode);
computedBSize = std::max(0, computedBSize);
SetComputedBSize(computedBSize);
}

Просмотреть файл

@ -363,15 +363,10 @@ nscoord nsTableWrapperFrame::ChildShrinkWrapISize(
nscoord* aMarginResult) const {
AutoMaybeDisableFontInflation an(aChildFrame);
// For the caption frame, child's WM may differ from the table's main WM.
WritingMode childWM = aChildFrame->GetWritingMode();
SizeComputationInput offsets(aChildFrame, aRenderingContext, aWM,
aCBSize.ISize(aWM));
LogicalSize marginSize = offsets.ComputedLogicalMargin(aWM).Size(aWM);
LogicalSize bpSize =
offsets.ComputedLogicalBorderPadding().Size(childWM).ConvertTo(aWM,
childWM);
LogicalSize bpSize = offsets.ComputedLogicalBorderPadding(aWM).Size(aWM);
// Shrink-wrap aChildFrame by default, except if we're a stretched grid item.
ComputeSizeFlags flags(ComputeSizeFlag::ShrinkWrap);

Просмотреть файл

@ -470,7 +470,7 @@ void nsBoxFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize computedSize = aReflowInput.ComputedSize();
LogicalMargin m = aReflowInput.ComputedLogicalBorderPadding();
LogicalMargin m = aReflowInput.ComputedLogicalBorderPadding(wm);
// GetXULBorderAndPadding(m);
LogicalSize prefSize(wm);
@ -494,7 +494,7 @@ void nsBoxFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
computedSize.BSize(wm) = prefSize.BSize(wm);
// prefSize is border-box but min/max constraints are content-box.
nscoord blockDirBorderPadding =
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
aReflowInput.ComputedLogicalBorderPadding(wm).BStartEnd(wm);
nscoord contentBSize = computedSize.BSize(wm) - blockDirBorderPadding;
// Note: contentHeight might be negative, but that's OK because min-height
// is never negative.