[css-grid] Wrong sizes for implicit tracks when multiple values are provided (grid-auto-columns/rows)
Categories
(Core :: Layout: Grid, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: Oriol, Assigned: boris)
References
Details
(Keywords: testcase)
Attachments
(2 files)
Load attached testcase.
There is a symmetrical grid with
grid-template: 200px / 200px;
grid-auto-columns: 100px 400px;
grid-auto-rows: 100px 400px;
The grid has 3 tracks:
- 1 leading implicit track
- 1 explicit track
- 1 trailing implicit track
The explicit track is of course sized with 200px, the implicit tracks are sized with 100px 400px
according to https://drafts.csswg.org/css-grid/#auto-tracks
If multiple track sizes are given, the pattern is repeated as necessary to find the size of the implicit tracks. The first implicit grid track after the explicit grid receives the first specified size, and so on forwards; and the last implicit grid track before the explicit grid receives the last specified size, and so on backwards.
Therefore, the 3rd track (trailing implicit) should be sized with 100px.
And the 1st track (leading implicit) should be sized with 400px.
So the track sizes should be 400px 200px 100px
.
In Firefox they are 100px 200px 400px
.
Chromium does it correctly.
Comment 1•5 years ago
|
||
Thanks for the detailed report!
Reporter | ||
Comment 2•5 years ago
|
||
This logic seems wrong: https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/layout/generic/nsGridContainerFrame.cpp#1157-1161
// If multiple track sizes are given, the pattern is repeated as necessary
// to find the size of the implicit tracks.
return mAutoSizing.IsEmpty()
? kAutoTrackSize
: mAutoSizing.AsSpan()[aIndex % mAutoSizing.Length()];
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Per the spec, if multiple track sizes are given, the pattern is repeated as
necessary to find the size of the implicit tracks:
- The first implicit grid track after the explicit grid receives the first
specified size, and so on forwards. - The last implicit grid track before the explicit grid receives the last
specified size, and so on backwards.
We use a positive index of the auto track sizes for (1) and an negative index
for (2), so we can apply the correct specified implicit size.
Pushed by bchiou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4c34130cc58f Apply the correct specified implicit size. r=mats
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/20225 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Comment 8•4 years ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Description
•