Title: [289216] trunk
Revision
289216
Author
[email protected]
Date
2022-02-07 07:10:33 -0800 (Mon, 07 Feb 2022)

Log Message

[css-logical] [web-animations] Add support for logical properties in JS-originated animations
https://bugs.webkit.org/show_bug.cgi?id=236229

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progressions.

* web-platform-tests/css/css-logical/animation-001-expected.txt:
* web-platform-tests/web-animations/interfaces/Animation/commitStyles-expected.txt:
* web-platform-tests/web-animations/timing-model/timelines/update-and-send-events-replacement-expected.txt:

Source/WebCore:

We need to resolve logical properties when parsing keyframes provided by the Web Animations bindings
and when considering whether an animation can be removed based on properties found on the effect stack.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animationCanBeRemoved):
* animation/KeyframeEffect.cpp:
(WebCore::processKeyframeLikeObject):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289215 => 289216)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-07 15:10:33 UTC (rev 289216)
@@ -1,3 +1,16 @@
+2022-02-07  Antoine Quint  <[email protected]>
+
+        [css-logical] [web-animations] Add support for logical properties in JS-originated animations
+        https://bugs.webkit.org/show_bug.cgi?id=236229
+
+        Reviewed by Dean Jackson.
+
+        Mark WPT progressions.
+
+        * web-platform-tests/css/css-logical/animation-001-expected.txt:
+        * web-platform-tests/web-animations/interfaces/Animation/commitStyles-expected.txt:
+        * web-platform-tests/web-animations/timing-model/timelines/update-and-send-events-replacement-expected.txt:
+
 2022-02-07  Ziran Sun  <[email protected]>
 
         [Forms] Use min as default value when min > max for input type="range"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001-expected.txt (289215 => 289216)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001-expected.txt	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/animation-001-expected.txt	2022-02-07 15:10:33 UTC (rev 289216)
@@ -1,26 +1,26 @@
 
-FAIL Logical properties can be animated using object notation assert_equals: expected "50px" but got "0px"
-FAIL Logical properties can be animated using array notation assert_equals: expected "50px" but got "0px"
-FAIL Logical properties are NOT stored as physical properties assert_equals: expected 2 but got 0
-FAIL Logical properties in animations respect the writing-mode assert_equals: expected "50px" but got "0px"
-FAIL Logical properties in animations respect the direction assert_equals: expected "50px" but got "0px"
+PASS Logical properties can be animated using object notation
+PASS Logical properties can be animated using array notation
+PASS Logical properties are NOT stored as physical properties
+PASS Logical properties in animations respect the writing-mode
+PASS Logical properties in animations respect the direction
 PASS Physical properties win over logical properties in object notation
 PASS Physical properties win over logical properties in array notation
 PASS Physical properties with variables win over logical properties
-FAIL Logical shorthands follow the usual prioritization based on number of component longhands assert_equals: expected "100px" but got "0px"
+FAIL Logical shorthands follow the usual prioritization based on number of component longhands assert_equals: expected "200px" but got "0px"
 FAIL Physical longhands win over logical shorthands assert_equals: expected "100px" but got "0px"
-FAIL Logical longhands win over physical shorthands assert_equals: expected "100px" but got "200px"
+PASS Logical longhands win over physical shorthands
 PASS Physical shorthands win over logical shorthands
 PASS Physical shorthands using variables win over logical shorthands
-FAIL Physical properties and logical properties can be mixed assert_equals: expected "250px" but got "300px"
+PASS Physical properties and logical properties can be mixed
 FAIL Physical shorthands and logical shorthands can be mixed assert_equals: expected "250px" but got "150px"
 PASS Physical properties win over logical properties even when some keyframes only have logical properties
 FAIL Animations update when the writing-mode is changed assert_equals: expected "50px" but got "0px"
 FAIL Filling animations update when the writing-mode is changed assert_equals: expected "100px" but got "0px"
-FAIL Animations with implicit from values update when the writing-mode is changed assert_equals: expected "250px" but got "200px"
+FAIL Animations with implicit from values update when the writing-mode is changed assert_equals: expected "200px" but got "100px"
 FAIL Animations with overlapping physical and logical properties update when the writing-mode is changed assert_equals: expected "50px" but got "0px"
 FAIL Animations update when the writing-mode is changed through a CSS variable assert_equals: expected "50px" but got "0px"
-FAIL Animations update when the direction is changed assert_equals: expected "50px" but got "0px"
+FAIL Animations update when the direction is changed assert_equals: expected "0px" but got "50px"
 FAIL Logical shorthand with variable references animates correctly assert_equals: expected "250px" but got "auto"
 PASS writing-mode is not animatable
 PASS direction is not animatable

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/commitStyles-expected.txt (289215 => 289216)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/commitStyles-expected.txt	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/commitStyles-expected.txt	2022-02-07 15:10:33 UTC (rev 289216)
@@ -2,8 +2,8 @@
 PASS Commits styles
 PASS Commits styles for an animation that has been removed
 PASS Commits shorthand styles
