summaryrefslogtreecommitdiffstats
path: root/dom/animation/Animation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/animation/Animation.cpp')
-rw-r--r--dom/animation/Animation.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp
index ad52495e67..fbfd689c9a 100644
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -11,7 +11,6 @@
#include "AnimationUtils.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/dom/AnimationBinding.h"
-#include "mozilla/dom/AnimationPlaybackEvent.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/dom/DocumentTimeline.h"
@@ -645,7 +644,8 @@ void Animation::Cancel(PostRestyleMode aPostRestyle) {
}
ResetFinishedPromise();
- QueuePlaybackEvent(u"cancel"_ns, GetTimelineCurrentTimeAsTimeStamp());
+ QueuePlaybackEvent(nsGkAtoms::oncancel,
+ GetTimelineCurrentTimeAsTimeStamp());
}
StickyTimeDuration activeTime =
@@ -1189,7 +1189,7 @@ void Animation::Remove() {
UpdateEffect(PostRestyleMode::IfNeeded);
PostUpdate();
- QueuePlaybackEvent(u"remove"_ns, GetTimelineCurrentTimeAsTimeStamp());
+ QueuePlaybackEvent(nsGkAtoms::onremove, GetTimelineCurrentTimeAsTimeStamp());
}
bool Animation::HasLowerCompositeOrderThan(const Animation& aOther) const {
@@ -1869,10 +1869,11 @@ void Animation::DoFinishNotificationImmediately(MicroTaskRunnable* aAsync) {
MaybeResolveFinishedPromise();
- QueuePlaybackEvent(u"finish"_ns, AnimationTimeToTimeStamp(EffectEnd()));
+ QueuePlaybackEvent(nsGkAtoms::onfinish,
+ AnimationTimeToTimeStamp(EffectEnd()));
}
-void Animation::QueuePlaybackEvent(const nsAString& aName,
+void Animation::QueuePlaybackEvent(nsAtom* aOnEvent,
TimeStamp&& aScheduledEventTime) {
// Use document for timing.
// https://drafts.csswg.org/web-animations-1/#document-for-timing
@@ -1886,20 +1887,19 @@ void Animation::QueuePlaybackEvent(const nsAString& aName,
return;
}
- AnimationPlaybackEventInit init;
- if (aName.EqualsLiteral("finish") || aName.EqualsLiteral("remove")) {
- init.mCurrentTime = GetCurrentTimeAsDouble();
+ Nullable<double> currentTime;
+ if (aOnEvent == nsGkAtoms::onfinish || aOnEvent == nsGkAtoms::onremove) {
+ currentTime = GetCurrentTimeAsDouble();
}
+
+ Nullable<double> timelineTime;
if (mTimeline) {
- init.mTimelineTime = mTimeline->GetCurrentTimeAsDouble();
+ timelineTime = mTimeline->GetCurrentTimeAsDouble();
}
- RefPtr<AnimationPlaybackEvent> event =
- AnimationPlaybackEvent::Constructor(this, aName, init);
- event->SetTrusted(true);
-
- presContext->AnimationEventDispatcher()->QueueEvent(AnimationEventInfo(
- std::move(event), std::move(aScheduledEventTime), this));
+ presContext->AnimationEventDispatcher()->QueueEvent(
+ AnimationEventInfo(aOnEvent, currentTime, timelineTime,
+ std::move(aScheduledEventTime), this));
}
bool Animation::IsRunningOnCompositor() const {