AnimationPlaybackEvent.cpp [plain text]
#include "config.h"
#include "AnimationPlaybackEvent.h"
#include "WebAnimationUtilities.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(AnimationPlaybackEvent);
AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomString& type, const AnimationPlaybackEventInit& initializer, IsTrusted isTrusted)
: AnimationEventBase(type, initializer, isTrusted)
{
if (initializer.currentTime)
m_currentTime = Seconds::fromMilliseconds(*initializer.currentTime);
else
m_currentTime = WTF::nullopt;
if (initializer.timelineTime)
m_timelineTime = Seconds::fromMilliseconds(*initializer.timelineTime);
else
m_timelineTime = WTF::nullopt;
}
AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomString& type, Optional<Seconds> currentTime, Optional<Seconds> timelineTime, WebAnimation* animation)
: AnimationEventBase(type, animation, timelineTime)
, m_currentTime(currentTime)
{
}
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 (!timelineTime())
return WTF::nullopt;
return secondsToWebAnimationsAPITime(timelineTime().value());
}
}