Bug 1154615 part 6 - Rename references to players within layout/; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Tue, 21 Apr 2015 10:22:10 +0900
changeset 240069 023fdd5ebd3fe2bcb7c75b3bb68663700da6f4ae
parent 240068 2bb61d7addb344c0ac6eac3a9dad1df564f48c0e
child 240070 1649585af78e01e7e12f8cb1080869591d676beb
push id58731
push userbbirtles@mozilla.com
push dateTue, 21 Apr 2015 01:22:31 +0000
treeherdermozilla-inbound@88a7dbe87754 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1154615
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1154615 part 6 - Rename references to players within layout/; r=jwatt We will rename CSSAnimationPlayer/CSSTransitionPlayer in a separate patch
dom/animation/Animation.cpp
dom/base/Element.cpp
layout/base/nsDisplayList.cpp
layout/base/nsLayoutUtils.cpp
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsTransitionManager.cpp
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -726,17 +726,17 @@ Animation::FlushStyle() const
   }
 }
 
 void
 Animation::PostUpdate()
 {
   AnimationCollection* collection = GetCollection();
   if (collection) {
-    collection->NotifyPlayerUpdated();
+    collection->NotifyAnimationUpdated();
   }
 }
 
 void
 Animation::CancelPendingTasks()
 {
   if (mPendingState == PendingState::NotPending) {
     return;
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3198,22 +3198,22 @@ Element::GetAnimations(nsTArray<nsRefPtr
   for (size_t propIdx = 0; propIdx < MOZ_ARRAY_LENGTH(properties);
        propIdx++) {
     AnimationCollection* collection =
       static_cast<AnimationCollection*>(
         GetProperty(properties[propIdx]));
     if (!collection) {
       continue;
     }
-    for (size_t playerIdx = 0;
-         playerIdx < collection->mPlayers.Length();
-         playerIdx++) {
-      Animation* player = collection->mPlayers[playerIdx];
-      if (player->IsRelevant()) {
-        aAnimations.AppendElement(player);
+    for (size_t animIdx = 0;
+         animIdx < collection->mAnimations.Length();
+         animIdx++) {
+      Animation* anim = collection->mAnimations[animIdx];
+      if (anim->IsRelevant()) {
+        aAnimations.AppendElement(anim);
       }
     }
   }
 }
 
 NS_IMETHODIMP
 Element::GetInnerHTML(nsAString& aInnerHTML)
 {
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -343,39 +343,38 @@ ToTimingFunction(const ComputedTimingFun
   }
 
   uint32_t type = aCTF.GetType() == nsTimingFunction::StepStart ? 1 : 2;
   return TimingFunction(StepFunction(aCTF.GetSteps(), type));
 }
 
 static void
 AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
-                        dom::Animation* aPlayer, Layer* aLayer,
+                        dom::Animation* aAnimation, Layer* aLayer,
                         AnimationData& aData, bool aPending)
 {
   MOZ_ASSERT(aLayer->AsContainerLayer(), "Should only animate ContainerLayer");
-  MOZ_ASSERT(aPlayer->GetEffect(),
-             "Should not be adding an animation for a player without"
-             " an effect");
+  MOZ_ASSERT(aAnimation->GetEffect(),
+             "Should not be adding an animation without an effect");
   nsStyleContext* styleContext = aFrame->StyleContext();
   nsPresContext* presContext = aFrame->PresContext();
   nsRect bounds = nsDisplayTransform::GetFrameBoundsForTransform(aFrame);
 
   layers::Animation* animation =
     aPending ?
     aLayer->AddAnimationForNextTransaction() :
     aLayer->AddAnimation();
 
-  const AnimationTiming& timing = aPlayer->GetEffect()->Timing();
-  Nullable<TimeDuration> startTime = aPlayer->GetCurrentOrPendingStartTime();
+  const AnimationTiming& timing = aAnimation->GetEffect()->Timing();
+  Nullable<TimeDuration> startTime = aAnimation->GetCurrentOrPendingStartTime();
   animation->startTime() = startTime.IsNull()
                            ? TimeStamp()
-                           : aPlayer->Timeline()->ToTimeStamp(
+                           : aAnimation->Timeline()->ToTimeStamp(
                               startTime.Value() + timing.mDelay);
-  animation->initialCurrentTime() = aPlayer->GetCurrentTime().Value()
+  animation->initialCurrentTime() = aAnimation->GetCurrentTime().Value()
                                     - timing.mDelay;
   animation->duration() = timing.mIterationDuration;
   animation->iterationCount() = timing.mIterationCount;
   animation->direction() = timing.mDirection;
   animation->property() = aProperty.mProperty;
   animation->data() = aData;
 
   for (uint32_t segIdx = 0; segIdx < aProperty.mSegments.Length(); segIdx++) {
@@ -402,32 +401,32 @@ AddAnimationForProperty(nsIFrame* aFrame
     animSegment->startPortion() = segment.mFromKey;
     animSegment->endPortion() = segment.mToKey;
     animSegment->sampleFn() = ToTimingFunction(segment.mTimingFunction);
   }
 }
 
 static void
 AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
-                         AnimationPlayerPtrArray& aPlayers,
+                         AnimationPtrArray& aAnimations,
                          Layer* aLayer, AnimationData& aData,
                          bool aPending)
 {
   MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty,
                                       CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
              "inconsistent property flags");
 
   // Add from first to last (since last overrides)
-  for (size_t playerIdx = 0; playerIdx < aPlayers.Length(); playerIdx++) {
-    dom::Animation* player = aPlayers[playerIdx];
-    if (!player->IsPlaying()) {
+  for (size_t animIdx = 0; animIdx < aAnimations.Length(); animIdx++) {
+    dom::Animation* anim = aAnimations[animIdx];
+    if (!anim->IsPlaying()) {
       continue;
     }
-    dom::KeyframeEffectReadonly* effect = player->GetEffect();
-    MOZ_ASSERT(effect, "A playing player should have an effect");
+    dom::KeyframeEffectReadonly* effect = anim->GetEffect();
+    MOZ_ASSERT(effect, "A playing animation should have an effect");
     const AnimationProperty* property =
       effect->GetAnimationOfProperty(aProperty);
     if (!property) {
       continue;
     }
 
     // Note that if mWinsInCascade on property was  false,
     // GetAnimationOfProperty returns null instead.
@@ -445,25 +444,25 @@ AddAnimationsForProperty(nsIFrame* aFram
     // refresh driver is under test control. This is because any pending
     // animations on layers will have their start time updated with the
     // current timestamp but when the refresh driver is under test control
     // its refresh times are unrelated to timestamp values.
     //
     // Instead we leave the animation running on the main thread and the
     // next time the refresh driver is advanced it will trigger any pending
     // animations.
-    if (player->PlayState() == AnimationPlayState::Pending) {
-      nsRefreshDriver* driver = player->Timeline()->GetRefreshDriver();
+    if (anim->PlayState() == AnimationPlayState::Pending) {
+      nsRefreshDriver* driver = anim->Timeline()->GetRefreshDriver();
       if (driver && driver->IsTestControllingRefreshesEnabled()) {
         continue;
       }
     }
 
-    AddAnimationForProperty(aFrame, *property, player, aLayer, aData, aPending);
-    player->SetIsRunningOnCompositor();
+    AddAnimationForProperty(aFrame, *property, anim, aLayer, aData, aPending);
+    anim->SetIsRunningOnCompositor();
   }
 }
 
 /* static */ void
 nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
                                                          nsDisplayListBuilder* aBuilder,
                                                          nsDisplayItem* aItem,
                                                          nsIFrame* aFrame,
@@ -561,22 +560,22 @@ nsDisplayListBuilder::AddAnimationsAndTr
                          aFrame->PresContext()->AppUnitsPerDevPixel());
   } else if (aProperty == eCSSProperty_opacity) {
     data = null_t();
   }
 
   // When both are running, animations override transitions.  We want
   // to add the ones that override last.
   if (transitions) {
-    AddAnimationsForProperty(aFrame, aProperty, transitions->mPlayers,
+    AddAnimationsForProperty(aFrame, aProperty, transitions->mAnimations,
                              aLayer, data, pending);
   }
 
   if (animations) {
-    AddAnimationsForProperty(aFrame, aProperty, animations->mPlayers,
+    AddAnimationsForProperty(aFrame, aProperty, animations->mAnimations,
                              aLayer, data, pending);
   }
 }
 
 nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
     Mode aMode, bool aBuildCaret)
     : mReferenceFrame(aReferenceFrame),
       mIgnoreScrollFrame(nullptr),
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -495,22 +495,22 @@ GetSuitableScale(float aMaxScale, float 
 }
 
 static void
 GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent,
                                       AnimationCollection* aAnimations,
                                       gfxSize& aMaxScale,
                                       gfxSize& aMinScale)
 {
-  for (size_t playerIdx = aAnimations->mPlayers.Length(); playerIdx-- != 0; ) {
-    dom::Animation* player = aAnimations->mPlayers[playerIdx];
-    if (!player->GetEffect() || player->GetEffect()->IsFinishedTransition()) {
+  for (size_t animIdx = aAnimations->mAnimations.Length(); animIdx-- != 0; ) {
+    dom::Animation* anim = aAnimations->mAnimations[animIdx];
+    if (!anim->GetEffect() || anim->GetEffect()->IsFinishedTransition()) {
       continue;
     }
-    dom::KeyframeEffectReadonly* effect = player->GetEffect();
+    dom::KeyframeEffectReadonly* effect = anim->GetEffect();
     for (size_t propIdx = effect->Properties().Length(); propIdx-- != 0; ) {
       AnimationProperty& prop = effect->Properties()[propIdx];
       if (prop.mProperty == eCSSProperty_transform) {
         for (uint32_t segIdx = prop.mSegments.Length(); segIdx-- != 0; ) {
           AnimationPropertySegment& segment = prop.mSegments[segIdx];
           gfxSize from = GetScaleForValue(segment.mFromValue,
                                           aContent->GetPrimaryFrame());
           aMaxScale.width = std::max<float>(aMaxScale.width, from.width);
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -590,43 +590,43 @@ AnimationCollection::CanPerformOnComposi
                             " not supported.  See bug 771367 (");
       message.Append(nsAtomCString(mElementProperty));
       message.Append(")");
       LogAsyncAnimationFailure(message, mElement);
     }
     return false;
   }
 
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    const Animation* player = mPlayers[playerIdx];
-    if (!player->IsPlaying()) {
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    const Animation* anim = mAnimations[animIdx];
+    if (!anim->IsPlaying()) {
       continue;
     }
 
-    const KeyframeEffectReadonly* effect = player->GetEffect();
-    MOZ_ASSERT(effect, "A playing player should have an effect");
+    const KeyframeEffectReadonly* effect = anim->GetEffect();
+    MOZ_ASSERT(effect, "A playing animation should have an effect");
 
     for (size_t propIdx = 0, propEnd = effect->Properties().Length();
          propIdx != propEnd; ++propIdx) {
       if (IsGeometricProperty(effect->Properties()[propIdx].mProperty)) {
         aFlags = CanAnimateFlags(aFlags | CanAnimate_HasGeometricProperty);
         break;
       }
     }
   }
 
   bool existsProperty = false;
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    const Animation* player = mPlayers[playerIdx];
-    if (!player->IsPlaying()) {
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    const Animation* anim = mAnimations[animIdx];
+    if (!anim->IsPlaying()) {
       continue;
     }
 
-    const KeyframeEffectReadonly* effect = player->GetEffect();
-    MOZ_ASSERT(effect, "A playing player should have an effect");
+    const KeyframeEffectReadonly* effect = anim->GetEffect();
+    MOZ_ASSERT(effect, "A playing animation should have an effect");
 
     existsProperty = existsProperty || effect->Properties().Length() > 0;
 
     for (size_t propIdx = 0, propEnd = effect->Properties().Length();
          propIdx != propEnd; ++propIdx) {
       const AnimationProperty& prop = effect->Properties()[propIdx];
       if (!CanAnimatePropertyOnCompositor(mElement,
                                           prop.mProperty,
@@ -644,18 +644,18 @@ AnimationCollection::CanPerformOnComposi
 
   return true;
 }
 
 void
 AnimationCollection::PostUpdateLayerAnimations()
 {
   nsCSSPropertySet propsHandled;
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    const auto& properties = mPlayers[playerIdx]->GetEffect()->Properties();
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    const auto& properties = mAnimations[animIdx]->GetEffect()->Properties();
     for (size_t propIdx = properties.Length(); propIdx-- != 0; ) {
       nsCSSProperty prop = properties[propIdx].mProperty;
       if (nsCSSProps::PropHasFlags(prop,
                                    CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR) &&
           !propsHandled.HasProperty(prop)) {
         propsHandled.AddProperty(prop);
         nsChangeHint changeHint = css::CommonAnimationManager::
           LayerAnimationRecordFor(prop)->mChangeHint;
@@ -667,18 +667,18 @@ AnimationCollection::PostUpdateLayerAnim
       }
     }
   }
 }
 
 bool
 AnimationCollection::HasAnimationOfProperty(nsCSSProperty aProperty) const
 {
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    const KeyframeEffectReadonly* effect = mPlayers[playerIdx]->GetEffect();
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    const KeyframeEffectReadonly* effect = mAnimations[animIdx]->GetEffect();
     if (effect && effect->HasAnimationOfProperty(aProperty) &&
         !effect->IsFinishedTransition()) {
       return true;
     }
   }
   return false;
 }
 
@@ -704,17 +704,17 @@ AnimationCollection::GetElementToRestyle
   }
   if (!pseudoFrame) {
     return nullptr;
   }
   return pseudoFrame->GetContent()->AsElement();
 }
 
 void
-AnimationCollection::NotifyPlayerUpdated()
+AnimationCollection::NotifyAnimationUpdated()
 {
   // On the next flush, force us to update the style rule
   mNeedsRefreshes = true;
   mStyleRuleRefreshTime = TimeStamp();
 
   mManager->NotifyCollectionUpdated(*this);
 }
 
@@ -749,19 +749,19 @@ AnimationCollection::PropertyDtor(void *
   collection->mCalledPropertyDtor = true;
 #endif
   delete collection;
 }
 
 void
 AnimationCollection::Tick()
 {
-  for (size_t playerIdx = 0, playerEnd = mPlayers.Length();
-       playerIdx != playerEnd; playerIdx++) {
-    mPlayers[playerIdx]->Tick();
+  for (size_t animIdx = 0, animEnd = mAnimations.Length();
+       animIdx != animEnd; animIdx++) {
+    mAnimations[animIdx]->Tick();
   }
 }
 
 void
 AnimationCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime,
                                         EnsureStyleRuleFlags aFlags)
 {
   if (!mNeedsRefreshes) {
@@ -777,18 +777,18 @@ AnimationCollection::EnsureStyleRuleFor(
 
   // If we're performing animations on the compositor thread, then we can skip
   // most of the work in this method. But even if we are throttled, then we
   // have to do the work if an animation is ending in order to get correct end
   // of animation behavior (the styles of the animation disappear, or the fill
   // mode behavior). CanThrottle returns false for any finishing animations
   // so we can force style recalculation in that case.
   if (aFlags == EnsureStyleRule_IsThrottled) {
-    for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-      if (!mPlayers[playerIdx]->CanThrottle()) {
+    for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+      if (!mAnimations[animIdx]->CanThrottle()) {
         aFlags = EnsureStyleRule_IsNotThrottled;
         break;
       }
     }
   }
 
   if (aFlags == EnsureStyleRule_IsThrottled) {
     return;
@@ -806,18 +806,18 @@ AnimationCollection::EnsureStyleRuleFor(
   mNeedsRefreshes = false;
 
   // If multiple animations specify behavior for the same property the
   // animation which occurs last in the value of animation-name wins.
   // As a result, we iterate from last animation to first and, if a
   // property has already been set, we don't leave it.
   nsCSSPropertySet properties;
 
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    mPlayers[playerIdx]->ComposeStyle(mStyleRule, properties, mNeedsRefreshes);
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    mAnimations[animIdx]->ComposeStyle(mStyleRule, properties, mNeedsRefreshes);
   }
 
   mManager->MaybeStartObservingRefreshDriver();
 }
 
 bool
 AnimationCollection::CanThrottleTransformChanges(TimeStamp aTime)
 {
@@ -901,35 +901,35 @@ AnimationCollection::UpdateCheckGenerati
 {
   mCheckGeneration =
     aPresContext->RestyleManager()->GetAnimationGeneration();
 }
 
 bool
 AnimationCollection::HasCurrentAnimations() const
 {
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    if (mPlayers[playerIdx]->HasCurrentEffect()) {
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    if (mAnimations[animIdx]->HasCurrentEffect()) {
       return true;
     }
   }
 
   return false;
 }
 
 bool
 AnimationCollection::HasCurrentAnimationsForProperties(
                               const nsCSSProperty* aProperties,
                               size_t aPropertyCount) const
 {
-  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    const Animation& player = *mPlayers[playerIdx];
-    const KeyframeEffectReadonly* effect = player.GetEffect();
+  for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+    const Animation& anim = *mAnimations[animIdx];
+    const KeyframeEffectReadonly* effect = anim.GetEffect();
     if (effect &&
-        effect->IsCurrent(player) &&
+        effect->IsCurrent(anim) &&
         effect->HasAnimationOfProperties(aProperties, aPropertyCount)) {
       return true;
     }
   }
 
   return false;
 }
 
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -95,17 +95,17 @@ public:
           aContent->GetProperty(nsGkAtoms::transitionsProperty)) {
         return true;
       }
     } while ((aContent = aContent->GetParent()));
 
     return false;
   }
 
-  // Notify this manager that one of its collections of animation players,
+  // Notify this manager that one of its collections of animations,
   // has been updated.
   void NotifyCollectionUpdated(AnimationCollection& aCollection);
 
   enum FlushFlags {
     Can_Throttle,
     Cannot_Throttle
   };
 
@@ -218,17 +218,17 @@ public:
 private:
   ~AnimValuesStyleRule() {}
 
   InfallibleTArray<PropertyValuePair> mPropertyValuePairs;
 };
 
 } /* end css sub-namespace */
 
-typedef InfallibleTArray<nsRefPtr<dom::Animation>> AnimationPlayerPtrArray;
+typedef InfallibleTArray<nsRefPtr<dom::Animation>> AnimationPtrArray;
 
 enum EnsureStyleRuleFlags {
   EnsureStyleRule_IsThrottled,
   EnsureStyleRule_IsNotThrottled
 };
 
 struct AnimationCollection : public PRCList
 {
@@ -253,18 +253,18 @@ struct AnimationCollection : public PRCL
                "must call destructor through element property dtor");
     MOZ_COUNT_DTOR(AnimationCollection);
     PR_REMOVE_LINK(this);
     mManager->ElementCollectionRemoved();
   }
 
   void Destroy()
   {
-    for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-      mPlayers[playerIdx]->Cancel();
+    for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
+      mAnimations[animIdx]->Cancel();
     }
     // This will call our destructor.
     mElement->DeleteProperty(mElementProperty);
   }
 
   static void PropertyDtor(void *aObject, nsIAtom *aPropertyName,
                            void *aPropertyValue, void *aData);
 
@@ -369,30 +369,30 @@ struct AnimationCollection : public PRCL
     mozilla::dom::Element* element = GetElementToRestyle();
     if (element) {
       nsRestyleHint hint = IsForTransitions() ? eRestyle_CSSTransitions
                                               : eRestyle_CSSAnimations;
       aPresContext->PresShell()->RestyleForAnimation(element, hint);
     }
   }
 
-  void NotifyPlayerUpdated();
+  void NotifyAnimationUpdated();
 
   static void LogAsyncAnimationFailure(nsCString& aMessage,
                                        const nsIContent* aContent = nullptr);
 
   dom::Element *mElement;
 
   // the atom we use in mElement's prop table (must be a static atom,
   // i.e., in an atom list)
   nsIAtom *mElementProperty;
 
   mozilla::css::CommonAnimationManager *mManager;
 
-  mozilla::AnimationPlayerPtrArray mPlayers;
+  mozilla::AnimationPtrArray mAnimations;
 
   // This style rule contains the style data for currently animating
   // values.  It only matches when styling with animation.  When we
   // style without animation, we need to not use it so that we can
   // detect any new changes; if necessary we restyle immediately
   // afterwards with animation.
   // NOTE: If we don't need to apply any styles, mStyleRule will be
   // null, but mStyleRuleRefreshTime will still be valid.
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -209,32 +209,32 @@ nsAnimationManager::UpdateStyleAndEvents
   aCollection->EnsureStyleRuleFor(aRefreshTime, aFlags);
   QueueEvents(aCollection, mPendingEvents);
 }
 
 void
 nsAnimationManager::QueueEvents(AnimationCollection* aCollection,
                                 EventArray& aEventsToDispatch)
 {
-  for (size_t playerIdx = aCollection->mPlayers.Length(); playerIdx-- != 0; ) {
-    CSSAnimationPlayer* player =
-      aCollection->mPlayers[playerIdx]->AsCSSAnimationPlayer();
-    MOZ_ASSERT(player, "Expected a collection of CSS Animation players");
-    player->QueueEvents(aEventsToDispatch);
+  for (size_t animIdx = aCollection->mAnimations.Length(); animIdx-- != 0; ) {
+    CSSAnimationPlayer* anim =
+      aCollection->mAnimations[animIdx]->AsCSSAnimationPlayer();
+    MOZ_ASSERT(anim, "Expected a collection of CSS Animations");
+    anim->QueueEvents(aEventsToDispatch);
   }
 }
 
 void
 nsAnimationManager::MaybeUpdateCascadeResults(AnimationCollection* aCollection)
 {
-  for (size_t playerIdx = aCollection->mPlayers.Length(); playerIdx-- != 0; ) {
-    CSSAnimationPlayer* player =
-      aCollection->mPlayers[playerIdx]->AsCSSAnimationPlayer();
+  for (size_t animIdx = aCollection->mAnimations.Length(); animIdx-- != 0; ) {
+    CSSAnimationPlayer* anim =
+      aCollection->mAnimations[animIdx]->AsCSSAnimationPlayer();
 
-    if (player->IsInEffect() != player->mInEffectForCascadeResults) {
+    if (anim->IsInEffect() != anim->mInEffectForCascadeResults) {
       // Update our own cascade results.
       mozilla::dom::Element* element = aCollection->GetElementToRestyle();
       if (element) {
         nsIFrame* frame = element->GetPrimaryFrame();
         if (frame) {
           UpdateCascadeResults(frame->StyleContext(), aCollection);
         }
       }
@@ -286,22 +286,22 @@ nsAnimationManager::CheckAnimationRule(n
       disp->mAnimations[0].GetName().IsEmpty()) {
     return nullptr;
   }
 
   nsAutoAnimationMutationBatch mb(aElement);
 
   // build the animations list
   dom::DocumentTimeline* timeline = aElement->OwnerDoc()->Timeline();
-  AnimationPlayerPtrArray newPlayers;
+  AnimationPtrArray newAnimations;
   if (!aStyleContext->IsInDisplayNoneSubtree()) {
-    BuildAnimations(aStyleContext, aElement, timeline, newPlayers);
+    BuildAnimations(aStyleContext, aElement, timeline, newAnimations);
   }
 
-  if (newPlayers.IsEmpty()) {
+  if (newAnimations.IsEmpty()) {
     if (collection) {
       // There might be transitions that run now that animations don't
       // override them.
       mPresContext->TransitionManager()->
         UpdateCascadeResultsWithAnimationsToBeDestroyed(collection);
 
       collection->Destroy();
     }
@@ -318,108 +318,108 @@ nsAnimationManager::CheckAnimationRule(n
     // old list of animations.
     // This means that we honor dynamic changes, which isn't what the
     // spec says to do, but WebKit seems to honor at least some of
     // them.  See
     // http://lists.w3.org/Archives/Public/www-style/2011Apr/0079.html
     // In order to honor what the spec said, we'd copy more data over
     // (or potentially optimize BuildAnimations to avoid rebuilding it
     // in the first place).
-    if (!collection->mPlayers.IsEmpty()) {
+    if (!collection->mAnimations.IsEmpty()) {
 
-      for (size_t newIdx = newPlayers.Length(); newIdx-- != 0;) {
-        Animation* newPlayer = newPlayers[newIdx];
+      for (size_t newIdx = newAnimations.Length(); newIdx-- != 0;) {
+        Animation* newAnim = newAnimations[newIdx];
 
         // Find the matching animation with this name in the old list
         // of animations.  We iterate through both lists in a backwards
         // direction which means that if there are more animations in
         // the new list of animations with a given name than in the old
         // list, it will be the animations towards the of the beginning of
         // the list that do not match and are treated as new animations.
-        nsRefPtr<CSSAnimationPlayer> oldPlayer;
-        size_t oldIdx = collection->mPlayers.Length();
+        nsRefPtr<CSSAnimationPlayer> oldAnim;
+        size_t oldIdx = collection->mAnimations.Length();
         while (oldIdx-- != 0) {
           CSSAnimationPlayer* a =
-            collection->mPlayers[oldIdx]->AsCSSAnimationPlayer();
+            collection->mAnimations[oldIdx]->AsCSSAnimationPlayer();
           MOZ_ASSERT(a, "All players in the CSS Animation collection should"
                         " be CSSAnimationPlayer objects");
-          if (a->Name() == newPlayer->Name()) {
-            oldPlayer = a;
+          if (a->Name() == newAnim->Name()) {
+            oldAnim = a;
             break;
           }
         }
-        if (!oldPlayer) {
+        if (!oldAnim) {
           continue;
         }
 
         bool animationChanged = false;
 
         // Update the old from the new so we can keep the original object
         // identity (and any expando properties attached to it).
-        if (oldPlayer->GetEffect() && newPlayer->GetEffect()) {
-          KeyframeEffectReadonly* oldEffect = oldPlayer->GetEffect();
-          KeyframeEffectReadonly* newEffect = newPlayer->GetEffect();
+        if (oldAnim->GetEffect() && newAnim->GetEffect()) {
+          KeyframeEffectReadonly* oldEffect = oldAnim->GetEffect();
+          KeyframeEffectReadonly* newEffect = newAnim->GetEffect();
           animationChanged =
             oldEffect->Timing() != newEffect->Timing() ||
             oldEffect->Properties() != newEffect->Properties();
           oldEffect->Timing() = newEffect->Timing();
           oldEffect->Properties() = newEffect->Properties();
         }
 
         // Reset compositor state so animation will be re-synchronized.
-        oldPlayer->ClearIsRunningOnCompositor();
+        oldAnim->ClearIsRunningOnCompositor();
 
         // Handle changes in play state.
         // CSSAnimationPlayer takes care of override behavior so that,
         // for example, if the author has called pause(), that will
         // override the animation-play-state.
-        // (We should check newPlayer->IsStylePaused() but that requires
+        // (We should check newAnim->IsStylePaused() but that requires
         //  downcasting to CSSAnimationPlayer and we happen to know that
-        //  newPlayer will only ever be paused by calling PauseFromStyle
+        //  newAnim will only ever be paused by calling PauseFromStyle
         //  making IsPausedOrPausing synonymous in this case.)
-        if (!oldPlayer->IsStylePaused() && newPlayer->IsPausedOrPausing()) {
-          oldPlayer->PauseFromStyle();
+        if (!oldAnim->IsStylePaused() && newAnim->IsPausedOrPausing()) {
+          oldAnim->PauseFromStyle();
           animationChanged = true;
-        } else if (oldPlayer->IsStylePaused() &&
-                   !newPlayer->IsPausedOrPausing()) {
-          oldPlayer->PlayFromStyle();
+        } else if (oldAnim->IsStylePaused() &&
+                   !newAnim->IsPausedOrPausing()) {
+          oldAnim->PlayFromStyle();
           animationChanged = true;
         }
 
         if (animationChanged) {
-          nsNodeUtils::AnimationChanged(oldPlayer);
+          nsNodeUtils::AnimationChanged(oldAnim);
         }
 
         // Replace new animation with the (updated) old one and remove the
         // old one from the array so we don't try to match it any more.
         //
         // Although we're doing this while iterating this is safe because
-        // we're not changing the length of newPlayers and we've finished
+        // we're not changing the length of newAnimations and we've finished
         // iterating over the list of old iterations.
-        newPlayer->Cancel();
-        newPlayer = nullptr;
-        newPlayers.ReplaceElementAt(newIdx, oldPlayer);
-        collection->mPlayers.RemoveElementAt(oldIdx);
+        newAnim->Cancel();
+        newAnim = nullptr;
+        newAnimations.ReplaceElementAt(newIdx, oldAnim);
+        collection->mAnimations.RemoveElementAt(oldIdx);
 
         // We've touched the old animation's timing properties, so this
-        // could update the old player's relevance.
-        oldPlayer->UpdateRelevance();
+        // could update the old animation's relevance.
+        oldAnim->UpdateRelevance();
       }
     }
   } else {
     collection =
       GetAnimations(aElement, aStyleContext->GetPseudoType(), true);
   }
-  collection->mPlayers.SwapElements(newPlayers);
+  collection->mAnimations.SwapElements(newAnimations);
   collection->mNeedsRefreshes = true;
   collection->Tick();
 
   // Cancel removed animations
-  for (size_t newPlayerIdx = newPlayers.Length(); newPlayerIdx-- != 0; ) {
-    newPlayers[newPlayerIdx]->Cancel();
+  for (size_t newAnimIdx = newAnimations.Length(); newAnimIdx-- != 0; ) {
+    newAnimations[newAnimIdx]->Cancel();
   }
 
   UpdateCascadeResults(aStyleContext, collection);
 
   TimeStamp refreshTime = mPresContext->RefreshDriver()->MostRecentRefresh();
   UpdateStyleAndEvents(collection, refreshTime,
                        EnsureStyleRule_IsNotThrottled);
   // We don't actually dispatch the mPendingEvents now.  We'll either
@@ -483,19 +483,19 @@ ResolvedStyleCache::Get(nsPresContext *a
   }
   return result;
 }
 
 void
 nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
                                     dom::Element* aTarget,
                                     dom::DocumentTimeline* aTimeline,
-                                    AnimationPlayerPtrArray& aPlayers)
+                                    AnimationPtrArray& aAnimations)
 {
-  MOZ_ASSERT(aPlayers.IsEmpty(), "expect empty array");
+  MOZ_ASSERT(aAnimations.IsEmpty(), "expect empty array");
 
   ResolvedStyleCache resolvedStyles;
 
   const nsStyleDisplay *disp = aStyleContext->StyleDisplay();
 
   nsRefPtr<nsStyleContext> styleWithoutAnimation;
 
   for (size_t animIdx = 0, animEnd = disp->mAnimationNameCount;
@@ -511,35 +511,36 @@ nsAnimationManager::BuildAnimations(nsSt
       src.GetName().IsEmpty()
       ? nullptr
       : mPresContext->StyleSet()->KeyframesRuleForName(src.GetName());
     if (!rule) {
       continue;
     }
 
     nsRefPtr<CSSAnimationPlayer> dest = new CSSAnimationPlayer(aTimeline);
-    aPlayers.AppendElement(dest);
+    aAnimations.AppendElement(dest);
 
     AnimationTiming timing;
     timing.mIterationDuration =
       TimeDuration::FromMilliseconds(src.GetDuration());
     timing.mDelay = TimeDuration::FromMilliseconds(src.GetDelay());
     timing.mIterationCount = src.GetIterationCount();
     timing.mDirection = src.GetDirection();
     timing.mFillMode = src.GetFillMode();
 
     nsRefPtr<KeyframeEffectReadonly> destEffect =
       new KeyframeEffectReadonly(mPresContext->Document(), aTarget,
                                  aStyleContext->GetPseudoType(), timing,
                                  src.GetName());
     dest->SetEffect(destEffect);
 
     // Even in the case where we call PauseFromStyle below, we still need to
-    // call PlayFromStyle first. This is because a newly-created player is idle
-    // and has no effect until it is played (or otherwise given a start time).
+    // call PlayFromStyle first. This is because a newly-created animation is
+    // idle and has no effect until it is played (or otherwise given a start
+    // time).
     dest->PlayFromStyle();
 
     if (src.GetPlayState() == NS_STYLE_ANIMATION_PLAY_STATE_PAUSED) {
       dest->PauseFromStyle();
     }
 
     // While current drafts of css3-animations say that later keyframes
     // with the same key entirely replace earlier ones (no cascading),
@@ -745,20 +746,20 @@ nsAnimationManager::UpdateCascadeResults
 
   // size of 2 since we only currently have 2 properties we animate on
   // the compositor
   nsAutoTArray<nsCSSProperty, 2> propertiesToTrack;
 
   {
     nsCSSPropertySet propertiesToTrackAsSet;
 
-    for (size_t playerIdx = aElementAnimations->mPlayers.Length();
-         playerIdx-- != 0; ) {
-      const Animation* player = aElementAnimations->mPlayers[playerIdx];
-      const KeyframeEffectReadonly* effect = player->GetEffect();
+    for (size_t animIdx = aElementAnimations->mAnimations.Length();
+         animIdx-- != 0; ) {
+      const Animation* anim = aElementAnimations->mAnimations[animIdx];
+      const KeyframeEffectReadonly* effect = anim->GetEffect();
       if (!effect) {
         continue;
       }
 
       for (size_t propIdx = 0, propEnd = effect->Properties().Length();
            propIdx != propEnd; ++propIdx) {
         const AnimationProperty& prop = effect->Properties()[propIdx];
         // We only bother setting mWinsInCascade for properties that we
@@ -792,23 +793,23 @@ nsAnimationManager::UpdateCascadeResults
    * We iterate from the last animation to the first, just like we do
    * when calling ComposeStyle from AnimationCollection::EnsureStyleRuleFor.
    * Later animations override earlier ones, so we add properties to the set
    * of overridden properties as we encounter them, if the animation is
    * currently in effect.
    */
 
   bool changed = false;
-  for (size_t playerIdx = aElementAnimations->mPlayers.Length();
-       playerIdx-- != 0; ) {
-    CSSAnimationPlayer* player =
-      aElementAnimations->mPlayers[playerIdx]->AsCSSAnimationPlayer();
-    KeyframeEffectReadonly* effect = player->GetEffect();
+  for (size_t animIdx = aElementAnimations->mAnimations.Length();
+       animIdx-- != 0; ) {
+    CSSAnimationPlayer* anim =
+      aElementAnimations->mAnimations[animIdx]->AsCSSAnimationPlayer();
+    KeyframeEffectReadonly* effect = anim->GetEffect();
 
-    player->mInEffectForCascadeResults = player->IsInEffect();
+    anim->mInEffectForCascadeResults = anim->IsInEffect();
 
     if (!effect) {
       continue;
     }
 
     for (size_t propIdx = 0, propEnd = effect->Properties().Length();
          propIdx != propEnd; ++propIdx) {
       AnimationProperty& prop = effect->Properties()[propIdx];
@@ -818,17 +819,17 @@ nsAnimationManager::UpdateCascadeResults
                                    CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) {
         bool newWinsInCascade =
           !propertiesOverridden.HasProperty(prop.mProperty);
         if (newWinsInCascade != prop.mWinsInCascade) {
           changed = true;
         }
         prop.mWinsInCascade = newWinsInCascade;
 
-        if (prop.mWinsInCascade && player->mInEffectForCascadeResults) {
+        if (prop.mWinsInCascade && anim->mInEffectForCascadeResults) {
           // This animation is in effect right now, so it overrides
           // earlier animations.  (For animations that aren't in effect,
           // we set mWinsInCascade as though they were, but they don't
           // suppress animations lower in the cascade.)
           propertiesOverridden.AddProperty(prop.mProperty);
         }
       }
     }
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -232,17 +232,17 @@ protected:
   virtual bool IsAnimationManager() override {
     return true;
   }
 
 private:
   void BuildAnimations(nsStyleContext* aStyleContext,
                        mozilla::dom::Element* aTarget,
                        mozilla::dom::DocumentTimeline* aTimeline,
-                       mozilla::AnimationPlayerPtrArray& aAnimations);
+                       mozilla::AnimationPtrArray& aAnimations);
   bool BuildSegment(InfallibleTArray<mozilla::AnimationPropertySegment>&
                       aSegments,
                     nsCSSProperty aProperty,
                     const mozilla::StyleAnimation& aAnimation,
                     float aFromKey, nsStyleContext* aFromContext,
                     mozilla::css::Declaration* aFromDeclaration,
                     float aToKey, nsStyleContext* aToContext);
 
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -307,24 +307,24 @@ nsTransitionManager::StyleContextChanged
             allTransitionProperties.AddProperty(*subprop);
           }
         } else {
           allTransitionProperties.AddProperty(property);
         }
       }
     }
 
-    AnimationPlayerPtrArray& players = collection->mPlayers;
-    size_t i = players.Length();
+    AnimationPtrArray& animations = collection->mAnimations;
+    size_t i = animations.Length();
     MOZ_ASSERT(i != 0, "empty transitions list?");
     StyleAnimationValue currentValue;
     do {
       --i;
-      Animation* player = players[i];
-      dom::KeyframeEffectReadonly* effect = player->GetEffect();
+      Animation* anim = animations[i];
+      dom::KeyframeEffectReadonly* effect = anim->GetEffect();
       MOZ_ASSERT(effect && effect->Properties().Length() == 1,
                  "Should have one animation property for a transition");
       MOZ_ASSERT(effect && effect->Properties()[0].mSegments.Length() == 1,
                  "Animation property should have one segment for a transition");
       const AnimationProperty& prop = effect->Properties()[0];
       const AnimationPropertySegment& segment = prop.mSegments[0];
           // properties no longer in 'transition-property'
       if ((checkProperties &&
@@ -333,25 +333,25 @@ nsTransitionManager::StyleContextChanged
           // did not start a new transition (because delay and
           // duration are both zero, or because the new value is not
           // interpolable); a new transition would have segment.mToValue
           // matching currentValue
           !ExtractComputedValueForTransition(prop.mProperty, afterChangeStyle,
                                              currentValue) ||
           currentValue != segment.mToValue) {
         // stop the transition
-        if (!player->GetEffect()->IsFinishedTransition()) {
-          player->Cancel();
+        if (!anim->GetEffect()->IsFinishedTransition()) {
+          anim->Cancel();
           collection->UpdateAnimationGeneration(mPresContext);
         }
-        players.RemoveElementAt(i);
+        animations.RemoveElementAt(i);
       }
     } while (i != 0);
 
-    if (players.IsEmpty()) {
+    if (animations.IsEmpty()) {
       collection->Destroy();
       collection = nullptr;
     }
   }
 
   MOZ_ASSERT(!startedAny || collection,
              "must have element transitions if we started any transitions");
 
@@ -426,20 +426,20 @@ nsTransitionManager::ConsiderStartingTra
     // CanInterpolate method, but it seems fine for now.)
     StyleAnimationValue::Interpolate(aProperty, startValue, endValue,
                                      0.5, dummyValue);
 
   bool haveCurrentTransition = false;
   size_t currentIndex = nsTArray<ElementPropertyTransition>::NoIndex;
   const ElementPropertyTransition *oldPT = nullptr;
   if (aElementTransitions) {
-    AnimationPlayerPtrArray& players = aElementTransitions->mPlayers;
-    for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) {
+    AnimationPtrArray& animations = aElementTransitions->mAnimations;
+    for (size_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
       const ElementPropertyTransition *iPt =
-        players[i]->GetEffect()->AsTransition();
+        animations[i]->GetEffect()->AsTransition();
       if (iPt->TransitionProperty() == aProperty) {
         haveCurrentTransition = true;
         currentIndex = i;
         oldPT = iPt;
         break;
       }
     }
   }
@@ -469,23 +469,23 @@ nsTransitionManager::ConsiderStartingTra
   if (!shouldAnimate) {
     if (haveCurrentTransition && !oldPT->IsFinishedTransition()) {
       // We're in the middle of a transition, and just got a non-transition
       // style change to something that we can't animate.  This might happen
       // because we got a non-transition style change changing to the current
       // in-progress value (which is particularly easy to cause when we're
       // currently in the 'transition-delay').  It also might happen because we
       // just got a style change to a value that can't be interpolated.
-      AnimationPlayerPtrArray& players = aElementTransitions->mPlayers;
-      players[currentIndex]->Cancel();
+      AnimationPtrArray& animations = aElementTransitions->mAnimations;
+      animations[currentIndex]->Cancel();
       oldPT = nullptr; // Clear pointer so it doesn't dangle
-      players.RemoveElementAt(currentIndex);
+      animations.RemoveElementAt(currentIndex);
       aElementTransitions->UpdateAnimationGeneration(mPresContext);
 
-      if (players.IsEmpty()) {
+      if (animations.IsEmpty()) {
         aElementTransitions->Destroy();
         // |aElementTransitions| is now a dangling pointer!
         aElementTransitions = nullptr;
       }
       // GetAnimationRule already called RestyleForAnimation.
     }
     return;
   }
@@ -559,50 +559,50 @@ nsTransitionManager::ConsiderStartingTra
 
   AnimationPropertySegment& segment = *prop.mSegments.AppendElement();
   segment.mFromValue = startValue;
   segment.mToValue = endValue;
   segment.mFromKey = 0;
   segment.mToKey = 1;
   segment.mTimingFunction.Init(tf);
 
-  nsRefPtr<CSSTransitionPlayer> player = new CSSTransitionPlayer(timeline);
+  nsRefPtr<CSSTransitionPlayer> animation = new CSSTransitionPlayer(timeline);
   // The order of the following two calls is important since PlayFromStyle
-  // will add the player to the PendingAnimationTracker of its effect's
+  // will add the animation to the PendingAnimationTracker of its effect's
   // document. When we come to make effect writeable (bug 1049975) we should
   // remove this dependency.
-  player->SetEffect(pt);
-  player->PlayFromStyle();
+  animation->SetEffect(pt);
+  animation->PlayFromStyle();
 
   if (!aElementTransitions) {
     aElementTransitions =
       GetAnimations(aElement, aNewStyleContext->GetPseudoType(), true);
     if (!aElementTransitions) {
       NS_WARNING("allocating CommonAnimationManager failed");
       return;
     }
   }
 
-  AnimationPlayerPtrArray& players = aElementTransitions->mPlayers;
+  AnimationPtrArray& animations = aElementTransitions->mAnimations;
 #ifdef DEBUG
-  for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) {
+  for (size_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
     MOZ_ASSERT(
       i == currentIndex ||
-      (players[i]->GetEffect() &&
-       players[i]->GetEffect()->AsTransition()->TransitionProperty()
+      (animations[i]->GetEffect() &&
+       animations[i]->GetEffect()->AsTransition()->TransitionProperty()
          != aProperty),
       "duplicate transitions for property");
   }
 #endif
   if (haveCurrentTransition) {
-    players[currentIndex]->Cancel();
+    animations[currentIndex]->Cancel();
     oldPT = nullptr; // Clear pointer so it doesn't dangle
-    players[currentIndex] = player;
+    animations[currentIndex] = animation;
   } else {
-    if (!players.AppendElement(player)) {
+    if (!animations.AppendElement(animation)) {
       NS_WARNING("out of memory");
       return;
     }
   }
   aElementTransitions->UpdateAnimationGeneration(mPresContext);
 
   *aStartedAny = true;
   aWhichStarted->AddProperty(aProperty);
@@ -669,22 +669,22 @@ nsTransitionManager::UpdateCascadeResult
       aAnimations->mStyleRule->AddPropertiesToSet(propertiesUsed);
     }
   }
 
   // Since we should never have more than one transition for the same
   // property, it doesn't matter what order we iterate the transitions.
   // But let's go the same way as animations.
   bool changed = false;
-  AnimationPlayerPtrArray& players = aTransitions->mPlayers;
-  for (size_t playerIdx = players.Length(); playerIdx-- != 0; ) {
-    MOZ_ASSERT(players[playerIdx]->GetEffect() &&
-               players[playerIdx]->GetEffect()->Properties().Length() == 1,
+  AnimationPtrArray& animations = aTransitions->mAnimations;
+  for (size_t animIdx = animations.Length(); animIdx-- != 0; ) {
+    MOZ_ASSERT(animations[animIdx]->GetEffect() &&
+               animations[animIdx]->GetEffect()->Properties().Length() == 1,
                "Should have one animation property for a transition");
-    AnimationProperty& prop = players[playerIdx]->GetEffect()->Properties()[0];
+    AnimationProperty& prop = animations[animIdx]->GetEffect()->Properties()[0];
     bool newWinsInCascade = !propertiesUsed.HasProperty(prop.mProperty);
     if (prop.mWinsInCascade != newWinsInCascade) {
       changed = true;
     }
     prop.mWinsInCascade = newWinsInCascade;
     // assert that we don't need to bother adding the transitioned
     // properties into propertiesUsed
 #ifdef DEBUG
@@ -792,51 +792,50 @@ nsTransitionManager::FlushTransitions(Fl
           AnimationCollection::CanAnimateFlags(0)) &&
         collection->CanThrottleAnimation(now);
 
       MOZ_ASSERT(collection->mElement->GetCrossShadowCurrentDoc() ==
                    mPresContext->Document(),
                  "Element::UnbindFromTree should have "
                  "destroyed the element transitions object");
 
-      size_t i = collection->mPlayers.Length();
+      size_t i = collection->mAnimations.Length();
       MOZ_ASSERT(i != 0, "empty transitions list?");
       bool transitionStartedOrEnded = false;
       do {
         --i;
-        Animation* player = collection->mPlayers[i];
-        if (!player->GetEffect()->IsFinishedTransition()) {
-          MOZ_ASSERT(player->GetEffect(),
-                     "Transitions should have an effect");
+        Animation* anim = collection->mAnimations[i];
+        if (!anim->GetEffect()->IsFinishedTransition()) {
+          MOZ_ASSERT(anim->GetEffect(), "Transitions should have an effect");
           ComputedTiming computedTiming =
-            player->GetEffect()->GetComputedTiming();
+            anim->GetEffect()->GetComputedTiming();
           if (computedTiming.mPhase == ComputedTiming::AnimationPhase_After) {
             nsCSSProperty prop =
-              player->GetEffect()->AsTransition()->TransitionProperty();
+              anim->GetEffect()->AsTransition()->TransitionProperty();
             TimeDuration duration =
-              player->GetEffect()->Timing().mIterationDuration;
+              anim->GetEffect()->Timing().mIterationDuration;
             events.AppendElement(
               TransitionEventInfo(collection->mElement, prop,
                                   duration,
                                   collection->PseudoElement()));
 
             // Leave this transition in the list for one more refresh
             // cycle, since we haven't yet processed its style change, and
             // if we also have (already, or will have from processing
             // transitionend events or other refresh driver notifications)
             // a non-animation style change that would affect it, we need
             // to know not to start a new transition for the transition
             // from the almost-completed value to the final value.
-            player->GetEffect()->SetIsFinishedTransition(true);
+            anim->GetEffect()->SetIsFinishedTransition(true);
             collection->UpdateAnimationGeneration(mPresContext);
             transitionStartedOrEnded = true;
           } else if ((computedTiming.mPhase ==
                       ComputedTiming::AnimationPhase_Active) &&
                      canThrottleTick &&
-                     !player->IsRunningOnCompositor()) {
+                     !anim->IsRunningOnCompositor()) {
             // Start a transition with a delay where we should start the
             // transition proper.
             collection->UpdateAnimationGeneration(mPresContext);
             transitionStartedOrEnded = true;
           }
         }
       } while (i != 0);
 
@@ -850,17 +849,17 @@ nsTransitionManager::FlushTransitions(Fl
                    nsGkAtoms::transitionsOfAfterProperty,
                  "Unexpected element property; might restyle too much");
       if (!canThrottleTick || transitionStartedOrEnded) {
         collection->PostRestyleForAnimation(mPresContext);
       } else {
         didThrottle = true;
       }
 
-      if (collection->mPlayers.IsEmpty()) {
+      if (collection->mAnimations.IsEmpty()) {
         collection->Destroy();
         // |collection| is now a dangling pointer!
         collection = nullptr;
       }
     }
   }
 
   if (didThrottle) {