Commit 008d0a49 authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Fix Animation::playState

https://github.com/w3c/csswg-drafts/issues/5400

There is the issue that led to the spec change for play state:

https://github.com/w3c/csswg-drafts/issues/2066

The issue addresses undesirable toggling of the play state due to
inactive timelines, but does not seem to adequately address having an
unresolved (null) timeline.


Bug: 1113382
Change-Id: I33032ee1e9de10d3dce4958fce599bd98391328f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339676Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796403}
parent 82e163da
......@@ -942,7 +942,9 @@ Animation::AnimationPlayState Animation::CalculateAnimationPlayState() const {
// * animation does not have either a pending play task or a pending pause
// task,
// then idle.
if (!CurrentTimeInternal() && !start_time_ && !PendingInternal())
// https://github.com/w3c/csswg-drafts/issues/5400
if (!CurrentTimeInternal() && (!start_time_ || !timeline_) &&
!PendingInternal())
return kIdle;
// 2. Either of the following conditions are true:
......
......@@ -60,7 +60,7 @@ test(t => {
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.startTime = document.timeline.currentTime;
assert_equals(animation.playState, 'running');
assert_equals(animation.playState, 'idle');
animation.timeline = document.timeline;
......@@ -73,7 +73,7 @@ test(t => {
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.startTime = document.timeline.currentTime - 200 * MS_PER_SEC;
assert_equals(animation.playState, 'running');
assert_equals(animation.playState, 'idle');
animation.timeline = document.timeline;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment