Open Bug 1838501 Opened 2 years ago Updated 2 years ago

[css-grid-1] Application of grid-positioning properties to static position of grid children is inconsistent

Categories

(Core :: Layout: Grid, defect)

defect

Tracking

()

ASSIGNED

People

(Reporter: mozilla-apprentice, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

A resolution was made for csswg-drafts/#7661.

[css-grid-1] Application of grid-positioning properties to static position of grid children is inconsistent

  • RESOLVED: Go with the content-box (option 2)

Discussion.

The resolved-upon "option 2" is discussed a bit more in this earlier comment: https://github.com/w3c/csswg-drafts/issues/7661#issuecomment-1551707447

See also the clarifications/confirmations in my later comment:
https://github.com/w3c/csswg-drafts/issues/7661#issuecomment-1561546264

FWIW IanK is updating WPT tests to reflect this spec change, in https://github.com/web-platform-tests/wpt/pull/40710

If I'm not mistaken: those test changes make current Firefox Nightly newly fail ~27 interop-2023-relevant tests in the css/css-grid/abspos directory.

[details follow, for folks curious about metrics/score]

Results with the current test set: we pass 169.5 / 171 score-relevant tests in that directory:
https://wpt.fyi/results/css/css-grid/abspos?sha=2cf035c769&label=experimental&label=master&product=chrome&product=firefox&view=interop&q=label%3Ainterop-2021-grid%20or%20label%3Ainterop-2023-grid

Results with IanK's PR: we pass 28.57 / 57 of the tests in that directory (i.e. we fail 28.43 tests) -- note that not all of the tests were run, but of the ones that were, we fail 28.43 of them:
https://wpt.fyi/results/css/css-grid/abspos?sha=5fcd4da0c2&label=pr_head&label=experimental&product=chrome&product=firefox&view=interop&q=label%3Ainterop-2021-grid%20or%20label%3Ainterop-2023-grid

So that indicates that we're going from 1.5 test-failures in that directory to 28.43 test-failures, which represents 26.93 new test failures. Assuming the total number of tests remains the same for the "grid" focus area (current total: 1043), these new test failures represent a 26.93 / 1043 = ~2.6% regression in our score for the grid focus area, which represents a ~0.1% regression in the overall top-level score (dividing 2.6% by 26 since there are 26 equally-weighted focus areas).

I think the relevant code to update here is probably around here, in OffsetToAlignedStaticPos(:
https://searchfox.org/mozilla-central/rev/6755226f52a02eac8b18f25a6f522e9c0814b628/layout/generic/nsAbsoluteContainingBlock.cpp#507-513

} else if (parentType == LayoutFrameType::GridContainer) {
  // This abspos elem's parent is a grid container. Per CSS Grid 10.1 & 10.2:
  //  - If the grid container *also* generates the abspos containing block (a
  // grid area) for this abspos child, we use that abspos containing block as
  // the alignment container, too. (And its size is aAbsPosCBSize.)
  //  - Otherwise, we use the grid's padding box as the alignment container.
  // https://drafts.csswg.org/css-grid/#static-position
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Depends on: 1269017
You need to log in before you can comment on or make changes to this bug.