void AnimationPlayer::DoPlay() { // FIXME: When we implement finishing behavior (bug 1074630) we will // need to pass a flag so that when we start playing due to a change in // animation-play-state we *don't* trigger finishing behavior. Nullable<TimeDuration> currentTime = GetCurrentTime(); if (currentTime.IsNull()) { mHoldTime.SetValue(TimeDuration(0)); } else if (mHoldTime.IsNull()) { // If the hold time is null, we are already playing normally return; } // Clear ready promise. We'll create a new one lazily. mReady = nullptr; StartNow(); }
void AnimationPlayer::DoPlay() { // FIXME: When we implement finishing behavior (bug 1074630) we will // need to pass a flag so that when we start playing due to a change in // animation-play-state we *don't* trigger finishing behavior. Nullable<TimeDuration> currentTime = GetCurrentTime(); if (currentTime.IsNull()) { mHoldTime.SetValue(TimeDuration(0)); } else if (mHoldTime.IsNull()) { // If the hold time is null, we are already playing normally return; } // Clear ready promise. We'll create a new one lazily. mReady = nullptr; mIsPending = true; nsIDocument* doc = GetRenderedDocument(); if (!doc) { // If we have no rendered document (e.g. because the source content's // target element is orphaned), then treat the animation as ready and // start it immediately. It is probably preferable to make playing // *always* asynchronous (e.g. by setting some additional state that // marks this player as pending and queueing a runnable to resolve the // start time). That situation, however, is currently rare enough that // we don't bother for now. StartNow(); return; } PendingPlayerTracker* tracker = doc->GetOrCreatePendingPlayerTracker(); tracker->AddPlayPending(*this); // We may have updated the current time when we set the hold time above // so notify source content. UpdateSourceContent(); }