summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-14 11:45:38 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-14 11:45:38 +0100
commitaade91b13a50ee4f246016fa8d8d1561f58f80ee (patch)
tree5deac61e124e06478040bedfbb1784b68fc8cc97 /dom
parentdcc00ffadf64270b0ae82431f5b71c527590e91b (diff)
downloadUXP-aade91b13a50ee4f246016fa8d8d1561f58f80ee.tar
UXP-aade91b13a50ee4f246016fa8d8d1561f58f80ee.tar.gz
UXP-aade91b13a50ee4f246016fa8d8d1561f58f80ee.tar.lz
UXP-aade91b13a50ee4f246016fa8d8d1561f58f80ee.tar.xz
UXP-aade91b13a50ee4f246016fa8d8d1561f58f80ee.zip
moebius#89: DOM - implement animationcancel event
Issue #55
Diffstat (limited to 'dom')
-rw-r--r--dom/animation/Animation.cpp13
-rw-r--r--dom/animation/ComputedTiming.h4
-rw-r--r--dom/base/nsGkAtomList.h1
-rw-r--r--dom/events/EventNameList.h4
-rw-r--r--dom/webidl/EventHandler.webidl1
5 files changed, 19 insertions, 4 deletions
diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp
index 242a0c6d6..bd318f79e 100644
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -787,12 +787,21 @@ Animation::CancelNoUpdate()
mHoldTime.SetNull();
mStartTime.SetNull();
- UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
-
if (mTimeline) {
mTimeline->RemoveAnimation(this);
}
MaybeQueueCancelEvent(activeTime);
+
+ // When an animation is cancelled it no longer needs further ticks from the
+ // timeline. However, if we queued a cancel event and this was the last
+ // animation attached to the timeline, the timeline will stop observing the
+ // refresh driver and there may be no subsequent refresh driver tick for
+ // dispatching the queued event.
+ //
+ // By calling UpdateTiming *after* removing ourselves from our timeline, we
+ // ensure the timeline will register with the refresh driver for at least one
+ // more tick.
+ UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
}
void
diff --git a/dom/animation/ComputedTiming.h b/dom/animation/ComputedTiming.h
index addf15865..525d59d23 100644
--- a/dom/animation/ComputedTiming.h
+++ b/dom/animation/ComputedTiming.h
@@ -64,12 +64,12 @@ struct ComputedTiming
}
enum class AnimationPhase {
- Null, // Not sampled (null sample time)
+ Idle, // Not sampled (null sample time)
Before, // Sampled prior to the start of the active interval
Active, // Sampled within the active interval
After // Sampled after (or at) the end of the active interval
};
- AnimationPhase mPhase = AnimationPhase::Null;
+ AnimationPhase mPhase = AnimationPhase::Idle;
ComputedTimingFunction::BeforeFlag mBeforeFlag =
ComputedTimingFunction::BeforeFlag::Unset;
diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h
index 09d73e617..948487083 100644
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -694,6 +694,7 @@ GK_ATOM(onadapterremoved, "onadapterremoved")
GK_ATOM(onafterprint, "onafterprint")
GK_ATOM(onafterscriptexecute, "onafterscriptexecute")
GK_ATOM(onalerting, "onalerting")
+GK_ATOM(onanimationcancel, "onanimationcancel")
GK_ATOM(onanimationend, "onanimationend")
GK_ATOM(onanimationiteration, "onanimationiteration")
GK_ATOM(onanimationstart, "onanimationstart")
diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h
index 61942b251..00478c87b 100644
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -1019,6 +1019,10 @@ EVENT(animationiteration,
eAnimationIteration,
EventNameType_All,
eAnimationEventClass)
+EVENT(animationcancel,
+ eAnimationCancel,
+ EventNameType_All,
+ eAnimationEventClass)
// Webkit-prefixed versions of Transition & Animation events, for web compat:
EVENT(webkitAnimationEnd,
diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl
index 6691ca224..306372ff1 100644
--- a/dom/webidl/EventHandler.webidl
+++ b/dom/webidl/EventHandler.webidl
@@ -128,6 +128,7 @@ interface GlobalEventHandlers {
attribute EventHandler onmozpointerlockerror;
// CSS-Animation and CSS-Transition handlers.
+ attribute EventHandler onanimationcancel;
attribute EventHandler onanimationend;
attribute EventHandler onanimationiteration;
attribute EventHandler onanimationstart;