-FAIL Commits logical properties assert_equals: expected "20px" but got "10px"
-FAIL Commits logical properties as physical properties assert_equals: expected "20px" but got "10px"
+PASS Commits logical properties
+PASS Commits logical properties as physical properties
 PASS Commits values calculated mid-interval
 PASS Commits variable references as their computed values
 FAIL Commits custom variables assert_approx_equals: expected 0.8 +/- 0.0001 but got 0.5

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events-replacement-expected.txt (289215 => 289216)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events-replacement-expected.txt	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events-replacement-expected.txt	2022-02-07 15:10:33 UTC (rev 289216)
@@ -17,9 +17,9 @@
 PASS Removes an animation after updating its effect to one with different properties
 PASS Removes an animation when another animation uses a shorthand
 PASS Removes an animation that uses a shorthand
-FAIL Removes an animation by another animation using logical properties assert_equals: expected "removed" but got "active"
+PASS Removes an animation by another animation using logical properties
 PASS Removes an animation using logical properties
-FAIL Removes an animation by another animation using logical properties after updating the context assert_equals: expected "active" but got "removed"
+FAIL Removes an animation by another animation using logical properties after updating the context assert_equals: expected "removed" but got "active"
 PASS Removes an animation after updating another animation's effect's target
 PASS Removes an animation after updating its effect's target
 PASS Removes an animation after updating another animation's effect to one with a different target

Modified: trunk/Source/WebCore/ChangeLog (289215 => 289216)


--- trunk/Source/WebCore/ChangeLog	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/Source/WebCore/ChangeLog	2022-02-07 15:10:33 UTC (rev 289216)
@@ -1,5 +1,20 @@
 2022-02-07  Antoine Quint  <[email protected]>
 
+        [css-logical] [web-animations] Add support for logical properties in JS-originated animations
+        https://bugs.webkit.org/show_bug.cgi?id=236229
+
+        Reviewed by Dean Jackson.
+
+        We need to resolve logical properties when parsing keyframes provided by the Web Animations bindings
+        and when considering whether an animation can be removed based on properties found on the effect stack.
+
+        * animation/DocumentTimeline.cpp:
+        (WebCore::DocumentTimeline::animationCanBeRemoved):
+        * animation/KeyframeEffect.cpp:
+        (WebCore::processKeyframeLikeObject):
+
+2022-02-07  Antoine Quint  <[email protected]>
+
         Remove RenderObject::documentTimeline()
         https://bugs.webkit.org/show_bug.cgi?id=236225
 

Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (289215 => 289216)


--- trunk/Source/WebCore/animation/DocumentTimeline.cpp	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp	2022-02-07 15:10:33 UTC (rev 289216)
@@ -235,8 +235,13 @@
     if (!target || !target->element.isDescendantOf(*m_document))
         return false;
 
-    HashSet<CSSPropertyID> propertiesToMatch = keyframeEffect->animatedProperties();
+    ASSERT(target->renderer());
+    auto& style = target->renderer()->style();
 
+    HashSet<CSSPropertyID> propertiesToMatch;
+    for (auto cssProperty : keyframeEffect->animatedProperties())
+        propertiesToMatch.add(CSSProperty::resolveDirectionAwareProperty(cssProperty, style.direction(), style.writingMode()));
+
     Vector<RefPtr<WebAnimation>> animations;
     if (auto* keyframeEffectStack = target->keyframeEffectStack()) {
         for (auto& effect : keyframeEffectStack->sortedEffects()) {
@@ -253,8 +258,9 @@
             auto* effectWithHigherCompositeOrder = animationWithHigherCompositeOrder->effect();
             if (is<KeyframeEffect>(effectWithHigherCompositeOrder)) {
                 auto* keyframeEffectWithHigherCompositeOrder = downcast<KeyframeEffect>(effectWithHigherCompositeOrder);
-                for (auto cssPropertyId : keyframeEffectWithHigherCompositeOrder->animatedProperties()) {
-                    if (propertiesToMatch.remove(cssPropertyId) && propertiesToMatch.isEmpty())
+                for (auto cssProperty : keyframeEffectWithHigherCompositeOrder->animatedProperties()) {
+                    auto resolvedProperty = CSSProperty::resolveDirectionAwareProperty(cssProperty, style.direction(), style.writingMode());
+                    if (propertiesToMatch.remove(resolvedProperty) && propertiesToMatch.isEmpty())
                         break;
                 }
             }

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (289215 => 289216)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-02-07 14:48:59 UTC (rev 289215)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-02-07 15:10:33 UTC (rev 289216)
@@ -227,10 +227,11 @@
     // 4. Make up a new list animation properties that consists of all of the properties that are in both input properties and animatable
     //    properties, or which are in input properties and conform to the <custom-property-name> production.
     Vector<JSC::Identifier> animationProperties;
-    size_t numberOfProperties = inputProperties.size();
-    for (size_t i = 0; i < numberOfProperties; ++i) {
-        if (CSSPropertyAnimation::isPropertyAnimatable(IDLAttributeNameToAnimationPropertyName(inputProperties[i].string())))
-            animationProperties.append(inputProperties[i]);
+    for (auto& inputProperty : inputProperties) {
+        auto cssProperty = IDLAttributeNameToAnimationPropertyName(inputProperty.string());
+        auto resolvedCSSProperty = CSSProperty::resolveDirectionAwareProperty(cssProperty, RenderStyle::initialDirection(), RenderStyle::initialWritingMode());
+        if (CSSPropertyAnimation::isPropertyAnimatable(resolvedCSSProperty))
+            animationProperties.append(inputProperty);
     }
 
     // 5. Sort animation properties in ascending order by the Unicode codepoints that define each property name.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to