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.)

--HG--
extra : rebase_source : 614ed9ef01204e4137783c0d48e975eb8febbe2a
This commit is contained in:
Brian Birtles 2015-05-18 11:41:19 +09:00
Родитель 87aaa8fc5f
Коммит cd4f9730c1
2 изменённых файлов: 14 добавлений и 4 удалений

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

@ -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);

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

@ -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>