Diff
Modified: trunk/LayoutTests/ChangeLog (225806 => 225807)
--- trunk/LayoutTests/ChangeLog 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/LayoutTests/ChangeLog 2017-12-12 22:24:37 UTC (rev 225807)
@@ -1,3 +1,17 @@
+2017-12-12 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Implement the playState property on Animation
+ https://bugs.webkit.org/show_bug.cgi?id=180711
+ <rdar://problem/36000982>
+
+ Reviewed by Dean Jackson.
+
+ Rebase some WPT expectations with progressions due to exposing the "playState" and "pending" properties.
+
+ * http/wpt/web-animations/interfaces/Animation/constructor-expected.txt:
+ * http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt:
+ * http/wpt/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt:
+
2017-12-12 Youenn Fablet <you...@apple.com>
Navigation requests should use navigate fetch mode
Modified: trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/constructor-expected.txt (225806 => 225807)
--- trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/constructor-expected.txt 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/constructor-expected.txt 2017-12-12 22:24:37 UTC (rev 225807)
@@ -1,7 +1,7 @@
FAIL Animation can be constructed with null effect and null timeline assert_equals: Animation timeline should be null expected null but got object "[object DocumentTimeline]"
-FAIL Animation can be constructed with null effect and non-null timeline assert_equals: Animation.playState should be initially 'idle' expected (string) "idle" but got (undefined) undefined
-FAIL Animation can be constructed with null effect and no timeline parameter assert_equals: Animation.playState should be initially 'idle' expected (string) "idle" but got (undefined) undefined
+PASS Animation can be constructed with null effect and non-null timeline
+PASS Animation can be constructed with null effect and no timeline parameter
FAIL Animation can be constructed with non-null effect and null timeline Can't find variable: KeyframeEffectReadOnly
FAIL Animation can be constructed with non-null effect and non-null timeline Can't find variable: KeyframeEffectReadOnly
FAIL Animation can be constructed with non-null effect and no timeline parameter Can't find variable: KeyframeEffectReadOnly
Modified: trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt (225806 => 225807)
--- trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/LayoutTests/http/wpt/web-animations/interfaces/Animation/idlharness-expected.txt 2017-12-12 22:24:37 UTC (rev 225807)
@@ -11,7 +11,7 @@
PASS Animation interface: attribute startTime
PASS Animation interface: attribute currentTime
PASS Animation interface: attribute playbackRate
-FAIL Animation interface: attribute playState assert_true: The prototype object must have a property "playState" expected true got false
+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
FAIL Animation interface: attribute onfinish assert_true: The prototype object must have a property "onfinish" expected true got false
@@ -29,7 +29,7 @@
PASS Animation interface: new Animation() must inherit property "startTime" with the proper type
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
-FAIL Animation interface: new Animation() must inherit property "playState" with the proper type assert_inherits: property "playState" not found in prototype chain
+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
FAIL Animation interface: new Animation() must inherit property "onfinish" with the proper type assert_inherits: property "onfinish" not found in prototype chain
Modified: trunk/LayoutTests/http/wpt/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt (225806 => 225807)
--- trunk/LayoutTests/http/wpt/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/LayoutTests/http/wpt/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt 2017-12-12 22:24:37 UTC (rev 225807)
@@ -1,17 +1,17 @@
-FAIL After setting timeline on paused animation it is still paused assert_equals: expected (string) "paused" but got (undefined) undefined
-FAIL After setting timeline on animation paused outside active interval it is still paused assert_equals: expected (string) "paused" but got (undefined) undefined
-FAIL After setting timeline on an idle animation without a start time it is still idle assert_equals: expected (string) "idle" but got (undefined) undefined
-FAIL After setting timeline on an idle animation with a start time it is running assert_equals: expected (string) "idle" but got (undefined) undefined
-FAIL After setting timeline on an idle animation with a sufficiently ancient start time it is finished assert_equals: expected (string) "idle" but got (undefined) undefined
+FAIL After setting timeline on paused animation it is still paused assert_equals: expected "paused" but got "finished"
+FAIL After setting timeline on animation paused outside active interval it is still paused assert_equals: expected "paused" but got "finished"
+PASS After setting timeline on an idle animation without a start time it is still idle
+FAIL After setting timeline on an idle animation with a start time it is running assert_equals: expected "idle" but got "finished"
+FAIL After setting timeline on an idle animation with a sufficiently ancient start time it is finished assert_equals: expected "idle" but got "finished"
FAIL After setting timeline on a play-pending animation it is still pending animation.play is not a function. (In 'animation.play()', 'animation.play' is undefined)
FAIL After setting timeline on a play-pending animation it begins playing after pending animation.play is not a function. (In 'animation.play()', 'animation.play' is undefined)
FAIL After setting timeline on a pause-pending animation it is still pending animation.pause is not a function. (In 'animation.pause()', 'animation.pause' is undefined)
FAIL After setting timeline on a pause-pending animation it becomes paused after pending animation.pause is not a function. (In 'animation.pause()', 'animation.pause' is undefined)
-FAIL After clearing timeline on paused animation it is still paused assert_equals: expected (string) "paused" but got (undefined) undefined
-FAIL After clearing timeline on finished animation it is idle assert_equals: expected (string) "finished" but got (undefined) undefined
-FAIL After clearing timeline on running animation it is idle assert_equals: expected (string) "running" but got (undefined) undefined
-FAIL After clearing timeline on idle animation it is still idle assert_equals: expected (string) "idle" but got (undefined) undefined
+FAIL After clearing timeline on paused animation it is still paused assert_equals: expected "paused" but got "finished"
+PASS After clearing timeline on finished animation it is idle
+FAIL After clearing timeline on running animation it is idle assert_equals: expected "running" but got "finished"
+PASS After clearing timeline on idle animation it is still idle
FAIL After clearing timeline on play-pending animation it is still pending createDiv(t).animate is not a function. (In 'createDiv(t).animate(null, 100 * MS_PER_SEC)', 'createDiv(t).animate' is undefined)
FAIL After clearing and re-setting timeline on play-pending animation it begins to play createDiv(t).animate is not a function. (In 'createDiv(t).animate(null, 100 * MS_PER_SEC)', 'createDiv(t).animate' is undefined)
FAIL After clearing timeline on a pause-pending animation it is still pending animation.pause is not a function. (In 'animation.pause()', 'animation.pause' is undefined)
Modified: trunk/Source/WebCore/ChangeLog (225806 => 225807)
--- trunk/Source/WebCore/ChangeLog 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/Source/WebCore/ChangeLog 2017-12-12 22:24:37 UTC (rev 225807)
@@ -1,3 +1,22 @@
+2017-12-12 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Implement the playState property on Animation
+ https://bugs.webkit.org/show_bug.cgi?id=180711
+ <rdar://problem/36000982>
+
+ Reviewed by Dean Jackson.
+
+ Expose the playState and pending properties. The playState property has a complete implementation but
+ has some test failures due to Animation lacking correct behavior while running animations which will
+ be fixed in a followup patch. The pending property is a placeholder until we implement pending play
+ and pause tasks in followup patches.
+
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::playState const):
+ (WebCore::WebAnimation::effectEndTime const):
+ * animation/WebAnimation.h:
+ * animation/WebAnimation.idl:
+
2017-12-12 Javier Fernandez <jfernan...@igalia.com>
[css-grid] Implement alignment for absolute positioned grid items
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (225806 => 225807)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2017-12-12 22:24:37 UTC (rev 225807)
@@ -217,6 +217,39 @@
setCurrentTime(previousTime);
}
+auto WebAnimation::playState() const -> PlayState
+{
+ // Section 3.5.19. Play states
+
+ // Animation has a pending play task or a pending pause task → pending
+ if (pending())
+ return PlayState::Pending;
+
+ // The current time of animation is unresolved → idle
+ if (!currentTime())
+ return PlayState::Idle;
+
+ // The start time of animation is unresolved → paused
+ if (!startTime())
+ return PlayState::Paused;
+
+ // For animation, animation playback rate > 0 and current time ≥ target effect end; or
+ // animation playback rate < 0 and current time ≤ 0 → finished
+ if ((m_playbackRate > 0 && currentTime().value() >= effectEndTime()) || (m_playbackRate < 0 && currentTime().value() <= 0_s))
+ return PlayState::Finished;
+
+ // Otherwise → running
+ return PlayState::Running;
+}
+
+Seconds WebAnimation::effectEndTime() const
+{
+ // The target effect end of an animation is equal to the end time of the animation's target effect.
+ // If the animation has no target effect, the target effect end is zero.
+ // FIXME: Use the effect's computed end time once we support it (webkit.org/b/179170).
+ return m_effect ? m_effect->timing()->duration() : 0_s;
+}
+
void WebAnimation::enqueueAnimationPlaybackEvent(const AtomicString& type, std::optional<Seconds> currentTime, std::optional<Seconds> timelineTime)
{
auto event = AnimationPlaybackEvent::create(type, currentTime, timelineTime);
Modified: trunk/Source/WebCore/animation/WebAnimation.h (225806 => 225807)
--- trunk/Source/WebCore/animation/WebAnimation.h 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/Source/WebCore/animation/WebAnimation.h 2017-12-12 22:24:37 UTC (rev 225807)
@@ -66,6 +66,12 @@
double playbackRate() const { return m_playbackRate; }
void setPlaybackRate(double);
+ enum class PlayState { Idle, Pending, Running, Paused, Finished };
+ PlayState playState() const;
+
+ // FIXME: return a live value once we support pending pause and play tasks.
+ bool pending() const { return false; }
+
Seconds timeToNextRequiredTick(Seconds) const;
void resolve(RenderStyle&);
void acceleratedRunningStateDidChange();
@@ -80,6 +86,7 @@
explicit WebAnimation(Document&);
void enqueueAnimationPlaybackEvent(const AtomicString&, std::optional<Seconds>, std::optional<Seconds>);
+ Seconds effectEndTime() const;
RefPtr<AnimationEffect> m_effect;
RefPtr<AnimationTimeline> m_timeline;
Modified: trunk/Source/WebCore/animation/WebAnimation.idl (225806 => 225807)
--- trunk/Source/WebCore/animation/WebAnimation.idl 2017-12-12 22:23:17 UTC (rev 225806)
+++ trunk/Source/WebCore/animation/WebAnimation.idl 2017-12-12 22:24:37 UTC (rev 225807)
@@ -23,6 +23,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+enum AnimationPlayState {
+ "idle",
+ "pending",
+ "running",
+ "paused",
+ "finished"
+};
+
[
ActiveDOMObject,
EnabledAtRuntime=WebAnimations,
@@ -35,4 +43,6 @@
[ImplementedAs=bindingsStartTime] attribute double? startTime;
[MayThrowException, ImplementedAs=bindingsCurrentTime] attribute double? currentTime;
attribute double playbackRate;
+ readonly attribute AnimationPlayState playState;
+ readonly attribute boolean pending;
};