- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Thu, 23 Jul 2020 20:26:14 +0000
- To: public-css-archive@w3.org
Thinking better about this, in common cases the spanning algorithm doesn't clamp with fit-content limits at all. Which is bad.
Consider
```css
#grid {
display: grid;
width: 200px;
grid-template-columns: fit-content(75px) 0px;
}
#item {
grid-column: span 2;
min-width: 0;
}
#item::before, #item::after {
content: '';
height: 50px;
width: 50px;
float: left;
}
```
```html
<div id="grid">
<div id="item"></div>
</div>
```
The 2nd track just to trigger the spanning algorithm, has no effect.
We run the spanning algorithm:
1. For intrinsic minimums: no-op, the minimum contribution is 0 because of `min-width: 0`.
2. For content-based minimums: no-op, no track with `min-content` min track sizing function.
3. For max-content minimums: no-op, no track with `max-content` min track sizing function.
4. No-op, the base size is 0, smaller than the infinite growth limit.
5. For intrinsic maximums: we distribute the min-content contribution (50px) into the growth limit.
- Find the space to distribute: all these 50px.
- Distribute space up to limits: the limit is infinity, so the track takes all the 50px
- Distribute space beyond growth limits: no-op, all space has been distributed
- Result: the growth limit becomes 50px, and we flag the track as infinitely growable.
6. For max-content maximums: we distribute the max-content contribution (100px) into the growth limit:
- Find the space to distribute: the growth limit is already 50px, so we only have to distribute the remaining 50px.
- Distribute space up to limits: the limit is infinity because of the flag, so the track takes all the additional 50px
- Distribute space beyond growth limits: no-op, all space has been distributed
- Result: the growth limit is increased by 50px, becoming 100px.
The 75px fit-content limit has been ignored!
So either revert 64494c001f8a9da9bc0efd7bc760240b726f97a2 completely and leave the clamping undefined for now, or apply my suggestions.
--
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4549#issuecomment-663215186 using your GitHub account
Received on Thursday, 23 July 2020 20:26:15 UTC