AnimationController.h [plain text]
#ifndef AnimationController_h
#define AnimationController_h
#include "AnimationBase.h"
#include "CSSPropertyNames.h"
#include <wtf/Forward.h>
namespace WebCore {
class AnimationControllerPrivate;
class Document;
class Element;
class Frame;
class RenderElement;
class RenderStyle;
class AnimationController {
public:
explicit AnimationController(Frame&);
~AnimationController();
void cancelAnimations(RenderElement*);
PassRef<RenderStyle> updateAnimations(RenderElement&, PassRef<RenderStyle> newStyle);
PassRefPtr<RenderStyle> getAnimatedStyleForRenderer(RenderElement*);
void notifyAnimationStarted(RenderElement*, double startTime);
bool pauseAnimationAtTime(RenderElement*, const AtomicString& name, double t); bool pauseTransitionAtTime(RenderElement*, const String& property, double t); unsigned numberOfActiveAnimations(Document*) const;
bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) 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();
bool allowsNewAnimationsWhileSuspended() const;
void setAllowsNewAnimationsWhileSuspended(bool);
static bool supportsAcceleratedAnimationOfProperty(CSSPropertyID);
private:
const std::unique_ptr<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