Re: [csswg-drafts] [css-shapes-1] Proposal: Option for the radii of `round` on `<basic-shape-rect>` to resolve percentages against the rectangle itself instead of the reference box (#12598)

**Workaround / Benefit**

While using calc as a workaround does technically work, it results in code that is not very easy to read. For comparison:
```
xywh(10mm 5mm 4em 3em round-self 33%)
xywh(10mm 5mm 4em 3em round calc(4em * 0.33) / calc(3em * 0.33))

rect(10mm 5mm 4em 3em round-self 33%)
rect(10mm 5mm 4em 3em round calc((5mm - 3em) * 0.33) / calc((4em - 10mm) * 0.33))

inset(10mm 5mm 4em 3em round-self 33%)
inset(10mm 5mm 4em 3em round calc((100% - 5mm - 3em) * 0.33) / calc((100% - 10mm - 4em) * 0.33))
```
We consider the difference in maintainability significant. And these are only cases with a single value for `round-self`. While less common, cases with multiple values make the calc workaround quite long and complex.

So we think there would actually be a relevant benefit to `round-self`.


**Resolving against different values**

We don't think that parameters of the same function being resolved against different values is a significant problem. Technically that is already happening as basic-shape-rect function parameters use width and height in turn.

But if that is considered a major issue in this design, we'd propose to turn `round-self` from a delimiting ident into a function:
```
xywh(10mm 5mm 4em 3em round-self(33%))
```
With 20/20 hindsight we'd say that ideally `round` could also have been a function. Then its parameters would already be separated form the ones of the basic-shape-rect function. `round-self` could then just be added as an alternative.

However, even with `round` already established as a delmiting ident, `round-self` could still be introduced as a function, just to separate its parameters from the ones of the basic-shape-rect function.

I'd like to stress that this is not our preferred approach, but if it eliminates a major concern we'd be fine with it.

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


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

Received on Wednesday, 3 December 2025 09:07:26 UTC