mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1109390 part 22 - Add AnimationPlayer::PauseAt to complete a pending pause; r=jwatt
This patch adds the method that is called when an asynchronous pause operation has completed. It is not used yet, however, since we don't yet put AnimationPlayer objects in the pause-pending map.
This commit is contained in:
parent
c9b0ef8904
commit
e1ab78805c
@ -287,14 +287,14 @@ AnimationPlayer::Tick()
|
||||
if (mPendingState != PendingState::NotPending &&
|
||||
!mPendingReadyTime.IsNull() &&
|
||||
mPendingReadyTime.Value() <= mTimeline->GetCurrentTime().Value()) {
|
||||
ResumeAt(mPendingReadyTime.Value());
|
||||
FinishPendingAt(mPendingReadyTime.Value());
|
||||
mPendingReadyTime.SetNull();
|
||||
}
|
||||
|
||||
if (IsPossiblyOrphanedPendingPlayer()) {
|
||||
MOZ_ASSERT(mTimeline && !mTimeline->GetCurrentTime().IsNull(),
|
||||
"Orphaned pending players should have an active timeline");
|
||||
ResumeAt(mTimeline->GetCurrentTime().Value());
|
||||
FinishPendingAt(mTimeline->GetCurrentTime().Value());
|
||||
}
|
||||
|
||||
UpdateTiming();
|
||||
@ -323,7 +323,7 @@ AnimationPlayer::TriggerNow()
|
||||
MOZ_ASSERT(mTimeline && !mTimeline->GetCurrentTime().IsNull(),
|
||||
"Expected an active timeline");
|
||||
|
||||
ResumeAt(mTimeline->GetCurrentTime().Value());
|
||||
FinishPendingAt(mTimeline->GetCurrentTime().Value());
|
||||
}
|
||||
|
||||
Nullable<TimeDuration>
|
||||
@ -506,7 +506,7 @@ AnimationPlayer::DoPause()
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::ResumeAt(const TimeDuration& aResumeTime)
|
||||
AnimationPlayer::ResumeAt(const TimeDuration& aReadyTime)
|
||||
{
|
||||
// This method is only expected to be called for a player that is
|
||||
// waiting to play. We can easily adapt it to handle other states
|
||||
@ -518,10 +518,10 @@ AnimationPlayer::ResumeAt(const TimeDuration& aResumeTime)
|
||||
" hold time");
|
||||
|
||||
if (mPlaybackRate != 0) {
|
||||
mStartTime.SetValue(aResumeTime - (mHoldTime.Value() / mPlaybackRate));
|
||||
mStartTime.SetValue(aReadyTime - (mHoldTime.Value() / mPlaybackRate));
|
||||
mHoldTime.SetNull();
|
||||
} else {
|
||||
mStartTime.SetValue(aResumeTime);
|
||||
mStartTime.SetValue(aReadyTime);
|
||||
}
|
||||
mPendingState = PendingState::NotPending;
|
||||
|
||||
@ -532,6 +532,26 @@ AnimationPlayer::ResumeAt(const TimeDuration& aResumeTime)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::PauseAt(const TimeDuration& aReadyTime)
|
||||
{
|
||||
MOZ_ASSERT(mPendingState == PendingState::PausePending,
|
||||
"Expected to pause a pause-pending player");
|
||||
|
||||
if (!mStartTime.IsNull()) {
|
||||
mHoldTime.SetValue((aReadyTime - mStartTime.Value())
|
||||
.MultDouble(mPlaybackRate));
|
||||
}
|
||||
mStartTime.SetNull();
|
||||
mPendingState = PendingState::NotPending;
|
||||
|
||||
UpdateTiming();
|
||||
|
||||
if (mReady) {
|
||||
mReady->MaybeResolve(this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::UpdateTiming()
|
||||
{
|
||||
|
@ -262,7 +262,18 @@ public:
|
||||
protected:
|
||||
void DoPlay(LimitBehavior aLimitBehavior);
|
||||
void DoPause();
|
||||
void ResumeAt(const TimeDuration& aResumeTime);
|
||||
void ResumeAt(const TimeDuration& aReadyTime);
|
||||
void PauseAt(const TimeDuration& aReadyTime);
|
||||
void FinishPendingAt(const TimeDuration& aReadyTime)
|
||||
{
|
||||
if (mPendingState == PendingState::PlayPending) {
|
||||
ResumeAt(aReadyTime);
|
||||
} else if (mPendingState == PendingState::PausePending) {
|
||||
PauseAt(aReadyTime);
|
||||
} else {
|
||||
NS_NOTREACHED("Can't finish pending if we're not in a pending state");
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateTiming();
|
||||
void UpdateFinishedState(bool aSeekFlag = false);
|
||||
|
Loading…
Reference in New Issue
Block a user