Re: [csswg-drafts] [css-values]: Express conditional values in a more terse way (#5009)

There's nothing special about "var() in calc()" - it's identical to var() anywhere else, and makes the property subject to IACVT.

The point is that calc() (and math functions in general) do *not* do that - they're exactly like any other ordinary value. There's no significant difference, functionality-wise, between `width: 10%` and `width: calc(10% + 2px)`, or any other math expression. Both of them are validated at parse-time (and so can be thrown out if invalid), and calc() doesn't introduce any dependencies between properties beyond what units themselves do.

> It also seems to me that cond((100% > 500px) …) and switch((available-inline-size > 500px) …) would usually mean the same thing.

"Usually the same thing" and "exactly the same thing" are a *very* wide gulf here. ^_^  The cond() is *exactly* as troublesome as a calc() would be - `width: calc(100% + 50px)` and `width: cond(100% > 500px; 20px; 30px)` both invoke the exact same machinery at the exact same time, and as far as the layout algorithms are concerned, they're identical - they're both functions that (in this case) involve a percentage, so in certain situations they'll behave as auto, in others they'll initially resolve the % to 0 and later resolve it against the true size, etc.  No fundamentally new machinery is involved.

Compare with `width: switch((available-inline-size > 500px) ...)`. `available-inline-size` should always resolve to a correct value; it's specifically meant to work in the kinds of situations that %s *don't* work in. It resolves "late" and causes its further internal layout to pause for it, until it knows for sure what its available inline size is.

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


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

Received on Wednesday, 24 February 2021 02:26:52 UTC