Bug 1181905 - Animation::IsPlaying should check playbackRate != 0 to stop playing on compositor animation. r=bbirtles

This commit is contained in:
Hiroyuki Ikezoe 2015-07-09 20:54:00 +02:00
parent eb88e69b1d
commit 96c914a343
2 changed files with 21 additions and 2 deletions

View File

@ -246,13 +246,15 @@ public:
* still running but we only consider it playing when it is in its active
* interval. This definition is used for fetching the animations that are
* candidates for running on the compositor (since we don't ship animations
* to the compositor when they are in their delay phase or paused).
* to the compositor when they are in their delay phase or paused including
* being effectively paused due to having a zero playback rate).
*/
bool IsPlaying() const
{
// We need to have an effect in its active interval, and
// be either running or waiting to run.
// be either running or waiting to run with a non-zero playback rate.
return HasInPlayEffect() &&
mPlaybackRate != 0.0 &&
(PlayState() == AnimationPlayState::Running ||
mPendingState == PendingState::PlayPending);
}

View File

@ -50,6 +50,23 @@ addAsyncAnimTest(function *() {
"at 300ms");
done_div();
});
addAsyncAnimTest(function *() {
var [ div, cs ] = new_div("animation: anim 10s 1 linear forwards");
var animation = div.getAnimations()[0];
advance_clock(300);
yield waitForPaints();
animation.playbackRate = 0;
yield waitForPaintsFlushed();
omta_is(div, "transform", { tx: 3 }, RunningOn.MainThread,
"animation with zero playback rate should stay in the " +
"same position and be running on the main thread");
done_div();
});
</script>
</body>
</html>