diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-29 18:48:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-29 18:48:43 +0200 |
commit | b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e (patch) | |
tree | 8ba5cabbaa5390ce5bffb1af3b31a4e49a8def09 /layout/style/AnimationCommon.h | |
parent | 3fe37f6ae848f7d88e2316857a1a95d9c2abae14 (diff) | |
parent | 35c61a027dc6f4d58ca9d33e06da79adf2503ebd (diff) | |
download | UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar.gz UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar.lz UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar.xz UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.zip |
Merge pull request #296 from janekptacijarabaci/js_dom_animationcancel_1
DOM - implement animationcancel event
Diffstat (limited to 'layout/style/AnimationCommon.h')
-rw-r--r-- | layout/style/AnimationCommon.h | 20 |
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) */ |