Title: [226697] trunk
Revision
226697
Author
[email protected]
Date
2018-01-09 22:15:52 -0800 (Tue, 09 Jan 2018)

Log Message

[Web Animations] Expose the id property on Animation
https://bugs.webkit.org/show_bug.cgi?id=181450
<rdar://problem/36383600>

Reviewed by Dean Jackson.

Source/WebCore:

Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
passed to Element.animate(). All of the WPT tests related to this property are now passing.

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

LayoutTests:

Mark all tests related to the "id" property as passing.

* http/wpt/web-animations/interfaces/Animatable/animate-expected.txt:
* http/wpt/web-animations/interfaces/Animation/id-expected.txt:
* http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226696 => 226697)


--- trunk/LayoutTests/ChangeLog	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/LayoutTests/ChangeLog	2018-01-10 06:15:52 UTC (rev 226697)
@@ -1,3 +1,17 @@
+2018-01-09  Antoine Quint  <[email protected]>
+
+        [Web Animations] Expose the id property on Animation
+        https://bugs.webkit.org/show_bug.cgi?id=181450
+        <rdar://problem/36383600>
+
+        Reviewed by Dean Jackson.
+
+        Mark all tests related to the "id" property as passing.
+
+        * http/wpt/web-animations/interfaces/Animatable/animate-expected.txt:
+        * http/wpt/web-animations/interfaces/Animation/id-expected.txt:
+        * http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt:
+
 2018-01-09  Chris Dumez  <[email protected]>
 
         Make service workers behave correctly with regards to Page Cache

Modified: trunk/LayoutTests/http/wpt/web-animations/interfaces/Animatable/animate-expected.txt (226696 => 226697)


--- trunk/LayoutTests/http/wpt/web-animations/interfaces/Animatable/animate-expected.txt	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/LayoutTests/http/wpt/web-animations/interfaces/Animatable/animate-expected.txt	2018-01-10 06:15:52 UTC (rev 226697)
@@ -147,8 +147,8 @@
 FAIL Element.animate() accepts a double as an options argument assert_equals: expected (string) "auto" but got (undefined) undefined
 FAIL Element.animate() accepts a KeyframeAnimationOptions argument assert_equals: expected (string) "forwards" but got (undefined) undefined
 FAIL Element.animate() accepts an absent options argument assert_equals: expected (string) "auto" but got (number) 0
-FAIL Element.animate() correctly sets the id attribute when no id is specified assert_equals: expected (string) "" but got (undefined) undefined
-FAIL Element.animate() correctly sets the id attribute assert_equals: expected (string) "test" but got (undefined) undefined
+PASS Element.animate() correctly sets the id attribute when no id is specified 
+PASS Element.animate() correctly sets the id attribute 
 PASS Element.animate() correctly sets the Animation's timeline 
 PASS Element.animate() correctly sets the Animation's timeline when triggered on an element in a different document 
 FAIL Element.animate() calls play on the Animation assert_equals: expected "pending" but got "running"

Modified: trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/id-expected.txt (226696 => 226697)


--- trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/id-expected.txt	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/id-expected.txt	2018-01-10 06:15:52 UTC (rev 226697)
@@ -1,4 +1,4 @@
 
-FAIL Animation.id initial value assert_equals: id for Animation is initially empty expected (string) "" but got (undefined) undefined
+PASS Animation.id initial value 
 PASS Animation.id setter 
 

Modified: trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt (226696 => 226697)


--- trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt	2018-01-10 06:15:52 UTC (rev 226697)
@@ -5,7 +5,7 @@
 PASS Animation interface object name 
 PASS Animation interface: existence and properties of interface prototype object 
 PASS Animation interface: existence and properties of interface prototype object's "constructor" property 
-FAIL Animation interface: attribute id assert_true: The prototype object must have a property "id" expected true got false
+PASS Animation interface: attribute id 
 PASS Animation interface: attribute effect 
 PASS Animation interface: attribute timeline 
 PASS Animation interface: attribute startTime 
@@ -23,7 +23,7 @@
 FAIL Animation interface: operation reverse() assert_own_property: interface prototype object missing non-static operation expected property "reverse" missing
 PASS Animation must be primary interface of new Animation() 
 PASS Stringification of new Animation() 
-FAIL Animation interface: new Animation() must inherit property "id" with the proper type assert_inherits: property "id" not found in prototype chain
+PASS Animation interface: new Animation() must inherit property "id" with the proper type 
 PASS Animation interface: new Animation() must inherit property "effect" with the proper type 
 PASS Animation interface: new Animation() must inherit property "timeline" with the proper type 
 PASS Animation interface: new Animation() must inherit property "startTime" with the proper type 

