[csswg-drafts] [css-grid-1] Resolving repeat counts for percentage tracks with indefinite width + definite max-width (#4480)

fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid-1] Resolving repeat counts for percentage tracks with indefinite width + definite max-width ==
From @Loirooriol in https://github.com/w3c/csswg-drafts/issues/4043:

>  I think there is the remaining case of both sizing functions being indefinite, like a grid container with `width: max-content; max-width: 100px; grid-template-columns: repeat(auto-fill, 50%)`. This falls into this case because the max size is definite, but the preferred size is intrinsic, so the percentage track size is initially treated as auto, right?

The spec currently says:

> When auto-fill is given as the repetition number, if the grid container has a definite size or max size in the relevant axis, then **the number of repetitions is the largest possible positive integer that does not cause the grid to overflow its grid container** (treating each track as its max track sizing function if that is definite or as its minimum track sizing function otherwise, and taking gap into account); if any number of repetitions would overflow, then 1 repetition. Otherwise, if the grid container has a definite min size in the relevant axis, the number of repetitions is the smallest possible positive integer that fulfills that minimum requirement. Otherwise, the specified track list repeats only once.

The intention was to make the repetition calculation something that can be performed without resolving indefinite sizes on the grid or the tracks, but if the grid has an indefinite min size, for example, the current wording doesn't handle that case well.

Probably what should happen is we resolve percentages and calculate the repetitions against the hypothetical size of the grid, where the hypothetical size is the first definite option of { preferred size, max size, min size } and is clamped by any definite min or max size.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4480 using your GitHub account

Received on Friday, 1 November 2019 22:21:15 UTC