[csswg-drafts] [css-sizing] Nobody follows the spec about cyclic percentages in preferred&max sizing properties of replaced element (#11452)

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

== [css-sizing] Nobody follows the spec about cyclic percentages in preferred&max sizing properties of replaced element ==
https://drafts.csswg.org/css-sizing-3/#replaced-percentage-min-contribution

> If the box is [replaced](https://drafts.csswg.org/css-display-4/#replaced-element), a [cyclic percentage](https://drafts.csswg.org/css-sizing-3/#cyclic-percentage-size) in the value of any [max size property](https://drafts.csswg.org/css-sizing-3/#max-size-properties) or [preferred size property](https://drafts.csswg.org/css-sizing-3/#preferred-size-properties) ([width](https://drafts.csswg.org/css-sizing-3/#propdef-width)/[max-width](https://drafts.csswg.org/css-sizing-3/#propdef-max-width)/[height](https://drafts.csswg.org/css-sizing-3/#propdef-height)/[max-height](https://drafts.csswg.org/css-sizing-3/#propdef-max-height)), is resolved against zero when calculating the [min-content contribution](https://drafts.csswg.org/css-sizing-3/#min-content-contribution) in the corresponding axis.

For starters, this needs to then floor the max-content contribution by that amount, otherwise the min-content contribution could be larger:

```html
<canvas width="50" height="50" style="width: calc(100px + 0%)"></canvas>
```

 - Min-content contribution: `100px + 0px = 100px`
 - Max-content contribution: `50px`

But browsers don't have this problem, because they do not resolve percentages against zero. Instead, they treat the min-content contribution as zero:

```html
<!DOCTYPE html>
<div style="width: min-content; border: solid">
  <canvas width="50" height="50" style="width: calc(100px + 0%)"></canvas>
</div>
```

This is in fact analogous to #10969

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


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

Received on Tuesday, 7 January 2025 12:21:22 UTC