зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1799064 - Avoid potential call PostUpdate() twice in SetTimeline(). r=emilio
Basically, in SetTimelineNoUpdate(), we shouldn't call PostUpdate(). So we shouldn't call SetCurrentTime() directly. There is no behavior change. Just make sure we don't PostUpdate twice while updating an existing CSS animation via changing animation-timeline. Differential Revision: https://phabricator.services.mozilla.com/D161245
This commit is contained in:
Родитель
cfe3a0e68a
Коммит
5f4447e66d
|
@ -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
|
||||
|
|
|
@ -111,7 +111,8 @@ class Animation : public DOMEventTargetHelper,
|
|||
return GetCurrentTimeForHoldTime(mHoldTime);
|
||||
}
|
||||
Nullable<double> GetCurrentTimeAsDouble() const;
|
||||
void SetCurrentTime(const TimeDuration& aNewCurrentTime);
|
||||
void SetCurrentTime(const TimeDuration& aSeekTime);
|
||||
void SetCurrentTimeNoUpdate(const TimeDuration& aSeekTime);
|
||||
void SetCurrentTimeAsDouble(const Nullable<double>& aCurrentTime,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче