summaryrefslogtreecommitdiffstats
path: root/layout/style/AnimationCommon.h
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 /layout/style/AnimationCommon.h
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 'layout/style/AnimationCommon.h')
-rw-r--r--layout/style/AnimationCommon.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h
index 37030411c..025c034a4 100644
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -251,6 +251,26 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
aField.Traverse(&aCallback, aName);
}
+// Return the TransitionPhase or AnimationPhase to use when the animation
+// doesn't have a target effect.
+template <typename PhaseType>
+PhaseType GetAnimationPhaseWithoutEffect(const dom::Animation& aAnimation)
+{
+ MOZ_ASSERT(!aAnimation.GetEffect(),
+ "Should only be called when we do not have an effect");
+
+ Nullable<TimeDuration> currentTime = aAnimation.GetCurrentTime();
+ if (currentTime.IsNull()) {
+ return PhaseType::Idle;
+ }
+
+ // If we don't have a target effect, the duration will be zero so the phase is
+ // 'before' if the current time is less than zero.
+ return currentTime.Value() < TimeDuration()
+ ? PhaseType::Before
+ : PhaseType::After;
+};
+
} // namespace mozilla
#endif /* !defined(mozilla_css_AnimationCommon_h) */