This source file includes following definitions.
- add
- startPendingAnimations
- notifyCompositorAnimationStarted
#include "config.h"
#include "core/animation/css/CSSPendingAnimations.h"
#include "core/animation/Animation.h"
#include "core/animation/DocumentTimeline.h"
#include "core/frame/FrameView.h"
#include "core/rendering/RenderLayer.h"
namespace WebCore {
void CSSPendingAnimations::add(AnimationPlayer* player)
{
ASSERT(player->source()->isAnimation());
m_pending.append(player);
}
bool CSSPendingAnimations::startPendingAnimations()
{
bool startedOnCompositor = false;
for (size_t i = 0; i < m_pending.size(); ++i) {
if (m_pending[i]->maybeStartAnimationOnCompositor())
startedOnCompositor = true;
}
if (startedOnCompositor) {
for (size_t i = 0; i < m_pending.size(); ++i)
m_waitingForCompositorAnimationStart.append(m_pending[i]);
} else {
for (size_t i = 0; i < m_pending.size(); ++i) {
m_pending[i]->setStartTime(m_pending[i]->timeline()->currentTime());
m_pending[i]->update(AnimationPlayer::UpdateOnDemand);
}
}
m_pending.clear();
if (startedOnCompositor || m_waitingForCompositorAnimationStart.isEmpty())
return !m_waitingForCompositorAnimationStart.isEmpty();
for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) {
if (m_waitingForCompositorAnimationStart[i].get()->hasActiveAnimationsOnCompositor())
return true;
}
notifyCompositorAnimationStarted(monotonicallyIncreasingTime());
return false;
}
void CSSPendingAnimations::notifyCompositorAnimationStarted(double monotonicAnimationStartTime)
{
for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) {
AnimationPlayer* player = m_waitingForCompositorAnimationStart[i].get();
player->setStartTime(monotonicAnimationStartTime - player->timeline()->zeroTime());
player->update(AnimationPlayer::UpdateOnDemand);
}
m_waitingForCompositorAnimationStart.clear();
}
}