- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Tue, 09 Nov 2021 19:00:28 +0000
- To: public-css-archive@w3.org
> calc() is turned into a calculation tree, but the procedure to serialize a calculation tree does not include a step to wrap it in calc(). Right, it shouldn't, that's handled by the "serialize a math function" algo, step 3. calc() is not a calculation, it's a math function which *contains* a "calculation" as its sole argument and whose *"internal representation"* is a calculation tree (see the first paragraph of [section 11.10](https://drafts.csswg.org/css-values/#calc-internal). When you're serializing CSS values, the CSS value is the math function; it's just that part of serializing that function involves serializing the calculation tree it's associated with. > If calc(), min(), and other functions are not calculations that contain calculation values, instead of being something that contains a calculation, I do not see how the calculation tree can be identified as a Min or Max node in step 5 of the procedure to simplify a calculation tree. See [section 11.10](https://drafts.csswg.org/css-values/#calc-internal) again - any math function *other than* a calc() has an internal representation that's a calculation tree whose root node is an operator node with the same name as the function. See also step 5 of "parse a calculation", which replaces math functions in the calculation tree with their internal representations (more calculation trees), so you get a homogenous tree of operators and numeric values. That's how something like `calc(1px + min(10px, 1em))` gets turned into the calculation tree `(Sum 1px (Min 10px 1em))`. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6802#issuecomment-964444669 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 9 November 2021 19:00:30 UTC