зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1674450 Part 8 - Remove SizeComputationInput's one-argument methods to set margin, border/padding, and padding. r=layout-reviewers,jfkthame
The two-argument versions are clearer and easier to use because they work for any pair of writing mode and logical margin. Differential Revision: https://phabricator.services.mozilla.com/D95371
This commit is contained in:
Родитель
1531f4b093
Коммит
06aecc5c9f
|
@ -1832,8 +1832,7 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
|||
|
||||
SetComputedLogicalOffsets(offsets.ConvertTo(wm, cbwm));
|
||||
|
||||
LogicalMargin marginInOurWM = margin.ConvertTo(wm, cbwm);
|
||||
SetComputedLogicalMargin(marginInOurWM);
|
||||
SetComputedLogicalMargin(cbwm, margin);
|
||||
|
||||
// If we have auto margins, update our UsedMarginProperty. The property
|
||||
// will have already been created by InitOffsets if it is needed.
|
||||
|
@ -1843,7 +1842,7 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT(propValue,
|
||||
"UsedMarginProperty should have been created "
|
||||
"by InitOffsets.");
|
||||
*propValue = marginInOurWM.GetPhysicalMargin(wm);
|
||||
*propValue = margin.GetPhysicalMargin(cbwm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2491,8 +2490,8 @@ void SizeComputationInput::InitOffsets(WritingMode aCBWM, nscoord aPercentBasis,
|
|||
// try to do anything like handling 'auto' widths,
|
||||
// 'box-sizing', or 'auto' margins.
|
||||
SetComputedLogicalPadding(wm, LogicalMargin(wm));
|
||||
SetComputedLogicalBorderPadding(
|
||||
tableFrame->GetIncludedOuterBCBorder(mWritingMode));
|
||||
SetComputedLogicalBorderPadding(wm,
|
||||
tableFrame->GetIncludedOuterBCBorder(wm));
|
||||
}
|
||||
|
||||
// The margin is inherited to the table wrapper frame via
|
||||
|
@ -2566,7 +2565,7 @@ void ReflowInput::CalculateBlockSideMargins(LayoutFrameType aFrameType) {
|
|||
// usual overconstraint rules.
|
||||
if (availMarginSpace < 0) {
|
||||
margin.IEnd(cbWM) += availMarginSpace;
|
||||
SetComputedLogicalMargin(margin.ConvertTo(mWritingMode, cbWM));
|
||||
SetComputedLogicalMargin(cbWM, margin);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2626,14 +2625,13 @@ void ReflowInput::CalculateBlockSideMargins(LayoutFrameType aFrameType) {
|
|||
} else if (isAutoEndMargin) {
|
||||
margin.IEnd(cbWM) += availMarginSpace;
|
||||
}
|
||||
LogicalMargin marginInOurWM = margin.ConvertTo(mWritingMode, cbWM);
|
||||
SetComputedLogicalMargin(marginInOurWM);
|
||||
SetComputedLogicalMargin(cbWM, margin);
|
||||
|
||||
if (isAutoStartMargin || isAutoEndMargin) {
|
||||
// Update the UsedMargin property if we were tracking it already.
|
||||
nsMargin* propValue = mFrame->GetProperty(nsIFrame::UsedMarginProperty());
|
||||
if (propValue) {
|
||||
*propValue = marginInOurWM.GetPhysicalMargin(mWritingMode);
|
||||
*propValue = margin.GetPhysicalMargin(cbWM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2788,7 +2786,7 @@ bool SizeComputationInput::ComputeMargin(WritingMode aCBWM,
|
|||
if (marginAdjustment > 0) {
|
||||
LogicalMargin m = ComputedLogicalMargin();
|
||||
m.IStart(mWritingMode) += marginAdjustment;
|
||||
SetComputedLogicalMargin(m);
|
||||
SetComputedLogicalMargin(mWritingMode, m);
|
||||
}
|
||||
|
||||
return isCBDependent;
|
||||
|
|
|
@ -137,25 +137,14 @@ struct SizeComputationInput {
|
|||
const LogicalMargin& aMargin) {
|
||||
mComputedMargin = aMargin.ConvertTo(mWritingMode, aWM);
|
||||
}
|
||||
void SetComputedLogicalMargin(const LogicalMargin& aMargin) {
|
||||
SetComputedLogicalMargin(mWritingMode, aMargin);
|
||||
}
|
||||
|
||||
void SetComputedLogicalBorderPadding(mozilla::WritingMode aWM,
|
||||
const LogicalMargin& aBorderPadding) {
|
||||
mComputedBorderPadding = aBorderPadding.ConvertTo(mWritingMode, aWM);
|
||||
}
|
||||
void SetComputedLogicalBorderPadding(const LogicalMargin& aMargin) {
|
||||
SetComputedLogicalBorderPadding(mWritingMode, aMargin);
|
||||
}
|
||||
|
||||
void SetComputedLogicalPadding(mozilla::WritingMode aWM,
|
||||
const LogicalMargin& aPadding) {
|
||||
mComputedPadding = aPadding.ConvertTo(mWritingMode, aWM);
|
||||
}
|
||||
void SetComputedLogicalPadding(const LogicalMargin& aMargin) {
|
||||
SetComputedLogicalPadding(mWritingMode, aMargin);
|
||||
}
|
||||
|
||||
WritingMode GetWritingMode() const { return mWritingMode; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче