Bug 788409: When the compositor runs past the end of an animation, just fill forwards until the main thread catches up. r=dbaron a=blocking-basecamp

This commit is contained in:
David Zbarsky ext:(%2C%20David%20Baron%20%3Cdbaron%40dbaron.org%3E%2C%20Chris%20Jones%20%3Cjones.chris.g%40gmail.com%3E) 2012-11-22 15:49:06 -08:00
parent 93ca3105f4
commit 1b8a2e6d1c
3 changed files with 27 additions and 28 deletions

View File

@ -720,12 +720,6 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
numIterations, numIterations,
animation.direction()); animation.direction());
if (positionInIteration == -1) {
animations.RemoveElementAt(i);
animationData.RemoveElementAt(i);
continue;
}
NS_ABORT_IF_FALSE(0.0 <= positionInIteration && NS_ABORT_IF_FALSE(0.0 <= positionInIteration &&
positionInIteration <= 1.0, positionInIteration <= 1.0,
"position should be in [0-1]"); "position should be in [0-1]");

View File

@ -54,29 +54,32 @@ ElementAnimations::GetPositionInIteration(TimeStamp aStartTime, TimeStamp aCurre
currentTimeDuration / aDuration; currentTimeDuration / aDuration;
bool dispatchStartOrIteration = false; bool dispatchStartOrIteration = false;
if (currentIterationCount >= aIterationCount) { if (currentIterationCount >= aIterationCount) {
if (!aAnimation) { if (aAnimation) {
// We are on the compositor, so send a signal that the animation is over. // Dispatch 'animationend' when needed.
// The main thread will fire the animationend event. if (aIsForElement &&
return -1; aAnimation->mLastNotification !=
} ElementAnimation::LAST_NOTIFICATION_END) {
// Dispatch 'animationend' when needed. aAnimation->mLastNotification = ElementAnimation::LAST_NOTIFICATION_END;
if (aIsForElement && // XXXdz: if this animation was done on the compositor, we should
aAnimation->mLastNotification != // invalidate the frame and update style once we start throttling style
ElementAnimation::LAST_NOTIFICATION_END) { // updates.
aAnimation->mLastNotification = ElementAnimation::LAST_NOTIFICATION_END; AnimationEventInfo ei(aEa->mElement, aAnimation->mName, NS_ANIMATION_END,
// XXXdz: if this animation was done on the compositor, we should currentTimeDuration);
// invalidate the frame and update style once we start throttling style aEventsToDispatch->AppendElement(ei);
// updates. }
AnimationEventInfo ei(aEa->mElement, aAnimation->mName, NS_ANIMATION_END,
currentTimeDuration);
aEventsToDispatch->AppendElement(ei);
}
if (!aAnimation->FillsForwards()) { if (!aAnimation->FillsForwards()) {
// No animation data. // No animation data.
return -1; return -1;
}
} else {
// If aAnimation is null, that means we're on the compositor
// thread. We want to just keep filling forwards until the main
// thread gets around to updating the compositor thread (which
// might take a little while). So just assume we fill fowards and
// move on.
} }
currentIterationCount = double(aAnimation->mIterationCount); currentIterationCount = aIterationCount;
} else { } else {
if (aAnimation && !aAnimation->IsPaused()) { if (aAnimation && !aAnimation->IsPaused()) {
aEa->mNeedsRefreshes = true; aEa->mNeedsRefreshes = true;

View File

@ -128,7 +128,9 @@ struct ElementAnimations : public mozilla::css::CommonElementAnimationData
// from the main thread, we need the actual ElementAnimation* in order to // from the main thread, we need the actual ElementAnimation* in order to
// get correct animation-fill behavior and to fire animation events. // get correct animation-fill behavior and to fire animation events.
// This function returns -1 for the position if the animation should not be // This function returns -1 for the position if the animation should not be
// run (because it is not currently active and has no fill behavior.) // run (because it is not currently active and has no fill behavior), but
// only does so if aAnimation is non-null; with a null aAnimation it is an
// error to give aCurrentTime < aStartTime, and fill-forwards is assumed.
static double GetPositionInIteration(TimeStamp aStartTime, static double GetPositionInIteration(TimeStamp aStartTime,
TimeStamp aCurrentTime, TimeStamp aCurrentTime,
TimeDuration aDuration, TimeDuration aDuration,