New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-values-4] Definition of a math function #6802
Comments
Also:
EDIT: I guess that |
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. 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.
See section 11.10 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 |
My misunderstanding came from the term/verb internal representation and representing, and also from how I match component values against a CSS grammar. In my implementation, component values are matched against CSS types from bottom to top ( Anyway, I found an implementation that seems to match the specification, and all tests for math functions pass, including cases like |
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.EDIT (answer): [for] any other math function [than
calc()
], the internal representation is an operator node with the same name as the function (11.10 - Internal Representation), then internal representations of math functions are eagerly simplified (11.10.1 - Simplification).The text was updated successfully, but these errors were encountered: