Closed Bug 1983756 Opened 2 months ago Closed 2 months ago

Abspos table or start-aligned block with non-auto insets and auto margins is laid out at a huge negative position

Categories

(Core :: Layout: Positioned, defect, P3)

defect

Tracking

()

RESOLVED FIXED
144 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox-esr140 --- wontfix
firefox142 --- wontfix
firefox143 --- wontfix
firefox144 --- fixed

People

(Reporter: Oriol, Assigned: dshin)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Or instead of display: table, align-self: start.

:dshin, since you are the author of the regressor, bug 1920160, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(dshin)

Set release status flags based on info from the regressing bug 1920160

Seems worth addressing sooner rather than later since it can cause missing content... But it's probably rare in practice?

Severity: -- → S3
Priority: -- → P3
Summary: Abspos table with non-auto insets and auto margins is laid out at a huge negative position → Abspos table or start-aligned block with non-auto insets and auto margins is laid out at a huge negative position

nsTableFrame::ComputeAutoSize returns unconstrained block size no matter what. This is because for tables, desired block size is computed after its children are reflowed.
That calls down from ReflowInput::InitAbsoluteConstraints where it's soon used for computation of auto margin in block direction.

Addressing this fundamentally probably requires a lot of table work. OTOH, it's probably a good idea to constrain the computed auto sizes to the abs-cb size so the content at least doesn't get hidden like this.

But per the above it's not specific to table, right? <div style="align-self: start"> also triggers this.

Basically any align-self different than auto, normal, stretch or center is broken.

The containing block of an abspos should be completely definite, and you resolve stretch correctly, so it's weird that you don't align correctly.

(Argh, comment 1, investigating further)

Right. When automatic block size becomes fit-content size size, we need to defer computation of auto margins to after layout, like we already do if we specify height: fit-content.

Wouldn't it be easier to always defer the computation of auto margins to after layout? That's how we do it in Servo.
https://github.com/servo/servo/blob/87fe202ded0fe9b0d61acda7ac81ab1714eb2389/components/layout/positioned.rs#L582-L600

May be worth pursuing - our abs offset/margin resolution is not the easiest to reason with because of this. Though that's (Unfortunately) a sizeable refactoring that should be worked as a separate bug.

Flags: needinfo?(dshin)
Assignee: nobody → dshin
Status: NEW → ASSIGNED
Blocks: 1985982
Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/8a50d94240fb https://hg.mozilla.org/integration/autoland/rev/af222f790798 Properly compute deferred auto margin sizes when abspos element's auto-size is fit-content size. r=layout-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/54634 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
Upstream PR merged by moz-wptsync-bot
Flags: in-testsuite+

The patch landed in nightly and beta is affected.
:dshin, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(dshin)

It's a pretty low-risk fix, but OTOH, we're pretty late into the beta phase, and I think this case (content-fit + auto margins + non-auto insets) won't be hugely common (The regressing bug 1920160 was closed 10 months ago).

Flags: needinfo?(dshin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: