Bug 1183461 part 1 - Move InitialAdvance to CSSAnimation; r=heycam

Currently we define a helper method, InitialAdvance, on KeyframeEffectReadOnly.
However, this method is only used for filling out the elapsedTime member of
AnimationEvents (which are generated by CSS animations). This patch moves this
method to CSSAnimation since it is unneeded for other types of Animations.
This commit is contained in:
Brian Birtles 2015-09-15 14:03:24 +09:00
parent 15f517c906
commit 885ac682c9
3 changed files with 13 additions and 10 deletions

View File

@ -253,14 +253,6 @@ public:
// owning animation.
void SetTiming(const AnimationTiming& aTiming, Animation& aOwningAnimtion);
// Return the duration from the start the active interval to the point where
// the animation begins playback. This is zero unless the animation has
// a negative delay in which case it is the absolute value of the delay.
// This is used for setting the elapsedTime member of CSS AnimationEvents.
TimeDuration InitialAdvance() const {
return std::max(TimeDuration(), mTiming.mDelay * -1);
}
Nullable<TimeDuration> GetLocalTime() const {
// Since the *animation* start time is currently always zero, the local
// time is equal to the parent time.

View File

@ -244,7 +244,7 @@ CSSAnimation::QueueEvents()
// First notifying for start of 0th iteration by appending an
// 'animationstart':
StickyTimeDuration elapsedTime =
std::min(StickyTimeDuration(mEffect->InitialAdvance()),
std::min(StickyTimeDuration(InitialAdvance()),
computedTiming.mActiveDuration);
manager->QueueEvent(
AnimationEventInfo(owningElement, mAnimationName, eAnimationStart,
@ -261,7 +261,7 @@ CSSAnimation::QueueEvents()
TimeDuration iterationStart = mEffect->Timing().mIterationDuration *
computedTiming.mCurrentIteration;
elapsedTime = StickyTimeDuration(std::max(iterationStart,
mEffect->InitialAdvance()));
InitialAdvance()));
} else {
MOZ_ASSERT(message == eAnimationEnd);
elapsedTime = computedTiming.mActiveDuration;

View File

@ -165,6 +165,17 @@ protected:
void UpdateTiming(SeekFlag aSeekFlag,
SyncNotifyFlag aSyncNotifyFlag) override;
// Returns the duration from the start of the animation's source effect's
// active interval to the point where the animation actually begins playback.
// This is zero unless the animation's source effect has a negative delay in
// which // case it is the absolute value of that delay.
// This is used for setting the elapsedTime member of CSS AnimationEvents.
TimeDuration InitialAdvance() const {
return mEffect ?
std::max(TimeDuration(), mEffect->Timing().mDelay * -1) :
TimeDuration();
}
nsString mAnimationName;
// The (pseudo-)element whose computed animation-name refers to this