Re: [w3ctag/design-reviews] CSS calc-size() function (Issue #955)

First, I dispute that the signaling value of `calc-size()` can be ignored. A `calc-size()` is very specifically *not a number* and can't be used in places where numbers can; it's an intrinsic size usable only in a few specially-allowed places. This is distinct from other specialized uses of `calc()`, like their use in RCS with channel keywords, where the value takes some context from its surroundings but is afterwards just an ordinary number.

This also comes with a usability benefit, in that *because* there are behavior differences in layout algorithms based on what sizing keywords you're using, it's of some value to authors to ensure that it's clear and obvious which keyword it is being adjusted. Having it pulled out as the first argument of `calc-size()` accomplishes this. 

Relatedly, it's just plain valuable to know that the value *is* an intrinsic size, of *any* sort; having that behavior switch hidden in an arbitrarily-complex `calc()` isn't ideal. (It also would mean that we could no longer define that `calc()` is a `<length-percentage>`; it would only be so conditionally, based on the absence of such a keyword.)

Second, I explained why a separate function, and not just "keywords in calc()", was useful back in [the CSSWG thread that introduced this](https://github.com/w3c/csswg-drafts/issues/626#issuecomment-1869828293), *in direct response* to your comments in that thread, @LeaVerou.

If I ignore the ones related to interpolation (largely moot now), and put the signaling value to the side as well, the big remaining reason from that thread is that percentages can have intrinsic behavior, but they *already* have well-defined and interoperable behavior in calc() which will *not* smoothly interpolate. That is, if `100%` ends up cyclic, interpolating from `100%` to `0` will "behave as auto" for the entire duration of the transition, and then suddenly snap to 0 at the end. With `calc-size()` you can instead get smooth interpolation behavior from *any* starting size, regardless of what it is, simply by putting it as the first argument.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/955#issuecomment-2183558551
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/955/2183558551@github.com>

Received on Friday, 21 June 2024 22:55:36 UTC