- Revision
- 276554
- Author
- [email protected]
- Date
- 2021-04-24 12:36:27 -0700 (Sat, 24 Apr 2021)
Log Message
Improve parsing and computed style of the rotate CSS property
https://bugs.webkit.org/show_bug.cgi?id=225019
Reviewed by Dean Jackson.
LayoutTests/imported/w3c:
Mark 2 WPT progressions and add some new parsing WPT tests for rotate.
* web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt: We don't support additive interpolation,
the FAIL result is most likely a test that passed without proper support for the feature which now fails due to lack of
support for this feature.
* web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt:
* web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid.html:
* web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:
Source/WebCore:
There were a few issues with how we parsed the rotate CSS property and how we dealt with it
when resolving the computed style.
When parsing, we required individual vector coordinates to be 1 when others were 0 for a vector
to be considered parallel with the x, y or z axis. We now support any positive value. Then, as
we create the TransformOperation from the CSSValue, we must set the type to ROTATE_3D instead
of ROTATE_Z if the z axis was specified through the CSS value. Indeed, ROTATE_Z is equivalent
to ROTATE and without setting this type to ROTATE_3D, TransformOperation::is3DOperation() would
return false.
This is important because when figuring out the computed style, we should only return an angle
without a rotation vector if TransformOperation::is3DOperation() is false. For the case where
the operation was specified in 3D, we now use the same rule used when parsing to determine
whether the rotation vector is parallel with the x, y or z axis to use the matching keywords.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::computedRotate):
* css/TransformFunctions.cpp:
(WebCore::rotateForValue):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeRotate):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-24 19:36:27 UTC (rev 276554)
@@ -1,5 +1,23 @@
2021-04-24 Antoine Quint <[email protected]>
+ Improve parsing and computed style of the rotate CSS property
+ https://bugs.webkit.org/show_bug.cgi?id=225019
+
+ Reviewed by Dean Jackson.
+
+ Mark 2 WPT progressions and add some new parsing WPT tests for rotate.
+
+ * web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt: We don't support additive interpolation,
+ the FAIL result is most likely a test that passed without proper support for the feature which now fails due to lack of
+ support for this feature.
+ * web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt:
+ * web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid.html:
+ * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
+ * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:
+ * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:
+
+2021-04-24 Antoine Quint <[email protected]>
+
Support interpolation of the background-repeat shorthand
https://bugs.webkit.org/show_bug.cgi?id=225016
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt 2021-04-24 19:36:27 UTC (rev 276554)
@@ -5,18 +5,18 @@
FAIL Compositing: property <rotate> underlying [100deg] from add [10deg] to add [30deg] at (0.75) should be [125deg] assert_equals: expected "125deg " but got "25deg "
FAIL Compositing: property <rotate> underlying [100deg] from add [10deg] to add [30deg] at (1) should be [130deg] assert_equals: expected "130deg " but got "30deg "
FAIL Compositing: property <rotate> underlying [100deg] from add [10deg] to add [30deg] at (2) should be [150deg] assert_equals: expected "150deg " but got "50deg "
-FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (-1) should be [1 0 0 160deg] assert_equals: expected "1 0 0 160deg " but got "1 0 0 - 240deg "
-FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (0) should be [1 0 0 100deg] assert_equals: expected "1 0 0 100deg " but got "1 0 0 - 100deg "
-FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (0.25) should be [1 0 0 85deg] assert_equals: expected "1 0 0 85deg " but got "1 0 0 - 65deg "
-FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (0.75) should be [1 0 0 55deg] assert_equals: expected "1 0 0 55deg " but got "1 0 0 5deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (-1) should be [1 0 0 160deg] assert_equals: expected "x 160deg " but got "x - 240deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (0) should be [1 0 0 100deg] assert_equals: expected "x 100deg " but got "x - 100deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (0.25) should be [1 0 0 85deg] assert_equals: expected "x 85deg " but got "x - 65deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (0.75) should be [1 0 0 55deg] assert_equals: expected "x 55deg " but got "x 5deg "
PASS Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (1) should be [1 0 0 40deg]
-FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (2) should be [1 0 0 -20deg] assert_equals: expected "1 0 0 - 20deg " but got "1 0 0 180deg "
-FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (-1) should be [0 1 0 130deg] assert_equals: expected "0 1 0 130deg " but got "0 1 0 90deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 200deg] from add [1 0 0 -100deg] to replace [1 0 0 40deg] at (2) should be [1 0 0 -20deg] assert_equals: expected "x - 20deg " but got "x 180deg "
+FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (-1) should be [0 1 0 130deg] assert_equals: expected "y 130deg " but got "y 90deg "
PASS Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (0) should be [0 1 0 50deg]
-FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (0.25) should be [0 1 0 30deg] assert_equals: expected "0 1 0 30deg " but got "0 1 0 40deg "
-FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (0.75) should be [0 1 0 -10deg] assert_equals: expected "0 1 0 - 10deg " but got "0 1 0 20deg "
-FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (1) should be [0 1 0 -30deg] assert_equals: expected "0 1 0 - 30deg " but got "0 1 0 10deg "
-FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (2) should be [0 1 0 -110deg] assert_equals: expected "0 1 0 - 110deg " but got "0 1 0 - 30deg "
+FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (0.25) should be [0 1 0 30deg] assert_equals: expected "y 30deg " but got "y 40deg "
+FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (0.75) should be [0 1 0 -10deg] assert_equals: expected "y - 10deg " but got "y 20deg "
+FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (1) should be [0 1 0 -30deg] assert_equals: expected "y - 30deg " but got "y 10deg "
+FAIL Compositing: property <rotate> underlying [0 1 0 -40deg] from replace [0 1 0 50deg] to add [0 1 0 10deg] at (2) should be [0 1 0 -110deg] assert_equals: expected "y - 110deg " but got "y - 30deg "
FAIL Compositing: property <rotate> underlying [1 2 3 40deg] from add [2 4 6 10deg] to add [3 6 9 50deg] at (-1) should be [1 2 3 10deg] assert_equals: expected "1 2 3 10deg " but got "- 0.27 - 0.53 - 0.8 30deg "
FAIL Compositing: property <rotate> underlying [1 2 3 40deg] from add [2 4 6 10deg] to add [3 6 9 50deg] at (0) should be [1 2 3 50deg] assert_equals: expected "1 2 3 50deg " but got "0.27 0.53 0.8 10deg "
FAIL Compositing: property <rotate> underlying [1 2 3 40deg] from add [2 4 6 10deg] to add [3 6 9 50deg] at (0.25) should be [1 2 3 60deg] assert_equals: expected "1 2 3 60deg " but got "0.27 0.53 0.8 20deg "
@@ -35,11 +35,11 @@
FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [2 4 6 270deg] to replace [0 1 0 100deg] at (0.75) should be [-1.51909e-17 1 -4.55726e-17 75deg] assert_equals: expected "0 1 0 75deg " but got "- 0.11 0.93 - 0.34 71.18deg "
PASS Compositing: property <rotate> underlying [1 2 3 90deg] from add [2 4 6 270deg] to replace [0 1 0 100deg] at (1) should be [0 1 0 100deg]
FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [2 4 6 270deg] to replace [0 1 0 100deg] at (2) should be [-3.3235e-17 -1 -9.97049e-17 160deg] assert_equals: expected "0 - 1 0 160deg " but got "- 0.22 - 0.73 - 0.65 120.66deg "
-FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (-1) should be [-6.12323e-17 -1 1.57009e-16 90deg] assert_equals: expected "0 - 1 0 90deg " but got "y 90deg "
-FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (0) should be [-4.32978e-17 -0.707107 -0.707107 180deg] assert_equals: expected "0 - 0.71 - 0.71 180deg " but got "0 - 1 0 180deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (-1) should be [-6.12323e-17 -1 1.57009e-16 90deg] assert_equals: expected "0 - 1 0 90deg " but got "0 0 1 90deg "
+FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (0) should be [-4.32978e-17 -0.707107 -0.707107 180deg] assert_equals: expected "0 - 0.71 - 0.71 180deg " but got "y 180deg "
FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (0.25) should be [-1.48952e-16 -0.894427 -0.447214 131.81deg] assert_equals: expected "0 - 0.89 - 0.45 131.81deg " but got "0 0.96 0.28 148.6deg "
FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (0.75) should be [-2.94392e-17 -0.707107 0.707107 70.5288deg] assert_equals: expected "0 - 0.71 0.71 70.53deg " but got "0 0.51 0.86 98.42deg "
-PASS Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (1) should be [90deg]
+FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (1) should be [90deg] assert_equals: expected "90deg " but got "z 90deg "
FAIL Compositing: property <rotate> underlying [1 0 0 90deg] from add [0 1 0 180deg] to replace [0 0 1 90deg] at (2) should be [-6.12323e-17 -1 -4.71028e-16 90deg] assert_equals: expected "0 - 1 0 90deg " but got "0 - 1 0 180deg "
PASS Compositing: property <rotate> underlying [none] from add [none] to replace [0 1 0 100deg] at (-1) should be [0 1 0 -100deg]
PASS Compositing: property <rotate> underlying [none] from add [none] to replace [0 1 0 100deg] at (0) should be [none]
@@ -53,12 +53,12 @@
FAIL Compositing: property <rotate> underlying [none] from add [2 4 6 270deg] to replace [none] at (0.75) should be [2 4 6 67.5deg] assert_equals: expected "2 4 6 67.5deg " but got "0.27 0.53 0.8 67.5deg "
PASS Compositing: property <rotate> underlying [none] from add [2 4 6 270deg] to replace [none] at (1) should be [none]
FAIL Compositing: property <rotate> underlying [none] from add [2 4 6 270deg] to replace [none] at (2) should be [2 4 6 -270deg] assert_equals: expected "2 4 6 - 270deg " but got "0.27 0.53 0.8 - 270deg "
-FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (-1) should be [0.31 -0.22 0.92 131.66deg] assert_equals: expected "0.31 - 0.22 0.92 131.66deg " but got "0 1 0 - 100deg "
+FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (-1) should be [0.31 -0.22 0.92 131.66deg] assert_equals: expected "0.31 - 0.22 0.92 131.66deg " but got "y - 100deg "
FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (0) should be [1 2 3 90deg] assert_equals: expected "1 2 3 90deg " but got "none "
-FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (0.25) should be [0.21 0.73 0.64 86.72deg] assert_equals: expected "0.21 0.73 0.64 86.72deg " but got "0 1 0 25deg "
-FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (0.75) should be [0.07 0.97 0.21 92.05deg] assert_equals: expected "0.07 0.97 0.21 92.05deg " but got "0 1 0 75deg "
+FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (0.25) should be [0.21 0.73 0.64 86.72deg] assert_equals: expected "0.21 0.73 0.64 86.72deg " but got "y 25deg "
+FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (0.75) should be [0.07 0.97 0.21 92.05deg] assert_equals: expected "0.07 0.97 0.21 92.05deg " but got "y 75deg "
PASS Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (1) should be [0 1 0 100deg]
-FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (2) should be [-0.2 0.79 -0.59 151.11deg] assert_equals: expected "- 0.2 0.79 - 0.59 151.11deg " but got "0 1 0 200deg "
+FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [none] to replace [0 1 0 100deg] at (2) should be [-0.2 0.79 -0.59 151.11deg] assert_equals: expected "- 0.2 0.79 - 0.59 151.11deg " but got "y 200deg "
FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [2 4 6 270deg] to replace [none] at (-1) should be [1 2 3 720deg] assert_equals: expected "1 2 3 720deg " but got "0.27 0.53 0.8 540deg "
FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [2 4 6 270deg] to replace [none] at (0) should be [1 2 3 360deg] assert_equals: expected "1 2 3 360deg " but got "0.27 0.53 0.8 270deg "
FAIL Compositing: property <rotate> underlying [1 2 3 90deg] from add [2 4 6 270deg] to replace [none] at (0.25) should be [1 2 3 270deg] assert_equals: expected "1 2 3 270deg " but got "0.27 0.53 0.8 202.5deg "
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt 2021-04-24 19:36:27 UTC (rev 276554)
@@ -3,13 +3,17 @@
PASS e.style['rotate'] = "0deg" should set the property value
PASS e.style['rotate'] = "100 200 300 400grad" should set the property value
PASS e.style['rotate'] = "400grad 100 200 300" should set the property value
+PASS e.style['rotate'] = "0 0 0 400grad" should set the property value
PASS e.style['rotate'] = "x 400grad" should set the property value
PASS e.style['rotate'] = "400grad x" should set the property value
+PASS e.style['rotate'] = "0.5 0 0 400grad" should set the property value
PASS e.style['rotate'] = "1 0 0 400grad" should set the property value
PASS e.style['rotate'] = "y 400grad" should set the property value
PASS e.style['rotate'] = "400grad y" should set the property value
+PASS e.style['rotate'] = "0 0.5 0 400grad" should set the property value
PASS e.style['rotate'] = "0 1 0 400grad" should set the property value
PASS e.style['rotate'] = "z 400grad" should set the property value
PASS e.style['rotate'] = "400grad z" should set the property value
+PASS e.style['rotate'] = "0 0 0.5 400grad" should set the property value
PASS e.style['rotate'] = "0 0 1 400grad" should set the property value
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid.html (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid.html 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid.html 2021-04-24 19:36:27 UTC (rev 276554)
@@ -22,18 +22,22 @@
// If a 3d rotation is specified, the property must serialize with an axis specified.
test_valid_value("rotate", "100 200 300 400grad");
test_valid_value("rotate", "400grad 100 200 300", "100 200 300 400grad");
+test_valid_value("rotate", "0 0 0 400grad", "0 0 0 400grad");
// If the axis is parallel with the x, y, or z axis, it must serialize as the appropriate keyword.
test_valid_value("rotate", "x 400grad");
test_valid_value("rotate", "400grad x", "x 400grad");
+test_valid_value("rotate", "0.5 0 0 400grad", "x 400grad");
test_valid_value("rotate", "1 0 0 400grad", "x 400grad");
test_valid_value("rotate", "y 400grad");
test_valid_value("rotate", "400grad y", "y 400grad");
+test_valid_value("rotate", "0 0.5 0 400grad", "y 400grad");
test_valid_value("rotate", "0 1 0 400grad", "y 400grad");
test_valid_value("rotate", "z 400grad");
test_valid_value("rotate", "400grad z", "z 400grad");
+test_valid_value("rotate", "0 0 0.5 400grad", "z 400grad");
test_valid_value("rotate", "0 0 1 400grad", "z 400grad");
</script>
</body>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt 2021-04-24 19:36:27 UTC (rev 276554)
@@ -172,7 +172,7 @@
PASS transform-style: "flat" onto "preserve-3d"
PASS rotate (type: rotateList) has testAccumulation function
FAIL rotate without rotation axes assert_equals: The value should be -45deg at 0ms expected "-45deg" but got "-90deg"
-FAIL rotate with underlying transform assert_equals: The value should be x 45deg at 0ms expected "x 45deg" but got "1 0 0 90deg"
+FAIL rotate with underlying transform assert_equals: The value should be x 45deg at 0ms expected "x 45deg" but got "x 90deg"
PASS rotate with different rotation axes
PASS translate (type: translateList) has testAccumulation function
FAIL translate assert_equals: The value should be -100px at 0ms expected "-100px" but got "-200px"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt 2021-04-24 19:36:27 UTC (rev 276554)
@@ -167,7 +167,7 @@
PASS transform-style: "flat" onto "preserve-3d"
PASS rotate (type: rotateList) has testAddition function
FAIL rotate without rotation axes assert_equals: The value should be -45deg at 0ms expected "-45deg" but got "-90deg"
-FAIL rotate with underlying transform assert_equals: The value should be y 45deg at 0ms expected "y 45deg" but got "0 1 0 90deg"
+FAIL rotate with underlying transform assert_equals: The value should be y 45deg at 0ms expected "y 45deg" but got "y 90deg"
PASS rotate with different rotation axes
PASS translate (type: translateList) has testAddition function
FAIL translate assert_equals: The value should be -100px at 0ms expected "-100px" but got "-200px"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt (276553 => 276554)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt 2021-04-24 19:36:27 UTC (rev 276554)
@@ -210,8 +210,8 @@
PASS transform-style uses discrete animation when animating between "flat" and "preserve-3d" with keyframe easing
PASS rotate (type: rotateList) has testInterpolation function
PASS rotate without rotation axes
-FAIL rotate with rotation axes assert_equals: The value should be y 45deg at 500ms expected "y 45deg" but got "0 1 0 45deg"
-FAIL rotate with rotation axes and range over 360 degrees assert_equals: The value should be y 180deg at 250ms expected "y 180deg" but got "0 1 0 180deg"
+PASS rotate with rotation axes
+PASS rotate with rotation axes and range over 360 degrees
PASS rotate with different rotation axes
PASS translate (type: translateList) has testInterpolation function
PASS translate with two unspecified values
Modified: trunk/Source/WebCore/ChangeLog (276553 => 276554)
--- trunk/Source/WebCore/ChangeLog 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/Source/WebCore/ChangeLog 2021-04-24 19:36:27 UTC (rev 276554)
@@ -1,5 +1,34 @@
2021-04-24 Antoine Quint <[email protected]>
+ Improve parsing and computed style of the rotate CSS property
+ https://bugs.webkit.org/show_bug.cgi?id=225019
+
+ Reviewed by Dean Jackson.
+
+ There were a few issues with how we parsed the rotate CSS property and how we dealt with it
+ when resolving the computed style.
+
+ When parsing, we required individual vector coordinates to be 1 when others were 0 for a vector
+ to be considered parallel with the x, y or z axis. We now support any positive value. Then, as
+ we create the TransformOperation from the CSSValue, we must set the type to ROTATE_3D instead
+ of ROTATE_Z if the z axis was specified through the CSS value. Indeed, ROTATE_Z is equivalent
+ to ROTATE and without setting this type to ROTATE_3D, TransformOperation::is3DOperation() would
+ return false.
+
+ This is important because when figuring out the computed style, we should only return an angle
+ without a rotation vector if TransformOperation::is3DOperation() is false. For the case where
+ the operation was specified in 3D, we now use the same rule used when parsing to determine
+ whether the rotation vector is parallel with the x, y or z axis to use the matching keywords.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::computedRotate):
+ * css/TransformFunctions.cpp:
+ (WebCore::rotateForValue):
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeRotate):
+
+2021-04-24 Antoine Quint <[email protected]>
+
Support interpolation of the background-repeat shorthand
https://bugs.webkit.org/show_bug.cgi?id=225016
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (276553 => 276554)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2021-04-24 19:36:27 UTC (rev 276554)
@@ -653,19 +653,18 @@
if (!rotate || !rendererCanBeTransformed(renderer) || rotate->isIdentity())
return cssValuePool.createIdentifierValue(CSSValueNone);
+ if (!rotate->is3DOperation())
+ return cssValuePool.createValue(rotate->angle(), CSSUnitType::CSS_DEG);
+
auto list = CSSValueList::createSpaceSeparated();
- bool hasImplicitX = !rotate->x();
- bool hasImplicitY = !rotate->y();
- bool hasImplicitZ = rotate->z() == 1;
-
- if (!hasImplicitX && hasImplicitY && hasImplicitZ)
+ if (rotate->x() && !rotate->y() && !rotate->z())
list->append(cssValuePool.createIdentifierValue(CSSValueX));
- else if (hasImplicitX && !hasImplicitY && hasImplicitZ)
+ else if (!rotate->x() && rotate->y() && !rotate->z())
list->append(cssValuePool.createIdentifierValue(CSSValueY));
- else if (hasImplicitX && hasImplicitY && !hasImplicitZ)
+ else if (!rotate->x() && !rotate->y() && rotate->z())
list->append(cssValuePool.createIdentifierValue(CSSValueZ));
- else if (!hasImplicitX || !hasImplicitY || !hasImplicitZ) {
+ else {
list->append(cssValuePool.createValue(rotate->x(), CSSUnitType::CSS_NUMBER));
list->append(cssValuePool.createValue(rotate->y(), CSSUnitType::CSS_NUMBER));
list->append(cssValuePool.createValue(rotate->z(), CSSUnitType::CSS_NUMBER));
Modified: trunk/Source/WebCore/css/TransformFunctions.cpp (276553 => 276554)
--- trunk/Source/WebCore/css/TransformFunctions.cpp 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/Source/WebCore/css/TransformFunctions.cpp 2021-04-24 19:36:27 UTC (rev 276554)
@@ -451,7 +451,7 @@
type = TransformOperation::ROTATE_Y;
y = 1.0;
} else if (axisIdentifier == CSSValueZ) {
- type = TransformOperation::ROTATE_Z;
+ type = TransformOperation::ROTATE_3D;
z = 1.0;
} else
return nullptr;
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (276553 => 276554)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2021-04-24 19:35:08 UTC (rev 276553)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2021-04-24 19:36:27 UTC (rev 276554)
@@ -2070,13 +2070,13 @@
auto y = downcast<CSSPrimitiveValue>(*list->itemWithoutBoundsCheck(1)).doubleValue();
auto z = downcast<CSSPrimitiveValue>(*list->itemWithoutBoundsCheck(2)).doubleValue();
- if (x == 1 && !y && !z) {
+ if (x && !y && !z) {
list = CSSValueList::createSpaceSeparated();
list->append(CSSPrimitiveValue::createIdentifier(CSSValueX));
- } else if (!x && y == 1 && !z) {
+ } else if (!x && y && !z) {
list = CSSValueList::createSpaceSeparated();
list->append(CSSPrimitiveValue::createIdentifier(CSSValueY));
- } else if (!x && !y && z == 1) {
+ } else if (!x && !y && z) {
list = CSSValueList::createSpaceSeparated();
list->append(CSSPrimitiveValue::createIdentifier(CSSValueZ));
}