CompositeAnimation.h [plain text]
#ifndef CompositeAnimation_h
#define CompositeAnimation_h
#include "ImplicitAnimation.h"
#include "KeyframeAnimation.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
class AnimationControllerPrivate;
class AnimationController;
class RenderObject;
class RenderStyle;
class WebKitAnimationList;
class CompositeAnimation : public RefCounted<CompositeAnimation> {
public:
static PassRefPtr<CompositeAnimation> create(AnimationControllerPrivate* animationController)
{
return adoptRef(new CompositeAnimation(animationController));
};
~CompositeAnimation();
void clearRenderer();
PassRefPtr<RenderStyle> animate(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
PassRefPtr<RenderStyle> getAnimatedStyle() const;
double timeToNextService() const;
AnimationControllerPrivate* animationController() const { return m_animationController; }
void suspendAnimations();
void resumeAnimations();
bool suspended() const { return m_suspended; }
bool hasAnimations() const { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
void setAnimating(bool);
bool isAnimatingProperty(int property, bool acceleratedOnly, bool isRunningNow) const;
PassRefPtr<KeyframeAnimation> getAnimationForProperty(int property) const;
void overrideImplicitAnimations(int property);
void resumeOverriddenImplicitAnimations(int property);
bool pauseAnimationAtTime(const AtomicString& name, double t);
bool pauseTransitionAtTime(int property, double t);
unsigned numberOfActiveAnimations() const;
PassRefPtr<WebKitAnimationList> animations() const;
private:
CompositeAnimation(AnimationControllerPrivate* animationController)
: m_animationController(animationController)
, m_numStyleAvailableWaiters(0)
, m_suspended(false)
{
}
void updateTransitions(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
void updateKeyframeAnimations(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
typedef HashMap<int, RefPtr<ImplicitAnimation> > CSSPropertyTransitionsMap;
typedef HashMap<AtomicStringImpl*, RefPtr<KeyframeAnimation> > AnimationNameMap;
AnimationControllerPrivate* m_animationController;
CSSPropertyTransitionsMap m_transitions;
AnimationNameMap m_keyframeAnimations;
Vector<AtomicStringImpl*> m_keyframeAnimationOrderMap;
unsigned m_numStyleAvailableWaiters;
bool m_suspended;
};
}
#endif // CompositeAnimation_h