Title: [274415] trunk
Revision
274415
Author
[email protected]
Date
2021-03-15 06:00:06 -0700 (Mon, 15 Mar 2021)

Log Message

CSS aspect-ratio interpolation
https://bugs.webkit.org/show_bug.cgi?id=220848

Patch by Rob Buis <[email protected]> on 2021-03-15
Reviewed by Antoine Quint.

LayoutTests/imported/w3c:

Import relevant test.

* web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt: Added.
* web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html: Added.

Source/WebCore:

Implement CSS aspect-ratio interpolation as defined here:
https://drafts.csswg.org/css-values/#combine-ratio

Test: imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html

* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (274414 => 274415)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-15 12:45:26 UTC (rev 274414)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-15 13:00:06 UTC (rev 274415)
@@ -1,3 +1,15 @@
+2021-03-15  Rob Buis  <[email protected]>
+
+        CSS aspect-ratio interpolation
+        https://bugs.webkit.org/show_bug.cgi?id=220848
+
+        Reviewed by Antoine Quint.
+
+        Import relevant test.
+
+        * web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt: Added.
+        * web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html: Added.
+
 2021-03-10  Sergio Villar Senin  <[email protected]>
 
         Do not shrink radio buttons bellow its size

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt (0 => 274415)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt	2021-03-15 13:00:06 UTC (rev 274415)
@@ -0,0 +1,192 @@
+
+PASS CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
+PASS CSS Animations: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
+PASS CSS Animations: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
+PASS CSS Animations: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
+PASS Web Animations: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
+PASS Web Animations: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
+PASS Web Animations: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (0) should be [0.5 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (0.5) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (1.5) should be [4 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (0) should be [0.5 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (0.5) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (1.5) should be [4 / 1]
+PASS CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (-0.5) should be [0.25 / 1]
+PASS CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (0) should be [0.5 / 1]
+PASS CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (0.5) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (1.5) should be [4 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [auto]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [auto]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [auto]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [auto]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [auto]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [auto]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [auto 1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [auto 1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [auto 1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
+PASS CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [auto 1 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [auto 1 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [auto 1 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
+PASS Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 0]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 0]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 0]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 0]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 0]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 0]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [0 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [0 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [0 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
+PASS CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
+PASS CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [1 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
+PASS CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [1 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
+PASS Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
+PASS Compositing: property <aspect-ratio> underlying [2 / 1] from replace [0.5 / 1] to add [1 / 1] at (0) should be [0.5 / 1]
+FAIL Compositing: property <aspect-ratio> underlying [2 / 1] from replace [0.5 / 1] to add [1 / 1] at (0.5) should be [1 / 1] assert_equals: expected "1 / 1 " but got "0.71 / 1 "
+FAIL Compositing: property <aspect-ratio> underlying [2 / 1] from replace [0.5 / 1] to add [1 / 1] at (1) should be [2 / 1] assert_equals: expected "2 / 1 " but got "1 / 1 "
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html (0 => 274415)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html	2021-03-15 13:00:06 UTC (rev 274415)
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>aspect-ratio interpolation</title>
+<link rel="help" href=""
+<meta name="assert" content="aspect-ratio supports animation">
+
+<script src=""
+<script src=""
+<script src=""
+
+<style>
+.target {
+  font-size: 16px;
+  background-color: black;
+  width: 10px;
+  aspect-ratio: 0.5;
+}
+</style>
+
+<body>
+  <template id="target-template">
+    <div class="container">
+      <div class="target"></div>
+    </div>
+  </template>
+</body>
+
+<script>
+test_interpolation({
+  property: 'aspect-ratio',
+  from: '0.5',
+  to: '2',
+}, [
+  {at: -0.5, expect: '0.25 / 1'},
+  {at: 0, expect: '0.5 / 1'},
+  {at: 0.5, expect: '1 / 1'},
+  {at: 1, expect: '2 / 1'},
+  {at: 1.5, expect: '4 / 1'}
+]);
+
+test_interpolation({
+  property: 'aspect-ratio',
+  from: '1 / 2',
+  to: '2 / 1',
+}, [
+  {at: -0.5, expect: '0.25 / 1'},
+  {at: 0, expect: '0.5 / 1'},
+  {at: 0.5, expect: '1 / 1'},
+  {at: 1, expect: '2 / 1'},
+  {at: 1.5, expect: '4 / 1'}
+]);
+
+// Test neutral keyframe
+test_interpolation({
+  property: 'aspect-ratio',
+  from: '',
+  to: '2 / 1',
+}, [
+  {at: -0.5, expect: '0.25 / 1'},
+  {at: 0, expect: '0.5 / 1'},
+  {at: 0.5, expect: '1 / 1'},
+  {at: 1, expect: '2 / 1'},
+  {at: 1.5, expect: '4 / 1'}
+]);
+
+test_interpolation({
+  property: 'aspect-ratio',
+  from: 'auto 1 / 2',
+  to: 'auto 2 / 1',
+}, [
+  {at: -0.5, expect: 'auto 0.25 / 1'},
+  {at: 0, expect: 'auto 0.5 / 1'},
+  {at: 0.5, expect: 'auto 1 / 1'},
+  {at: 1, expect: 'auto 2 / 1'},
+  {at: 1.5, expect: 'auto 4 / 1'}
+]);
+
+test_no_interpolation({
+  property: 'aspect-ratio',
+  from: 'auto',
+  to: '2 / 1',
+});
+
+test_no_interpolation({
+  property: 'aspect-ratio',
+  from: 'auto 1 / 1',
+  to: '2 / 1',
+});
+
+// If either number in the ratio is 0 or infinite, it represents a degenerate
+// ratio and will not be interpolated:
+// https://drafts.csswg.org/css-values-4/#combine-ratio
+test_no_interpolation({
+  property: 'aspect-ratio',
+  from: '1 / 0',
+  to: '1 / 1',
+});
+test_no_interpolation({
+  property: 'aspect-ratio',
+  from: '1 / 1',
+  to: '0 / 1',
+});
+
+// Addition of <ratio>s is not possible.
+// https://drafts.csswg.org/css-values/#combine-ratio
+//
+// And if a value type does not define a specific procedure for addition or is
+// defined as not additive, its addition operation is simply Vresult = Va.
+// (The first value is Va, the second value is Vb, and the result is Vresult.)
+// https://drafts.csswg.org/css-values-4/#not-additive,
+//
+// So in this test case:
+// 1. The 1st keyframe: { aspectRatio: 0.5/1, composite: 'replace', offset: 0 }
+// 2. The 2nd keyframe: { aspectRatio:   1/1, composite: 'add',     offset: 1 }
+// and the underlying value is 2/1. Based on the spec, the composited from_value
+// is 0.5/1 (because we just replace it), and the composited to_value is 2/1
+// (because we use Va as the result value).
+test_composition({
+  property: 'aspect-ratio',
+  underlying: '2 / 1',
+  replaceFrom: '0.5 / 1',
+  addTo: '1 / 1',
+}, [
+  {at: 0, expect: '0.5 / 1'},
+  {at: 0.5, expect: '1 / 1'},
+  {at: 1, expect: '2 / 1'}
+]);
+
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (274414 => 274415)


--- trunk/Source/WebCore/ChangeLog	2021-03-15 12:45:26 UTC (rev 274414)
+++ trunk/Source/WebCore/ChangeLog	2021-03-15 13:00:06 UTC (rev 274415)
@@ -1,3 +1,18 @@
+2021-03-15  Rob Buis  <[email protected]>
+
+        CSS aspect-ratio interpolation
+        https://bugs.webkit.org/show_bug.cgi?id=220848
+
+        Reviewed by Antoine Quint.
+
+        Implement CSS aspect-ratio interpolation as defined here:
+        https://drafts.csswg.org/css-values/#combine-ratio
+
+        Test: imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html
+
+        * animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
 2021-03-15  Kimmo Kinnunen  <[email protected]>
 
         Move vertex array functionality from ExtensionsGL to GraphicsContextGL

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (274414 => 274415)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-03-15 12:45:26 UTC (rev 274414)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-03-15 13:00:06 UTC (rev 274415)
@@ -1855,6 +1855,52 @@
     }
 };
 
+class PropertyWrapperAspectRatio final : public AnimationPropertyWrapperBase {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    PropertyWrapperAspectRatio()
+        : AnimationPropertyWrapperBase(CSSPropertyAspectRatio)
+    {
+    }
+
+    bool equals(const RenderStyle* a, const RenderStyle* b) const final
+    {
+        if (a == b)
+            return true;
+        if (!a || !b)
+            return false;
+
+        return a->aspectRatioType() == b->aspectRatioType() && a->aspectRatioWidth() == b->aspectRatioWidth() && a->aspectRatioHeight() == b->aspectRatioHeight();
+    }
+
+    bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
+    {
+        return (from->aspectRatioType() == AspectRatioType::Ratio && to->aspectRatioType() == AspectRatioType::Ratio) || (from->aspectRatioType() == AspectRatioType::AutoAndRatio && to->aspectRatioType() == AspectRatioType::AutoAndRatio);
+    }
+
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
+    {
+        LOG_WITH_STREAM(Animations, stream << "  blending " << getPropertyName(property()) << " from " << from->logicalAspectRatio() << " to " << to->logicalAspectRatio() << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << result->logicalAspectRatio());
+    }
+#endif
+
+    void blend(const CSSPropertyBlendingClient*, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
+    {
+        destination->setAspectRatioType(progress < 0.5 ? from->aspectRatioType() : to->aspectRatioType());
+        if (canInterpolate(from, to)) {
+            auto aspectRatioDst = WebCore::blend(log(from->logicalAspectRatio()), log(to->logicalAspectRatio()), progress);
+            destination->setAspectRatio(exp(aspectRatioDst), 1);
+            return;
+        }
+        // For auto/auto-zero aspect-ratio we use discrete values, we can't use general
+        // logic since logicalAspectRatio asserts on aspect-ratio type.
+        ASSERT(!progress || progress == 1);
+        auto* applicableStyle = progress ? to : from;
+        destination->setAspectRatio(applicableStyle->aspectRatioWidth(), applicableStyle->aspectRatioHeight());
+    }
+};
+
 class CSSPropertyAnimationWrapperMap final {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -2153,6 +2199,7 @@
         new DiscretePropertyWrapper<Isolation>(CSSPropertyIsolation, &RenderStyle::isolation, &RenderStyle::setIsolation),
         new DiscretePropertyWrapper<BlendMode>(CSSPropertyMixBlendMode, &RenderStyle::blendMode, &RenderStyle::setBlendMode),
 #endif
+        new PropertyWrapperAspectRatio,
     };
     const unsigned animatableLonghandPropertiesCount = WTF_ARRAY_LENGTH(animatableLonghandPropertyWrappers);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to