Modified: trunk/Source/WebCore/ChangeLog (226696 => 226697)


--- trunk/Source/WebCore/ChangeLog	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/Source/WebCore/ChangeLog	2018-01-10 06:15:52 UTC (rev 226697)
@@ -1,3 +1,19 @@
+2018-01-09  Antoine Quint  <[email protected]>
+
+        [Web Animations] Expose the id property on Animation
+        https://bugs.webkit.org/show_bug.cgi?id=181450
+        <rdar://problem/36383600>
+
+        Reviewed by Dean Jackson.
+
+        Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
+        passed to Element.animate(). All of the WPT tests related to this property are now passing.
+
+        * animation/WebAnimation.h:
+        * animation/WebAnimation.idl:
+        * dom/Element.cpp:
+        (WebCore::Element::animate):
+
 2018-01-09  Chris Dumez  <[email protected]>
 
         Make service workers behave correctly with regards to Page Cache

Modified: trunk/Source/WebCore/animation/WebAnimation.h (226696 => 226697)


--- trunk/Source/WebCore/animation/WebAnimation.h	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/Source/WebCore/animation/WebAnimation.h	2018-01-10 06:15:52 UTC (rev 226697)
@@ -49,6 +49,9 @@
     static Ref<WebAnimation> create(Document&, AnimationEffect*, AnimationTimeline*);
     ~WebAnimation();
 
+    const String& id() const { return m_id; }
+    void setId(const String& id) { m_id = id; }
+
     AnimationEffect* effect() const { return m_effect.get(); }
     void setEffect(RefPtr<AnimationEffect>&&);
     AnimationTimeline* timeline() const { return m_timeline.get(); }
@@ -123,6 +126,7 @@
     void runPendingPlayTask();
     void resetPendingTasks();
     
+    String m_id;
     RefPtr<AnimationEffect> m_effect;
     RefPtr<AnimationTimeline> m_timeline;
     std::optional<Seconds> m_previousCurrentTime;

Modified: trunk/Source/WebCore/animation/WebAnimation.idl (226696 => 226697)


--- trunk/Source/WebCore/animation/WebAnimation.idl	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/Source/WebCore/animation/WebAnimation.idl	2018-01-10 06:15:52 UTC (rev 226697)
@@ -38,6 +38,7 @@
     ConstructorCallWith=Document,
     Constructor(optional AnimationEffect? effect = null, optional AnimationTimeline? timeline)
 ] interface WebAnimation : EventTarget {
+    attribute DOMString id;
     attribute AnimationEffect? effect;
     attribute AnimationTimeline? timeline;
     [ImplementedAs=bindingsStartTime] attribute double? startTime;

Modified: trunk/Source/WebCore/dom/Element.cpp (226696 => 226697)


--- trunk/Source/WebCore/dom/Element.cpp	2018-01-10 05:43:45 UTC (rev 226696)
+++ trunk/Source/WebCore/dom/Element.cpp	2018-01-10 06:15:52 UTC (rev 226697)
@@ -3688,6 +3688,7 @@
 
 ExceptionOr<Ref<WebAnimation>> Element::animate(JSC::ExecState& state, JSC::Strong<JSC::JSObject>&& keyframes, std::optional<Variant<double, KeyframeAnimationOptions>>&& options)
 {
+    String id = "";
     std::optional<Variant<double, KeyframeEffectOptions>> keyframeEffectOptions;
     if (options) {
         auto optionsValue = options.value();
@@ -3694,8 +3695,11 @@
         Variant<double, KeyframeEffectOptions> keyframeEffectOptionsVariant;
         if (WTF::holds_alternative<double>(optionsValue))
             keyframeEffectOptionsVariant = WTF::get<double>(optionsValue);
-        else
-            keyframeEffectOptionsVariant = WTF::get<KeyframeAnimationOptions>(optionsValue);
+        else {
+            auto keyframeEffectOptions = WTF::get<KeyframeAnimationOptions>(optionsValue);
+            id = keyframeEffectOptions.id;
+            keyframeEffectOptionsVariant = WTFMove(keyframeEffectOptions);
+        }
         keyframeEffectOptions = keyframeEffectOptionsVariant;
     }
 
@@ -3704,6 +3708,7 @@
         return keyframeEffectResult.releaseException();
 
     auto animation = WebAnimation::create(document(), &keyframeEffectResult.returnValue().get(), nullptr);
+    animation->setId(id);
 
     auto animationPlayResult = animation->play();
     if (animationPlayResult.hasException())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to