Closed Bug 1840796 Opened 11 months ago Closed 11 months ago

WPT css/css-flexbox/alignment/flex-align-baseline-flex-003.html and flex-align-baseline-flex-004.html fail in Firefox

Categories

(Core :: Layout: Flexbox, defect)

defect

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: dholbert, Assigned: TYLin)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We fail various subtests in these two WPTs:
https://wpt.fyi/results/css/css-flexbox/alignment/flex-align-baseline-flex-003.html
https://wpt.fyi/results/css/css-flexbox/alignment/flex-align-baseline-flex-004.html

http://wpt.live/css/css-flexbox/alignment/flex-align-baseline-flex-003.html
http://wpt.live/css/css-flexbox/alignment/flex-align-baseline-flex-004.html

Looking at the first failure in -003 test: the test is doing e.g. first baseline alignment between a flex container and another element, and it's testing whether we export the correct baseline for that flex container.

In this case the test seems to be expecting that the flex container should derive its first baseline from an item in its first row, and that item happens to be last baseline aligned. (There are no first-baseline aligned items in that first row.) We instead fall back to just using the first flex item.

The relevant spec text is here:
https://drafts.csswg.org/css-flexbox-1/#flex-baselines

If any of the flex items on the flex container’s startmost/endmost flex line participate in baseline alignment, the flex container’s first/last main-axis baseline set is generated from the shared alignment baseline of those flex items.

This doesn't say anything about requiring the flex items to be participating in first vs. last baseline alignment; just whether they "participate in baseline alignment".

So we probably need to adjust the logic here:
https://searchfox.org/mozilla-central/rev/c0adc2160976e2c118e2e5709d08aac071fddce9/layout/generic/nsFlexContainerFrame.cpp#5257-5262
...to fall back from FirstBaselineOffset() to the line's LastBaselineOffset() before we finally give up and fall back to the sentinel value to trigger the first flex item.

Likewise, we should also consider first baseline in the endmost line when
computing flex container last baseline.

Fixed the XXX comment by using logical coordinates. This is necessary to pass
flex-align-baseline-flex-004.html because it tests a vertical-rl flex container.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Duplicate of this bug: 1839947
Blocks: 1841173
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/fb3b06cc9188
Consider last baseline in the startmost line when computing flex container first baseline. r=dholbert
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: