AnimationController.h [plain text]
#ifndef AnimationController_h
#define AnimationController_h
#include "CSSPropertyNames.h"
#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
namespace WebCore {
class AnimationBase;
class AnimationControllerPrivate;
class Document;
class Element;
class Frame;
class Node;
class RenderObject;
class RenderStyle;
class AnimationController {
public:
AnimationController(Frame*);
~AnimationController();
void cancelAnimations(RenderObject*);
PassRefPtr<RenderStyle> updateAnimations(RenderObject*, RenderStyle* newStyle);
PassRefPtr<RenderStyle> getAnimatedStyleForRenderer(RenderObject*);
void notifyAnimationStarted(RenderObject*, double startTime);
bool pauseAnimationAtTime(RenderObject*, const AtomicString& name, double t); bool pauseTransitionAtTime(RenderObject*, const String& property, double t); unsigned numberOfActiveAnimations(Document*) const;
bool isRunningAnimationOnRenderer(RenderObject*, CSSPropertyID, bool isRunningNow = true) const;
bool isRunningAcceleratedAnimationOnRenderer(RenderObject*, CSSPropertyID, bool isRunningNow = true) const;
bool isSuspended() const;
void suspendAnimations();
void resumeAnimations();
#if ENABLE(REQUEST_ANIMATION_FRAME)
void serviceAnimations();
#endif
void suspendAnimationsForDocument(Document*);
void resumeAnimationsForDocument(Document*);
void startAnimationsIfNotSuspended(Document*);
void beginAnimationUpdate();
void endAnimationUpdate();
static bool supportsAcceleratedAnimationOfProperty(CSSPropertyID);
private:
OwnPtr<AnimationControllerPrivate> m_data;
int m_beginAnimationUpdateCount;
};
class AnimationUpdateBlock {
public:
AnimationUpdateBlock(AnimationController* animationController)
: m_animationController(animationController)
{
if (m_animationController)
m_animationController->beginAnimationUpdate();
}
~AnimationUpdateBlock()
{
if (m_animationController)
m_animationController->endAnimationUpdate();
}
AnimationController* m_animationController;
};
}
#endif // AnimationController_h