void SMILTimeContainer::begin() { RELEASE_ASSERT(!m_beginTime); if (!handleAnimationPolicy(RestartOnceTimerIfNotPaused)) return; double now = currentTime(); // If 'm_presetStartTime' is set, the timeline was modified via setElapsed() before the document began. // In this case pass on 'seekToTime=true' to updateAnimations(). m_beginTime = now - m_presetStartTime; #if !ENABLE(OILPAN) DiscardScope discardScope(m_ownerSVGElement); #endif SMILTime earliestFireTime = updateAnimations(SMILTime(m_presetStartTime), m_presetStartTime ? true : false); m_presetStartTime = 0; if (m_pauseTime) { m_pauseTime = now; // If updateAnimations() caused new syncbase instance to be generated, // we don't want to cancel those. Excepting that, no frame should've // been scheduled at this point. ASSERT(m_frameSchedulingState == Idle || m_frameSchedulingState == SynchronizeAnimations); } else if (!hasPendingSynchronization()) { ASSERT(isTimelineRunning()); // If the timeline is running, and there's pending animation updates, // always perform the first update after the timeline was started using // the wake-up mechanism. if (earliestFireTime.isFinite()) { SMILTime delay = earliestFireTime - elapsed(); scheduleWakeUp(std::max(initialFrameDelay, delay.value()), SynchronizeAnimations); } } }
void SMILTimeContainer::scheduleAnimationFrame() { if (!isTimelineRunning()) return; m_timer.startOneShot(0); }
void SMILTimeContainer::scheduleAnimationFrame(SMILTime fireTime) { if (!isTimelineRunning()) return; if (!fireTime.isFinite()) return; SMILTime delay = max(fireTime - elapsed(), SMILTime(animationFrameDelay)); m_timer.startOneShot(delay.value()); }
void SMILTimeContainer::wakeupTimerFired(Timer<SMILTimeContainer>*) { ASSERT(m_frameSchedulingState == SynchronizeAnimations || m_frameSchedulingState == FutureAnimationFrame); if (m_frameSchedulingState == FutureAnimationFrame) { ASSERT(isTimelineRunning()); m_frameSchedulingState = Idle; serviceOnNextFrame(); } else { m_frameSchedulingState = Idle; updateAnimationsAndScheduleFrameIfNeeded(elapsed()); } }
void SMILTimeContainer::scheduleAnimationFrame(SMILTime fireTime) { ASSERT(isTimelineRunning() && fireTime.isFinite()); ASSERT(!m_wakeupTimer.isActive()); SMILTime delay = fireTime - elapsed(); if (delay.value() < AnimationTimeline::s_minimumDelay) { serviceOnNextFrame(); } else { scheduleWakeUp(delay.value() - AnimationTimeline::s_minimumDelay, FutureAnimationFrame); } }
void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToTime) { #if !ENABLE(OILPAN) DiscardScope discardScope(m_ownerSVGElement); #endif SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime); // If updateAnimations() ended up triggering a synchronization (most likely // via syncbases), then give that priority. if (hasPendingSynchronization()) return; if (!isTimelineRunning()) return; if (!earliestFireTime.isFinite()) return; scheduleAnimationFrame(earliestFireTime); }
void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToTime) { if (!document().isActive()) return; SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime); // If updateAnimations() ended up triggering a synchronization (most likely // via syncbases), then give that priority. if (hasPendingSynchronization()) return; if (!isTimelineRunning()) return; if (!earliestFireTime.isFinite()) return; scheduleAnimationFrame(earliestFireTime); }
void SMILTimeContainer::timerFired(Timer<SMILTimeContainer>*) { ASSERT(isTimelineRunning()); updateAnimations(elapsed()); }