summaryrefslogtreecommitdiffstats
path: root/dom/animation/Animation.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-14 09:16:03 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-14 09:16:03 +0100
commit34ef9d4683b3e81b8df1be1a9c38eae331e8c398 (patch)
tree2536466cf07202d6502938eb004d9c2f672def84 /dom/animation/Animation.cpp
parent4644a03770ef95fd3acbaa205fae339b3a99f599 (diff)
downloadUXP-34ef9d4683b3e81b8df1be1a9c38eae331e8c398.tar
UXP-34ef9d4683b3e81b8df1be1a9c38eae331e8c398.tar.gz
UXP-34ef9d4683b3e81b8df1be1a9c38eae331e8c398.tar.lz
UXP-34ef9d4683b3e81b8df1be1a9c38eae331e8c398.tar.xz
UXP-34ef9d4683b3e81b8df1be1a9c38eae331e8c398.zip
Bug 1264125: Call the queueing events when canceling transition via Style or Script
Issue #55
Diffstat (limited to 'dom/animation/Animation.cpp')
-rw-r--r--dom/animation/Animation.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp
index 6dd583ed1..cefdbb76d 100644
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -230,6 +230,10 @@ Animation::SetTimelineNoUpdate(AnimationTimeline* aTimeline)
return;
}
+ StickyTimeDuration activeTime = mEffect
+ ? mEffect->GetComputedTiming().mActiveTime
+ : StickyTimeDuration();
+
RefPtr<AnimationTimeline> oldTimeline = mTimeline;
if (oldTimeline) {
oldTimeline->RemoveAnimation(this);
@@ -240,6 +244,9 @@ Animation::SetTimelineNoUpdate(AnimationTimeline* aTimeline)
mHoldTime.SetNull();
}
+ if (!aTimeline) {
+ MaybeQueueCancelEvent(activeTime);
+ }
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
}
@@ -771,6 +778,10 @@ Animation::CancelNoUpdate()
DispatchPlaybackEvent(NS_LITERAL_STRING("cancel"));
+ StickyTimeDuration activeTime = mEffect
+ ? mEffect->GetComputedTiming().mActiveTime
+ : StickyTimeDuration();
+
mHoldTime.SetNull();
mStartTime.SetNull();
@@ -779,6 +790,7 @@ Animation::CancelNoUpdate()
if (mTimeline) {
mTimeline->RemoveAnimation(this);
}
+ MaybeQueueCancelEvent(activeTime);
}
void
@@ -819,6 +831,17 @@ Animation::HasLowerCompositeOrderThan(const Animation& aOther) const
return thisTransition->HasLowerCompositeOrderThan(*otherTransition);
}
if (thisTransition || otherTransition) {
+ // Cancelled transitions no longer have an owning element. To be strictly
+ // correct we should store a strong reference to the owning element
+ // so that if we arrive here while sorting cancel events, we can sort
+ // them in the correct order.
+ //
+ // However, given that cancel events are almost always queued
+ // synchronously in some deterministic manner, we can be fairly sure
+ // that cancel events will be dispatched in a deterministic order
+ // (which is our only hard requirement until specs say otherwise).
+ // Furthermore, we only reach here when we have events with equal
+ // timestamps so this is an edge case we can probably ignore for now.
return thisTransition;
}
}