#pragma once
#include "DeclarativeAnimation.h"
#include <wtf/Ref.h>
namespace WebCore {
class Animation;
class Element;
class RenderStyle;
class CSSAnimation final : public DeclarativeAnimation {
public:
static Ref<CSSAnimation> create(Element&, const Animation&, const RenderStyle* oldStyle, const RenderStyle& newStyle);
~CSSAnimation() = default;
bool isCSSAnimation() const override { return true; }
const String& animationName() const { return m_animationName; }
const RenderStyle& unanimatedStyle() const { return *m_unanimatedStyle; }
std::optional<double> bindingsStartTime() const final;
void setBindingsStartTime(std::optional<double>) final;
std::optional<double> bindingsCurrentTime() const final;
ExceptionOr<void> setBindingsCurrentTime(std::optional<double>) final;
WebAnimation::PlayState bindingsPlayState() const final;
bool bindingsPending() const final;
WebAnimation::ReadyPromise& bindingsReady() final;
WebAnimation::FinishedPromise& bindingsFinished() final;
ExceptionOr<void> bindingsPlay() final;
ExceptionOr<void> bindingsPause() final;
protected:
void syncPropertiesWithBackingAnimation() final;
private:
CSSAnimation(Element&, const Animation&, const RenderStyle&);
void flushPendingStyleChanges() const;
String m_animationName;
std::unique_ptr<RenderStyle> m_unanimatedStyle;
bool m_stickyPaused { false };
};
}
SPECIALIZE_TYPE_TRAITS_WEB_ANIMATION(CSSAnimation, isCSSAnimation())