Closed Bug 1870949 Opened 6 months ago Closed 6 months ago

Firefox uses central baseline when synthesizing a baseline from border-box of (orthogonal) vertical-writing-mode grid item

Categories

(Core :: Layout: Grid, defect)

defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox123 --- verified
firefox124 --- verified

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(4 files)

STR:

  1. Load https://bugzilla.mozilla.org/attachment.cgi?id=9369318

EXPECTED RESULTS:
Text should be aligned with the bottom border-edge of the cyan box.

ACTUAL RESULTS:
The text is aligned with the center of the cyan box.

This is the remaining part of getting us to passing on the WPT in bug 1833486. I'm spinning it off to its own bug in case there's anything remaining there, and since it's kind of unrelated to what that WPT is focused on (which is subgrid stretch behavior).

I've stepped through in gdb and it looks like the root issue here happens when we get to this snippet
https://searchfox.org/mozilla-central/rev/008ce958417fd724e02748740d669aafd49debb3/layout/generic/nsGridContainerFrame.cpp#9673,9690,9702

if (aAxis == eLogicalAxisBlock) {
...
} else {
...
    baseline = ::SynthesizeBaselineFromBorderBox(aGroup, childWM, size);

When we step into SynthesizeBaselineFromBorderBox, we see that childWM is a vertical writing mode and we interpret that to mean that we should use a central baseline. But in fact that would only make sense if we were getting a baseline in the other axis. In this case we're getting a vertical baseline (i.e. a distance from the top of the page) which is in the opposite axis from the one where the child would use a central baseline.

Hmm, so swapping from childWM to aCBWM fixes the linked testcase (attachment 9369318 [details]) but it still doesn't fix the issue in https://wpt.fyi/results/css/css-grid/subgrid/subgrid-stretch.html

In particular, it looks like we're still broken if the grid item itself has display:grid, so that's probably triggering a different codepath that needs a similar fix.

Attachment #9369566 - Attachment description: testcase 2 (testing vairous display values on grid item) → testcase 2 (testing various display values on grid item)
Attachment #9369567 - Attachment description: WIP: Bug 1870949: When synthesizing a baseline, choose central vs. alphabetic using the rules of the outer writing-mode rather than the inner one. r?TYLin → Bug 1870949: When synthesizing a baseline from a grid item, don't bother with central baselines if we're getting a measurement in the item's inline axis. r?TYLin
Attachment #9369567 - Attachment description: Bug 1870949: When synthesizing a baseline from a grid item, don't bother with central baselines if we're getting a measurement in the item's inline axis. r?TYLin → Bug 1870949 part 1: When synthesizing a baseline from a grid item, don't bother with central baselines if we're getting a measurement in the item's inline axis. r?TYLin
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bafa1b145894
part 1: When synthesizing a baseline from a grid item, don't bother with central baselines if we're getting a measurement in the item's inline axis. r=TYLin
https://hg.mozilla.org/integration/autoland/rev/4713b1c806dd
part 2: Add a WPT to check some grid synthesized baseline behavior. r=TYLin
https://hg.mozilla.org/integration/autoland/rev/8319ba83d9cb
part 3: Add a few variants of the WPT for grid synthesized baselines. r=TYLin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43764 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-123b-p2]

Reproducible on a 2023-12-18 Nightly build on macOS 12.
Verified as fixed on Firefox 123.0 and Firefox Nightly 124.0a1 on Windows 10, Ubuntu 22, macOS 12.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-123b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: