[webkit-changes] [WebKit/WebKit] e06fc2: Sum & Product calculation node children should onl...
Chris Dumez
noreply at github.com
Thu Dec 8 10:31:34 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e06fc205e555343166257ba62d210b5244db8306
https://github.com/WebKit/WebKit/commit/e06fc205e555343166257ba62d210b5244db8306
Author: Chris Dumez <cdumez at apple.com>
Date: 2022-12-08 (Thu, 08 Dec 2022)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/transformvalue-normalization.tentative-expected.txt
M Source/WebCore/css/calc/CSSCalcOperationNode.cpp
M Source/WebCore/css/typedom/CSSNumericValue.cpp
Log Message:
-----------
Sum & Product calculation node children should only get sorted for serialization
https://bugs.webkit.org/show_bug.cgi?id=248925
Reviewed by Antti Koivisto.
Sum & Product calculation node children should only get sorted for
serialization, as per:
- https://drafts.csswg.org/css-values-4/#serialize-a-calculation-tree
- https://drafts.csswg.org/css-values-4/#sort-a-calculations-children
However, we were doing this eagerly after parsing the calculation value, during
the simplification step:
- https://w3c.github.io/csswg-drafts/css-values/#calc-simplification
This is observable with CSS Typed OM since the following:
`CSSStyleValue.parse("width", "calc(1px + 1em)")` would get parsed as
`new CSSMathSum(CSS.em(1), CSS.px(1))` instead of
`new CSSMathSum(CSS.px(1), CSS.em(1))`.
This was causing some CSS typed OM tests to fail.
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/transformvalue-normalization.tentative-expected.txt:
Rebaseline some WPT tests now that more checks are passing.
* Source/WebCore/css/calc/CSSCalcOperationNode.cpp:
(WebCore::sortChildren):
Factor the logic to sort sum / product children out of combineChildren() and
into a separate function. This is to avoid code duplication now that the logic
is needed in two places.
(WebCore::CSSCalcOperationNode::combineChildren):
- Stop sorting sum and product children during simplification, as this is
observable by CSS Typed OM and not as per spec
(https://w3c.github.io/csswg-drafts/css-values/#calc-simplification).
- Update the logic to simplify sum and product nodes to not rely on the
fact that the children were previously sorted (since this is not the
case anymore).
(WebCore::CSSCalcOperationNode::buildCSSTextRecursive):
- During serialization, if the node is a sum or a product, make sure to
sort the children before serializing them, as per the spec
(https://drafts.csswg.org/css-values-4/#serialize-a-calculation-tree).
* Source/WebCore/css/typedom/CSSNumericValue.cpp:
(WebCore::reifyMathExpression):
- Add a FIXME for a bug that I found in our math reification logic while
investigating this, so I remember to fix it later.
Canonical link: https://commits.webkit.org/257573@main
More information about the webkit-changes
mailing list