void Animation::UpdateEffect() { if (mEffect) { UpdateRelevance(); } }
void Animation::UpdateEffect() { if (mEffect) { mEffect->SetParentTime(GetCurrentTime()); UpdateRelevance(); } }
void Animation::UpdateEffect() { if (mEffect) { UpdateRelevance(); mEffect->NotifyAnimationTimingUpdated(); } }
void Animation::UpdateEffect() { if (mEffect) { UpdateRelevance(); KeyframeEffectReadOnly* keyframeEffect = mEffect->AsKeyframeEffect(); if (keyframeEffect) { keyframeEffect->NotifyAnimationTimingUpdated(); } } }
// https://w3c.github.io/web-animations/#setting-the-target-effect void Animation::SetEffectNoUpdate(AnimationEffectReadOnly* aEffect) { RefPtr<Animation> kungFuDeathGrip(this); if (mEffect == aEffect) { return; } AutoMutationBatchForAnimation mb(*this); bool wasRelevant = mIsRelevant; if (mEffect) { if (!aEffect) { // If the new effect is null, call ResetPendingTasks before clearing // mEffect since ResetPendingTasks needs it to get the appropriate // PendingAnimationTracker. ResetPendingTasks(); } // We need to notify observers now because once we set mEffect to null // we won't be able to find the target element to notify. if (mIsRelevant) { nsNodeUtils::AnimationRemoved(this); } // Break links with the old effect and then drop it. RefPtr<AnimationEffectReadOnly> oldEffect = mEffect; mEffect = nullptr; oldEffect->SetAnimation(nullptr); // The following will not do any notification because mEffect is null. UpdateRelevance(); } if (aEffect) { // Break links from the new effect to its previous animation, if any. RefPtr<AnimationEffectReadOnly> newEffect = aEffect; Animation* prevAnim = aEffect->GetAnimation(); if (prevAnim) { prevAnim->SetEffect(nullptr); } // Create links with the new effect. SetAnimation(this) will also update // mIsRelevant of this animation, and then notify mutation observer if // needed by calling Animation::UpdateRelevance(), so we don't need to // call it again. mEffect = newEffect; mEffect->SetAnimation(this); // Notify possible add or change. // If the target is different, the change notification will be ignored by // AutoMutationBatchForAnimation. if (wasRelevant && mIsRelevant) { nsNodeUtils::AnimationChanged(this); } // Reschedule pending pause or pending play tasks. // If we have a pending animation, it will either be registered // in the pending animation tracker and have a null pending ready time, // or, after it has been painted, it will be removed from the tracker // and assigned a pending ready time. // After updating the effect we'll typically need to repaint so if we've // already been assigned a pending ready time, we should clear it and put // the animation back in the tracker. if (!mPendingReadyTime.IsNull()) { mPendingReadyTime.SetNull(); nsIDocument* doc = GetRenderedDocument(); if (doc) { PendingAnimationTracker* tracker = doc->GetOrCreatePendingAnimationTracker(); if (mPendingState == PendingState::PlayPending) { tracker->AddPlayPending(*this); } else { tracker->AddPausePending(*this); } } } } UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async); }