Re: [csswg-drafts] [css-grid] Unclear how to limit track growth by fit-content() argument (#4549)

My thoughts are:

 - Limiting the growth limit by the fit-content() argument only when handling `max-content` maximums but not when handling all intrinsic maximums (including `max-content`) seems an oversight. It should happen in both cases.
 - When the growth limit of a fit-content() track reaches the fit-content() limit and stops growing, we should try to grow other tracks to compensate (option B in the previous post).
 - We should try to respect fit-content() limits when accommodating minimums up to growth limits. Sure, minimums take precedence over maximums in case of conflict, but if we can distribute into other tracks, it makes sense to to so. E.g. if we are distributing 100px among 2 tracks `fit-content(10px)` and `auto` with infinite growth limits, then 10px 90px makes more sense than 50px 50px. If necessary, we can always grow beyond the fit-content() limit when distributing space beyond growth limits, thanks to the "if there are no such tracks, then all affected tracks".
   This seems also better for implementations. The most reasonable way to distribute contributions and freeze tracks when they reach some limit seems sorting the tracks by their growth potential (ascending). It would be undesirable to have to sort twice, first by growth limits for distributing up to growth limits, and then by fit-content() limits for distributing beyond growth limits.

So I propose something like:

```diff
@@ -4161,8 +4161,6 @@ Resolve Intrinsic Track Sizes</h3>
           a <a>max track sizing function</a> of ''max-content''
           by <a href="#extra-space">distributing extra space</a> as needed
           to account for these items' <a>max-content contributions</a>.
-          However, limit the growth of any ''fit-content()'' tracks
-          by their ''fit-content()'' argument.
       </ol>
 
       Repeat incrementally for items with greater spans until all items have been considered.
@@ -4233,13 +4231,15 @@ Distributing Extra Space Across Spanned Tracks</h4>
           <pre><var>extra-space</var> = max(0, <var>size-contribution</var> - ∑<var>track-sizes</var>)</pre>
 
         <li>
-          <strong>Distribute space to base sizes up to growth limits:</strong>
+          <strong>Distribute space to base sizes up to limits:</strong>
           Find the |item-incurred increase| for each spanned track with an affected size
           by: distributing the space equally among such tracks,
           freezing a track’s |item-incurred increase|
           as its affected size + |item-incurred increase|
-          reaches its <a>growth limit</a>
-          (and continuing to grow the unfrozen tracks as needed).
+          reaches its <a>growth limit</a>.
+          Also freeze ''fit-content()'' tracks
+          when they reach their ''fit-content()'' argument.
+          In both cases, continue to grow the unfrozen tracks as needed.
 
           If a track was marked as <a>infinitely growable</a> for this phase,
           treat its <a>growth limit</a> as infinite for this calculation
@@ -4265,7 +4265,8 @@ Distributing Extra Space Across Spanned Tracks</h4>
               if there are no such tracks, then all affected tracks.
             <li>
               when handling any intrinsic <a>growth limit</a>:
-              all affected tracks.
+              any affected track that happens to also have an intrinsic <a>max track sizing function</a>;
+              if there are no such tracks, then stop distributing space.
           </ul>
 
           For this purpose, ''fit-content()'' tracks are treated as ''max-content''
```

CC @MatsPalmgren @fantasai 

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4549#issuecomment-560126163 using your GitHub account

Received on Sunday, 1 December 2019 16:13:44 UTC