Bug 1767069 part 3: Modernize naming for some SizeComputationInput variables in float layout code. r=emilio

This patch does not impact behavior.

Before this patch, these variables' names are abbreviations of their original
type-name, "nsCSSOffsetState".  We renamed that type to SizeComputationInput in
bug 1277129, and this patch just updates the variable-names to reflect that
renaming, so that now they're abbreviations of the new type-name, rather than
the old one.

This patch also takes this opportunity to move these variables declarations
closer to their usage, and in one case we convert a variable to be a temporary
anonymous value in the middle of another assignment.

Differential Revision: https://phabricator.services.mozilla.com/D145137
This commit is contained in:
Daniel Holbert 2022-05-02 18:49:17 +00:00
Родитель 85eff7ef92
Коммит 968d8951a4
2 изменённых файлов: 20 добавлений и 18 удалений

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

@ -165,10 +165,11 @@ void BlockReflowState::ComputeFloatAvoidingOffsets(
iStartOffset = 0;
iEndOffset = 0;
} else {
LogicalMargin frameMargin(wm);
SizeComputationInput os(aFloatAvoidingBlock, mReflowInput.mRenderingContext,
wm, mContentArea.ISize(wm));
frameMargin = os.ComputedLogicalMargin(wm);
const LogicalMargin frameMargin =
SizeComputationInput(aFloatAvoidingBlock,
mReflowInput.mRenderingContext, wm,
mContentArea.ISize(wm))
.ComputedLogicalMargin(wm);
nscoord iStartFloatIOffset =
aFloatAvailableSpace.IStart(wm) - mContentArea.IStart(wm);
@ -624,15 +625,15 @@ bool BlockReflowState::CanPlaceFloat(
// how much inline-size it will occupy in the containing block's mode.
static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
nscoord aFloatAvailableISize, nsIFrame* aFloat,
const SizeComputationInput& aFloatOffsetState) {
const SizeComputationInput& aFloatSizingInput) {
AutoMaybeDisableFontInflation an(aFloat);
WritingMode wm = aFloatOffsetState.GetWritingMode();
WritingMode wm = aFloatSizingInput.GetWritingMode();
auto floatSize = aFloat->ComputeSize(
aCBReflowInput.mRenderingContext, wm, aCBReflowInput.ComputedSize(wm),
aFloatAvailableISize,
aFloatOffsetState.ComputedLogicalMargin(wm).Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding(wm).Size(wm), {},
aFloatSizingInput.ComputedLogicalMargin(wm).Size(wm),
aFloatSizingInput.ComputedLogicalBorderPadding(wm).Size(wm), {},
ComputeSizeFlag::ShrinkWrap);
WritingMode cbwm = aCBReflowInput.GetWritingMode();
@ -642,8 +643,8 @@ static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
}
return floatISize +
aFloatOffsetState.ComputedLogicalMargin(cbwm).IStartEnd(cbwm) +
aFloatOffsetState.ComputedLogicalBorderPadding(cbwm).IStartEnd(cbwm);
aFloatSizingInput.ComputedLogicalMargin(cbwm).IStartEnd(cbwm) +
aFloatSizingInput.ComputedLogicalBorderPadding(cbwm).IStartEnd(cbwm);
}
// A frame property that stores the last shape source / margin / etc. if there's
@ -733,11 +734,11 @@ bool BlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat) {
NS_ASSERTION(aFloat->GetParent() == mBlock, "Float frame has wrong parent");
SizeComputationInput offsets(aFloat, mReflowInput.mRenderingContext, wm,
mReflowInput.ComputedISize());
SizeComputationInput sizingInput(aFloat, mReflowInput.mRenderingContext, wm,
mReflowInput.ComputedISize());
nscoord floatMarginISize = FloatMarginISize(
mReflowInput, adjustedAvailableSpace.ISize(wm), aFloat, offsets);
mReflowInput, adjustedAvailableSpace.ISize(wm), aFloat, sizingInput);
LogicalMargin floatMargin(wm); // computed margin
LogicalMargin floatOffsets(wm);

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

@ -7702,9 +7702,6 @@ nsBlockFrame::FloatAvoidingISizeToClear nsBlockFrame::ISizeToClearPastFloats(
nsIFrame* aFloatAvoidingBlock) {
nscoord inlineStartOffset, inlineEndOffset;
WritingMode wm = aState.mReflowInput.GetWritingMode();
SizeComputationInput offsetState(aFloatAvoidingBlock,
aState.mReflowInput.mRenderingContext, wm,
aState.mContentArea.ISize(wm));
FloatAvoidingISizeToClear result;
aState.ComputeFloatAvoidingOffsets(aFloatAvoidingBlock, aFloatAvailableSpace,
@ -7725,9 +7722,13 @@ nsBlockFrame::FloatAvoidingISizeToClear nsBlockFrame::ISizeToClearPastFloats(
aFloatAvoidingBlock, availSpace);
result.borderBoxISize =
reflowInput.ComputedSizeWithBorderPadding(wm).ISize(wm);
// Use the margins from offsetState rather than reflowInput so that
// Use the margins from sizingInput rather than reflowInput so that
// they aren't reduced by ignoring margins in overconstrained cases.
LogicalMargin computedMargin = offsetState.ComputedLogicalMargin(wm);
SizeComputationInput sizingInput(aFloatAvoidingBlock,
aState.mReflowInput.mRenderingContext, wm,
aState.mContentArea.ISize(wm));
const LogicalMargin computedMargin = sizingInput.ComputedLogicalMargin(wm);
result.marginIStart = computedMargin.IStart(wm);
return result;
}