[csswg-drafts] [css-grid] Unclear how to 'limit the growth of any fit-content() tracks by their fit-content() argument' (#4549)

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

== [css-grid] Unclear how to 'limit the growth of any fit-content() tracks by their fit-content() argument' ==
From https://drafts.csswg.org/css-grid/#algo-spanning-items,

> - For max-content maximums:
>    Lastly continue to increase the growth limit of tracks with a max track sizing function of max-content by distributing extra space as needed to account for these items' max-content contributions. **However, limit the growth of any fit-content() tracks by their fit-content() argument.**

The last sentence could be applied in different ways, I can see 2 reasonable options:

 - Option A: In https://drafts.csswg.org/css-grid/#extra-space run step 2 as normal, but at step 3 'Update the tracks' affected sizes' clamp the planned increase, i.e.

       affectedSize += plannedIncrease

    becomes

       affectedSize += clamp(0, plannedIncrease, fitContentArgument - affectedSize)

 - Option B: impose this limit during step 2.

    The 'Distribute space to base sizes up to growth limit' is not affected, it's no-op since the affected size is a growth limit in this case.

    During 'Distribute space beyond growth limits', when it says

    > when handling any intrinsic growth limit: all affected tracks. 

    actually only distribute among the tracks that are still treated as having a max-content max track sizing function, and stop distributing once they reach their fit-content() argument and start being treated as fixed.

With both options we may end up not distributing all the space (all tracks could have `fit-content(0)`). The difference is that with option A we are more likely to distribute less space, while in B we will fallback to distributing to other tracks if possible.

Actually I don't really understand what the spec is trying to do by limiting the growth by the fit-content() argument only when dealing with max-content maximums, but not for intrinsic maximums. I also wonder whether 'Distribute space to base sizes up to growth limit' should freeze when a base size reaches a fit-content() argument smaller than the growth limit, and leave further increases for 'Distribute space beyond growth limits'.

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

Received on Saturday, 30 November 2019 21:25:10 UTC