- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Tue, 07 Nov 2023 18:55:57 +0000
- To: public-css-archive@w3.org
> I'm a little hesitant about the syntax because I think it reads a bit more like a "way to fit content" rather than "take the fit-content result and multiply it by X and add Y". I admit I'm not entirely sure how to fix that without calling it calc(), though. Hm, that's an idea, tho. Call it `calc-size()`, it takes an intrinsic size keyword arg and a calculation arg that must resolve to a length or percentage. Within that calculation, you can use the keyword `size` to refer to the specified sizing keyword; it resolves to a length. The rest of the caveats continue to apply - the element counts as intrinsically sized, etc. For all layout purposes the function is treated as the specified keyword, so like `calc-size(max-content, ...)` triggers "sized under a max-content constraint" for its children, etc. So scaling from auto to 100px high would be `calc-size(fit-content, size)` to `calc-size(fit-content, 100px)`, and have an intermediate value of `calc-size(fit-content, size * .5 + 50px)`. This avoids the awkwardness of the `scale X add X` arguments, and lets authors potentially do much weirder stuff with the size value if they want, beyond just scaling it. Dunno *what* they would do, but it's well-defined and just as simple as doing scale + add. It also avoids the naming conflict with `fit-content()`, and even lets us use `fit-content()` as the first arg if desired. (Heck, maybe the first argument doesn't have to be limited to a sizing keyword, maybe it can just be any size and it'll resolve accordingly. Like, you can pass a % as the first arg and usefully work with it even if it's cyclic and triggers auto behavior. I don't think generalizing this adds any more complexity than already exists?) -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/626#issuecomment-1799573007 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 7 November 2023 18:55:58 UTC