Bug 1166164 part 1 - Make setting the current time complete a pending pause, not abort it; r=jwatt

The point of making pausing async is to allow time to sync up the current time
with the compositor. Setting the current time manually should simply force it to
the specified time and complete the pause action, not abort it. (We do a similar
thing for a pending play. For a pending play we're waiting to establish
a suitable start time. Manually setting the start time in that case simply
forces the start time to the specified time and completes the play operation.)
This commit is contained in:
Brian Birtles 2015-05-18 11:41:19 +09:00
parent 0cc4a5377f
commit 67c2a91189
2 changed files with 14 additions and 4 deletions

View File

@ -120,10 +120,14 @@ Animation::SetCurrentTime(const TimeDuration& aSeekTime)
SilentlySetCurrentTime(aSeekTime);
if (mPendingState == PendingState::PausePending) {
CancelPendingTasks();
// Finish the pause operation
mHoldTime.SetValue(aSeekTime);
mStartTime.SetNull();
if (mReady) {
mReady->MaybeResolve(this);
}
CancelPendingTasks();
}
UpdateFinishedState(true);

View File

@ -186,8 +186,14 @@ async_test(function(t) {
// Set current time
animation.currentTime = 5000;
assert_equals(animation.playState, 'running',
'Animation is running immediately after setting currentTime');
assert_equals(animation.playState, 'paused',
'Animation is paused immediately after setting currentTime');
assert_equals(animation.startTime, null,
'Animation startTime is unresolved immediately after ' +
'setting currentTime');
assert_equals(animation.currentTime, 5000,
'Animation currentTime does not change when forcing a ' +
'pause operation to complete');
// The ready promise should now be resolved. If it's not then test will
// probably time out before anything else happens that causes it to resolve.
@ -195,7 +201,7 @@ async_test(function(t) {
})).then(t.step_func(function() {
t.done();
}));
}, 'Setting the current time cancels a pending pause');
}, 'Setting the current time completes a pending pause');
done();
</script>