зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1154615
part 8 - Rename references to players in animation observers; r=jwatt
This commit is contained in:
Родитель
2cfdd7ac06
Коммит
c04588b2f3
|
@ -325,10 +325,10 @@ void nsMutationReceiver::NodeWillBeDestroyed(const nsINode *aNode)
|
|||
}
|
||||
|
||||
void
|
||||
nsAnimationReceiver::RecordAnimationMutation(Animation* aPlayer,
|
||||
nsAnimationReceiver::RecordAnimationMutation(Animation* aAnimation,
|
||||
AnimationMutation aMutationType)
|
||||
{
|
||||
KeyframeEffectReadonly* effect = aPlayer->GetEffect();
|
||||
KeyframeEffectReadonly* effect = aAnimation->GetEffect();
|
||||
if (!effect) {
|
||||
return;
|
||||
}
|
||||
|
@ -350,13 +350,13 @@ nsAnimationReceiver::RecordAnimationMutation(Animation* aPlayer,
|
|||
|
||||
switch (aMutationType) {
|
||||
case eAnimationMutation_Added:
|
||||
nsAutoAnimationMutationBatch::AnimationAdded(aPlayer);
|
||||
nsAutoAnimationMutationBatch::AnimationAdded(aAnimation);
|
||||
break;
|
||||
case eAnimationMutation_Changed:
|
||||
nsAutoAnimationMutationBatch::AnimationChanged(aPlayer);
|
||||
nsAutoAnimationMutationBatch::AnimationChanged(aAnimation);
|
||||
break;
|
||||
case eAnimationMutation_Removed:
|
||||
nsAutoAnimationMutationBatch::AnimationRemoved(aPlayer);
|
||||
nsAutoAnimationMutationBatch::AnimationRemoved(aAnimation);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -373,33 +373,33 @@ nsAnimationReceiver::RecordAnimationMutation(Animation* aPlayer,
|
|||
|
||||
switch (aMutationType) {
|
||||
case eAnimationMutation_Added:
|
||||
m->mAddedAnimations.AppendElement(aPlayer);
|
||||
m->mAddedAnimations.AppendElement(aAnimation);
|
||||
break;
|
||||
case eAnimationMutation_Changed:
|
||||
m->mChangedAnimations.AppendElement(aPlayer);
|
||||
m->mChangedAnimations.AppendElement(aAnimation);
|
||||
break;
|
||||
case eAnimationMutation_Removed:
|
||||
m->mRemovedAnimations.AppendElement(aPlayer);
|
||||
m->mRemovedAnimations.AppendElement(aAnimation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsAnimationReceiver::AnimationAdded(Animation* aPlayer)
|
||||
nsAnimationReceiver::AnimationAdded(Animation* aAnimation)
|
||||
{
|
||||
RecordAnimationMutation(aPlayer, eAnimationMutation_Added);
|
||||
RecordAnimationMutation(aAnimation, eAnimationMutation_Added);
|
||||
}
|
||||
|
||||
void
|
||||
nsAnimationReceiver::AnimationChanged(Animation* aPlayer)
|
||||
nsAnimationReceiver::AnimationChanged(Animation* aAnimation)
|
||||
{
|
||||
RecordAnimationMutation(aPlayer, eAnimationMutation_Changed);
|
||||
RecordAnimationMutation(aAnimation, eAnimationMutation_Changed);
|
||||
}
|
||||
|
||||
void
|
||||
nsAnimationReceiver::AnimationRemoved(Animation* aPlayer)
|
||||
nsAnimationReceiver::AnimationRemoved(Animation* aAnimation)
|
||||
{
|
||||
RecordAnimationMutation(aPlayer, eAnimationMutation_Removed);
|
||||
RecordAnimationMutation(aAnimation, eAnimationMutation_Removed);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsAnimationReceiver, nsMutationReceiver,
|
||||
|
@ -1020,11 +1020,11 @@ nsAutoAnimationMutationBatch::Done()
|
|||
|
||||
for (const Entry& e : mEntries) {
|
||||
if (e.mState == eState_Added) {
|
||||
m->mAddedAnimations.AppendElement(e.mPlayer);
|
||||
m->mAddedAnimations.AppendElement(e.mAnimation);
|
||||
} else if (e.mState == eState_Removed) {
|
||||
m->mRemovedAnimations.AppendElement(e.mPlayer);
|
||||
m->mRemovedAnimations.AppendElement(e.mAnimation);
|
||||
} else if (e.mState == eState_RemainedPresent && e.mChanged) {
|
||||
m->mChangedAnimations.AppendElement(e.mPlayer);
|
||||
m->mChangedAnimations.AppendElement(e.mAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class nsDOMMutationRecord final : public nsISupports,
|
|||
virtual ~nsDOMMutationRecord() {}
|
||||
|
||||
public:
|
||||
typedef nsTArray<nsRefPtr<mozilla::dom::Animation>> AnimationPlayerArray;
|
||||
typedef nsTArray<nsRefPtr<mozilla::dom::Animation>> AnimationArray;
|
||||
|
||||
nsDOMMutationRecord(nsIAtom* aType, nsISupports* aOwner)
|
||||
: mType(aType), mAttrNamespace(NullString()), mPrevValue(NullString()), mOwner(aOwner)
|
||||
|
@ -95,17 +95,17 @@ public:
|
|||
aRetVal.SetOwnedString(mPrevValue);
|
||||
}
|
||||
|
||||
void GetAddedAnimations(AnimationPlayerArray& aRetVal) const
|
||||
void GetAddedAnimations(AnimationArray& aRetVal) const
|
||||
{
|
||||
aRetVal = mAddedAnimations;
|
||||
}
|
||||
|
||||
void GetRemovedAnimations(AnimationPlayerArray& aRetVal) const
|
||||
void GetRemovedAnimations(AnimationArray& aRetVal) const
|
||||
{
|
||||
aRetVal = mRemovedAnimations;
|
||||
}
|
||||
|
||||
void GetChangedAnimations(AnimationPlayerArray& aRetVal) const
|
||||
void GetChangedAnimations(AnimationArray& aRetVal) const
|
||||
{
|
||||
aRetVal = mChangedAnimations;
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ public:
|
|||
nsRefPtr<nsSimpleContentList> mRemovedNodes;
|
||||
nsCOMPtr<nsINode> mPreviousSibling;
|
||||
nsCOMPtr<nsINode> mNextSibling;
|
||||
AnimationPlayerArray mAddedAnimations;
|
||||
AnimationPlayerArray mRemovedAnimations;
|
||||
AnimationPlayerArray mChangedAnimations;
|
||||
AnimationArray mAddedAnimations;
|
||||
AnimationArray mRemovedAnimations;
|
||||
AnimationArray mChangedAnimations;
|
||||
|
||||
nsRefPtr<nsDOMMutationRecord> mNext;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -434,7 +434,7 @@ private:
|
|||
eAnimationMutation_Removed
|
||||
};
|
||||
|
||||
void RecordAnimationMutation(mozilla::dom::Animation* aPlayer,
|
||||
void RecordAnimationMutation(mozilla::dom::Animation* aAnimation,
|
||||
AnimationMutation aMutationType);
|
||||
};
|
||||
|
||||
|
@ -756,13 +756,13 @@ public:
|
|||
return sCurrentBatch->mBatchTarget;
|
||||
}
|
||||
|
||||
static void AnimationAdded(mozilla::dom::Animation* aPlayer)
|
||||
static void AnimationAdded(mozilla::dom::Animation* aAnimation)
|
||||
{
|
||||
if (!IsBatching()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entry* entry = sCurrentBatch->FindEntry(aPlayer);
|
||||
Entry* entry = sCurrentBatch->FindEntry(aAnimation);
|
||||
if (entry) {
|
||||
switch (entry->mState) {
|
||||
case eState_RemainedAbsent:
|
||||
|
@ -777,15 +777,15 @@ public:
|
|||
}
|
||||
} else {
|
||||
entry = sCurrentBatch->mEntries.AppendElement();
|
||||
entry->mPlayer = aPlayer;
|
||||
entry->mAnimation = aAnimation;
|
||||
entry->mState = eState_Added;
|
||||
entry->mChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void AnimationChanged(mozilla::dom::Animation* aPlayer)
|
||||
static void AnimationChanged(mozilla::dom::Animation* aAnimation)
|
||||
{
|
||||
Entry* entry = sCurrentBatch->FindEntry(aPlayer);
|
||||
Entry* entry = sCurrentBatch->FindEntry(aAnimation);
|
||||
if (entry) {
|
||||
NS_ASSERTION(entry->mState == eState_RemainedPresent ||
|
||||
entry->mState == eState_Added,
|
||||
|
@ -794,15 +794,15 @@ public:
|
|||
entry->mChanged = true;
|
||||
} else {
|
||||
entry = sCurrentBatch->mEntries.AppendElement();
|
||||
entry->mPlayer = aPlayer;
|
||||
entry->mAnimation = aAnimation;
|
||||
entry->mState = eState_RemainedPresent;
|
||||
entry->mChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void AnimationRemoved(mozilla::dom::Animation* aPlayer)
|
||||
static void AnimationRemoved(mozilla::dom::Animation* aAnimation)
|
||||
{
|
||||
Entry* entry = sCurrentBatch->FindEntry(aPlayer);
|
||||
Entry* entry = sCurrentBatch->FindEntry(aAnimation);
|
||||
if (entry) {
|
||||
switch (entry->mState) {
|
||||
case eState_RemainedPresent:
|
||||
|
@ -817,17 +817,17 @@ public:
|
|||
}
|
||||
} else {
|
||||
entry = sCurrentBatch->mEntries.AppendElement();
|
||||
entry->mPlayer = aPlayer;
|
||||
entry->mAnimation = aAnimation;
|
||||
entry->mState = eState_Removed;
|
||||
entry->mChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Entry* FindEntry(mozilla::dom::Animation* aPlayer)
|
||||
Entry* FindEntry(mozilla::dom::Animation* aAnimation)
|
||||
{
|
||||
for (Entry& e : mEntries) {
|
||||
if (e.mPlayer == aPlayer) {
|
||||
if (e.mAnimation == aAnimation) {
|
||||
return &e;
|
||||
}
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ private:
|
|||
|
||||
struct Entry
|
||||
{
|
||||
nsRefPtr<mozilla::dom::Animation> mPlayer;
|
||||
nsRefPtr<mozilla::dom::Animation> mAnimation;
|
||||
State mState;
|
||||
bool mChanged;
|
||||
};
|
||||
|
|
|
@ -22,36 +22,36 @@ class nsIAnimationObserver : public nsIMutationObserver
|
|||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IANIMATION_OBSERVER_IID)
|
||||
|
||||
virtual void AnimationAdded(mozilla::dom::Animation* aPlayer) = 0;
|
||||
virtual void AnimationChanged(mozilla::dom::Animation* aPlayer) = 0;
|
||||
virtual void AnimationRemoved(mozilla::dom::Animation* aPlayer) = 0;
|
||||
virtual void AnimationAdded(mozilla::dom::Animation* aAnimation) = 0;
|
||||
virtual void AnimationChanged(mozilla::dom::Animation* aAnimation) = 0;
|
||||
virtual void AnimationRemoved(mozilla::dom::Animation* aAnimation) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIAnimationObserver, NS_IANIMATION_OBSERVER_IID)
|
||||
|
||||
#define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONADDED \
|
||||
virtual void AnimationAdded(mozilla::dom::Animation* aPlayer) \
|
||||
virtual void AnimationAdded(mozilla::dom::Animation* aAnimation) \
|
||||
override;
|
||||
|
||||
#define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONCHANGED \
|
||||
virtual void AnimationChanged(mozilla::dom::Animation* aPlayer) \
|
||||
virtual void AnimationChanged(mozilla::dom::Animation* aAnimation) \
|
||||
override;
|
||||
|
||||
#define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONREMOVED \
|
||||
virtual void AnimationRemoved(mozilla::dom::Animation* aPlayer) \
|
||||
virtual void AnimationRemoved(mozilla::dom::Animation* aAnimation) \
|
||||
override;
|
||||
|
||||
#define NS_IMPL_NSIANIMATIONOBSERVER_STUB(class_) \
|
||||
void \
|
||||
class_::AnimationAdded(mozilla::dom::Animation* aPlayer) \
|
||||
class_::AnimationAdded(mozilla::dom::Animation* aAnimation) \
|
||||
{ \
|
||||
} \
|
||||
void \
|
||||
class_::AnimationChanged(mozilla::dom::Animation* aPlayer) \
|
||||
class_::AnimationChanged(mozilla::dom::Animation* aAnimation) \
|
||||
{ \
|
||||
} \
|
||||
void \
|
||||
class_::AnimationRemoved(mozilla::dom::Animation* aPlayer) \
|
||||
class_::AnimationRemoved(mozilla::dom::Animation* aAnimation) \
|
||||
{ \
|
||||
} \
|
||||
NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(class_) \
|
||||
|
|
|
@ -216,9 +216,9 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
|
|||
}
|
||||
|
||||
static inline Element*
|
||||
GetTarget(Animation* aPlayer)
|
||||
GetTarget(Animation* aAnimation)
|
||||
{
|
||||
KeyframeEffectReadonly* effect = aPlayer->GetEffect();
|
||||
KeyframeEffectReadonly* effect = aAnimation->GetEffect();
|
||||
if (!effect) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -238,44 +238,44 @@ GetTarget(Animation* aPlayer)
|
|||
}
|
||||
|
||||
void
|
||||
nsNodeUtils::AnimationAdded(Animation* aPlayer)
|
||||
nsNodeUtils::AnimationAdded(Animation* aAnimation)
|
||||
{
|
||||
Element* target = GetTarget(aPlayer);
|
||||
Element* target = GetTarget(aAnimation);
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
nsIDocument* doc = target->OwnerDoc();
|
||||
|
||||
if (doc->MayHaveAnimationObservers()) {
|
||||
IMPL_ANIMATION_NOTIFICATION(AnimationAdded, target, (aPlayer));
|
||||
IMPL_ANIMATION_NOTIFICATION(AnimationAdded, target, (aAnimation));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsNodeUtils::AnimationChanged(Animation* aPlayer)
|
||||
nsNodeUtils::AnimationChanged(Animation* aAnimation)
|
||||
{
|
||||
Element* target = GetTarget(aPlayer);
|
||||
Element* target = GetTarget(aAnimation);
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
nsIDocument* doc = target->OwnerDoc();
|
||||
|
||||
if (doc->MayHaveAnimationObservers()) {
|
||||
IMPL_ANIMATION_NOTIFICATION(AnimationChanged, target, (aPlayer));
|
||||
IMPL_ANIMATION_NOTIFICATION(AnimationChanged, target, (aAnimation));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsNodeUtils::AnimationRemoved(Animation* aPlayer)
|
||||
nsNodeUtils::AnimationRemoved(Animation* aAnimation)
|
||||
{
|
||||
Element* target = GetTarget(aPlayer);
|
||||
Element* target = GetTarget(aAnimation);
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
nsIDocument* doc = target->OwnerDoc();
|
||||
|
||||
if (doc->MayHaveAnimationObservers()) {
|
||||
IMPL_ANIMATION_NOTIFICATION(AnimationRemoved, target, (aPlayer));
|
||||
IMPL_ANIMATION_NOTIFICATION(AnimationRemoved, target, (aAnimation));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,9 +127,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
static void AnimationAdded(mozilla::dom::Animation* aPlayer);
|
||||
static void AnimationChanged(mozilla::dom::Animation* aPlayer);
|
||||
static void AnimationRemoved(mozilla::dom::Animation* aPlayer);
|
||||
static void AnimationAdded(mozilla::dom::Animation* aAnimation);
|
||||
static void AnimationChanged(mozilla::dom::Animation* aAnimation);
|
||||
static void AnimationRemoved(mozilla::dom::Animation* aAnimation);
|
||||
|
||||
/**
|
||||
* To be called when reference count of aNode drops to zero.
|
||||
|
|
Загрузка…
Ссылка в новой задаче