Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sum & Product calculation node children should only get sorted for se…
…rialization 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
- Loading branch information
Showing
4 changed files
with
66 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters