Title: [289862] trunk
Revision
289862
Author
nmouchta...@apple.com
Date
2022-02-15 16:26:24 -0800 (Tue, 15 Feb 2022)

Log Message

[css-transforms] properly handle interpolation of non-invertible matrices
https://bugs.webkit.org/show_bug.cgi?id=236480

Reviewed by Martin Robinson.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-transforms/animation/transform-matrix-composition-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:

Source/WebCore:

All composition types should fall back to discrete animation behavior when
interpolating non-invertible matrices. Need to segment progress value
depending on either side of 0.5.

* platform/graphics/transforms/TransformOperations.cpp:
(WebCore::TransformOperations::shouldFallbackToDiscreteAnimation const):
(WebCore::TransformOperations::blendByMatchingOperations const):
(WebCore::TransformOperations::blendByUsingMatrixInterpolation const):
* platform/graphics/transforms/TransformOperations.h:
(WebCore::TransformOperations::hasMatrixOperation const):
* platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::TransformationMatrix::blend):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289861 => 289862)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-16 00:26:24 UTC (rev 289862)
@@ -1,3 +1,13 @@
+2022-02-15  Nikolaos Mouchtaris  <nmouchta...@apple.com>
+
+        [css-transforms] properly handle interpolation of non-invertible matrices
+        https://bugs.webkit.org/show_bug.cgi?id=236480
+
+        Reviewed by Martin Robinson.
+
+        * web-platform-tests/css/css-transforms/animation/transform-matrix-composition-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:
+
 2022-02-15  Antti Koivisto  <an...@apple.com>
 
         [CSS Container Queries] Support all size features

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-matrix-composition-expected.txt (289861 => 289862)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-matrix-composition-expected.txt	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-matrix-composition-expected.txt	2022-02-16 00:26:24 UTC (rev 289862)
@@ -13,20 +13,20 @@
 PASS Compositing: property <transform> underlying [matrix3d(0.8535533905932737,0.1464466094067262,-0.5,0,0.1464466094067262,0.8535533905932737,0.5,0,0.5,-0.5,0.7071067811865476,0,100,0,0,1)] from add [matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 0, 0, 1)] to add [matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 200, 0, 0, 1)] at (0.75) should be [translateX(100px) rotate3d(1, 1, 0, 45deg) translateX(175px)]
 PASS Compositing: property <transform> underlying [matrix3d(0.8535533905932737,0.1464466094067262,-0.5,0,0.1464466094067262,0.8535533905932737,0.5,0,0.5,-0.5,0.7071067811865476,0,100,0,0,1)] from add [matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 0, 0, 1)] to add [matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 200, 0, 0, 1)] at (1) should be [translateX(100px) rotate3d(1, 1, 0, 45deg) translateX(200px)]
 PASS Compositing: property <transform> underlying [matrix3d(0.8535533905932737,0.1464466094067262,-0.5,0,0.1464466094067262,0.8535533905932737,0.5,0,0.5,-0.5,0.7071067811865476,0,100,0,0,1)] from add [matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 0, 0, 1)] to add [matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 200, 0, 0, 1)] at (1.5) should be [translateX(100px) rotate3d(1, 1, 0, 45deg) translateX(250px)]
-FAIL Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(1, 1, 0, 0, 100, 200)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 100 , 200 ) " but got "matrix ( 1 , 1 , 0 , 0 , 100 , 100 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(1, 1, 0, 0, 100, 200)]
 PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0) should be [matrix(1, 1, 0, 0, 100, 200)]
-FAIL Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(1, 1, 0, 0, 100, 200)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 100 , 200 ) " but got "matrix ( 1 , 1 , 0 , 0 , 175 , 175 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.5) should be [matrix(1, 1, 0, 0, 200, 300)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 200 , 300 ) " but got "matrix ( 1 , 1 , 0 , 0 , 200 , 200 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 1, 0, 0, 200, 300)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 200 , 300 ) " but got "matrix ( 1 , 1 , 0 , 0 , 225 , 225 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(1, 1, 0, 0, 100, 200)]
+PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.5) should be [matrix(1, 1, 0, 0, 200, 300)]
+PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 1, 0, 0, 200, 300)]
 PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (1) should be [matrix(1, 1, 0, 0, 200, 300)]
-FAIL Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 1, 0, 0, 200, 300)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 200 , 300 ) " but got "matrix ( 1 , 1 , 0 , 0 , 300 , 300 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(1, 1, 0, 0, 100, 100)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 100 , 100 ) " but got "matrix ( 1.28 , 0.84 , - 0.03 , 0.3 , 187.5 , - 37.5 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from add [matrix(1, 0, 0, 1, 100, 0)] to add [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 1, 0, 0, 200, 300)]
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(1, 1, 0, 0, 100, 100)]
 PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0) should be [matrix(1, 1, 0, 0, 100, 100)]
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(1, 1, 0, 0, 100, 100)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 100 , 100 ) " but got "matrix ( 0.95 , 0.86 , - 0.01 , 0.08 , 159.38 , 65.63 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.5) should be [matrix(1, 0, 0, 1, 300, 0)] assert_equals: expected "matrix ( 1 , 0 , 0 , 1 , 300 , 0 ) " but got "matrix ( 0.95 , 0.63 , - 0.03 , 0.3 , 187.5 , 62.5 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 0, 0, 1, 300, 0)] assert_equals: expected "matrix ( 1 , 0 , 0 , 1 , 300 , 0 ) " but got "matrix ( 0.97 , 0.32 , - 0.04 , 0.63 , 234.38 , 40.63 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(1, 1, 0, 0, 100, 100)]
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.5) should be [matrix(1, 0, 0, 1, 300, 0)]
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 0, 0, 1, 300, 0)]
 PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (1) should be [matrix(1, 0, 0, 1, 300, 0)]
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 0, 0, 1, 300, 0)] assert_equals: expected "matrix ( 1 , 0 , 0 , 1 , 300 , 0 ) " but got "matrix ( 0.99 , - 0.56 , 0.37 , 1.59 , 487.5 , - 137.5 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from add [matrix(1, 1, 0, 0, 0, 100)] to add [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 0, 0, 1, 300, 0)]
 PASS Compositing: property <transform> underlying [matrix(0, 1, -1, 0, 100, 0)] from accumulate [matrix(1, 0, 0, 1, 100, 0)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(0, 1, -1, 0, 150, 0)]
 PASS Compositing: property <transform> underlying [matrix(0, 1, -1, 0, 100, 0)] from accumulate [matrix(1, 0, 0, 1, 100, 0)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0) should be [matrix(0, 1, -1, 0, 200, 0)]
 PASS Compositing: property <transform> underlying [matrix(0, 1, -1, 0, 100, 0)] from accumulate [matrix(1, 0, 0, 1, 100, 0)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(0, 1, -1, 0, 225, 0)]
@@ -48,11 +48,11 @@
 PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from accumulate [matrix(1, 0, 0, 1, 100, 0)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 0, 0, 1, 175, 0)]
 PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from accumulate [matrix(1, 0, 0, 1, 100, 0)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (1) should be [matrix(1, 0, 0, 1, 200, 0)]
 PASS Compositing: property <transform> underlying [matrix(1, 1, 0, 0, 0, 100)] from accumulate [matrix(1, 0, 0, 1, 100, 0)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 0, 0, 1, 250, 0)]
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(1, 1, 0, 0, 0, 100)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 0 , 100 ) " but got "matrix ( 1.28 , 0.84 , - 0.03 , 0.3 , 75 , - 75 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (-0.5) should be [matrix(1, 1, 0, 0, 0, 100)]
 PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0) should be [matrix(1, 1, 0, 0, 0, 100)]
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(1, 1, 0, 0, 0, 100)] assert_equals: expected "matrix ( 1 , 1 , 0 , 0 , 0 , 100 ) " but got "matrix ( 0.95 , 0.86 , - 0.01 , 0.08 , 75 , 75 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.5) should be [matrix(1, 0, 0, 1, 300, 0)] assert_equals: expected "matrix ( 1 , 0 , 0 , 1 , 300 , 0 ) " but got "matrix ( 0.95 , 0.63 , - 0.03 , 0.3 , 125 , 75 ) "
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 0, 0, 1, 300, 0)] assert_equals: expected "matrix ( 1 , 0 , 0 , 1 , 300 , 0 ) " but got "matrix ( 0.97 , 0.32 , - 0.04 , 0.63 , 200 , 50 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.25) should be [matrix(1, 1, 0, 0, 0, 100)]
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.5) should be [matrix(1, 0, 0, 1, 300, 0)]
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (0.75) should be [matrix(1, 0, 0, 1, 300, 0)]
 PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (1) should be [matrix(1, 0, 0, 1, 300, 0)]
-FAIL Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 0, 0, 1, 300, 0)] assert_equals: expected "matrix ( 1 , 0 , 0 , 1 , 300 , 0 ) " but got "matrix ( 0.99 , - 0.56 , 0.37 , 1.59 , 575 , - 175 ) "
+PASS Compositing: property <transform> underlying [matrix(1, 0, 0, 1, 100, 0)] from accumulate [matrix(1, 1, 0, 0, 0, 100)] to accumulate [matrix(1, 0, 0, 1, 200, 0)] at (1.5) should be [matrix(1, 0, 0, 1, 300, 0)]
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt (289861 => 289862)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt	2022-02-16 00:26:24 UTC (rev 289862)
@@ -224,9 +224,9 @@
 PASS transform: matrix3d
 PASS transform: mismatched 3D transforms
 PASS transform: rotateY
-FAIL transform: non-invertible matrices assert_approx_equals: expected matrix(-1, 0, 0, -1, 200, 0) but got matrix(-0.070657, 0.719998, -0.395146, -0.260079, 87.65015, 62.44985): The value should be matrix(-1, 0, 0, -1, 200, 0) at 499ms but got matrix(-0.070657, 0.719998, -0.395146, -0.260079, 87.65015, 62.44985) expected -1 +/- 0.0001 but got -0.070657
-FAIL transform: non-invertible matrices in matched transform lists assert_approx_equals: expected matrix(0, -1, 1, 0, 250, 0) but got matrix(-0.229966, -0.692507, 0.329012, -0.3263, 162.600147, 62.44985): The value should be matrix(0, -1, 1, 0, 250, 0) at 499ms but got matrix(-0.229966, -0.692507, 0.329012, -0.3263, 162.600147, 62.44985) expected 0 +/- 0.0001 but got -0.229966
-FAIL transform: non-invertible matrices in mismatched transform lists assert_approx_equals: expected matrix(-2, 0, 0, -2, 250, 0) but got matrix(0.457235, 1.576158, -1.117609, -0.657221, 112.65025, 49.9): The value should be matrix(-2, 0, 0, -2, 250, 0) at 499ms but got matrix(0.457235, 1.576158, -1.117609, -0.657221, 112.65025, 49.9) expected -2 +/- 0.0001 but got 0.457235
+PASS transform: non-invertible matrices
+PASS transform: non-invertible matrices in matched transform lists
+PASS transform: non-invertible matrices in mismatched transform lists
 FAIL transform: perspective assert_approx_equals: expected matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.55, 0, 0, 0, 1) but got matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.05, 0, 0, 0, 1): The value should be matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.55, 0, 0, 0, 1) at 500ms but got matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.05, 0, 0, 0, 1) expected -0.55 +/- 0.0001 but got -0.05
 PASS transform-box (type: discrete) has testInterpolation function
 PASS transform-box uses discrete animation when animating between "fill-box" and "border-box" with linear easing

Modified: trunk/Source/WebCore/ChangeLog (289861 => 289862)


--- trunk/Source/WebCore/ChangeLog	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/Source/WebCore/ChangeLog	2022-02-16 00:26:24 UTC (rev 289862)
@@ -1,3 +1,23 @@
+2022-02-15  Nikolaos Mouchtaris  <nmouchta...@apple.com>
+
+        [css-transforms] properly handle interpolation of non-invertible matrices
+        https://bugs.webkit.org/show_bug.cgi?id=236480
+
+        Reviewed by Martin Robinson.
+
+        All composition types should fall back to discrete animation behavior when 
+        interpolating non-invertible matrices. Need to segment progress value 
+        depending on either side of 0.5.
+
+        * platform/graphics/transforms/TransformOperations.cpp:
+        (WebCore::TransformOperations::shouldFallbackToDiscreteAnimation const):
+        (WebCore::TransformOperations::blendByMatchingOperations const):
+        (WebCore::TransformOperations::blendByUsingMatrixInterpolation const):
+        * platform/graphics/transforms/TransformOperations.h:
+        (WebCore::TransformOperations::hasMatrixOperation const):
+        * platform/graphics/transforms/TransformationMatrix.cpp:
+        (WebCore::TransformationMatrix::blend):
+
 2022-02-15  Philip Chimento  <pchime...@igalia.com>
 
         Fixes for build-webkit --minimal

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp (289861 => 289862)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp	2022-02-16 00:26:24 UTC (rev 289862)
@@ -96,6 +96,11 @@
     return false;
 }
 
+bool TransformOperations::shouldFallBackToDiscreteAnimation(const TransformOperations& from, const LayoutSize& boxSize) const
+{
+    return (from.hasMatrixOperation() || hasMatrixOperation()) && (!from.isInvertible(boxSize) || !isInvertible(boxSize));
+}
+
 TransformOperations TransformOperations::blendByMatchingOperations(const TransformOperations& from, const BlendingContext& context, const LayoutSize& boxSize) const
 {
     TransformOperations result;
@@ -104,7 +109,7 @@
     unsigned toOperationCount = operations().size();
     unsigned maxOperationCount = std::max(fromOperationCount, toOperationCount);
     
-    if (context.compositeOperation == CompositeOperation::Accumulate && (!from.isInvertible(boxSize) || !isInvertible(boxSize)))
+    if (shouldFallBackToDiscreteAnimation(from, boxSize))
         return blendByUsingMatrixInterpolation(from, context, boxSize);
     
     for (unsigned i = 0; i < maxOperationCount; i++) {
@@ -139,7 +144,14 @@
     TransformationMatrix toTransform;
     from.apply(boxSize, fromTransform);
     apply(boxSize, toTransform);
-    toTransform.blend(fromTransform, context.progress, context.compositeOperation);
+    
+    auto progress = context.progress;
+    auto compositeOperation = context.compositeOperation;
+    if (shouldFallBackToDiscreteAnimation(from, boxSize)) {
+        progress = progress < 0.5 ? 0 : 1;
+        compositeOperation = CompositeOperation::Replace;
+    }
+    toTransform.blend(fromTransform, progress, compositeOperation);
     // Append the result
     result.operations().append(Matrix3DTransformOperation::create(toTransform));
 

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformOperations.h (289861 => 289862)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformOperations.h	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformOperations.h	2022-02-16 00:26:24 UTC (rev 289862)
@@ -60,6 +60,13 @@
         }
         return false;
     }
+    
+    bool hasMatrixOperation() const
+    {
+        return std::any_of(m_operations.begin(), m_operations.end(), [](auto operation) {
+            return operation->type() == WebCore::TransformOperation::MATRIX;
+        });
+    }
 
     bool isRepresentableIn2D() const
     {
@@ -96,6 +103,8 @@
         return transform.isInvertible();
     }
     
+    bool shouldFallBackToDiscreteAnimation(const TransformOperations&, const LayoutSize&) const;
+    
     TransformOperations blendByMatchingOperations(const TransformOperations& from, const BlendingContext&, const LayoutSize&) const;
     TransformOperations blendByUsingMatrixInterpolation(const TransformOperations& from, const BlendingContext&, const LayoutSize&) const;
     TransformOperations blend(const TransformOperations& from, const BlendingContext&, const LayoutSize&) const;

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp (289861 => 289862)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp	2022-02-16 00:26:00 UTC (rev 289861)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp	2022-02-16 00:26:24 UTC (rev 289862)
@@ -1753,8 +1753,6 @@
 
 void TransformationMatrix::blend(const TransformationMatrix& from, double progress, CompositeOperation compositeOperation)
 {
-    if (compositeOperation == CompositeOperation::Accumulate && (!from.isInvertible() || !isInvertible()))
-        compositeOperation = CompositeOperation::Replace;
     
     if (!progress && compositeOperation == CompositeOperation::Replace) {
         *this = from;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to