Skip to content

Commit

Permalink
Merge pull request #479 from suzyh/play-state
Browse files Browse the repository at this point in the history
Ensure idle animations become paused if seeked.
  • Loading branch information
alancutter authored Jul 28, 2016
2 parents e7041fc + 2ffa141 commit 46f41d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
this._currentTimePending = false;
if (this._currentTime == newTime)
return;
if (this._idle) {
this._idle = false;
this._paused = true;
}
this._tickCurrentTime(newTime, true);
scope.invalidateEffects();
},
Expand Down Expand Up @@ -180,8 +184,9 @@
return;
this._inEffect = false;
this._idle = true;
this._paused = false;
this._finishedFlag = true;
this.currentTime = 0;
this._currentTime = 0;
this._startTime = null;
this._effect._update(null);
// effects are invalid after cancellation as the animation state
Expand Down
10 changes: 1 addition & 9 deletions test/web-platform-tests-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ module.exports = {
},

'test/web-platform-tests/web-animations/interfaces/Animation/cancel.html': {
'After cancelling an animation, it can still be seeked':
'assert_equals: margin-left style is updated when cancelled animation is seeked expected "50px" but got "0px"',

'Animated style is cleared after calling Animation.cancel()':
'assert_not_equals: transform style is animated before cancelling got disallowed value "none"',
},
Expand Down Expand Up @@ -226,11 +223,6 @@ module.exports = {
'assert_throws: Expect InvalidStateError exception on calling pause() from idle with a negative playbackRate and infinite-duration animation function "function () {\n"use strict";\n animation.pause(); }" did not throw',
},

'test/web-platform-tests/web-animations/interfaces/Animation/playState.html': {
'Animation.playState is \'paused\' after cancelling an animation, seeking it makes it paused':
'assert_equals: After seeking an idle animation, it is effectively paused expected "paused" but got "idle"',
},

'test/web-platform-tests/web-animations/interfaces/Animation/playbackRate.html': {
'Test the effect of setting playbackRate while playing animation':
'FLAKY_TEST_RESULT',
Expand Down Expand Up @@ -1437,7 +1429,7 @@ module.exports = {
'assert_equals: expected "running" but got "idle"',

'Setting the start time clears the hold time':
'assert_equals: The current time is calculated from the hold time expected (number) 1000 but got (object) null',
'assert_approx_equals: The current time is calculated from the start time, not the hold time expected 2000 +/- 0.0005 but got 1000',

'Setting the start time of an animation without an active timeline':
'Animation with null timeline is not supported',
Expand Down

0 comments on commit 46f41d1

Please sign in to comment.