commit 298bf96b4060eda1025742ddec94e44e1ff926d6
parent e81a02b99aae84128329ba94f829efda821fa642
Author: Ting-Yu Lin <tlin@mozilla.com>
Date: Mon, 8 Dec 2025 17:10:52 +0000
Bug 1985982 - Update comments in ReflowInput::InitAbsoluteConstraints(). r=layout-reviewers,emilio
Delete legacy XXX comments. It is true that we always compute the inline-size in
`nsIFrame::ComputeSize()`. However, we compute the offsets in the containing
block's writing mode. In orthogonal flow, the inline-size in containing block's
writing mode is the block-size of `mFrame`, which might still be unconstrained.
Note: changing `iSizeIsAuto` to `computedSize.ISize(cbwm)` could introduce test
failures in
`testing/web-platform/tests/css/css-position/position-absolute-table-001.html`,
because the table wrapper always has `auto` width/height, but
`nsTableWrapperFrame::ComputeAutoSize()` can resolve a definite width/height,
which acts as min-width/min-height. So the offsets are only correct when we
resolve them after reflowing the table.
Differential Revision: https://phabricator.services.mozilla.com/D275369
Diffstat:
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp
@@ -1874,9 +1874,6 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
size.mAspectRatioUsage == nsIFrame::AspectRatioUsage::ToComputeBSize;
}
- // XXX Now that we have ComputeSize, can we condense many of the
- // branches off of widthIsAuto?
-
LogicalMargin margin = ComputedLogicalMargin(cbwm);
const LogicalMargin borderPadding = ComputedLogicalBorderPadding(cbwm);
@@ -1903,13 +1900,9 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
mFlags.mDeferAutoMarginComputation =
nonZeroAutoMarginOnUnconstrainedSize || hasIntrinsicKeywordForBSize;
if (iStartIsAuto) {
- // We know 'right' is not 'auto' anymore thanks to the hypothetical
- // box code above.
- // Solve for 'left'.
+ // We know 'inset-inline-end' is not 'auto' anymore thanks to the
+ // hypothetical box code above. Solve for 'inset-inline-start'.
if (iSizeIsAuto) {
- // XXXldb This, and the corresponding code in
- // AbsoluteContainingBlock.cpp, could probably go away now that
- // we always compute widths.
offsets.IStart(cbwm) = NS_AUTOOFFSET;
} else {
offsets.IStart(cbwm) = aCBSize.ISize(cbwm) - offsets.IEnd(cbwm) -
@@ -1917,13 +1910,9 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
borderPadding.IStartEnd(cbwm);
}
} else if (iEndIsAuto) {
- // We know 'left' is not 'auto' anymore thanks to the hypothetical
- // box code above.
- // Solve for 'right'.
+ // We know 'inset-inline-start' is not 'auto' anymore thanks to the
+ // hypothetical box code above. Solve for 'inset-inline-end'.
if (iSizeIsAuto) {
- // XXXldb This, and the corresponding code in
- // AbsoluteContainingBlock.cpp, could probably go away now that
- // we always compute widths.
offsets.IEnd(cbwm) = NS_AUTOOFFSET;
} else {
offsets.IEnd(cbwm) = aCBSize.ISize(cbwm) - offsets.IStart(cbwm) -
@@ -1958,7 +1947,7 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
mStylePosition->BSize(cbwm, anchorResolutionParams.mBaseParams)
->BehavesLikeInitialValueOnBlockAxis();
if (bStartIsAuto) {
- // solve for block-start
+ // Solve for 'inset-block-start'.
if (bSizeIsAuto) {
offsets.BStart(cbwm) = NS_AUTOOFFSET;
} else {
@@ -1967,7 +1956,7 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
computedSize.BSize(cbwm) - offsets.BEnd(cbwm);
}
} else if (bEndIsAuto) {
- // solve for block-end
+ // Solve for 'inset-block-end'.
if (bSizeIsAuto) {
offsets.BEnd(cbwm) = NS_AUTOOFFSET;
} else {