[csswg-drafts] [css-values][css-images] Unit algebra with `<flex>` in `stripes()` leads to a contradiction (#9667)

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

== [css-values][css-images] Unit algebra with `<flex>` in `stripes()` leads to a contradiction ==
https://drafts.csswg.org/css-images-4/#stripes

> A [`<flex>`](https://www.w3.org/TR/css-grid-2/#typedef-flex) is evaluated as a fraction of the total width relative to the total sum of `<flex>` entries in the function, after subtracting the thickness of any non-`<flex>` entries (flooring the subtraction result at zero). If the sum of `<flex>` values is less than `1fr`, the result of the subtraction is multiplied by the sum’s value before being distributed.

Suppose a total width of 100px, what should happen with `stripes(#000 50px, #111 calc(1fr / 1fr * 50px), #222 1fr)`?
- 1st stripe is a `<length>` of 50px
- 2nd stripe is a `<length>` of `calc(1fr / 1fr * 50px)` :sweat: 
- 3rd stripe is a `<flex>` of `1fr`

Then,
 - If we assume that `1fr` is not zero, the 2nd stripe is 50px thick, and so we distribute `100px - 50px - 50px` into `1fr`, so the third stripe is 0px thick. So the final thicknesses are `50px, 50px, 0px`, but this is a contradiction because we assumed that `1fr` wasn't zero.
 - If we assume that `1fr` is zero, the 2nd stripe gets a `NaN * px` which is censored into 0px at the top-level calculation. So we distribute `100px - 50px - 0px` into `1fr`, so the 3rd stripe is 50px thick. So the final thicknesses are `50px, 0px, 50px`, but this is a contradiction because we assumed that `1fr` was zero.

Thus it's a contradiction either way. How to solve it?

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


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

Received on Friday, 1 December 2023 16:35:09 UTC