Skip to content

[css-values-4] Properly handle simplification of sum nodes containing negated sum nodes #13020#13069

Merged
tabatkins merged 3 commits into
w3c:mainfrom
Calme1709:simplify-sums-with-negated-sums
May 8, 2026
Merged

[css-values-4] Properly handle simplification of sum nodes containing negated sum nodes #13020#13069
tabatkins merged 3 commits into
w3c:mainfrom
Calme1709:simplify-sums-with-negated-sums

Conversation

@Calme1709
Copy link
Copy Markdown
Contributor

Closes #13020

A WPT test already exists in the form of css/css-values/calc-nesting-002.html

… negated sum nodes w3c#13020

A WPT test already exists in the form of css/css-values/calc-nesting-002.html
Comment thread css-values-4/Overview.bs Outdated
@tabatkins tabatkins merged commit 8102aa6 into w3c:main May 8, 2026
1 check failed
@tabatkins
Copy link
Copy Markdown
Member

Looks good to me. Didn't think of this, but yes, pushing a negate into a sum makes perfect sense for simplification purposes.

Looks like Firefox is failing this test with an odd transformation - it pushes the Negate inward, but then further transforms the min() into a max() with negated arguments, which isn't supported in the spec.

Afaict, Safari is failing the test because it actually faithfully follows the spec, including for Product simplification: in this case (1 * (min(...) - 10px)), none of the simplification cases apply (it's got two children, one of which is a number and the other is a Sum, but that Sum does not contain only numeric values). Chrome (and Firefox) are simplifying the case regardless, just in different ways - Chrome is turning it into Sum(Negate(Min(...)), 10px), while Firefox, as I say above, is turning it into Sum(Max(...), 10px).

I'll open an issue about this latter transform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[css-values-4] Incomplete simplification of calculation sum node containing inverted sum nodes

2 participants