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

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

@ -7702,9 +7702,6 @@ nsBlockFrame::FloatAvoidingISizeToClear nsBlockFrame::ISizeToClearPastFloats(
nsIFrame* aFloatAvoidingBlock) { nsIFrame* aFloatAvoidingBlock) {
nscoord inlineStartOffset, inlineEndOffset; nscoord inlineStartOffset, inlineEndOffset;
WritingMode wm = aState.mReflowInput.GetWritingMode(); WritingMode wm = aState.mReflowInput.GetWritingMode();
SizeComputationInput offsetState(aFloatAvoidingBlock,
aState.mReflowInput.mRenderingContext, wm,
aState.mContentArea.ISize(wm));
FloatAvoidingISizeToClear result; FloatAvoidingISizeToClear result;
aState.ComputeFloatAvoidingOffsets(aFloatAvoidingBlock, aFloatAvailableSpace, aState.ComputeFloatAvoidingOffsets(aFloatAvoidingBlock, aFloatAvailableSpace,
@ -7725,9 +7722,13 @@ nsBlockFrame::FloatAvoidingISizeToClear nsBlockFrame::ISizeToClearPastFloats(
aFloatAvoidingBlock, availSpace); aFloatAvoidingBlock, availSpace);
result.borderBoxISize = result.borderBoxISize =
reflowInput.ComputedSizeWithBorderPadding(wm).ISize(wm); 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. // 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); result.marginIStart = computedMargin.IStart(wm);
return result; return result;
} }