diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index 5259d0356afc..dfb553320f40 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -308,7 +308,8 @@ void Animation::SetTimelineNoUpdate(AnimationTimeline* aTimeline) { } else if (oldTimeline && !oldTimeline->IsMonotonicallyIncreasing() && !previousCurrentTime.IsNull()) { // If "from finite timeline" and previous progress is resolved. - SetCurrentTime(TimeDuration(EffectEnd().MultDouble(previousProgress))); + SetCurrentTimeNoUpdate( + TimeDuration(EffectEnd().MultDouble(previousProgress))); } if (!mStartTime.IsNull()) { @@ -322,6 +323,9 @@ void Animation::SetTimelineNoUpdate(AnimationTimeline* aTimeline) { UpdatePendingAnimationTracker(oldTimeline, aTimeline); UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async); + + // FIXME: Bug 1799071: Check if we need to add + // MutationObservers::NotifyAnimationChanged(this) here. } // https://drafts.csswg.org/web-animations/#set-the-animation-start-time @@ -408,6 +412,15 @@ void Animation::SetCurrentTime(const TimeDuration& aSeekTime) { AutoMutationBatchForAnimation mb(*this); + SetCurrentTimeNoUpdate(aSeekTime); + + if (IsRelevant()) { + MutationObservers::NotifyAnimationChanged(this); + } + PostUpdate(); +} + +void Animation::SetCurrentTimeNoUpdate(const TimeDuration& aSeekTime) { SilentlySetCurrentTime(aSeekTime); if (mPendingState == PendingState::PausePending) { @@ -424,10 +437,6 @@ void Animation::SetCurrentTime(const TimeDuration& aSeekTime) { } UpdateTiming(SeekFlag::DidSeek, SyncNotifyFlag::Async); - if (IsRelevant()) { - MutationObservers::NotifyAnimationChanged(this); - } - PostUpdate(); } // https://drafts.csswg.org/web-animations/#set-the-playback-rate diff --git a/dom/animation/Animation.h b/dom/animation/Animation.h index 7fbd2992d143..464a273a6b85 100644 --- a/dom/animation/Animation.h +++ b/dom/animation/Animation.h @@ -111,7 +111,8 @@ class Animation : public DOMEventTargetHelper, return GetCurrentTimeForHoldTime(mHoldTime); } Nullable GetCurrentTimeAsDouble() const; - void SetCurrentTime(const TimeDuration& aNewCurrentTime); + void SetCurrentTime(const TimeDuration& aSeekTime); + void SetCurrentTimeNoUpdate(const TimeDuration& aSeekTime); void SetCurrentTimeAsDouble(const Nullable& aCurrentTime, ErrorResult& aRv);