Skip to content

Commit

Permalink
[css-grid] Fix WPT grid-flex-track-intrinsic-sizes-002.html
Browse files Browse the repository at this point in the history
This test was checking that grid items not spanning any flex track with
an intrinsic min track sizing function would distribute its intrinsic
contribution in $11.5.3. That was according to the resolution from
w3c/csswg-drafts#3705

However, that wasn't web compatible, so it was later amended in
w3c/csswg-drafts#4783

Now, the intrinsic contributions of items spanning flex tracks must be
distributed in $11.5.4, even if none of the flex tracks is intrinsic.

This change makes the test pass in GridNG.

Bug: 1045599
Change-Id: Ibfb818dcc12a185e30d2824e9ca534069beb48ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2791426
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#867283}
  • Loading branch information
Loirooriol authored and chromium-wpt-export-bot committed Mar 29, 2021
1 parent d365491 commit 4fb0b5b
Showing 1 changed file with 7 additions and 12 deletions.
Expand Up @@ -54,21 +54,16 @@
// ├─╫─┼─┼─╢
// └─╚═╧═╧═╝

// The 1st item has spans less tracks (2) than the 2nd item (3),
// therefore its contribution (60px) is distributed first.
// All the 60px go to the 2nd track, since the 1st track is not intrinsic.
// Then the 2nd item only needs to distribute 150px-60px=90px
// among the 3rd and 4th tracks.
checkTrackSizes("minmax(0, 1fr) auto auto auto", "0px 60px 45px 45px");

// The 1st item now spans a flexible track with an intrinsic minimum,
// therefore its contribution (60px) is distributed last.
// The 1st item spans a flexible track, therefore its contribution (60px) is distributed last.
// The 2nd item distributes its contribution (150px) among the 2nd, 3rd and 4th tracks.
// Then the 1st item only needs to distribute 60px-50px=10px to the 1st track.
checkTrackSizes("1fr auto auto auto", "10px 50px 50px 50px");

// Now both items span a flexible track with an intrinsic minimum,
// so their contributions are handled simultaneously,
// Now the 1st item still spans a flexible track, but it's not intrinsic.
// Therefore, no track receives its intrinsic contribution.
checkTrackSizes("minmax(0, 1fr) auto auto auto", "0px 50px 50px 50px");

// Now both items span a flexible track, so their contributions are handled simultaneously,
// even if the 1st item still spans less tracks than the 2nd one.
// Therefore the distribution is as follows:
// - 1st track: 60px/2 = 30px
Expand Down Expand Up @@ -97,7 +92,7 @@
// Now the 1st item has a span of 1, so usually we would handle its contribution
// at the very beginning, before items that span multiple tracks.
// But not if its track is flexible, then it's still handled at the end,
// simultaneously with other items that span some intrinsic flexible track.
// simultaneously with other items that span some flexible track.
// - 1nd track: max(60px, 150px/3) = 60px
// - 2nd track: 150px/3 = 50px
// - 3rd track: 150px/3 = 50px
Expand Down

0 comments on commit 4fb0b5b

Please sign in to comment.