KeyframeAnimation.h [plain text]
#ifndef KeyframeAnimation_h
#define KeyframeAnimation_h
#include "AnimationBase.h"
#include "Document.h"
#include "KeyframeList.h"
namespace WebCore {
class RenderStyle;
class KeyframeAnimation final : public AnimationBase {
public:
static RefPtr<KeyframeAnimation> create(const Animation& animation, RenderElement* renderer, int index, CompositeAnimation* compositeAnimation, RenderStyle* unanimatedStyle)
{
return adoptRef(new KeyframeAnimation(animation, renderer, index, compositeAnimation, unanimatedStyle));
}
virtual void animate(CompositeAnimation*, RenderElement*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle) override;
virtual void getAnimatedStyle(RefPtr<RenderStyle>&) override;
const KeyframeList& keyframes() const { return m_keyframes; }
const AtomicString& name() const { return m_keyframes.animationName(); }
int index() const { return m_index; }
void setIndex(int i) { m_index = i; }
bool hasAnimationForProperty(CSSPropertyID) const;
void setUnanimatedStyle(PassRefPtr<RenderStyle> style) { m_unanimatedStyle = style; }
RenderStyle* unanimatedStyle() const { return m_unanimatedStyle.get(); }
virtual double timeToNextService() override;
protected:
virtual void onAnimationStart(double elapsedTime) override;
virtual void onAnimationIteration(double elapsedTime) override;
virtual void onAnimationEnd(double elapsedTime) override;
virtual bool startAnimation(double timeOffset) override;
virtual void pauseAnimation(double timeOffset) override;
virtual void endAnimation() override;
virtual void overrideAnimations() override;
virtual void resumeOverriddenAnimations() override;
bool shouldSendEventForListener(Document::ListenerType inListenerType) const;
bool sendAnimationEvent(const AtomicString&, double elapsedTime);
virtual bool affectsProperty(CSSPropertyID) const override;
void validateTransformFunctionList();
#if ENABLE(CSS_FILTERS)
void checkForMatchingFilterFunctionLists();
#endif
private:
KeyframeAnimation(const Animation&, RenderElement*, int index, CompositeAnimation*, RenderStyle* unanimatedStyle);
virtual ~KeyframeAnimation();
void fetchIntervalEndpointsForProperty(CSSPropertyID, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& progress) const;
KeyframeList m_keyframes;
int m_index;
bool m_startEventDispatched;
RefPtr<RenderStyle> m_unanimatedStyle;
};
}
#endif // KeyframeAnimation_h