This source file includes following definitions.
- shouldCompositeForActiveAnimations
- hasActiveAnimations
- hasActiveAnimationsOnCompositor
- hasActiveAnimations
- hasActiveAnimationsOnCompositor
- cancelAnimationOnCompositor
- trace
#include "config.h"
#include "core/animation/ActiveAnimations.h"
#include "core/rendering/RenderObject.h"
namespace WebCore {
bool shouldCompositeForActiveAnimations(const RenderObject& renderer)
{
if (!renderer.node() || !renderer.node()->isElementNode())
return false;
const Element* element = toElement(renderer.node());
if (const ActiveAnimations* activeAnimations = element->activeAnimations()) {
if (activeAnimations->hasActiveAnimations(CSSPropertyOpacity)
|| activeAnimations->hasActiveAnimations(CSSPropertyTransform)
|| activeAnimations->hasActiveAnimations(CSSPropertyWebkitFilter))
return true;
}
return false;
}
bool hasActiveAnimations(const RenderObject& renderer, CSSPropertyID property)
{
if (!renderer.node() || !renderer.node()->isElementNode())
return false;
const Element* element = toElement(renderer.node());
if (const ActiveAnimations* activeAnimations = element->activeAnimations())
return activeAnimations->hasActiveAnimations(property);
return false;
}
bool hasActiveAnimationsOnCompositor(const RenderObject& renderer, CSSPropertyID property)
{
if (!renderer.node() || !renderer.node()->isElementNode())
return false;
const Element* element = toElement(renderer.node());
if (const ActiveAnimations* activeAnimations = element->activeAnimations())
return activeAnimations->hasActiveAnimationsOnCompositor(property);
return false;
}
bool ActiveAnimations::hasActiveAnimations(CSSPropertyID property) const
{
for (AnimationPlayerSet::const_iterator it = m_players.begin(); it != players().end(); ++it) {
const AnimationPlayer& player = *it->key;
ASSERT(player.source());
ASSERT(player.source()->isAnimation());
const Animation& animation = *toAnimation(player.source());
if (animation.isCurrent() && animation.affects(property))
return true;
}
return false;
}
bool ActiveAnimations::hasActiveAnimationsOnCompositor(CSSPropertyID property) const
{
return m_defaultStack.hasActiveAnimationsOnCompositor(property);
}
void ActiveAnimations::cancelAnimationOnCompositor()
{
for (AnimationPlayerSet::iterator it = m_players.begin(); it != players().end(); ++it)
it->key->cancelAnimationOnCompositor();
}
void ActiveAnimations::trace(Visitor* visitor)
{
visitor->trace(m_cssAnimations);
}
}