AnimationPlaybackEvent.cpp [plain text]
#include "config.h"
#include "AnimationPlaybackEvent.h"
#include "WebAnimationUtilities.h"
namespace WebCore {
AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, const AnimationPlaybackEventInit& initializer, IsTrusted isTrusted)
: Event(type, initializer, isTrusted)
{
if (initializer.currentTime == WTF::nullopt)
m_currentTime = WTF::nullopt;
else
m_currentTime = Seconds::fromMilliseconds(initializer.currentTime.value());
if (initializer.timelineTime == WTF::nullopt)
m_timelineTime = WTF::nullopt;
else
m_timelineTime = Seconds::fromMilliseconds(initializer.timelineTime.value());
}
AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, Optional<Seconds> currentTime, Optional<Seconds> timelineTime)
: Event(type, CanBubble::Yes, IsCancelable::No)
, m_currentTime(currentTime)
, m_timelineTime(timelineTime)
{
}
AnimationPlaybackEvent::~AnimationPlaybackEvent() = default;
Optional<double> AnimationPlaybackEvent::bindingsCurrentTime() const
{
if (!m_currentTime)
return WTF::nullopt;
return secondsToWebAnimationsAPITime(m_currentTime.value());
}
Optional<double> AnimationPlaybackEvent::bindingsTimelineTime() const
{
if (!m_timelineTime)
return WTF::nullopt;
return secondsToWebAnimationsAPITime(m_timelineTime.value());
}
}