Skip to content
Permalink
Browse files
calc() simplification for a multiplication should apply the multiplic…
…ation to each value of an addition

https://bugs.webkit.org/show_bug.cgi?id=224376

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Mark 99 WPT progressions.

* web-platform-tests/css/css-backgrounds/animations/background-position-origin-interpolation-expected.txt:
* web-platform-tests/css/css-shapes/animation/shape-outside-interpolation-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-margin-003-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-circle-010-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-circle-011-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-ellipse-010-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-ellipse-011-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-inset-008-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-inset-009-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-polygon-006-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:

Source/WebCore:

An expression such as calc(0.5 * (100% + 100px)) should be simplified to calc(50% + 50px). We produce
these types of expressions when blending between a percentage and a dimension, and they can also be
specified explicitly in style.

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::combineChildren):

LayoutTests:

Rebase some non-WPT tests to account for new results.

* css3/calc/simplification-expected.txt:
* transitions/background-position-transitions-expected.txt:
* transitions/background-position-transitions.html:

Canonical link: https://commits.webkit.org/236434@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
graouts committed Apr 13, 2021
1 parent f46f0a8 commit 1bc29fec79b668323dcf8ce488bd1a0de3c9d4d4
Showing 20 changed files with 187 additions and 117 deletions.
@@ -1,3 +1,16 @@
2021-04-13 Antoine Quint <graouts@webkit.org>

calc() simplification for a multiplication should apply the multiplication to each value of an addition
https://bugs.webkit.org/show_bug.cgi?id=224376

Reviewed by Simon Fraser.

Rebase some non-WPT tests to account for new results.

* css3/calc/simplification-expected.txt:
* transitions/background-position-transitions-expected.txt:
* transitions/background-position-transitions.html:

2021-04-13 Said Abou-Hallawa <said@apple.com>

SVG paced value animations overwrite user-provided keyTimes
@@ -8,7 +8,7 @@ This tests parse time simplification in calc()
100in * (6 * (5 - 4) / 8) => calc(7200px)
1px * (3 + 1/(7 + 1/(15 + 1/(1 + 1/(292 + 1/(1 + 1/(1 + 1/(1 + 1)))))))) => calc(3.1415926535583574px)
100pc * 20 + 100rem * 10 - 100ch * 5 + 100pc => calc(-500ch + 33600px + 1000rem)
((100px + 20 * 5px) * 10 - 5 * (10em * 5 + 10em)) * 2 => calc(2 * (-300em + 2000px))
((100px + 20 * 5px) * 10 - 5 * (10em * 5 + 10em)) * 2 => calc(-600em + 4000px)
100px + 1in => calc(196px)
10 * 10px + 0.5 * 2in => calc(196px)
100px + 1in + 10% => calc(10% + 196px)
@@ -19,9 +19,9 @@ PASS - "webkitShapeOutside" property for "polygon2-box" element at 1s saw someth
PASS - "webkitShapeOutside" property for "circle-auto-box" element at 1s saw something close to: circle(50% at 50% 50%)
PASS - "webkitShapeOutside" property for "circle-to-topleft-box" element at 1s saw something close to: circle(35% at 25% 25%)
PASS - "webkitShapeOutside" property for "circle-to-topleft-box" element at 1s saw something close to: circle(35% at 25% 25%)
PASS - "webkitShapeOutside" property for "circle-to-bottomright-using-keyword-box" element at 1s saw something close to: circle(35% at calc(25% + (0.5 * (100% + 0px))) calc(25% + (0.5 * (100% + 0px))))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-using-keyword-box" element at 1s saw something close to: circle(35% at calc(25% + (0.5 * (100% + 0px))) calc(25% + (0.5 * (100% + 0px))))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-using-keyword-box" element at 1s saw something close to: circle(35% at calc(75% + 0px) calc(75% + 0px))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-using-keyword-box" element at 1s saw something close to: circle(35% at calc(75% + 0px) calc(75% + 0px))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-box" element at 1s saw something close to: circle(35% at 75% 75%)
PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-box" element at 1s saw something close to: circle(35% at 70% calc(25% + (0.5 * (100% - 20px))))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-2-box" element at 1s saw something close to: circle(35% at 70% calc(25% + (0.5 * (100% - 10px))))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-box" element at 1s saw something close to: circle(35% at 70% calc(75% - 10px))
PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-2-box" element at 1s saw something close to: circle(35% at 70% calc(75% - 5px)) border-box

