зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1150064, part 1 - Implement the Animation.finish() method. r=birtles, r=smaug
This commit is contained in:
Родитель
31e4e5bba1
Коммит
7646a6a26c
|
@ -217,6 +217,32 @@ Animation::GetFinished(ErrorResult& aRv)
|
|||
return mFinished;
|
||||
}
|
||||
|
||||
void
|
||||
Animation::Finish(ErrorResult& aRv)
|
||||
{
|
||||
// https://w3c.github.io/web-animations/#finish-an-animation
|
||||
|
||||
if (mPlaybackRate == 0 ||
|
||||
(mPlaybackRate > 0 && EffectEnd() == TimeDuration::Forever())) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
TimeDuration limit =
|
||||
mPlaybackRate > 0 ? TimeDuration(EffectEnd()) : TimeDuration(0);
|
||||
|
||||
SetCurrentTime(limit);
|
||||
|
||||
if (mPendingState == PendingState::PlayPending) {
|
||||
CancelPendingTasks();
|
||||
if (mReady) {
|
||||
mReady->MaybeResolve(this);
|
||||
}
|
||||
}
|
||||
UpdateFinishedState(true);
|
||||
PostUpdate();
|
||||
}
|
||||
|
||||
void
|
||||
Animation::Play(LimitBehavior aLimitBehavior)
|
||||
{
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
AnimationPlayState PlayState() const;
|
||||
virtual Promise* GetReady(ErrorResult& aRv);
|
||||
virtual Promise* GetFinished(ErrorResult& aRv);
|
||||
virtual void Finish(ErrorResult& aRv);
|
||||
virtual void Play(LimitBehavior aLimitBehavior);
|
||||
virtual void Pause();
|
||||
bool IsRunningOnCompositor() const { return mIsRunningOnCompositor; }
|
||||
|
|
|
@ -32,8 +32,9 @@ interface Animation {
|
|||
readonly attribute Promise<Animation> finished;
|
||||
/*
|
||||
void cancel ();
|
||||
void finish ();
|
||||
*/
|
||||
[Throws]
|
||||
void finish ();
|
||||
[BinaryName="playFromJS"]
|
||||
void play ();
|
||||
[BinaryName="pauseFromJS"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче