moebius#89: DOM - implement animationcancel event

Issue #55
This commit is contained in:
janekptacijarabaci 2018-03-14 11:45:38 +01:00 • committed by Roy Tam
commit 901d2a277f
11 changed files with 99 additions and 73 deletions

View file

@ -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) */