mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 1123523 - Part 8: Dispatch nsIAnimationObserver notifications when an animation is added or removed. r=birtles
This commit is contained in:
parent
89fb2d451f
commit
d648fe467f
@ -335,7 +335,15 @@ AnimationPlayer::IsRunning() const
|
||||
void
|
||||
AnimationPlayer::UpdateRelevance()
|
||||
{
|
||||
bool wasRelevant = mIsRelevant;
|
||||
mIsRelevant = HasCurrentSource() || HasInEffectSource();
|
||||
|
||||
// Notify animation observers.
|
||||
if (wasRelevant && !mIsRelevant) {
|
||||
nsNodeUtils::AnimationRemoved(this);
|
||||
} else if (!wasRelevant && mIsRelevant) {
|
||||
nsNodeUtils::AnimationAdded(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include <math.h>
|
||||
|
||||
using namespace mozilla;
|
||||
@ -260,6 +261,8 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoAnimationMutationBatch mb(aElement);
|
||||
|
||||
// build the animations list
|
||||
dom::AnimationTimeline* timeline = aElement->OwnerDoc()->Timeline();
|
||||
AnimationPlayerPtrArray newPlayers;
|
||||
@ -714,6 +717,9 @@ nsAnimationManager::FlushAnimations(FlushFlags aFlags)
|
||||
l = PR_NEXT_LINK(l)) {
|
||||
AnimationPlayerCollection* collection =
|
||||
static_cast<AnimationPlayerCollection*>(l);
|
||||
|
||||
nsAutoAnimationMutationBatch mb(collection->mElement);
|
||||
|
||||
collection->Tick();
|
||||
bool canThrottleTick = aFlags == Can_Throttle &&
|
||||
collection->CanPerformOnCompositorThread(
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "nsStyleChangeList.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "RestyleManager.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::TimeDuration;
|
||||
@ -218,6 +219,8 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
||||
afterChangeStyle = newStyleContext;
|
||||
}
|
||||
|
||||
nsAutoAnimationMutationBatch mb(aElement);
|
||||
|
||||
// Per http://lists.w3.org/Archives/Public/www-style/2009Aug/0109.html
|
||||
// I'll consider only the transitions from the number of items in
|
||||
// 'transition-property' on down, and later ones will override earlier
|
||||
@ -676,6 +679,8 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
|
||||
static_cast<AnimationPlayerCollection*>(next);
|
||||
next = PR_NEXT_LINK(next);
|
||||
|
||||
nsAutoAnimationMutationBatch mb(collection->mElement);
|
||||
|
||||
collection->Tick();
|
||||
bool canThrottleTick = aFlags == Can_Throttle &&
|
||||
collection->CanPerformOnCompositorThread(
|
||||
|
Loading…
Reference in New Issue
Block a user