Commit fb139e4a authored by suzyh's avatar suzyh Committed by Commit bot

Rename AnimationPlayerEvent as AnimationPlaybackEvent

The Web Animations spec now uses the name AnimationPlaybackEvent instead of
AnimationPlayerEvent:
http://w3c.github.io/web-animations/#the-animationplaybackevent-interface

This patch also makes the timelineTime property of AnimationPlaybackEvent
nullable, as specced.

BUG=624639

Review-Url: https://codereview.chromium.org/2344473002
Cr-Commit-Position: refs/heads/master@{#419103}
parent 270969d1
......@@ -62,7 +62,7 @@ interface AnimationEvent : Event
getter animationName
getter elapsedTime
method constructor
interface AnimationPlayerEvent : Event
interface AnimationPlaybackEvent : Event
attribute @@toStringTag
getter currentTime
getter timelineTime
......
......@@ -48,8 +48,8 @@ generated_core_dictionary_files = [
"$blink_core_output_dir/events/AddEventListenerOptions.h",
"$blink_core_output_dir/events/AnimationEventInit.cpp",
"$blink_core_output_dir/events/AnimationEventInit.h",
"$blink_core_output_dir/events/AnimationPlayerEventInit.cpp",
"$blink_core_output_dir/events/AnimationPlayerEventInit.h",
"$blink_core_output_dir/events/AnimationPlaybackEventInit.cpp",
"$blink_core_output_dir/events/AnimationPlaybackEventInit.h",
"$blink_core_output_dir/events/ApplicationCacheErrorEventInit.cpp",
"$blink_core_output_dir/events/ApplicationCacheErrorEventInit.h",
"$blink_core_output_dir/events/CompositionEventInit.cpp",
......
......@@ -265,7 +265,7 @@ generate_event_interfaces("core_event_interfaces") {
"css/FontFaceSetLoadEvent.idl",
"css/MediaQueryListEvent.idl",
"events/AnimationEvent.idl",
"events/AnimationPlayerEvent.idl",
"events/AnimationPlaybackEvent.idl",
"events/ApplicationCacheErrorEvent.idl",
"events/BeforeUnloadEvent.idl",
"events/ClipboardEvent.idl",
......
......@@ -36,7 +36,7 @@
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/StyleChangeReason.h"
#include "core/events/AnimationPlayerEvent.h"
#include "core/events/AnimationPlaybackEvent.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h"
......@@ -835,7 +835,7 @@ bool Animation::update(TimingUpdateReason reason)
const AtomicString& eventType = EventTypeNames::cancel;
if (getExecutionContext() && hasEventListeners(eventType)) {
double eventCurrentTime = nullValue();
m_pendingCancelledEvent = AnimationPlayerEvent::create(eventType, eventCurrentTime, timeline()->currentTime());
m_pendingCancelledEvent = AnimationPlaybackEvent::create(eventType, eventCurrentTime, timeline()->currentTime());
m_pendingCancelledEvent->setTarget(this);
m_pendingCancelledEvent->setCurrentTarget(this);
m_timeline->document()->enqueueAnimationFrameEvent(m_pendingCancelledEvent);
......@@ -844,7 +844,7 @@ bool Animation::update(TimingUpdateReason reason)
const AtomicString& eventType = EventTypeNames::finish;
if (getExecutionContext() && hasEventListeners(eventType)) {
double eventCurrentTime = currentTimeInternal() * 1000;
m_pendingFinishedEvent = AnimationPlayerEvent::create(eventType, eventCurrentTime, timeline()->currentTime());
m_pendingFinishedEvent = AnimationPlaybackEvent::create(eventType, eventCurrentTime, timeline()->currentTime());
m_pendingFinishedEvent->setTarget(this);
m_pendingFinishedEvent->setCurrentTarget(this);
m_timeline->document()->enqueueAnimationFrameEvent(m_pendingFinishedEvent);
......
......@@ -146,7 +146,7 @@ core_idl_files = get_path_info([
"dom/shadow/ShadowRoot.idl",
"editing/Selection.idl",
"events/AnimationEvent.idl",
"events/AnimationPlayerEvent.idl",
"events/AnimationPlaybackEvent.idl",
"events/ApplicationCacheErrorEvent.idl",
"events/BeforeUnloadEvent.idl",
"events/ClipboardEvent.idl",
......@@ -523,7 +523,7 @@ core_dictionary_idl_files =
"dom/TouchInit.idl",
"events/AddEventListenerOptions.idl",
"events/AnimationEventInit.idl",
"events/AnimationPlayerEventInit.idl",
"events/AnimationPlaybackEventInit.idl",
"events/ApplicationCacheErrorEventInit.idl",
"events/CompositionEventInit.idl",
"events/CustomEventInit.idl",
......
......@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/events/AnimationPlayerEvent.h"
#include "core/events/AnimationPlaybackEvent.h"
namespace blink {
AnimationPlayerEvent::AnimationPlayerEvent(const AtomicString& type, double currentTime, double timelineTime)
AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, double currentTime, double timelineTime)
: Event(type, false, false)
, m_currentTime(currentTime)
, m_timelineTime(timelineTime)
{
}
AnimationPlayerEvent::AnimationPlayerEvent(const AtomicString& type, const AnimationPlayerEventInit& initializer)
AnimationPlaybackEvent::AnimationPlaybackEvent(const AtomicString& type, const AnimationPlaybackEventInit& initializer)
: Event(type, initializer)
, m_currentTime(0.0)
, m_timelineTime(0.0)
......@@ -24,33 +24,40 @@ AnimationPlayerEvent::AnimationPlayerEvent(const AtomicString& type, const Anima
m_timelineTime = initializer.timelineTime();
}
AnimationPlayerEvent::~AnimationPlayerEvent()
AnimationPlaybackEvent::~AnimationPlaybackEvent()
{
}
double AnimationPlayerEvent::currentTime(bool& isNull) const
double AnimationPlaybackEvent::currentTime(bool& isNull) const
{
double result = currentTime();
isNull = std::isnan(result);
return result;
}
double AnimationPlayerEvent::currentTime() const
double AnimationPlaybackEvent::currentTime() const
{
return m_currentTime;
}
double AnimationPlayerEvent::timelineTime() const
double AnimationPlaybackEvent::timelineTime(bool& isNull) const
{
double result = timelineTime();
isNull = std::isnan(result);
return result;
}
double AnimationPlaybackEvent::timelineTime() const
{
return m_timelineTime;
}
const AtomicString& AnimationPlayerEvent::interfaceName() const
const AtomicString& AnimationPlaybackEvent::interfaceName() const
{
return EventNames::AnimationPlayerEvent;
return EventNames::AnimationPlaybackEvent;
}
DEFINE_TRACE(AnimationPlayerEvent)
DEFINE_TRACE(AnimationPlaybackEvent)
{
Event::trace(visitor);
}
......
......@@ -2,30 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef AnimationPlayerEvent_h
#define AnimationPlayerEvent_h
#ifndef AnimationPlaybackEvent_h
#define AnimationPlaybackEvent_h
#include "core/events/AnimationPlayerEventInit.h"
#include "core/events/AnimationPlaybackEventInit.h"
#include "core/events/Event.h"
namespace blink {
class AnimationPlayerEvent final : public Event {
class AnimationPlaybackEvent final : public Event {
DEFINE_WRAPPERTYPEINFO();
public:
static AnimationPlayerEvent* create(const AtomicString& type, double currentTime, double timelineTime)
static AnimationPlaybackEvent* create(const AtomicString& type, double currentTime, double timelineTime)
{
return new AnimationPlayerEvent(type, currentTime, timelineTime);
return new AnimationPlaybackEvent(type, currentTime, timelineTime);
}
static AnimationPlayerEvent* create(const AtomicString& type, const AnimationPlayerEventInit& initializer)
static AnimationPlaybackEvent* create(const AtomicString& type, const AnimationPlaybackEventInit& initializer)
{
return new AnimationPlayerEvent(type, initializer);
return new AnimationPlaybackEvent(type, initializer);
}
~AnimationPlayerEvent() override;
~AnimationPlaybackEvent() override;
double currentTime(bool& isNull) const;
double currentTime() const;
double timelineTime(bool& isNull) const;
double timelineTime() const;
const AtomicString& interfaceName() const override;
......@@ -33,8 +34,8 @@ public:
DECLARE_VIRTUAL_TRACE();
private:
AnimationPlayerEvent(const AtomicString& type, double currentTime, double timelineTime);
AnimationPlayerEvent(const AtomicString&, const AnimationPlayerEventInit&);
AnimationPlaybackEvent(const AtomicString& type, double currentTime, double timelineTime);
AnimationPlaybackEvent(const AtomicString&, const AnimationPlaybackEventInit&);
double m_currentTime;
double m_timelineTime;
......@@ -42,4 +43,4 @@ private:
} // namespace blink
#endif // AnimationPlayerEvent_h
#endif // AnimationPlaybackEvent_h
......@@ -2,15 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// http://www.w3.org/TR/web-animations/#the-animationplayerevent-interface
// TODO(dstockwell): This interface has been removed in the latest spec:
// https://w3c.github.io/web-animations/
// http://w3c.github.io/web-animations/#the-animationplaybackevent-interface
[
Constructor(DOMString type, optional AnimationPlayerEventInit eventInitDict),
Constructor(DOMString type, optional AnimationPlaybackEventInit eventInitDict),
RuntimeEnabled=WebAnimationsAPI,
] interface AnimationPlayerEvent : Event {
] interface AnimationPlaybackEvent : Event {
readonly attribute double? currentTime;
readonly attribute double timelineTime;
readonly attribute double? timelineTime;
};
......@@ -2,12 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// http://www.w3.org/TR/web-animations/#the-animationplayerevent-interface
// http://w3c.github.io/web-animations/#the-animationplaybackevent-interface
// TODO(dstockwell): This dictionary has been removed in the latest spec:
// https://w3c.github.io/web-animations/
dictionary AnimationPlayerEventInit : EventInit {
dictionary AnimationPlaybackEventInit : EventInit {
double? currentTime = null;
double? timelineTime = null;
};
......@@ -10,8 +10,8 @@ blink_core_sources("events") {
"AddEventListenerOptionsResolved.h",
"AnimationEvent.cpp",
"AnimationEvent.h",
"AnimationPlayerEvent.cpp",
"AnimationPlayerEvent.h",
"AnimationPlaybackEvent.cpp",
"AnimationPlaybackEvent.h",
"ApplicationCacheErrorEvent.cpp",
"ApplicationCacheErrorEvent.h",
"BeforeTextInsertedEvent.cpp",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment