Bug 1040543 part 6 - Rename mAnimations to mPlayers and likewise for similar local variables; r=bz
authorBrian Birtles <birtles@gmail.com>
Sun, 10 Aug 2014 17:06:48 +1000
changeset 198788 8d0e15df4168ad7e13466991a6952644a8b7dba2
parent 198787 86f0c54582ffec5ef017b76d48261cf093aae35c
child 198789 34cb6ae672bdfc6c2e490d83623e646694955992
push id27286
push usernigelbabu@gmail.com
push dateMon, 11 Aug 2014 06:26:45 +0000
treeherdermozilla-central@8c4a1b3a2a8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1040543
milestone34.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 1040543 part 6 - Rename mAnimations to mPlayers and likewise for similar local variables; r=bz Now that we have both AnimationPlayer and Animation in use we need to clarify which object we are referring to. This patch renames a number of member and local variables to better reflect whether they point to an AnimationPlayer or an Animation. This patch is mostly renaming only with one exception. Since we are touching a number of local variables used in loops (for looping over the array of animation players) we take the opportunity to replace a number of instances of uint32_t with size_t since that is the preferred type for array indices now.
content/base/src/Element.cpp
layout/base/nsDisplayList.cpp
layout/base/nsLayoutUtils.cpp
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/nsAnimationManager.cpp
layout/style/nsTransitionManager.cpp
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -2873,22 +2873,22 @@ Element::GetAnimationPlayers(nsTArray<ns
   for (size_t propIdx = 0; propIdx < MOZ_ARRAY_LENGTH(properties);
        propIdx++) {
     AnimationPlayerCollection* collection =
       static_cast<AnimationPlayerCollection*>(
         GetProperty(properties[propIdx]));
     if (!collection) {
       continue;
     }
-    for (size_t animIdx = 0;
-         animIdx < collection->mAnimations.Length();
-         animIdx++) {
-      AnimationPlayer* anim = collection->mAnimations[animIdx];
-      if (anim->IsCurrent()) {
-        aPlayers.AppendElement(anim);
+    for (size_t playerIdx = 0;
+         playerIdx < collection->mPlayers.Length();
+         playerIdx++) {
+      AnimationPlayer* player = collection->mPlayers[playerIdx];
+      if (player->IsCurrent()) {
+        aPlayers.AppendElement(player);
       }
     }
   }
 }
 
 NS_IMETHODIMP
 Element::GetInnerHTML(nsAString& aInnerHTML)
 {
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -326,38 +326,40 @@ ToTimingFunction(ComputedTimingFunction&
   }
 
   uint32_t type = aCTF.GetType() == nsTimingFunction::StepStart ? 1 : 2;
   return TimingFunction(StepFunction(aCTF.GetSteps(), type));
 }
 
 static void
 AddAnimationForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
-                        AnimationPlayer* ea, Layer* aLayer,
+                        AnimationPlayer* aPlayer, Layer* aLayer,
                         AnimationData& aData, bool aPending)
 {
   NS_ASSERTION(aLayer->AsContainerLayer(), "Should only animate ContainerLayer");
   nsStyleContext* styleContext = aFrame->StyleContext();
   nsPresContext* presContext = aFrame->PresContext();
   nsRect bounds = nsDisplayTransform::GetFrameBoundsForTransform(aFrame);
 
   mozilla::layers::Animation* animation =
     aPending ?
     aLayer->AddAnimationForNextTransaction() :
     aLayer->AddAnimation();
 
-  animation->startTime() = ea->mStartTime + ea->mTiming.mDelay;
-  animation->duration() = ea->mTiming.mIterationDuration;
-  animation->iterationCount() = ea->mTiming.mIterationCount;
-  animation->direction() = ea->mTiming.mDirection;
+  animation->startTime() = aPlayer->mStartTime + aPlayer->mTiming.mDelay;
+  animation->duration() = aPlayer->mTiming.mIterationDuration;
+  animation->iterationCount() = aPlayer->mTiming.mIterationCount;
+  animation->direction() = aPlayer->mTiming.mDirection;
   animation->property() = aProperty;
   animation->data() = aData;
 
-  for (uint32_t propIdx = 0; propIdx < ea->mProperties.Length(); propIdx++) {
-    AnimationProperty* property = &ea->mProperties[propIdx];
+  for (size_t propIdx = 0;
+       propIdx < aPlayer->mProperties.Length();
+       propIdx++) {
+    AnimationProperty* property = &aPlayer->mProperties[propIdx];
 
     if (aProperty != property->mProperty) {
       continue;
     }
 
     for (uint32_t segIdx = 0; segIdx < property->mSegments.Length(); segIdx++) {
       AnimationPropertySegment* segment = &property->mSegments[segIdx];
 
@@ -382,26 +384,26 @@ AddAnimationForProperty(nsIFrame* aFrame
       animSegment->endPortion() = segment->mToKey;
       animSegment->sampleFn() = ToTimingFunction(segment->mTimingFunction);
     }
   }
 }
 
 static void
 AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
-                         AnimationPlayerPtrArray& aAnimations,
+                         AnimationPlayerPtrArray& aPlayers,
                          Layer* aLayer, AnimationData& aData,
                          bool aPending) {
-  for (uint32_t animIdx = 0; animIdx < aAnimations.Length(); animIdx++) {
-    AnimationPlayer* anim = aAnimations[animIdx];
-    if (!(anim->HasAnimationOfProperty(aProperty) && anim->IsRunning())) {
+  for (size_t playerIdx = 0; playerIdx < aPlayers.Length(); playerIdx++) {
+    AnimationPlayer* player = aPlayers[playerIdx];
+    if (!(player->HasAnimationOfProperty(aProperty) && player->IsRunning())) {
       continue;
     }
-    AddAnimationForProperty(aFrame, aProperty, anim, aLayer, aData, aPending);
-    anim->mIsRunningOnCompositor = true;
+    AddAnimationForProperty(aFrame, aProperty, player, aLayer, aData, aPending);
+    player->mIsRunningOnCompositor = true;
   }
 }
 
 /* static */ void
 nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
                                                          nsDisplayListBuilder* aBuilder,
                                                          nsDisplayItem* aItem,
                                                          nsIFrame* aFrame,
@@ -484,23 +486,23 @@ nsDisplayListBuilder::AddAnimationsAndTr
     data = TransformData(origin, offsetToTransformOrigin,
                          offsetToPerspectiveOrigin, bounds, perspective,
                          aFrame->PresContext()->AppUnitsPerDevPixel());
   } else if (aProperty == eCSSProperty_opacity) {
     data = null_t();
   }
 
   if (transitions) {
-    AddAnimationsForProperty(aFrame, aProperty, transitions->mAnimations,
+    AddAnimationsForProperty(aFrame, aProperty, transitions->mPlayers,
                              aLayer, data, pending);
     aLayer->SetAnimationGeneration(transitions->mAnimationGeneration);
   }
 
   if (animations) {
-    AddAnimationsForProperty(aFrame, aProperty, animations->mAnimations,
+    AddAnimationsForProperty(aFrame, aProperty, animations->mPlayers,
                              aLayer, data, pending);
     aLayer->SetAnimationGeneration(animations->mAnimationGeneration);
   }
 }
 
 nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
     Mode aMode, bool aBuildCaret)
     : mReferenceFrame(aReferenceFrame),
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -465,23 +465,23 @@ GetMinAndMaxScaleForAnimationProperty(ns
                                       gfxSize& aMinScale)
 {
   AnimationPlayerCollection* collection =
     GetAnimationsOrTransitionsForCompositor(aContent, aAnimationProperty,
                                             eCSSProperty_transform);
   if (!collection)
     return;
 
-  for (uint32_t animIdx = collection->mAnimations.Length(); animIdx-- != 0; ) {
-    AnimationPlayer* anim = collection->mAnimations[animIdx];
-    if (anim->IsFinishedTransition()) {
+  for (size_t playerIdx = collection->mPlayers.Length(); playerIdx-- != 0; ) {
+    AnimationPlayer* player = collection->mPlayers[playerIdx];
+    if (player->IsFinishedTransition()) {
       continue;
     }
-    for (uint32_t propIdx = anim->mProperties.Length(); propIdx-- != 0; ) {
-      AnimationProperty& prop = anim->mProperties[propIdx];
+    for (size_t propIdx = player->mProperties.Length(); propIdx-- != 0; ) {
+      AnimationProperty& prop = player->mProperties[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);
           aMaxScale.height = std::max<float>(aMaxScale.height, from.height);
           aMinScale.width = std::min<float>(aMinScale.width, from.width);
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -348,41 +348,41 @@ AnimationPlayerCollection::CanPerformOnC
                             " not supported.  See bug 771367 (");
       message.Append(nsAtomCString(mElementProperty));
       message.Append(")");
       LogAsyncAnimationFailure(message, mElement);
     }
     return false;
   }
 
-  for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-    const AnimationPlayer* anim = mAnimations[animIdx];
-    bool isRunning = anim->IsRunning();
-    for (uint32_t propIdx = 0, propEnd = anim->mProperties.Length();
+  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
+    const AnimationPlayer* player = mPlayers[playerIdx];
+    bool isRunning = player->IsRunning();
+    for (size_t propIdx = 0, propEnd = player->mProperties.Length();
          propIdx != propEnd; ++propIdx) {
-      if (IsGeometricProperty(anim->mProperties[propIdx].mProperty) &&
+      if (IsGeometricProperty(player->mProperties[propIdx].mProperty) &&
           isRunning) {
         aFlags = CanAnimateFlags(aFlags | CanAnimate_HasGeometricProperty);
         break;
       }
     }
   }
 
   bool existsProperty = false;
-  for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-    const AnimationPlayer* anim = mAnimations[animIdx];
-    if (!anim->IsRunning()) {
+  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
+    const AnimationPlayer* player = mPlayers[playerIdx];
+    if (!player->IsRunning()) {
       continue;
     }
 
     existsProperty = true;
 
-    for (uint32_t propIdx = 0, propEnd = anim->mProperties.Length();
+    for (size_t propIdx = 0, propEnd = player->mProperties.Length();
          propIdx != propEnd; ++propIdx) {
-      const AnimationProperty& prop = anim->mProperties[propIdx];
+      const AnimationProperty& prop = player->mProperties[propIdx];
       if (!CanAnimatePropertyOnCompositor(mElement,
                                           prop.mProperty,
                                           aFlags) ||
           IsCompositorAnimationDisabledForFrame(frame)) {
         return false;
       }
     }
   }
@@ -394,20 +394,20 @@ AnimationPlayerCollection::CanPerformOnC
 
   return true;
 }
 
 bool
 AnimationPlayerCollection::HasAnimationOfProperty(
   nsCSSProperty aProperty) const
 {
-  for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-    const AnimationPlayer* anim = mAnimations[animIdx];
-    if (anim->HasAnimationOfProperty(aProperty) &&
-        !anim->IsFinishedTransition()) {
+  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
+    const AnimationPlayer* player = mPlayers[playerIdx];
+    if (player->HasAnimationOfProperty(aProperty) &&
+        !player->IsFinishedTransition()) {
       return true;
     }
   }
   return false;
 }
 
 /* static */ void
 AnimationPlayerCollection::LogAsyncAnimationFailure(nsCString& aMessage,
@@ -440,19 +440,19 @@ AnimationPlayerCollection::PropertyDtor(
   collection->mCalledPropertyDtor = true;
 #endif
   delete collection;
 }
 
 void
 AnimationPlayerCollection::Tick()
 {
-  for (size_t animIdx = 0, animEnd = mAnimations.Length();
-       animIdx != animEnd; animIdx++) {
-    mAnimations[animIdx]->Tick();
+  for (size_t playerIdx = 0, playerEnd = mPlayers.Length();
+       playerIdx != playerEnd; playerIdx++) {
+    mPlayers[playerIdx]->Tick();
   }
 }
 
 void
 AnimationPlayerCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime,
                                               EnsureStyleRuleFlags aFlags)
 {
   if (!mNeedsRefreshes) {
@@ -462,36 +462,37 @@ AnimationPlayerCollection::EnsureStyleRu
 
   // 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 behaviour (the styles of the animation disappear, or the fill
   // mode behaviour). This loop checks for any finishing animations and forces
   // the style recalculation if we find any.
   if (aFlags == EnsureStyleRule_IsThrottled) {
-    for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-      AnimationPlayer* anim = mAnimations[animIdx];
+    for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
+      AnimationPlayer* player = mPlayers[playerIdx];
 
       // Skip finished transitions or animations whose @keyframes rule
       // is empty.
-      if (anim->IsFinishedTransition() || anim->mProperties.IsEmpty()) {
+      if (player->IsFinishedTransition() || player->mProperties.IsEmpty()) {
         continue;
       }
 
-      // The GetLocalTime() call here handles pausing.  But:
+      // The GetComputedTiming() call here handles pausing.  But:
       // FIXME: avoid recalculating every time when paused.
-      ComputedTiming computedTiming = anim->GetComputedTiming(anim->mTiming);
+      ComputedTiming computedTiming =
+        player->GetComputedTiming(player->mTiming);
 
       // XXX We shouldn't really be using mLastNotification as a general
       // indicator that the animation has finished, it should be reserved for
       // events. If we use it differently in the future this use might need
       // changing.
-      if (!anim->mIsRunningOnCompositor ||
+      if (!player->mIsRunningOnCompositor ||
           (computedTiming.mPhase == ComputedTiming::AnimationPhase_After &&
-           anim->mLastNotification != AnimationPlayer::LAST_NOTIFICATION_END))
+           player->mLastNotification != AnimationPlayer::LAST_NOTIFICATION_END))
       {
         aFlags = EnsureStyleRule_IsNotThrottled;
         break;
       }
     }
   }
 
   if (aFlags == EnsureStyleRule_IsThrottled) {
@@ -506,47 +507,48 @@ AnimationPlayerCollection::EnsureStyleRu
     // We'll set mNeedsRefreshes to true below in all cases where we need them.
     mNeedsRefreshes = false;
 
     // FIXME(spec): assume that properties in higher animations override
     // those in lower ones.
     // Therefore, we iterate from last animation to first.
     nsCSSPropertySet properties;
 
-    for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-      AnimationPlayer* anim = mAnimations[animIdx];
+    for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
+      AnimationPlayer* player = mPlayers[playerIdx];
 
-      if (anim->IsFinishedTransition()) {
+      if (player->IsFinishedTransition()) {
         continue;
       }
 
-      // The GetLocalTime() call here handles pausing.  But:
+      // The GetComputedTiming() call here handles pausing.  But:
       // FIXME: avoid recalculating every time when paused.
-      ComputedTiming computedTiming = anim->GetComputedTiming(anim->mTiming);
+      ComputedTiming computedTiming =
+        player->GetComputedTiming(player->mTiming);
 
       if ((computedTiming.mPhase == ComputedTiming::AnimationPhase_Before ||
            computedTiming.mPhase == ComputedTiming::AnimationPhase_Active) &&
-          !anim->IsPaused()) {
+          !player->IsPaused()) {
         mNeedsRefreshes = true;
       }
 
       // If the time fraction is null, we don't have fill data for the current
       // time so we shouldn't animate.
       if (computedTiming.mTimeFraction == ComputedTiming::kNullTimeFraction) {
         continue;
       }
 
       NS_ABORT_IF_FALSE(0.0 <= computedTiming.mTimeFraction &&
                         computedTiming.mTimeFraction <= 1.0,
                         "timing fraction should be in [0-1]");
 
-      for (uint32_t propIdx = 0, propEnd = anim->mProperties.Length();
+      for (size_t propIdx = 0, propEnd = player->mProperties.Length();
            propIdx != propEnd; ++propIdx)
       {
-        const AnimationProperty &prop = anim->mProperties[propIdx];
+        const AnimationProperty& prop = player->mProperties[propIdx];
 
         NS_ABORT_IF_FALSE(prop.mSegments[0].mFromKey == 0.0,
                           "incorrect first from key");
         NS_ABORT_IF_FALSE(prop.mSegments[prop.mSegments.Length() - 1].mToKey
                             == 1.0,
                           "incorrect last to key");
 
         if (properties.HasProperty(prop.mProperty)) {
@@ -686,18 +688,18 @@ AnimationPlayerCollection::UpdateAnimati
 {
   mAnimationGeneration =
     aPresContext->RestyleManager()->GetAnimationGeneration();
 }
 
 bool
 AnimationPlayerCollection::HasCurrentAnimations()
 {
-  for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-    if (mAnimations[animIdx]->IsCurrent()) {
+  for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
+    if (mPlayers[playerIdx]->IsCurrent()) {
       return true;
     }
   }
 
   return false;
 }
 
 }
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -265,17 +265,17 @@ struct AnimationPlayerCollection : publi
   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 mAnimations;
+  mozilla::AnimationPlayerPtrArray mPlayers;
 
   // 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
@@ -38,74 +38,76 @@ nsAnimationManager::UpdateStyleAndEvents
   CheckNeedsRefresh();
 }
 
 void
 nsAnimationManager::GetEventsForCurrentTime(AnimationPlayerCollection*
                                               aCollection,
                                             EventArray& aEventsToDispatch)
 {
-  for (uint32_t animIdx = aCollection->mAnimations.Length(); animIdx-- != 0; ) {
-    AnimationPlayer* anim = aCollection->mAnimations[animIdx];
+  for (size_t playerIdx = aCollection->mPlayers.Length(); playerIdx-- != 0; ) {
+    AnimationPlayer* player = aCollection->mPlayers[playerIdx];
 
-    ComputedTiming computedTiming = anim->GetComputedTiming(anim->mTiming);
+    ComputedTiming computedTiming = player->GetComputedTiming(player->mTiming);
 
     switch (computedTiming.mPhase) {
       case ComputedTiming::AnimationPhase_Null:
       case ComputedTiming::AnimationPhase_Before:
         // Do nothing
         break;
 
       case ComputedTiming::AnimationPhase_Active:
         // Dispatch 'animationstart' or 'animationiteration' when needed.
-        if (computedTiming.mCurrentIteration != anim->mLastNotification) {
+        if (computedTiming.mCurrentIteration != player->mLastNotification) {
           // Notify 'animationstart' even if a negative delay puts us
           // past the first iteration.
           // Note that when somebody changes the animation-duration
           // dynamically, this will fire an extra iteration event
           // immediately in many cases.  It's not clear to me if that's the
           // right thing to do.
           uint32_t message =
-            anim->mLastNotification == AnimationPlayer::LAST_NOTIFICATION_NONE
-              ? NS_ANIMATION_START : NS_ANIMATION_ITERATION;
+            player->mLastNotification ==
+              AnimationPlayer::LAST_NOTIFICATION_NONE
+              ? NS_ANIMATION_START
+              : NS_ANIMATION_ITERATION;
 
-          anim->mLastNotification = computedTiming.mCurrentIteration;
+          player->mLastNotification = computedTiming.mCurrentIteration;
           TimeDuration iterationStart =
-            anim->mTiming.mIterationDuration *
+            player->mTiming.mIterationDuration *
             computedTiming.mCurrentIteration;
           TimeDuration elapsedTime =
-            std::max(iterationStart, anim->InitialAdvance());
-          AnimationEventInfo ei(aCollection->mElement, anim->mName, message,
+            std::max(iterationStart, player->InitialAdvance());
+          AnimationEventInfo ei(aCollection->mElement, player->mName, message,
                                 elapsedTime, aCollection->PseudoElement());
           aEventsToDispatch.AppendElement(ei);
         }
         break;
 
       case ComputedTiming::AnimationPhase_After:
         // If we skipped the animation interval entirely, dispatch
         // 'animationstart' first
-        if (anim->mLastNotification ==
+        if (player->mLastNotification ==
             AnimationPlayer::LAST_NOTIFICATION_NONE) {
           // Notifying for start of 0th iteration.
           // (This is overwritten below but we set it here to maintain
           // internal consistency.)
-          anim->mLastNotification = 0;
+          player->mLastNotification = 0;
           TimeDuration elapsedTime =
-            std::min(anim->InitialAdvance(), computedTiming.mActiveDuration);
+            std::min(player->InitialAdvance(), computedTiming.mActiveDuration);
           AnimationEventInfo ei(aCollection->mElement,
-                                anim->mName, NS_ANIMATION_START,
+                                player->mName, NS_ANIMATION_START,
                                 elapsedTime, aCollection->PseudoElement());
           aEventsToDispatch.AppendElement(ei);
         }
         // Dispatch 'animationend' when needed.
-        if (anim->mLastNotification !=
+        if (player->mLastNotification !=
             AnimationPlayer::LAST_NOTIFICATION_END) {
-          anim->mLastNotification = AnimationPlayer::LAST_NOTIFICATION_END;
+          player->mLastNotification = AnimationPlayer::LAST_NOTIFICATION_END;
           AnimationEventInfo ei(aCollection->mElement,
-                                anim->mName, NS_ANIMATION_END,
+                                player->mName, NS_ANIMATION_END,
                                 computedTiming.mActiveDuration,
                                 aCollection->PseudoElement());
           aEventsToDispatch.AppendElement(ei);
         }
         break;
     }
   }
 }
@@ -239,20 +241,20 @@ nsAnimationManager::CheckAnimationRule(n
     if (!collection &&
         disp->mAnimationNameCount == 1 &&
         disp->mAnimations[0].GetName().IsEmpty()) {
       return nullptr;
     }
 
     // build the animations list
     dom::AnimationTimeline* timeline = aElement->OwnerDoc()->Timeline();
-    AnimationPlayerPtrArray newAnimations;
-    BuildAnimations(aStyleContext, timeline, newAnimations);
+    AnimationPlayerPtrArray newPlayers;
+    BuildAnimations(aStyleContext, timeline, newPlayers);
 
-    if (newAnimations.IsEmpty()) {
+    if (newPlayers.IsEmpty()) {
       if (collection) {
         collection->Destroy();
       }
       return nullptr;
     }
 
     if (collection) {
       collection->mStyleRule = nullptr;
@@ -264,81 +266,81 @@ 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->mAnimations.IsEmpty()) {
-        for (size_t newIdx = newAnimations.Length(); newIdx-- != 0;) {
-          AnimationPlayer* newAnim = newAnimations[newIdx];
+      if (!collection->mPlayers.IsEmpty()) {
+        for (size_t newIdx = newPlayers.Length(); newIdx-- != 0;) {
+          AnimationPlayer* newPlayer = newPlayers[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<AnimationPlayer> oldAnim;
-          size_t oldIdx = collection->mAnimations.Length();
+          nsRefPtr<AnimationPlayer> oldPlayer;
+          size_t oldIdx = collection->mPlayers.Length();
           while (oldIdx-- != 0) {
-            AnimationPlayer* a = collection->mAnimations[oldIdx];
-            if (a->mName == newAnim->mName) {
-              oldAnim = a;
+            AnimationPlayer* a = collection->mPlayers[oldIdx];
+            if (a->mName == newPlayer->mName) {
+              oldPlayer = a;
               break;
             }
           }
-          if (!oldAnim) {
+          if (!oldPlayer) {
             continue;
           }
 
           // Update the old from the new so we can keep the original object
           // identity (and any expando properties attached to it).
-          oldAnim->mTiming = newAnim->mTiming;
-          oldAnim->mProperties = newAnim->mProperties;
+          oldPlayer->mTiming = newPlayer->mTiming;
+          oldPlayer->mProperties = newPlayer->mProperties;
 
           // Reset compositor state so animation will be re-synchronized.
-          oldAnim->mIsRunningOnCompositor = false;
+          oldPlayer->mIsRunningOnCompositor = false;
 
           // Handle changes in play state.
-          if (!oldAnim->IsPaused() && newAnim->IsPaused()) {
+          if (!oldPlayer->IsPaused() && newPlayer->IsPaused()) {
             // Start pause at current time.
-            oldAnim->mPauseStart = timeline->GetCurrentTimeStamp();
-          } else if (oldAnim->IsPaused() && !newAnim->IsPaused()) {
+            oldPlayer->mPauseStart = timeline->GetCurrentTimeStamp();
+          } else if (oldPlayer->IsPaused() && !newPlayer->IsPaused()) {
             const TimeStamp& now = timeline->GetCurrentTimeStamp();
             if (!now.IsNull()) {
               // FIXME: Once we store the start time and pause start as
               // offsets (not timestamps) we should be able to update the
               // start time to something more appropriate when now IsNull.
               // Handle change in pause state by adjusting start time to
               // unpause.
-              oldAnim->mStartTime += now - oldAnim->mPauseStart;
+              oldPlayer->mStartTime += now - oldPlayer->mPauseStart;
             }
-            oldAnim->mPauseStart = TimeStamp();
+            oldPlayer->mPauseStart = TimeStamp();
           }
-          oldAnim->mPlayState = newAnim->mPlayState;
+          oldPlayer->mPlayState = newPlayer->mPlayState;
 
           // 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 newAnimations and we've finished
+          // we're not changing the length of newPlayers and we've finished
           // iterating over the list of old iterations.
-          newAnim = nullptr;
-          newAnimations.ReplaceElementAt(newIdx, oldAnim);
-          collection->mAnimations.RemoveElementAt(oldIdx);
+          newPlayer = nullptr;
+          newPlayers.ReplaceElementAt(newIdx, oldPlayer);
+          collection->mPlayers.RemoveElementAt(oldIdx);
         }
       }
     } else {
       collection =
         GetAnimationPlayers(aElement, aStyleContext->GetPseudoType(), true);
     }
-    collection->mAnimations.SwapElements(newAnimations);
+    collection->mPlayers.SwapElements(newPlayers);
     collection->mNeedsRefreshes = true;
     collection->Tick();
 
     TimeStamp refreshTime = mPresContext->RefreshDriver()->MostRecentRefresh();
     UpdateStyleAndEvents(collection, refreshTime,
                          EnsureStyleRule_IsNotThrottled);
     // We don't actually dispatch the mPendingEvents now.  We'll either
     // dispatch them the next time we get a refresh driver notification
@@ -401,26 +403,26 @@ ResolvedStyleCache::Get(nsPresContext *a
     result = resultStrong;
   }
   return result;
 }
 
 void
 nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
                                     dom::AnimationTimeline* aTimeline,
-                                    AnimationPlayerPtrArray& aAnimations)
+                                    AnimationPlayerPtrArray& aPlayers)
 {
-  NS_ABORT_IF_FALSE(aAnimations.IsEmpty(), "expect empty array");
+  NS_ABORT_IF_FALSE(aPlayers.IsEmpty(), "expect empty array");
 
   ResolvedStyleCache resolvedStyles;
 
   const nsStyleDisplay *disp = aStyleContext->StyleDisplay();
   TimeStamp now = aTimeline->GetCurrentTimeStamp();
 
-  for (uint32_t animIdx = 0, animEnd = disp->mAnimationNameCount;
+  for (size_t animIdx = 0, animEnd = disp->mAnimationNameCount;
        animIdx != animEnd; ++animIdx) {
     const StyleAnimation& src = disp->mAnimations[animIdx];
 
     // CSS Animations whose animation-name does not match a @keyframes rule do
     // not generate animation events. This includes when the animation-name is
     // "none" which is represented by an empty name in the StyleAnimation.
     // Since such animations neither affect style nor dispatch events, we do
     // not generate a corresponding AnimationPlayer for them.
@@ -429,17 +431,17 @@ nsAnimationManager::BuildAnimations(nsSt
       ? nullptr
       : mPresContext->StyleSet()->KeyframesRuleForName(mPresContext,
                                                        src.GetName());
     if (!rule) {
       continue;
     }
 
     nsRefPtr<AnimationPlayer> dest =
-      *aAnimations.AppendElement(new AnimationPlayer(aTimeline));
+      *aPlayers.AppendElement(new AnimationPlayer(aTimeline));
 
     dest->mName = src.GetName();
 
     dest->mTiming.mIterationDuration =
       TimeDuration::FromMilliseconds(src.GetDuration());
     dest->mTiming.mDelay = TimeDuration::FromMilliseconds(src.GetDelay());
     dest->mTiming.mIterationCount = src.GetIterationCount();
     dest->mTiming.mDirection = src.GetDirection();
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -249,44 +249,44 @@ nsTransitionManager::StyleContextChanged
             allTransitionProperties.AddProperty(*subprop);
           }
         } else {
           allTransitionProperties.AddProperty(property);
         }
       }
     }
 
-    AnimationPlayerPtrArray& animations = collection->mAnimations;
-    uint32_t i = animations.Length();
+    AnimationPlayerPtrArray& players = collection->mPlayers;
+    size_t i = players.Length();
     NS_ABORT_IF_FALSE(i != 0, "empty transitions list?");
     StyleAnimationValue currentValue;
     do {
       --i;
-      AnimationPlayer* animation = animations[i];
-      MOZ_ASSERT(animation->mProperties.Length() == 1,
+      AnimationPlayer* player = players[i];
+      MOZ_ASSERT(player->mProperties.Length() == 1,
                  "Should have one animation property for a transition");
-      MOZ_ASSERT(animation->mProperties[0].mSegments.Length() == 1,
+      MOZ_ASSERT(player->mProperties[0].mSegments.Length() == 1,
                  "Animation property should have one segment for a transition");
-      const AnimationProperty& prop = animation->mProperties[0];
+      const AnimationProperty& prop = player->mProperties[0];
       const AnimationPropertySegment& segment = prop.mSegments[0];
           // properties no longer in 'transition-property'
       if ((checkProperties &&
            !allTransitionProperties.HasProperty(prop.mProperty)) ||
           // properties whose computed values changed but delay and
           // duration are both zero
           !ExtractComputedValueForTransition(prop.mProperty, aNewStyleContext,
                                              currentValue) ||
           currentValue != segment.mToValue) {
         // stop the transition
-        animations.RemoveElementAt(i);
+        players.RemoveElementAt(i);
         collection->UpdateAnimationGeneration(mPresContext);
       }
     } while (i != 0);
 
-    if (animations.IsEmpty()) {
+    if (players.IsEmpty()) {
       collection->Destroy();
       collection = nullptr;
     }
   }
 
   if (!startedAny) {
     return nullptr;
   }
@@ -306,24 +306,24 @@ nsTransitionManager::StyleContextChanged
   // descendants don't start their own transitions.  (In the case of
   // negative transition delay, this covering rule produces different
   // results than applying the transition rule immediately would).
   // Our caller is responsible for restyling again using this covering
   // rule.
 
   nsRefPtr<css::AnimValuesStyleRule> coverRule = new css::AnimValuesStyleRule;
 
-  AnimationPlayerPtrArray& animations = collection->mAnimations;
-  for (uint32_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
-    AnimationPlayer* animation = animations[i];
-    MOZ_ASSERT(animation->mProperties.Length() == 1,
+  AnimationPlayerPtrArray& players = collection->mPlayers;
+  for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) {
+    AnimationPlayer* player = players[i];
+    MOZ_ASSERT(player->mProperties.Length() == 1,
                "Should have one animation property for a transition");
-    MOZ_ASSERT(animation->mProperties[0].mSegments.Length() == 1,
+    MOZ_ASSERT(player->mProperties[0].mSegments.Length() == 1,
                "Animation property should have one segment for a transition");
-    AnimationProperty& prop = animation->mProperties[0];
+    AnimationProperty& prop = player->mProperties[0];
     AnimationPropertySegment& segment = prop.mSegments[0];
     if (whichStarted.HasProperty(prop.mProperty)) {
       coverRule->AddValue(prop.mProperty, segment.mFromValue);
     }
   }
 
   collection->mStyleRule = nullptr;
 
@@ -380,25 +380,25 @@ 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& animations = aElementTransitions->mAnimations;
-    for (size_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
-      MOZ_ASSERT(animations[i]->mProperties.Length() == 1,
+    AnimationPlayerPtrArray& players = aElementTransitions->mPlayers;
+    for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) {
+      MOZ_ASSERT(players[i]->mProperties.Length() == 1,
                  "Should have one animation property for a transition");
-      if (animations[i]->mProperties[0].mProperty == aProperty) {
+      if (players[i]->mProperties[0].mProperty == aProperty) {
         haveCurrentTransition = true;
         currentIndex = i;
         oldPT =
-          aElementTransitions->mAnimations[currentIndex]->AsTransition();
+          aElementTransitions->mPlayers[currentIndex]->AsTransition();
         break;
       }
     }
   }
 
   // If we got a style change that changed the value to the endpoint
   // of the currently running transition, we don't want to interrupt
   // its timing function.
@@ -421,21 +421,21 @@ nsTransitionManager::ConsiderStartingTra
   if (!shouldAnimate) {
     if (haveCurrentTransition) {
       // 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& animations = aElementTransitions->mAnimations;
-      animations.RemoveElementAt(currentIndex);
+      AnimationPlayerPtrArray& players = aElementTransitions->mPlayers;
+      players.RemoveElementAt(currentIndex);
       aElementTransitions->UpdateAnimationGeneration(mPresContext);
 
-      if (animations.IsEmpty()) {
+      if (players.IsEmpty()) {
         aElementTransitions->Destroy();
         // |aElementTransitions| is now a dangling pointer!
         aElementTransitions = nullptr;
       }
       // WalkTransitionRule already called RestyleForAnimation.
     }
     return;
   }
@@ -516,30 +516,30 @@ nsTransitionManager::ConsiderStartingTra
       GetElementTransitions(aElement, aNewStyleContext->GetPseudoType(),
                             true);
     if (!aElementTransitions) {
       NS_WARNING("allocating CommonAnimationManager failed");
       return;
     }
   }
 
-  AnimationPlayerPtrArray &animations = aElementTransitions->mAnimations;
+  AnimationPlayerPtrArray& players = aElementTransitions->mPlayers;
 #ifdef DEBUG
-  for (uint32_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
-    NS_ABORT_IF_FALSE(animations[i]->mProperties.Length() == 1,
+  for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) {
+    NS_ABORT_IF_FALSE(players[i]->mProperties.Length() == 1,
                       "Should have one animation property for a transition");
     NS_ABORT_IF_FALSE(i == currentIndex ||
-                      animations[i]->mProperties[0].mProperty != aProperty,
+                      players[i]->mProperties[0].mProperty != aProperty,
                       "duplicate transitions for property");
   }
 #endif
   if (haveCurrentTransition) {
-    animations[currentIndex] = pt;
+    players[currentIndex] = pt;
   } else {
-    if (!animations.AppendElement(pt)) {
+    if (!players.AppendElement(pt)) {
       NS_WARNING("out of memory");
       return;
     }
   }
   aElementTransitions->UpdateAnimationGeneration(mPresContext);
   aElementTransitions->PostRestyleForAnimation(presContext);
 
   *aStartedAny = true;
@@ -752,61 +752,61 @@ nsTransitionManager::FlushTransitions(Fl
           AnimationPlayerCollection::CanAnimateFlags(0)) &&
         collection->CanThrottleAnimation(now);
 
       NS_ABORT_IF_FALSE(collection->mElement->GetCrossShadowCurrentDoc() ==
                           mPresContext->Document(),
                         "Element::UnbindFromTree should have "
                         "destroyed the element transitions object");
 
-      uint32_t i = collection->mAnimations.Length();
+      size_t i = collection->mPlayers.Length();
       NS_ABORT_IF_FALSE(i != 0, "empty transitions list?");
       bool transitionStartedOrEnded = false;
       do {
         --i;
-        AnimationPlayer* anim = collection->mAnimations[i];
-        if (anim->IsFinishedTransition()) {
+        AnimationPlayer* player = collection->mPlayers[i];
+        if (player->IsFinishedTransition()) {
           // Actually remove transitions one throttle-able cycle after their
           // completion. We only clear on a throttle-able cycle because that
           // means it is a regular restyle tick and thus it is safe to discard
           // the transition. If the flush is not throttle-able, we might still
           // have new transitions left to process. See comment below.
           if (aFlags == Can_Throttle) {
-            collection->mAnimations.RemoveElementAt(i);
+            collection->mPlayers.RemoveElementAt(i);
           }
         } else {
           ComputedTiming computedTiming =
-            anim->GetComputedTiming(anim->mTiming);
+            player->GetComputedTiming(player->mTiming);
           if (computedTiming.mPhase == ComputedTiming::AnimationPhase_After) {
-            MOZ_ASSERT(anim->mProperties.Length() == 1,
+            MOZ_ASSERT(player->mProperties.Length() == 1,
                        "Should have one animation property for a transition");
-            nsCSSProperty prop = anim->mProperties[0].mProperty;
+            nsCSSProperty prop = player->mProperties[0].mProperty;
             if (nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_REPORT_OTHER_NAME))
             {
               prop = nsCSSProps::OtherNameFor(prop);
             }
             events.AppendElement(
               TransitionEventInfo(collection->mElement, prop,
-                                  anim->mTiming.mIterationDuration,
+                                  player->mTiming.mIterationDuration,
                                   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.
-            anim->SetFinishedTransition();
+            player->SetFinishedTransition();
             collection->UpdateAnimationGeneration(mPresContext);
             transitionStartedOrEnded = true;
           } else if ((computedTiming.mPhase ==
                       ComputedTiming::AnimationPhase_Active) &&
                      canThrottleTick &&
-                    !anim->mIsRunningOnCompositor) {
+                    !player->mIsRunningOnCompositor) {
             // Start a transition with a delay where we should start the
             // transition proper.
             collection->UpdateAnimationGeneration(mPresContext);
             transitionStartedOrEnded = true;
           }
         }
       } while (i != 0);
 
@@ -820,17 +820,17 @@ nsTransitionManager::FlushTransitions(Fl
                    nsGkAtoms::transitionsOfAfterProperty,
                  "Unexpected element property; might restyle too much");
       if (!canThrottleTick || transitionStartedOrEnded) {
         collection->PostRestyleForAnimation(mPresContext);
       } else {
         didThrottle = true;
       }
 
-      if (collection->mAnimations.IsEmpty()) {
+      if (collection->mPlayers.IsEmpty()) {
         collection->Destroy();
         // |collection| is now a dangling pointer!
         collection = nullptr;
       }
     }
   }
 
   if (didThrottle) {