Bug 1004871 part 5 - Add ComputedTiming data structure; r=dholbert

This patch adds a ComputedTiming struct for storing the results of calculating
the timing properties of an animation at a given sample time.
This commit is contained in:
Brian Birtles 2014-05-28 16:51:49 +09:00
parent b0f0bab622
commit c9cad0a5c8
2 changed files with 35 additions and 0 deletions

View File

@ -362,6 +362,10 @@ ComputedTimingFunction::GetValue(double aPortion) const
} /* end sub-namespace css */
// In the Web Animations model, the time fraction can be outside the range
// [0.0, 1.0] but it shouldn't be Infinity.
const double ComputedTiming::kNullTimeFraction = NS_IEEEPositiveInfinity();
bool
ElementAnimation::IsRunningAt(TimeStamp aTime) const
{

View File

@ -243,6 +243,37 @@ struct AnimationTiming
}
};
/**
* Stores the results of calculating the timing properties of an animation
* at a given sample time.
*/
struct ComputedTiming
{
ComputedTiming()
: mTimeFraction(kNullTimeFraction),
mCurrentIteration(0)
{ }
static const double kNullTimeFraction;
// Will be kNullTimeFraction if the animation is neither animating nor
// filling at the sampled time.
double mTimeFraction;
// Zero-based iteration index (meaningless if mTimeFraction is
// kNullTimeFraction).
uint64_t mCurrentIteration;
enum {
// Sampled prior to the start of the active interval
AnimationPhase_Before,
// Sampled within the active interval
AnimationPhase_Active,
// Sampled after (or at) the end of the active interval
AnimationPhase_After
} mPhase;
};
/**
* Data about one animation (i.e., one of the values of
* 'animation-name') running on an element.