Title: [290655] trunk
Revision
290655
Author
[email protected]
Date
2022-03-01 10:14:37 -0800 (Tue, 01 Mar 2022)

Log Message

[web-animations] add support for passing an optional timeline to Element.animate()
https://bugs.webkit.org/show_bug.cgi?id=237312

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

* web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt:

Source/WebCore:

* animation/KeyframeAnimationOptions.h:
* animation/KeyframeAnimationOptions.idl:
* dom/Element.cpp:
(WebCore::Element::animate):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290654 => 290655)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-01 18:12:13 UTC (rev 290654)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-01 18:14:37 UTC (rev 290655)
@@ -1,3 +1,12 @@
+2022-03-01  Antoine Quint  <[email protected]>
+
+        [web-animations] add support for passing an optional timeline to Element.animate()
+        https://bugs.webkit.org/show_bug.cgi?id=237312
+
+        Reviewed by Dean Jackson.
+
+        * web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt:
+
 2022-02-28  Jonathan Bedard  <[email protected]>
 
         [Python 3] Delete old pywebsocket

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt (290654 => 290655)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt	2022-03-01 18:12:13 UTC (rev 290654)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-expected.txt	2022-03-01 18:14:37 UTC (rev 290655)
@@ -133,7 +133,7 @@
 PASS Element.animate() correctly sets the Animation's timeline when triggered on an element in a different document
 PASS Element.animate() correctly sets the Animation's timeline with no timeline parameter in KeyframeAnimationOptions.
 PASS Element.animate() correctly sets the Animation's timeline with undefined timeline in KeyframeAnimationOptions.
-FAIL Element.animate() correctly sets the Animation's timeline with null timeline in KeyframeAnimationOptions. assert_equals: Animation timeline should be null expected null but got object "[object DocumentTimeline]"
+PASS Element.animate() correctly sets the Animation's timeline with null timeline in KeyframeAnimationOptions.
 PASS Element.animate() correctly sets the Animation's timeline with DocumentTimeline in KeyframeAnimationOptions.
 PASS Element.animate() calls play on the Animation
 PASS Element.animate() does NOT trigger a style change event

Modified: trunk/Source/WebCore/ChangeLog (290654 => 290655)


--- trunk/Source/WebCore/ChangeLog	2022-03-01 18:12:13 UTC (rev 290654)
+++ trunk/Source/WebCore/ChangeLog	2022-03-01 18:14:37 UTC (rev 290655)
@@ -1,3 +1,15 @@
+2022-03-01  Antoine Quint  <[email protected]>
+
+        [web-animations] add support for passing an optional timeline to Element.animate()
+        https://bugs.webkit.org/show_bug.cgi?id=237312
+
+        Reviewed by Dean Jackson.
+
+        * animation/KeyframeAnimationOptions.h:
+        * animation/KeyframeAnimationOptions.idl:
+        * dom/Element.cpp:
+        (WebCore::Element::animate):
+
 2022-03-01  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r290325.

Modified: trunk/Source/WebCore/animation/KeyframeAnimationOptions.h (290654 => 290655)


--- trunk/Source/WebCore/animation/KeyframeAnimationOptions.h	2022-03-01 18:12:13 UTC (rev 290654)
+++ trunk/Source/WebCore/animation/KeyframeAnimationOptions.h	2022-03-01 18:14:37 UTC (rev 290655)
@@ -27,6 +27,7 @@
 
 #include "AnimationFrameRate.h"
 #include "AnimationFrameRatePreset.h"
+#include "AnimationTimeline.h"
 #include "KeyframeEffectOptions.h"
 
 namespace WebCore {
@@ -33,6 +34,7 @@
 
 struct KeyframeAnimationOptions : KeyframeEffectOptions {
     String id;
+    std::optional<RefPtr<AnimationTimeline>> timeline;
     std::variant<FramesPerSecond, AnimationFrameRatePreset> frameRate;
 };
 

Modified: trunk/Source/WebCore/animation/KeyframeAnimationOptions.idl (290654 => 290655)


--- trunk/Source/WebCore/animation/KeyframeAnimationOptions.idl	2022-03-01 18:12:13 UTC (rev 290654)
+++ trunk/Source/WebCore/animation/KeyframeAnimationOptions.idl	2022-03-01 18:14:37 UTC (rev 290655)
@@ -27,5 +27,6 @@
 
 dictionary KeyframeAnimationOptions : KeyframeEffectOptions {
     DOMString id = "";
+    [EnabledBySetting=WebAnimationsMutableTimelinesEnabled] AnimationTimeline? timeline;
     [EnabledBySetting=WebAnimationsCustomFrameRateEnabled] (FramesPerSecond or AnimationFrameRatePreset) frameRate = "auto";
 };

Modified: trunk/Source/WebCore/dom/Element.cpp (290654 => 290655)


--- trunk/Source/WebCore/dom/Element.cpp	2022-03-01 18:12:13 UTC (rev 290654)
+++ trunk/Source/WebCore/dom/Element.cpp	2022-03-01 18:14:37 UTC (rev 290655)
@@ -4685,6 +4685,7 @@
 ExceptionOr<Ref<WebAnimation>> Element::animate(JSC::JSGlobalObject& lexicalGlobalObject, JSC::Strong<JSC::JSObject>&& keyframes, std::optional<std::variant<double, KeyframeAnimationOptions>>&& options)
 {
     String id = "";
+    std::optional<RefPtr<AnimationTimeline>> timeline;
     std::variant<FramesPerSecond, AnimationFrameRatePreset> frameRate = AnimationFrameRatePreset::Auto;
     std::optional<std::variant<double, KeyframeEffectOptions>> keyframeEffectOptions;
     if (options) {
@@ -4696,6 +4697,7 @@
             auto keyframeEffectOptions = std::get<KeyframeAnimationOptions>(optionsValue);
             id = keyframeEffectOptions.id;
             frameRate = keyframeEffectOptions.frameRate;
+            timeline = keyframeEffectOptions.timeline;
             keyframeEffectOptionsVariant = WTFMove(keyframeEffectOptions);
         }
         keyframeEffectOptions = keyframeEffectOptionsVariant;
@@ -4707,6 +4709,8 @@
 
     auto animation = WebAnimation::create(document(), &keyframeEffectResult.returnValue().get());
     animation->setId(id);
+    if (timeline)
+        animation->setTimeline(timeline->get());
     animation->setBindingsFrameRate(WTFMove(frameRate));
 
     auto animationPlayResult = animation->play();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to