Bug 1036287 part 1 - Add a null animation phase; r=dholbert

In order to support arbitrary timelines which may provide a "null" current time,
we need a suitable value to return from GetComputedTimingAt for the animation's
phase when the timeline time is null.

This patch introduces a null animation phase for this purpose.
This commit is contained in:
Brian Birtles 2014-07-16 09:02:32 +09:00
parent f0c19226a1
commit adc58299de
2 changed files with 6 additions and 7 deletions

View File

@ -270,17 +270,13 @@ struct AnimationTiming
/**
* Stores the results of calculating the timing properties of an animation
* at a given sample time.
*
* The members of a default-constructed object of this type are not meaningful.
* Rather, this object is intended to be used as the return value of
* ElementAnimation::GetComputedTimingAt which ensures all members are set
* correctly.
*/
struct ComputedTiming
{
ComputedTiming()
: mTimeFraction(kNullTimeFraction),
mCurrentIteration(0)
: mTimeFraction(kNullTimeFraction)
, mCurrentIteration(0)
, mPhase(AnimationPhase_Null)
{ }
static const double kNullTimeFraction;
@ -298,6 +294,8 @@ struct ComputedTiming
uint64_t mCurrentIteration;
enum {
// Not sampled (null sample time)
AnimationPhase_Null,
// Sampled prior to the start of the active interval
AnimationPhase_Before,
// Sampled within the active interval

View File

@ -48,6 +48,7 @@ nsAnimationManager::GetEventsAt(ElementAnimationCollection* aCollection,
ElementAnimation::GetComputedTimingAt(localTime, anim->mTiming);
switch (computedTiming.mPhase) {
case ComputedTiming::AnimationPhase_Null:
case ComputedTiming::AnimationPhase_Before:
// Do nothing
break;