Closed Bug 1977501 Opened 10 months ago Closed 10 months ago

Orthogonal grid item has incorrect intrinsic contribution to grid container's inline size

Categories

(Core :: Layout: Grid, defect)

defect

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [grid-percentages:m1], [wptsync upstream])

Attachments

(7 files)

I'm looking at the behavior difference between Chrome and Firefox of this reftest https://searchfox.org/mozilla-central/rev/c329cccde3e1e6f5d71d87c62b3db7e9f5fecb3c/layout/reftests/css-grid/grid-item-sizing-percent-004.html

Attached a reduced testcase from the above reftest.

Whiteboard: [grid-percentages:triage]
Whiteboard: [grid-percentages:triage] → [grid-percentages:m1]

When creating ReflowInput for grid items, the grid container always pass
customized containing block size [1], so ReflowInput constructor should
account for this in the orthogonal scenarios.

[1] https://searchfox.org/mozilla-central/rev/146c8d8d1f3cf15be3c263808f9674a97752c41a/layout/generic/ReflowInput.h#606-610,621

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

GridReflowInput::PercentageBasisFor() considers track sizes, and resolve
correct percentage basis for a grid item if a given axis has a definite track
size.

The aPercentageBasis argument on ContentContribution() is computed in
CachedIntrinsicSizes constructor [1].

This patch also updates the documentation for PercentageBasisFor().
Specifically, delete the description of the implementation details that
described the legacy behavior, i.e.
layout.css.grid-multi-pass-track-sizing.enabled=false.

[1] https://searchfox.org/mozilla-central/rev/146c8d8d1f3cf15be3c263808f9674a97752c41a/layout/generic/nsGridContainerFrame.cpp#6001

After Part 1 and Part 2, grid-size-with-orthogonal-child-001.html passes
regardless of layout.css.grid-multi-pass-track-sizing.enabled preference.

After Part 2, cbSize is initialized from aPercentageBasis, which will
contain a definite column size occupied by the grid item, if it is resolvable.
Therefore, we don't need to resolve the column size again in
ContentContribution().

This patch does not change behavior.

Duplicate of this bug: 1453571
Blocks: 1957244
Pushed by aethanyc@gmail.com: https://github.com/mozilla-firefox/firefox/commit/037f70e45b94 https://hg.mozilla.org/integration/autoland/rev/689d379c3891 Part 1 - Use customized containing block size passing into ReflowInput in orthogonal scenarios. r=layout-grid-reviewers,dholbert https://github.com/mozilla-firefox/firefox/commit/aebb6efabf43 https://hg.mozilla.org/integration/autoland/rev/70bf8cc7f24d Part 2 - Use correct percentage basis when performing measuring reflow for grid items. r=layout-grid-reviewers,dholbert https://github.com/mozilla-firefox/firefox/commit/e9d4ea6e6c4d https://hg.mozilla.org/integration/autoland/rev/0bf72b949a22 Part 3 - Update WPT expectations. r=layout-grid-reviewers,dholbert https://github.com/mozilla-firefox/firefox/commit/231a6e0c21f9 https://hg.mozilla.org/integration/autoland/rev/d33518bccc0e Part 4 - Tweak grid-item-sizing-percent-004-ref.html to reflect the new behavior. r=layout-grid-reviewers,dholbert https://github.com/mozilla-firefox/firefox/commit/29f249161953 https://hg.mozilla.org/integration/autoland/rev/439deeba0e48 Part 5 - Add additional WPTs for orthogonal grid item. r=layout-grid-reviewers,dholbert https://github.com/mozilla-firefox/firefox/commit/79585f32f3ac https://hg.mozilla.org/integration/autoland/rev/320fe0da2b9f Part 6 - Get column size from cbSize instead of resolving it again in ContentContribution(). r=layout-grid-reviewers,dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/54045 for changes under testing/web-platform/tests
Whiteboard: [grid-percentages:m1] → [grid-percentages:m1], [wptsync upstream]
Upstream PR merged by moz-wptsync-bot
Duplicate of this bug: 1841315
Duplicate of this bug: 1841679
Duplicate of this bug: 1716493
Duplicate of this bug: 1959294
QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: