Bug 1188251 part 9 - Request restyles from Animation::Tick; r=dholbert

In preparation for ultimately being able to run animations without a manager,
this patch moves the request restyle code from FlushAnimations to
Animation::Tick. (Ultimately most of this functionality should move to the
KeyframeEffect but for now Animation is fine.)
This commit is contained in:
Brian Birtles 2015-08-18 16:11:55 +09:00
parent 7c975ccea1
commit 64a877c128
2 changed files with 12 additions and 11 deletions

View File

@ -374,6 +374,14 @@ Animation::Tick()
}
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
// FIXME: Detect the no-change case and don't request a restyle at all
AnimationCollection* collection = GetCollection();
if (collection) {
collection->RequestRestyle(CanThrottle() ?
AnimationCollection::RestyleType::Throttled :
AnimationCollection::RestyleType::Standard);
}
}
void

View File

@ -391,19 +391,12 @@ CommonAnimationManager::FlushAnimations(FlushFlags aFlags)
continue;
}
nsAutoAnimationMutationBatch mb(collection->mElement);
collection->Tick();
bool canThrottleTick = aFlags == Can_Throttle;
for (auto iter = collection->mAnimations.cbegin();
canThrottleTick && iter != collection->mAnimations.cend();
++iter) {
canThrottleTick &= (*iter)->CanThrottle();
if (aFlags == Cannot_Throttle) {
collection->RequestRestyle(AnimationCollection::RestyleType::Standard);
}
collection->RequestRestyle(canThrottleTick ?
AnimationCollection::RestyleType::Throttled :
AnimationCollection::RestyleType::Standard);
nsAutoAnimationMutationBatch mb(collection->mElement);
collection->Tick();
}
MaybeStartOrStopObservingRefreshDriver();