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 RenderElement;
class RenderStyle;
class CompositeAnimation : public RefCounted<CompositeAnimation> {
public:
static PassRefPtr<CompositeAnimation> create(AnimationControllerPrivate* animationController)
{
return adoptRef(new CompositeAnimation(animationController));
};
~CompositeAnimation();
void clearRenderer();
PassRef<RenderStyle> animate(RenderElement&, RenderStyle* currentStyle, RenderStyle& targetStyle);
PassRefPtr<RenderStyle> getAnimatedStyle() const;
double timeToNextService() const;
AnimationControllerPrivate* animationController() const { return m_animationController; }
void suspendAnimations();
void resumeAnimations();
bool isSuspended() const { return m_suspended; }
bool hasAnimations() const { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, AnimationBase::RunningState) const;
PassRefPtr<KeyframeAnimation> getAnimationForProperty(CSSPropertyID) const;
void overrideImplicitAnimations(CSSPropertyID);
void resumeOverriddenImplicitAnimations(CSSPropertyID);
bool pauseAnimationAtTime(const AtomicString& name, double t);
bool pauseTransitionAtTime(CSSPropertyID, double);
unsigned numberOfActiveAnimations() const;
private:
CompositeAnimation(AnimationControllerPrivate*);
void updateTransitions(RenderElement*, RenderStyle* currentStyle, RenderStyle* targetStyle);
void updateKeyframeAnimations(RenderElement*, 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;
bool m_suspended;
};
}
#endif // CompositeAnimation_h