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

> ```diff
> -However, limit the growth of any ''fit-content()'' tracks
> -by their ''fit-content()'' argument.
> ```

Good!

> ```diff
> -the |limit| is infinity if it is marked as [=infinitely growable=],
> +the |limit| is
> +the ''fit-content()'' argument if has a ''fit-content()'' [=track sizing function=],
> +infinity if it is marked as [=infinitely growable=],
> ```

This doesn't seem entirely right. Because if a `fit-content()` track isn't marked as infinitely growable, I don't think it should grow here even if the fit-content limit is higher. Example:

```css
.grid {
  display: grid;
  grid-template-columns: fit-content(100px) minmax(auto, max-content);
}
/* minimum contribution = 0px
   min-content contribution = 0px
   max-content contribution = 0px */
.grid-item-1 { grid-column: 1 / 2 }
.grid-item-2 { grid-column: 2 / 3 }

/* minimum contribution = 0px
   min-content contribution = 10px
   max-content contribution = 100px */
.grid-item-3 {
  grid-column: 1 / 3;
  min-width: 0;
}
.grid-item::before {
  content: "1 2 3 4 5 6 7 8 9 0";
  font: 10px/1 Ahem;
}
```

1. [¶12.5.2](https://drafts.csswg.org/css-grid/#algo-single-span-items) takes care of the non-spanning items, their intrinsic contribution is 0, so they just set the growth limit to 0, without the infinitely growable flag.
2. [¶12.5.3](https://drafts.csswg.org/css-grid/#algo-spanning-items).5 distributes the 10px among the growth limit of both tracks. So both growth limits become 5px.
3. [¶12.5.3](https://drafts.csswg.org/css-grid/#algo-spanning-items).6 distributes the 100px among the growth limit of both tracks. 10px already done, so 90px remaining. With the proposed text, the limit for the fit-content track is 100px, and the limit for the other track is 5px.
4. Result: the fit-content track ens up with a growth limit of 95px, the other track with 5px. But `fit-content(100px)` is supposed to be the smallest of `minmax(auto, 100px)` and `minmax(auto, max-content)`, so it shouldn't be bigger.

I would change it to:

> the limit is equal to the growth limit if the track is not marked as infinitely growable, otherwise it's the ''fit-content()'' argument if it has a ''fit-content()'' track sizing function, or +infinity otherwise.

Next:

> 
> ```diff
> -unfreeze and continue to distribute space to the |item-incurred increase| of…
> +unfreeze and continue to distribute space
> +to the unfrozen |item-incurred increase| of…
> ```
> ```diff
> -after which it is treated as having a <a>fixed sizing function</a> of that argument.
> +after which it is frozen at that [=fixed sizing function=].
> ```

No, we don't want to freeze permanently. Consider this case:

> when accommodating minimum contributions or accommodating min-content contributions: any affected track that happens to also have an intrinsic max track sizing function; if there are no such tracks, then all affected tracks. 

When the base sizes reach the fit-content limit, we want to stop considering them as having "an intrinsic max track sizing function". However, if we run out of tracks, we still want to distribute into them ("if there are no such tracks, then all affected tracks"). If we freeze, and only distribute to the unfrozen, we will skip them.

Actually, we only want to freeze in this case:

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

So I would stick with my old proposal of

```diff
@@ -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''
```

or, if you want to freeze, let's split that step into 2:

> 3. Distribute space beyond limits (1): If space remains after all tracks are frozen, unfreeze and continue to distribute space to the unfrozen item-incurred increase of…
> 
>    - when accommodating minimum contributions or accommodating min-content contributions or handling any intrinsic growth limit: any affected track that happens to also have an intrinsic max track sizing function.
>    - when accommodating max-content contributions: any affected track that happens to also have a max-content max track sizing function.
>
>    For this purpose, the max track sizing function of a fit-content() track is treated as max-content until it reaches the limit specified as the fit-content() argument, after which after which it is frozen at that fixed sizing function.
> 
> 4. Distribute space beyond limits (2): If space remains, and handling any intrinsic base size, unfreeze and continue to distribute space to the item-incurred increase of all affected tracks.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 18 June 2021 13:52:51 UTC