- Revision
- 229058
- Author
- [email protected]
- Date
- 2018-02-27 05:00:29 -0800 (Tue, 27 Feb 2018)
Log Message
[Web Animations] Update the playState implementation
https://bugs.webkit.org/show_bug.cgi?id=183145
Reviewed by Dean Jackson.
LayoutTests/imported/w3c:
Update test expectations with slightly different failures later on in a couple of tests.
* web-platform-tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt:
Source/WebCore:
The Web Animations spec has changed since we first implemented the playState property and the "pending"
enum value has been dropped since then (there is a separate "pending" property which we also implement).
We update our implementation to match the latest spec text. This does not change WPT test results a lot,
but this patch will help getting a significant number of new PASS results when we get around to implementing
correct support for async procedures (pending pause/play tasks and promises) in a couple of patches.
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::playState const):
* animation/WebAnimation.h:
* animation/WebAnimation.idl:
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (229057 => 229058)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-02-27 09:36:28 UTC (rev 229057)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-02-27 13:00:29 UTC (rev 229058)
@@ -1,5 +1,16 @@
2018-02-26 Antoine Quint <[email protected]>
+ [Web Animations] Update the playState implementation
+ https://bugs.webkit.org/show_bug.cgi?id=183145
+
+ Reviewed by Dean Jackson.
+
+ Update test expectations with slightly different failures later on in a couple of tests.
+
+ * web-platform-tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt:
+
+2018-02-26 Antoine Quint <[email protected]>
+
[Web Animations] Implement the procedure to set the start time
https://bugs.webkit.org/show_bug.cgi?id=183137
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt (229057 => 229058)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt 2018-02-27 09:36:28 UTC (rev 229057)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation-expected.txt 2018-02-27 13:00:29 UTC (rev 229058)
@@ -4,8 +4,8 @@
PASS After setting timeline on an idle animation without a start time it is still idle
PASS After setting timeline on an idle animation with a start time it is running
PASS After setting timeline on an idle animation with a sufficiently ancient start time it is finished
-FAIL After setting timeline on a play-pending animation it begins playing after pending assert_true: Animation is initially play-pending expected true got false
-FAIL After setting timeline on a pause-pending animation it becomes paused after pending assert_true: Animation is initially pause-pending expected true got false
+FAIL After setting timeline on a play-pending animation it begins playing after pending assert_true: Animation is still play-pending after setting timeline expected true got false
+FAIL After setting timeline on a pause-pending animation it becomes paused after pending assert_true: Animation is still pause-pending after setting timeline expected true got false
PASS After clearing timeline on paused animation it is still paused
PASS After clearing timeline on finished animation it is idle
PASS After clearing timeline on running animation it is idle
Modified: trunk/Source/WebCore/ChangeLog (229057 => 229058)
--- trunk/Source/WebCore/ChangeLog 2018-02-27 09:36:28 UTC (rev 229057)
+++ trunk/Source/WebCore/ChangeLog 2018-02-27 13:00:29 UTC (rev 229058)
@@ -1,3 +1,21 @@
+2018-02-26 Antoine Quint <[email protected]>
+
+ [Web Animations] Update the playState implementation
+ https://bugs.webkit.org/show_bug.cgi?id=183145
+
+ Reviewed by Dean Jackson.
+
+ The Web Animations spec has changed since we first implemented the playState property and the "pending"
+ enum value has been dropped since then (there is a separate "pending" property which we also implement).
+ We update our implementation to match the latest spec text. This does not change WPT test results a lot,
+ but this patch will help getting a significant number of new PASS results when we get around to implementing
+ correct support for async procedures (pending pause/play tasks and promises) in a couple of patches.
+
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::playState const):
+ * animation/WebAnimation.h:
+ * animation/WebAnimation.idl:
+
2018-02-27 Wenson Hsieh <[email protected]>
Address post-review comment after r229049.
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (229057 => 229058)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2018-02-27 09:36:28 UTC (rev 229057)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2018-02-27 13:00:29 UTC (rev 229058)
@@ -397,24 +397,30 @@
auto WebAnimation::playState() const -> PlayState
{
- // Section 3.5.19. Play states
+ // 3.5.19 Play states
+ // https://drafts.csswg.org/web-animations/#play-states
- // Animation has a pending play task or a pending pause task → pending
- if (pending())
- return PlayState::Pending;
+ // The play state of animation, animation, at a given moment is the state corresponding to the
+ // first matching condition from the following:
- // The current time of animation is unresolved → idle
+ // The current time of animation is unresolved, and animation does not have either a pending
+ // play task or a pending pause task,
+ // → idle
auto animationCurrentTime = currentTime();
- if (!animationCurrentTime)
+ if (!animationCurrentTime && !pending())
return PlayState::Idle;
- // The start time of animation is unresolved → paused
- if (!startTime())
+ // Animation has a pending pause task, or both the start time of animation is unresolved and it does not
+ // have a pending play task,
+ // → paused
+ if (hasPendingPauseTask() || (!m_startTime && !hasPendingPlayTask()))
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 && animationCurrentTime.value() >= effectEndTime()) || (m_playbackRate < 0 && animationCurrentTime.value() <= 0_s))
+ // For animation, current time is resolved and either of the following conditions are true:
+ // playback rate > 0 and current time ≥ target effect end; or
+ // playback rate < 0 and current time ≤ 0,
+ // → finished
+ if (animationCurrentTime && ((m_playbackRate > 0 && animationCurrentTime.value() >= effectEndTime()) || (m_playbackRate < 0 && animationCurrentTime.value() <= 0_s)))
return PlayState::Finished;
// Otherwise → running
Modified: trunk/Source/WebCore/animation/WebAnimation.h (229057 => 229058)
--- trunk/Source/WebCore/animation/WebAnimation.h 2018-02-27 09:36:28 UTC (rev 229057)
+++ trunk/Source/WebCore/animation/WebAnimation.h 2018-02-27 13:00:29 UTC (rev 229058)
@@ -73,7 +73,7 @@
double playbackRate() const { return m_playbackRate; }
void setPlaybackRate(double, Silently silently = Silently::No );
- enum class PlayState { Idle, Pending, Running, Paused, Finished };
+ enum class PlayState { Idle, Running, Paused, Finished };
PlayState playState() const;
bool pending() const { return hasPendingPauseTask() || hasPendingPlayTask(); }
Modified: trunk/Source/WebCore/animation/WebAnimation.idl (229057 => 229058)
--- trunk/Source/WebCore/animation/WebAnimation.idl 2018-02-27 09:36:28 UTC (rev 229057)
+++ trunk/Source/WebCore/animation/WebAnimation.idl 2018-02-27 13:00:29 UTC (rev 229058)
@@ -25,7 +25,6 @@
enum AnimationPlayState {
"idle",
- "pending",
"running",
"paused",
"finished"