mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1216846 - Don't update hold time when completing a pause if it is already set; r=heycam
The Animation.pause() method operates asynchronously since, if the animation is currently running on the compositor, we should wait for the animation to stop on the compositor before establishing the pause time. Otherwise, if the compositor is ahead of the main thread and we use the main thread's notion of the current time to establish the pause time, the animation will jump backwards when we take it off the compositor. This pause time is represented using the "hold time". However, when we have a finished animation, its current time is not advancing but rather its current time is fixed to its end time. This too is represented using the hold time. As a result, if we pause a finished animation we should not update its hold time (by calculating the current time from the start time) but just continue to use the existing hold time. This is true of any other situation where we might have set the hold time before or during pausing.
This commit is contained in:
parent
0eb94a796a
commit
b7a8c05c63
@ -933,7 +933,7 @@ Animation::PauseAt(const TimeDuration& aReadyTime)
|
||||
MOZ_ASSERT(mPendingState == PendingState::PausePending,
|
||||
"Expected to pause a pause-pending animation");
|
||||
|
||||
if (!mStartTime.IsNull()) {
|
||||
if (!mStartTime.IsNull() && mHoldTime.IsNull()) {
|
||||
mHoldTime.SetValue((aReadyTime - mStartTime.Value())
|
||||
.MultDouble(mPlaybackRate));
|
||||
}
|
||||
|
@ -257,6 +257,19 @@ test(function(t) {
|
||||
'infinite-duration animation');
|
||||
}, 'pause() from idle with a negative playbackRate and endless effect');
|
||||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t, { style: 'animation: anim 1000s' });
|
||||
return div.getAnimations()[0].ready
|
||||
.then(function(animation) {
|
||||
animation.finish();
|
||||
animation.pause();
|
||||
return animation.ready;
|
||||
}).then(function(animation) {
|
||||
assert_equals(animation.currentTime, 1000 * 1000,
|
||||
'currentTime after pausing finished animation');
|
||||
});
|
||||
}, 'pause() on a finished animation');
|
||||
|
||||
done();
|
||||
</script>
|
||||
</body>
|
||||
|
@ -96,7 +96,7 @@ if (opener) {
|
||||
"assert_between_inclusive",
|
||||
"assert_true", "assert_false",
|
||||
"assert_class_string", "assert_throws",
|
||||
"assert_unreached", "test"]) {
|
||||
"assert_unreached", "promise_test", "test"]) {
|
||||
window[funcName] = opener[funcName].bind(opener);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user