Bug 927349 part 3 - Cancel a pending play when pause is called; r=jwatt

This patch updates the pause procedure for AnimationPlayer so that if there is
a pending play it will be cancelled.

At the same it removes the existing check for a redundant call to Pause when we
are already paused. This check is not necessary since if we are already paused
the method will have no effect anyway.

Finally, this patch updates the comment about going to the pending state while
pausing since this will happen in bug 1109390.
This commit is contained in:
Brian Birtles 2014-12-18 08:42:41 +09:00
Родитель 97da0a29b5
Коммит e7e0331a96
1 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -245,15 +245,33 @@ AnimationPlayer::DoPlay()
void void
AnimationPlayer::DoPause() AnimationPlayer::DoPause()
{ {
if (IsPaused()) { // Cancel a pending play
return; if (mIsPending) {
nsIDocument* doc = GetRenderedDocument();
if (doc) {
PendingPlayerTracker* tracker = doc->GetPendingPlayerTracker();
if (tracker) {
tracker->RemovePlayPending(*this);
}
}
mIsPending = false;
// Resolve the ready promise since we currently only use it for
// players that are waiting to play. Later (in bug 1109390), we will
// use this for players waiting to pause as well and then we won't
// want to resolve it just yet.
if (mReady) {
mReady->MaybeResolve(this);
}
} }
// Mark this as no longer running on the compositor so that next time // Mark this as no longer running on the compositor so that next time
// we update animations we won't throttle them and will have a chance // we update animations we won't throttle them and will have a chance
// to remove the animation from any layer it might be on. // to remove the animation from any layer it might be on.
mIsRunningOnCompositor = false; mIsRunningOnCompositor = false;
// Bug 927349 - check for null result here and go to pending state // Bug 1109390 - check for null result here and go to pending state
mHoldTime = GetCurrentTime(); mHoldTime = GetCurrentTime();
mStartTime.SetNull(); mStartTime.SetNull();
} }