AnimationEventBase.h [plain text]
#pragma once
#include "Event.h"
#include <wtf/Markable.h>
namespace WebCore {
class WebAnimation;
class AnimationEventBase : public Event {
WTF_MAKE_ISO_ALLOCATED(AnimationEventBase);
public:
static Ref<AnimationEventBase> create(const AtomString& type, WebAnimation* animation, Optional<Seconds> timelineTime)
{
return adoptRef(*new AnimationEventBase(type, animation, timelineTime));
}
virtual ~AnimationEventBase();
virtual bool isAnimationPlaybackEvent() const { return false; }
virtual bool isAnimationEvent() const { return false; }
virtual bool isTransitionEvent() const { return false; }
Optional<Seconds> timelineTime() const { return m_timelineTime; }
WebAnimation* animation() const { return m_animation.get(); }
protected:
AnimationEventBase(const AtomString&, WebAnimation*, Optional<Seconds>);
AnimationEventBase(const AtomString&, const EventInit&, IsTrusted);
RefPtr<WebAnimation> m_animation;
Markable<Seconds, Seconds::MarkableTraits> m_timelineTime;
};
}
#define SPECIALIZE_TYPE_TRAITS_ANIMATION_EVENT_BASE(ToValueTypeName, predicate) \
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
static bool isType(const WebCore::AnimationEventBase& value) { return value.predicate; } \
SPECIALIZE_TYPE_TRAITS_END()