@@ -143,11 +143,11 @@
["circle-auto-anim", 1, "circle-auto-box", "webkitShapeOutside", "circle(50% at 50% 50%)", 0.05],
["circle-to-topleft-anim", 1, "circle-to-topleft-box", "webkitShapeOutside", "circle(35% at 25% 25%)", 0.05],
["circle-to-topleft-anim", 1, "circle-to-topleft-box", "webkitShapeOutside", "circle(35% at 25% 25%)", 0.05],
["circle-to-bottomright-using-keyword-anim", 1, "circle-to-bottomright-using-keyword-box", "webkitShapeOutside", "circle(35% at calc(25% + (0.5 * (100% + 0px))) calc(25% + (0.5 * (100% + 0px))))", 0.05],
["circle-to-bottomright-using-keyword-anim", 1, "circle-to-bottomright-using-keyword-box", "webkitShapeOutside", "circle(35% at calc(25% + (0.5 * (100% + 0px))) calc(25% + (0.5 * (100% + 0px))))", 0.05],
["circle-to-bottomright-using-keyword-anim", 1, "circle-to-bottomright-using-keyword-box", "webkitShapeOutside", "circle(35% at calc(75% + 0px) calc(75% + 0px))", 0.05],
["circle-to-bottomright-using-keyword-anim", 1, "circle-to-bottomright-using-keyword-box", "webkitShapeOutside", "circle(35% at calc(75% + 0px) calc(75% + 0px))", 0.05],
["circle-to-bottomright-extended-anim", 1, "circle-to-bottomright-extended-box", "webkitShapeOutside", "circle(35% at 75% 75%)", 0.05],
["circle-to-bottomright-extended-using-keyword-anim", 1, "circle-to-bottomright-extended-using-keyword-box", "webkitShapeOutside", "circle(35% at 70% calc(25% + (0.5 * (100% - 20px))))", 0.01],
["circle-to-bottomright-extended-using-keyword-2-anim", 1, "circle-to-bottomright-extended-using-keyword-2-box", "webkitShapeOutside", "circle(35% at 70% calc(25% + (0.5 * (100% - 10px))))", 0.01],
["circle-to-bottomright-extended-using-keyword-anim", 1, "circle-to-bottomright-extended-using-keyword-box", "webkitShapeOutside", "circle(35% at 70% calc(75% - 10px))", 0.01],
["circle-to-bottomright-extended-using-keyword-2-anim", 1, "circle-to-bottomright-extended-using-keyword-2-box", "webkitShapeOutside", "circle(35% at 70% calc(75% - 5px)) border-box", 0.01],
];

runAnimationTest(expectedValues);
@@ -1,3 +1,24 @@
2021-04-13 Antoine Quint <graouts@webkit.org>

calc() simplification for a multiplication should apply the multiplication to each value of an addition
https://bugs.webkit.org/show_bug.cgi?id=224376

Reviewed by Simon Fraser.

Mark 99 WPT progressions.

* web-platform-tests/css/css-backgrounds/animations/background-position-origin-interpolation-expected.txt:
* web-platform-tests/css/css-shapes/animation/shape-outside-interpolation-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-margin-003-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-circle-010-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-circle-011-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-ellipse-010-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-ellipse-011-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-inset-008-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-inset-009-expected.txt:
* web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-polygon-006-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:

2021-04-13 Said Abou-Hallawa <said@apple.com>

SVG paced value animations overwrite user-provided keyTimes

0 comments on commit 1bc29fe

Please sign in to comment.