mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1195180 part 8 - Tick animations from their timeline; r=heycam
This commit is contained in:
parent
68cafe83b4
commit
36c16f7957
@ -8,10 +8,11 @@
|
||||
#include "mozilla/dom/DocumentTimelineBinding.h"
|
||||
#include "AnimationUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -113,15 +114,26 @@ DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime)
|
||||
bool needsTicks = false;
|
||||
AnimationArray animationsToKeep(mAnimationOrder.Length());
|
||||
|
||||
nsAutoAnimationMutationBatch mb(mDocument);
|
||||
|
||||
for (Animation* animation : mAnimationOrder) {
|
||||
if (animation->GetTimeline() != this ||
|
||||
(!animation->IsRelevant() && !animation->NeedsTicks())) {
|
||||
// Skip any animations that are longer need associated with this timeline.
|
||||
if (animation->GetTimeline() != this) {
|
||||
mAnimations.RemoveEntry(animation);
|
||||
continue;
|
||||
}
|
||||
|
||||
needsTicks |= animation->NeedsTicks();
|
||||
animationsToKeep.AppendElement(animation);
|
||||
// Even if |animation| doesn't need future ticks, we should still
|
||||
// Tick it this time around since it might just need a one-off tick in
|
||||
// order to dispatch events.
|
||||
animation->Tick();
|
||||
|
||||
if (animation->IsRelevant() || animation->NeedsTicks()) {
|
||||
animationsToKeep.AppendElement(animation);
|
||||
} else {
|
||||
mAnimations.RemoveEntry(animation);
|
||||
}
|
||||
}
|
||||
|
||||
mAnimationOrder.SwapElements(animationsToKeep);
|
||||
|
@ -31,3 +31,7 @@ UNIFIED_SOURCES += [
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
]
|
||||
|
@ -427,13 +427,6 @@ CommonAnimationManager::WillRefresh(TimeStamp aTime)
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoAnimationMutationBatch mb(mPresContext->Document());
|
||||
|
||||
for (AnimationCollection* collection = mElementCollections.getFirst();
|
||||
collection; collection = collection->getNext()) {
|
||||
collection->Tick();
|
||||
}
|
||||
|
||||
MaybeStartOrStopObservingRefreshDriver();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user