KeyframeAnimation.h [plain text]
#pragma once
#include "AnimationBase.h"
#include "Document.h"
#include "KeyframeList.h"
namespace WebCore {
class RenderStyle;
class KeyframeAnimation final : public AnimationBase {
public:
static Ref<KeyframeAnimation> create(const Animation& animation, Element& element, CompositeAnimation& compositeAnimation, const RenderStyle& unanimatedStyle)
{
return adoptRef(*new KeyframeAnimation(animation, element, compositeAnimation, unanimatedStyle));
}
bool animate(CompositeAnimation&, const RenderStyle& targetStyle, std::unique_ptr<RenderStyle>& animatedStyle, bool& didBlendStyle);
void getAnimatedStyle(std::unique_ptr<RenderStyle>&) override;
bool computeExtentOfTransformAnimation(LayoutRect&) const override;
const KeyframeList& keyframes() const { return m_keyframes; }
const AtomicString& name() const { return m_keyframes.animationName(); }
bool hasAnimationForProperty(CSSPropertyID) const;
bool triggersStackingContext() const { return m_triggersStackingContext; }
bool dependsOnLayout() const { return m_dependsOnLayout; }
void setUnanimatedStyle(std::unique_ptr<RenderStyle> style) { m_unanimatedStyle = WTFMove(style); }
const RenderStyle& unanimatedStyle() const override { return *m_unanimatedStyle; }
std::optional<Seconds> timeToNextService() override;
protected:
void onAnimationStart(double elapsedTime) override;
void onAnimationIteration(double elapsedTime) override;
void onAnimationEnd(double elapsedTime) override;
bool startAnimation(double timeOffset) override;
void pauseAnimation(double timeOffset) override;
void endAnimation() override;
void overrideAnimations() override;
void resumeOverriddenAnimations() override;
bool shouldSendEventForListener(Document::ListenerType inListenerType) const;
bool sendAnimationEvent(const AtomicString&, double elapsedTime);
bool affectsProperty(CSSPropertyID) const override;
bool computeExtentOfAnimationForMatrixAnimation(const FloatRect& rendererBox, LayoutRect&) const;
bool computeExtentOfAnimationForMatchingTransformLists(const FloatRect& rendererBox, LayoutRect&) const;
void computeStackingContextImpact();
void computeLayoutDependency();
void resolveKeyframeStyles();
void validateTransformFunctionList();
void checkForMatchingFilterFunctionLists();
#if ENABLE(FILTERS_LEVEL_2)
void checkForMatchingBackdropFilterFunctionLists();
#endif
private:
KeyframeAnimation(const Animation&, Element&, CompositeAnimation&, const RenderStyle& unanimatedStyle);
virtual ~KeyframeAnimation();
void fetchIntervalEndpointsForProperty(CSSPropertyID, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& progress) const;
KeyframeList m_keyframes;
std::unique_ptr<RenderStyle> m_unanimatedStyle;
bool m_startEventDispatched { false };
bool m_triggersStackingContext { false };
bool m_dependsOnLayout { false };
};
}