This source file includes following definitions.
- updateAnimationTiming
- updateAnimationTimingForAnimationFrame
- updateOutdatedAnimationPlayersAfterFrameCallbacks
- updateAnimationTimingForGetComputedStyle
- startPendingAnimations
#include "config.h"
#include "core/animation/DocumentAnimations.h"
#include "core/animation/ActiveAnimations.h"
#include "core/animation/AnimationClock.h"
#include "core/animation/DocumentTimeline.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/Node.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/compositing/RenderLayerCompositor.h"
namespace WebCore {
namespace {
void updateAnimationTiming(Document& document, AnimationPlayer::UpdateReason reason)
{
document.timeline().serviceAnimations(reason);
document.transitionTimeline().serviceAnimations(reason);
}
}
void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& document, double monotonicAnimationStartTime)
{
document.animationClock().updateTime(monotonicAnimationStartTime);
updateAnimationTiming(document, AnimationPlayer::UpdateForAnimationFrame);
}
void DocumentAnimations::updateOutdatedAnimationPlayersAfterFrameCallbacks(Document& document)
{
if (document.timeline().hasOutdatedAnimationPlayer()) {
updateAnimationTiming(document, AnimationPlayer::UpdateOnDemand);
}
}
void DocumentAnimations::updateAnimationTimingForGetComputedStyle(Node& node, CSSPropertyID property)
{
if (!node.isElementNode())
return;
const Element& element = toElement(node);
if (element.document().timeline().hasOutdatedAnimationPlayer()) {
updateAnimationTiming(element.document(), AnimationPlayer::UpdateOnDemand);
return;
}
if (const ActiveAnimations* activeAnimations = element.activeAnimations()) {
if (activeAnimations->hasActiveAnimationsOnCompositor(property))
updateAnimationTiming(element.document(), AnimationPlayer::UpdateOnDemand);
}
}
void DocumentAnimations::startPendingAnimations(Document& document)
{
ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean);
if (document.cssPendingAnimations().startPendingAnimations()) {
ASSERT(document.view());
document.view()->scheduleAnimation();
}
document.animationClock().unfreeze();
}
}