Title: [225812] trunk
Revision
225812
Author
grao...@webkit.org
Date
2017-12-12 15:12:02 -0800 (Tue, 12 Dec 2017)

Log Message

[Web Animations] Expose promises on Animation interface
https://bugs.webkit.org/show_bug.cgi?id=180710
<rdar://problem/36000604>

Reviewed by Dean Jackson.

Source/WebCore:

Expose the "ready" and "finished" promises on Animation. A future patch will fulfil or reject them.

* animation/WebAnimation.cpp:
(WebCore::WebAnimation::WebAnimation):
(WebCore::WebAnimation::readyPromiseResolve):
(WebCore::WebAnimation::finishedPromiseResolve):
* animation/WebAnimation.h:
* animation/WebAnimation.idl:

LayoutTests:

Rebase some WPT expectations with progressions due to exposing the "ready" and "finished" promises.

* http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt:
* http/wpt/web-animations/timing-model/animations/current-time-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (225811 => 225812)


--- trunk/LayoutTests/ChangeLog	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/LayoutTests/ChangeLog	2017-12-12 23:12:02 UTC (rev 225812)
@@ -1,3 +1,16 @@
+2017-12-12  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Expose promises on Animation interface
+        https://bugs.webkit.org/show_bug.cgi?id=180710
+        <rdar://problem/36000604>
+
+        Reviewed by Dean Jackson.
+
+        Rebase some WPT expectations with progressions due to exposing the "ready" and "finished" promises.
+
+        * http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt:
+        * http/wpt/web-animations/timing-model/animations/current-time-expected.txt:
+
 2017-12-12  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         IPC code doesn't understand NSDictionaries with non-NSString keys

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


--- trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt	2017-12-12 23:12:02 UTC (rev 225812)
@@ -12,8 +12,8 @@
 PASS Animation interface: attribute currentTime 
 PASS Animation interface: attribute playbackRate 
 PASS Animation interface: attribute playState 
-FAIL Animation interface: attribute ready assert_true: The prototype object must have a property "ready" expected true got false
-FAIL Animation interface: attribute finished assert_true: The prototype object must have a property "finished" expected true got false
+PASS Animation interface: attribute ready 
+PASS Animation interface: attribute finished 
 FAIL Animation interface: attribute onfinish assert_true: The prototype object must have a property "onfinish" expected true got false
 FAIL Animation interface: attribute oncancel assert_true: The prototype object must have a property "oncancel" expected true got false
 FAIL Animation interface: operation cancel() assert_own_property: interface prototype object missing non-static operation expected property "cancel" missing
@@ -30,8 +30,8 @@
 PASS Animation interface: new Animation() must inherit property "currentTime" with the proper type 
 PASS Animation interface: new Animation() must inherit property "playbackRate" with the proper type 
 PASS Animation interface: new Animation() must inherit property "playState" with the proper type 
-FAIL Animation interface: new Animation() must inherit property "ready" with the proper type assert_inherits: property "ready" not found in prototype chain
-FAIL Animation interface: new Animation() must inherit property "finished" with the proper type assert_inherits: property "finished" not found in prototype chain
+PASS Animation interface: new Animation() must inherit property "ready" with the proper type 
+PASS Animation interface: new Animation() must inherit property "finished" with the proper type 
 FAIL Animation interface: new Animation() must inherit property "onfinish" with the proper type assert_inherits: property "onfinish" not found in prototype chain
 FAIL Animation interface: new Animation() must inherit property "oncancel" with the proper type assert_inherits: property "oncancel" not found in prototype chain
 FAIL Animation interface: new Animation() must inherit property "cancel()" with the proper type assert_inherits: property "cancel" not found in prototype chain

Modified: trunk/LayoutTests/http/wpt/web-animations/timing-model/animations/current-time-expected.txt (225811 => 225812)


--- trunk/LayoutTests/http/wpt/web-animations/timing-model/animations/current-time-expected.txt	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/LayoutTests/http/wpt/web-animations/timing-model/animations/current-time-expected.txt	2017-12-12 23:12:02 UTC (rev 225812)
@@ -1,7 +1,9 @@
 
+Harness Error (TIMEOUT), message = null
+
 FAIL The current time returns the hold time when set animation.play is not a function. (In 'animation.play()', 'animation.play' is undefined)
-FAIL The current time is unresolved when there is no associated timeline (and no hold time is set) undefined is not an object (evaluating 'animation.ready.then')
+TIMEOUT The current time is unresolved when there is no associated timeline (and no hold time is set) Test timed out
 PASS The current time is unresolved when the start time is unresolved (and no hold time is set) 
 PASS The current time is calculated from the timeline time, start time and playback rate 
-FAIL The current time does not progress if playback rate is 0 createDiv(t).animate is not a function. (In 'createDiv(t).animate(null, 100 * MS_PER_SEC)', 'createDiv(t).animate' is undefined)
+NOTRUN The current time does not progress if playback rate is 0 
 

Modified: trunk/Source/WebCore/ChangeLog (225811 => 225812)


--- trunk/Source/WebCore/ChangeLog	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/Source/WebCore/ChangeLog	2017-12-12 23:12:02 UTC (rev 225812)
@@ -1,3 +1,20 @@
+2017-12-12  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Expose promises on Animation interface
+        https://bugs.webkit.org/show_bug.cgi?id=180710
+        <rdar://problem/36000604>
+
+        Reviewed by Dean Jackson.
+
+        Expose the "ready" and "finished" promises on Animation. A future patch will fulfil or reject them.
+
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::WebAnimation):
+        (WebCore::WebAnimation::readyPromiseResolve):
+        (WebCore::WebAnimation::finishedPromiseResolve):
+        * animation/WebAnimation.h:
+        * animation/WebAnimation.idl:
+
 2017-12-12  Youenn Fablet  <you...@apple.com>
 
         Fetch Event header filtering should apply in CORS mode only

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (225811 => 225812)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2017-12-12 23:12:02 UTC (rev 225812)
@@ -30,6 +30,7 @@
 #include "AnimationPlaybackEvent.h"
 #include "AnimationTimeline.h"
 #include "Document.h"
+#include "JSWebAnimation.h"
 #include "KeyframeEffect.h"
 #include <wtf/text/WTFString.h>
 
@@ -50,6 +51,8 @@
 
 WebAnimation::WebAnimation(Document& document)
     : ActiveDOMObject(&document)
+    , m_readyPromise(*this, &WebAnimation::readyPromiseResolve)
+    , m_finishedPromise(*this, &WebAnimation::finishedPromiseResolve)
 {
     suspendIfNeeded();
 }
@@ -311,6 +314,16 @@
         downcast<KeyframeEffect>(*m_effect).startOrStopAccelerated();
 }
 
+WebAnimation& WebAnimation::readyPromiseResolve()
+{
+    return *this;
+}
+
+WebAnimation& WebAnimation::finishedPromiseResolve()
+{
+    return *this;
+}
+
 String WebAnimation::description()
 {
     return "Animation";

Modified: trunk/Source/WebCore/animation/WebAnimation.h (225811 => 225812)


--- trunk/Source/WebCore/animation/WebAnimation.h	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/Source/WebCore/animation/WebAnimation.h	2017-12-12 23:12:02 UTC (rev 225812)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "ActiveDOMObject.h"
+#include "DOMPromiseProxy.h"
 #include "EventTarget.h"
 #include "ExceptionOr.h"
 #include <wtf/Forward.h>
@@ -72,6 +73,12 @@
     // FIXME: return a live value once we support pending pause and play tasks.
     bool pending() const { return false; }
 
+    using ReadyPromise = DOMPromiseProxyWithResolveCallback<IDLInterface<WebAnimation>>;
+    ReadyPromise& ready() { return m_readyPromise; }
+
+    using FinishedPromise = DOMPromiseProxyWithResolveCallback<IDLInterface<WebAnimation>>;
+    FinishedPromise& finished() { return m_finishedPromise; }
+
     Seconds timeToNextRequiredTick(Seconds) const;
     void resolve(RenderStyle&);
     void acceleratedRunningStateDidChange();
@@ -87,6 +94,8 @@
 
     void enqueueAnimationPlaybackEvent(const AtomicString&, std::optional<Seconds>, std::optional<Seconds>);
     Seconds effectEndTime() const;
+    WebAnimation& readyPromiseResolve();
+    WebAnimation& finishedPromiseResolve();
     
     RefPtr<AnimationEffect> m_effect;
     RefPtr<AnimationTimeline> m_timeline;
@@ -93,6 +102,8 @@
     std::optional<Seconds> m_startTime;
     double m_playbackRate { 1 };
     bool m_isStopped { false };
+    ReadyPromise m_readyPromise;
+    FinishedPromise m_finishedPromise;
 
     // ActiveDOMObject.
     const char* activeDOMObjectName() const final;

Modified: trunk/Source/WebCore/animation/WebAnimation.idl (225811 => 225812)


--- trunk/Source/WebCore/animation/WebAnimation.idl	2017-12-12 23:11:19 UTC (rev 225811)
+++ trunk/Source/WebCore/animation/WebAnimation.idl	2017-12-12 23:12:02 UTC (rev 225812)
@@ -45,4 +45,6 @@
     attribute double playbackRate;
     readonly attribute AnimationPlayState playState;
     readonly attribute boolean pending;
+    readonly attribute Promise<WebAnimation> ready;
+    readonly attribute Promise<WebAnimation> finished;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to