Bug 1010067 part 7 - Rename instances of ElementAnimationCollection; r=dbaron
authorBrian Birtles <birtles@gmail.com>
Fri, 27 Jun 2014 08:57:13 +0900
changeset 204900 d091d8da77a8606a58bff715252257ce617f2244
parent 204899 c9e25ef0aa0d8dc0d236ed9528bc81a60c8af032
child 204901 b311a62db22bcc3d86131819042ad78d9cd462c4
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs1010067
milestone33.0a1
Bug 1010067 part 7 - Rename instances of ElementAnimationCollection; r=dbaron
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/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -410,22 +410,22 @@ nsDisplayListBuilder::AddAnimationsAndTr
   } else {
     aLayer->ClearAnimations();
   }
 
   nsIContent* content = aFrame->GetContent();
   if (!content) {
     return;
   }
-  ElementAnimationCollection* et =
+  ElementAnimationCollection* transitions =
     nsTransitionManager::GetAnimationsForCompositor(content, aProperty);
-  ElementAnimationCollection* ea =
+  ElementAnimationCollection* animations =
     nsAnimationManager::GetAnimationsForCompositor(content, aProperty);
 
-  if (!ea && !et) {
+  if (!animations && !transitions) {
     return;
   }
 
   // If the frame is not prerendered, bail out.
   // Do this check only during layer construction; during updating the
   // caller is required to check it appropriately.
   if (aItem && !aItem->CanUseAsyncAnimations(aBuilder)) {
     // AnimationManager or TransitionManager need to know that we refused to
@@ -470,26 +470,26 @@ nsDisplayListBuilder::AddAnimationsAndTr
 
     data = TransformData(origin, offsetToTransformOrigin,
                          offsetToPerspectiveOrigin, bounds, perspective,
                          aFrame->PresContext()->AppUnitsPerDevPixel());
   } else if (aProperty == eCSSProperty_opacity) {
     data = null_t();
   }
 
-  if (et) {
-    AddAnimationsForProperty(aFrame, aProperty, et->mAnimations,
+  if (transitions) {
+    AddAnimationsForProperty(aFrame, aProperty, transitions->mAnimations,
                              aLayer, data, pending);
-    aLayer->SetAnimationGeneration(et->mAnimationGeneration);
-  }
-
-  if (ea) {
-    AddAnimationsForProperty(aFrame, aProperty, ea->mAnimations,
+    aLayer->SetAnimationGeneration(transitions->mAnimationGeneration);
+  }
+
+  if (animations) {
+    AddAnimationsForProperty(aFrame, aProperty, animations->mAnimations,
                              aLayer, data, pending);
-    aLayer->SetAnimationGeneration(ea->mAnimationGeneration);
+    aLayer->SetAnimationGeneration(animations->mAnimationGeneration);
   }
 }
 
 nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
     Mode aMode, bool aBuildCaret)
     : mReferenceFrame(aReferenceFrame),
       mIgnoreScrollFrame(nullptr),
       mLayerEventRegions(nullptr),
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -256,25 +256,25 @@ TextAlignTrueEnabledPrefChangeCallback(c
     isTextAlignTrueEnabled ? eCSSKeyword_true : eCSSKeyword_UNKNOWN;
 }
 
 static ElementAnimationCollection*
 GetAnimationsOrTransitionsForCompositor(nsIContent* aContent,
                                         nsIAtom* aAnimationProperty,
                                         nsCSSProperty aProperty)
 {
-  ElementAnimationCollection* animations =
+  ElementAnimationCollection* collection =
     static_cast<ElementAnimationCollection*>(
       aContent->GetProperty(aAnimationProperty));
-  if (animations) {
-    bool propertyMatches = animations->HasAnimationOfProperty(aProperty);
+  if (collection) {
+    bool propertyMatches = collection->HasAnimationOfProperty(aProperty);
     if (propertyMatches &&
-        animations->CanPerformOnCompositorThread(
+        collection->CanPerformOnCompositorThread(
           ElementAnimationCollection::CanAnimate_AllowPartial)) {
-      return animations;
+      return collection;
     }
   }
 
   return nullptr;
 }
 
 bool
 nsLayoutUtils::HasAnimationsForCompositor(nsIContent* aContent,
@@ -288,23 +288,23 @@ nsLayoutUtils::HasAnimationsForComposito
            aContent, nsGkAtoms::transitionsProperty, aProperty);
 }
 
 static ElementAnimationCollection*
 GetAnimationsOrTransitions(nsIContent* aContent,
                            nsIAtom* aAnimationProperty,
                            nsCSSProperty aProperty)
 {
-  ElementAnimationCollection* animations =
+  ElementAnimationCollection* collection =
     static_cast<ElementAnimationCollection*>(aContent->GetProperty(
         aAnimationProperty));
-  if (animations) {
-    bool propertyMatches = animations->HasAnimationOfProperty(aProperty);
+  if (collection) {
+    bool propertyMatches = collection->HasAnimationOfProperty(aProperty);
     if (propertyMatches) {
-      return animations;
+      return collection;
     }
   }
   return nullptr;
 }
 
 bool
 nsLayoutUtils::HasAnimations(nsIContent* aContent,
                              nsCSSProperty aProperty)
@@ -322,20 +322,20 @@ nsLayoutUtils::HasCurrentAnimations(nsIC
                                     nsIAtom* aAnimationProperty,
                                     nsPresContext* aPresContext)
 {
   if (!aContent->MayHaveAnimations())
     return false;
 
   TimeStamp now = aPresContext->RefreshDriver()->MostRecentRefresh();
 
-  ElementAnimationCollection* animations =
+  ElementAnimationCollection* collection =
     static_cast<ElementAnimationCollection*>(
       aContent->GetProperty(aAnimationProperty));
-  return (animations && animations->HasCurrentAnimationsAt(now));
+  return (collection && collection->HasCurrentAnimationsAt(now));
 }
 
 static gfxSize
 GetScaleForValue(const StyleAnimationValue& aValue, nsIFrame* aFrame)
 {
   if (!aFrame) {
     NS_WARNING("No frame.");
     return gfxSize();
@@ -386,24 +386,24 @@ GetSuitableScale(float aMaxScale, float 
 }
 
 static void
 GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent,
                                       nsIAtom* aAnimationProperty,
                                       gfxSize& aMaxScale,
                                       gfxSize& aMinScale)
 {
-  ElementAnimationCollection* animations =
+  ElementAnimationCollection* collection =
     GetAnimationsOrTransitionsForCompositor(aContent, aAnimationProperty,
                                             eCSSProperty_transform);
-  if (!animations)
+  if (!collection)
     return;
 
-  for (uint32_t animIdx = animations->mAnimations.Length(); animIdx-- != 0; ) {
-    mozilla::ElementAnimation* anim = animations->mAnimations[animIdx];
+  for (uint32_t animIdx = collection->mAnimations.Length(); animIdx-- != 0; ) {
+    mozilla::ElementAnimation* anim = collection->mAnimations[animIdx];
     if (anim->IsFinishedTransition()) {
       continue;
     }
     for (uint32_t propIdx = anim->mProperties.Length(); propIdx-- != 0; ) {
       AnimationProperty& prop = anim->mProperties[propIdx];
       if (prop.mProperty == eCSSProperty_transform) {
         for (uint32_t segIdx = prop.mSegments.Length(); segIdx-- != 0; ) {
           AnimationPropertySegment& segment = prop.mSegments[segIdx];
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -79,38 +79,38 @@ CommonAnimationManager::RemoveAllElement
 
 ElementAnimationCollection*
 CommonAnimationManager::GetAnimationsForCompositor(nsIContent* aContent,
                                                    nsIAtom* aElementProperty,
                                                    nsCSSProperty aProperty)
 {
   if (!aContent->MayHaveAnimations())
     return nullptr;
-  ElementAnimationCollection* animations =
+  ElementAnimationCollection* collection =
     static_cast<ElementAnimationCollection*>(
       aContent->GetProperty(aElementProperty));
-  if (!animations ||
-      !animations->HasAnimationOfProperty(aProperty) ||
-      !animations->CanPerformOnCompositorThread(
+  if (!collection ||
+      !collection->HasAnimationOfProperty(aProperty) ||
+      !collection->CanPerformOnCompositorThread(
         ElementAnimationCollection::CanAnimate_AllowPartial)) {
     return nullptr;
   }
 
   // This animation can be done on the compositor.
   // Mark the frame as active, in case we are able to throttle this animation.
-  nsIFrame* frame = nsLayoutUtils::GetStyleFrame(animations->mElement);
+  nsIFrame* frame = nsLayoutUtils::GetStyleFrame(collection->mElement);
   if (frame) {
     if (aProperty == eCSSProperty_opacity) {
       ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_opacity);
     } else if (aProperty == eCSSProperty_transform) {
       ActiveLayerTracker::NotifyAnimated(frame, eCSSProperty_transform);
     }
   }
 
-  return animations;
+  return collection;
 }
 
 /*
  * nsISupports implementation
  */
 
 NS_IMPL_ISUPPORTS(CommonAnimationManager, nsIStyleRuleProcessor)
 
@@ -251,41 +251,41 @@ CommonAnimationManager::UpdateThrottledS
     if (ruleNode->IsRoot()) {
       break;
     }
 
     nsStyleSet::RuleAndLevel curRule;
     curRule.mLevel = ruleNode->GetLevel();
 
     if (curRule.mLevel == nsStyleSet::eAnimationSheet) {
-      ElementAnimationCollection* ea =
+      ElementAnimationCollection* collection =
         mPresContext->AnimationManager()->GetElementAnimations(
           aElement,
           oldStyle->GetPseudoType(),
           false);
-      NS_ASSERTION(ea,
+      NS_ASSERTION(collection,
         "Rule has level eAnimationSheet without animation on manager");
 
       mPresContext->AnimationManager()->UpdateStyleAndEvents(
-        ea, mPresContext->RefreshDriver()->MostRecentRefresh(),
+        collection, mPresContext->RefreshDriver()->MostRecentRefresh(),
         EnsureStyleRule_IsNotThrottled);
-      curRule.mRule = ea->mStyleRule;
+      curRule.mRule = collection->mStyleRule;
     } else if (curRule.mLevel == nsStyleSet::eTransitionSheet) {
-      ElementAnimationCollection* et =
+      ElementAnimationCollection* collection =
         mPresContext->TransitionManager()->GetElementTransitions(
           aElement,
           oldStyle->GetPseudoType(),
           false);
-      NS_ASSERTION(et,
+      NS_ASSERTION(collection,
         "Rule has level eTransitionSheet without transition on manager");
 
-      et->EnsureStyleRuleFor(
+      collection->EnsureStyleRuleFor(
         mPresContext->RefreshDriver()->MostRecentRefresh(),
         EnsureStyleRule_IsNotThrottled);
-      curRule.mRule = et->mStyleRule;
+      curRule.mRule = collection->mStyleRule;
     } else {
       curRule.mRule = ruleNode->GetRule();
     }
 
     if (curRule.mRule) {
       rules.AppendElement(curRule);
     }
   } while ((ruleNode = ruleNode->GetParent()));
@@ -579,18 +579,18 @@ ElementAnimation::ActiveDuration(const A
            : TimeDuration::Forever();
   }
   return aTiming.mIterationDuration.MultDouble(aTiming.mIterationCount);
 }
 
 bool
 ElementAnimationCollection::CanAnimatePropertyOnCompositor(
   const dom::Element *aElement,
-                                                           nsCSSProperty aProperty,
-                                                           CanAnimateFlags aFlags)
+  nsCSSProperty aProperty,
+  CanAnimateFlags aFlags)
 {
   bool shouldLog = nsLayoutUtils::IsAnimationLoggingEnabled();
   if (!gfxPlatform::OffMainThreadCompositingEnabled()) {
     if (shouldLog) {
       nsCString message;
       message.AppendLiteral("Performance warning: Compositor disabled");
       LogAsyncAnimationFailure(message);
     }
@@ -754,23 +754,23 @@ ElementAnimationCollection::LogAsyncAnim
   aMessage.Append('\n');
   printf_stderr(aMessage.get());
 }
 
 /*static*/ void
 ElementAnimationCollection::PropertyDtor(void *aObject, nsIAtom *aPropertyName,
                                          void *aPropertyValue, void *aData)
 {
-  ElementAnimationCollection* data =
+  ElementAnimationCollection* collection =
     static_cast<ElementAnimationCollection*>(aPropertyValue);
 #ifdef DEBUG
-  NS_ABORT_IF_FALSE(!data->mCalledPropertyDtor, "can't call dtor twice");
-  data->mCalledPropertyDtor = true;
+  NS_ABORT_IF_FALSE(!collection->mCalledPropertyDtor, "can't call dtor twice");
+  collection->mCalledPropertyDtor = true;
 #endif
-  delete data;
+  delete collection;
 }
 
 void
 ElementAnimationCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime,
                                                EnsureStyleRuleFlags aFlags)
 {
   if (!mNeedsRefreshes) {
     mStyleRuleRefreshTime = aRefreshTime;
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -114,29 +114,29 @@ class_::UpdateAllThrottledStylesInternal
                                                                                \
   nsStyleChangeList changeList;                                                \
                                                                                \
   /* update each transitioning element by finding its root-most ancestor
      with a transition, and flushing the style on that ancestor and all
      its descendants*/                                                         \
   PRCList *next = PR_LIST_HEAD(&mElementData);                                 \
   while (next != &mElementData) {                                              \
-    ElementAnimationCollection* ea =                                           \
+    ElementAnimationCollection* collection =                                   \
       static_cast<ElementAnimationCollection*>(next);                          \
     next = PR_NEXT_LINK(next);                                                 \
                                                                                \
-    if (ea->mFlushGeneration == now) {                                         \
+    if (collection->mFlushGeneration == now) {                                 \
       /* this element has been ticked already */                               \
       continue;                                                                \
     }                                                                          \
                                                                                \
     /* element is initialised to the starting element (i.e., one we know has
        an animation) and ends up with the root-most animated ancestor,
        that is, the element where we begin updates. */                         \
-    dom::Element* element = ea->mElement;                                      \
+    dom::Element* element = collection->mElement;                              \
     /* make a list of ancestors */                                             \
     nsTArray<dom::Element*> ancestors;                                         \
     do {                                                                       \
       ancestors.AppendElement(element);                                        \
     } while ((element = element->GetParentElement()));                         \
                                                                                \
     /* walk down the ancestors until we find one with a throttled transition */\
     for (int32_t i = ancestors.Length() - 1; i >= 0; --i) {                    \
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -20,32 +20,33 @@
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include <math.h>
 
 using namespace mozilla;
 using namespace mozilla::css;
 
 void
-nsAnimationManager::UpdateStyleAndEvents(ElementAnimationCollection* aEA,
+nsAnimationManager::UpdateStyleAndEvents(ElementAnimationCollection*
+                                           aCollection,
                                          TimeStamp aRefreshTime,
                                          EnsureStyleRuleFlags aFlags)
 {
-  aEA->EnsureStyleRuleFor(aRefreshTime, aFlags);
-  GetEventsAt(aEA, aRefreshTime, mPendingEvents);
+  aCollection->EnsureStyleRuleFor(aRefreshTime, aFlags);
+  GetEventsAt(aCollection, aRefreshTime, mPendingEvents);
   CheckNeedsRefresh();
 }
 
 void
-nsAnimationManager::GetEventsAt(ElementAnimationCollection* aEA,
+nsAnimationManager::GetEventsAt(ElementAnimationCollection* aCollection,
                                 TimeStamp aRefreshTime,
                                 EventArray& aEventsToDispatch)
 {
-  for (uint32_t animIdx = aEA->mAnimations.Length(); animIdx-- != 0; ) {
-    ElementAnimation* anim = aEA->mAnimations[animIdx];
+  for (uint32_t animIdx = aCollection->mAnimations.Length(); animIdx-- != 0; ) {
+    ElementAnimation* anim = aCollection->mAnimations[animIdx];
 
     TimeDuration localTime = anim->GetLocalTimeAt(aRefreshTime);
     ComputedTiming computedTiming =
       ElementAnimation::GetComputedTimingAt(localTime, anim->mTiming);
 
     switch (computedTiming.mPhase) {
       case ComputedTiming::AnimationPhase_Before:
         // Do nothing
@@ -65,44 +66,46 @@ nsAnimationManager::GetEventsAt(ElementA
               ? NS_ANIMATION_START : NS_ANIMATION_ITERATION;
 
           anim->mLastNotification = computedTiming.mCurrentIteration;
           TimeDuration iterationStart =
             anim->mTiming.mIterationDuration *
             computedTiming.mCurrentIteration;
           TimeDuration elapsedTime =
             std::max(iterationStart, anim->InitialAdvance());
-          AnimationEventInfo ei(aEA->mElement, anim->mName, message,
-                                elapsedTime, aEA->PseudoElement());
+          AnimationEventInfo ei(aCollection->mElement, anim->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 ==
             ElementAnimation::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;
           TimeDuration elapsedTime =
             std::min(anim->InitialAdvance(), computedTiming.mActiveDuration);
-          AnimationEventInfo ei(aEA->mElement, anim->mName, NS_ANIMATION_START,
-                                elapsedTime, aEA->PseudoElement());
+          AnimationEventInfo ei(aCollection->mElement,
+                                anim->mName, NS_ANIMATION_START,
+                                elapsedTime, aCollection->PseudoElement());
           aEventsToDispatch.AppendElement(ei);
         }
         // Dispatch 'animationend' when needed.
         if (anim->mLastNotification !=
             ElementAnimation::LAST_NOTIFICATION_END) {
           anim->mLastNotification = ElementAnimation::LAST_NOTIFICATION_END;
-          AnimationEventInfo ei(aEA->mElement, anim->mName, NS_ANIMATION_END,
+          AnimationEventInfo ei(aCollection->mElement,
+                                anim->mName, NS_ANIMATION_END,
                                 computedTiming.mActiveDuration,
-                                aEA->PseudoElement());
+                                aCollection->PseudoElement());
           aEventsToDispatch.AppendElement(ei);
         }
         break;
     }
   }
 }
 
 ElementAnimationCollection*
@@ -123,38 +126,39 @@ nsAnimationManager::GetElementAnimations
   } else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
     propName = nsGkAtoms::animationsOfAfterProperty;
   } else {
     NS_ASSERTION(!aCreateIfNeeded,
                  "should never try to create transitions for pseudo "
                  "other than :before or :after");
     return nullptr;
   }
-  ElementAnimationCollection *ea = static_cast<ElementAnimationCollection*>(
-                                   aElement->GetProperty(propName));
-  if (!ea && aCreateIfNeeded) {
+  ElementAnimationCollection* collection =
+    static_cast<ElementAnimationCollection*>(aElement->GetProperty(propName));
+  if (!collection && aCreateIfNeeded) {
     // FIXME: Consider arena-allocating?
-    ea = new ElementAnimationCollection(aElement, propName, this,
-           mPresContext->RefreshDriver()->MostRecentRefresh());
+    collection =
+      new ElementAnimationCollection(aElement, propName, this,
+        mPresContext->RefreshDriver()->MostRecentRefresh());
     nsresult rv =
-      aElement->SetProperty(propName, ea,
+      aElement->SetProperty(propName, collection,
                             &ElementAnimationCollection::PropertyDtor, false);
     if (NS_FAILED(rv)) {
       NS_WARNING("SetProperty failed");
-      delete ea;
+      delete collection;
       return nullptr;
     }
     if (propName == nsGkAtoms::animationsProperty) {
       aElement->SetMayHaveAnimations();
     }
 
-    AddElementData(ea);
+    AddElementData(collection);
   }
 
-  return ea;
+  return collection;
 }
 
 /* virtual */ void
 nsAnimationManager::RulesMatching(ElementRuleProcessorData* aData)
 {
   NS_ABORT_IF_FALSE(aData->mPresContext == mPresContext,
                     "pres context mismatch");
   nsIStyleRule *rule =
@@ -222,69 +226,70 @@ nsAnimationManager::CheckAnimationRule(n
       return nullptr;
     }
 
     // Everything that causes our animation data to change triggers a
     // style change, which in turn triggers a non-animation restyle.
     // Likewise, when we initially construct frames, we're not in a
     // style change, but also not in an animation restyle.
 
-    const nsStyleDisplay *disp = aStyleContext->StyleDisplay();
-    ElementAnimationCollection *ea =
+    const nsStyleDisplay* disp = aStyleContext->StyleDisplay();
+    ElementAnimationCollection* collection =
       GetElementAnimations(aElement, aStyleContext->GetPseudoType(), false);
-    if (!ea &&
+    if (!collection &&
         disp->mAnimationNameCount == 1 &&
         disp->mAnimations[0].GetName().IsEmpty()) {
       return nullptr;
     }
 
     // build the animations list
     ElementAnimationPtrArray newAnimations;
     BuildAnimations(aStyleContext, newAnimations);
 
     if (newAnimations.IsEmpty()) {
-      if (ea) {
-        ea->Destroy();
+      if (collection) {
+        collection->Destroy();
       }
       return nullptr;
     }
 
     TimeStamp refreshTime = mPresContext->RefreshDriver()->MostRecentRefresh();
 
-    if (ea) {
-      ea->mStyleRule = nullptr;
-      ea->mStyleRuleRefreshTime = TimeStamp();
-      ea->UpdateAnimationGeneration(mPresContext);
+    if (collection) {
+      collection->mStyleRule = nullptr;
+      collection->mStyleRuleRefreshTime = TimeStamp();
+      collection->UpdateAnimationGeneration(mPresContext);
 
       // Copy over the start times and (if still paused) pause starts
       // for each animation (matching on name only) that was also in the
       // 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 (!ea->mAnimations.IsEmpty()) {
+      if (!collection->mAnimations.IsEmpty()) {
         for (uint32_t newIdx = 0, newEnd = newAnimations.Length();
              newIdx != newEnd; ++newIdx) {
           nsRefPtr<ElementAnimation> newAnim = newAnimations[newIdx];
 
           // Find the matching animation with this name in the old list
           // of animations.  Because of this code, they must all have
           // the same start time, though they might differ in pause
           // state.  So if a page uses multiple copies of the same
           // animation in one element's animation list, and gives them
           // different pause states, they, well, get what they deserve.
           // We'll use the last one since it's more likely to be the one
           // doing something.
           const ElementAnimation* oldAnim = nullptr;
-          for (uint32_t oldIdx = ea->mAnimations.Length(); oldIdx-- != 0; ) {
-            const ElementAnimation* a = ea->mAnimations[oldIdx];
+          for (uint32_t oldIdx = collection->mAnimations.Length();
+               oldIdx-- != 0; ) {
+            const ElementAnimation* a = collection->mAnimations[oldIdx];
             if (a->mName == newAnim->mName) {
               oldAnim = a;
               break;
             }
           }
           if (!oldAnim) {
             continue;
           }
@@ -300,23 +305,24 @@ nsAnimationManager::CheckAnimationRule(n
               // Handle change in pause state by adjusting start
               // time to unpause.
               newAnim->mStartTime += refreshTime - oldAnim->mPauseStart;
             }
           }
         }
       }
     } else {
-      ea = GetElementAnimations(aElement, aStyleContext->GetPseudoType(),
-                                true);
+      collection =
+        GetElementAnimations(aElement, aStyleContext->GetPseudoType(), true);
     }
-    ea->mAnimations.SwapElements(newAnimations);
-    ea->mNeedsRefreshes = true;
+    collection->mAnimations.SwapElements(newAnimations);
+    collection->mNeedsRefreshes = true;
 
-    UpdateStyleAndEvents(ea, refreshTime, EnsureStyleRule_IsNotThrottled);
+    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
     // or the next time somebody calls
     // nsPresShell::FlushPendingNotifications.
     if (!mPendingEvents.IsEmpty()) {
       mPresContext->Document()->SetNeedStyleFlush();
     }
   }
@@ -609,40 +615,40 @@ nsAnimationManager::GetAnimationRule(moz
     aPseudoType == nsCSSPseudoElements::ePseudo_after,
     "forbidden pseudo type");
 
   if (!mPresContext->IsDynamic()) {
     // For print or print preview, ignore animations.
     return nullptr;
   }
 
-  ElementAnimationCollection *ea =
+  ElementAnimationCollection* collection =
     GetElementAnimations(aElement, aPseudoType, false);
-  if (!ea) {
+  if (!collection) {
     return nullptr;
   }
 
   if (mPresContext->IsProcessingRestyles() &&
       !mPresContext->IsProcessingAnimationStyleChange()) {
     // During the non-animation part of processing restyles, we don't
     // add the animation rule.
 
-    if (ea->mStyleRule) {
-      ea->PostRestyleForAnimation(mPresContext);
+    if (collection->mStyleRule) {
+      collection->PostRestyleForAnimation(mPresContext);
     }
 
     return nullptr;
   }
 
-  NS_WARN_IF_FALSE(!ea->mNeedsRefreshes ||
-                   ea->mStyleRuleRefreshTime ==
+  NS_WARN_IF_FALSE(!collection->mNeedsRefreshes ||
+                   collection->mStyleRuleRefreshTime ==
                      mPresContext->RefreshDriver()->MostRecentRefresh(),
                    "should already have refreshed style rule");
 
-  return ea->mStyleRule;
+  return collection->mStyleRule;
 }
 
 /* virtual */ void
 nsAnimationManager::WillRefresh(mozilla::TimeStamp aTime)
 {
   NS_ABORT_IF_FALSE(mPresContext,
                     "refresh driver should not notify additional observers "
                     "after pres context has been destroyed");
@@ -697,29 +703,29 @@ nsAnimationManager::FlushAnimations(Flus
 {
   // FIXME: check that there's at least one style rule that's not
   // in its "done" state, and if there isn't, remove ourselves from
   // the refresh driver (but leave the animations!).
   TimeStamp now = mPresContext->RefreshDriver()->MostRecentRefresh();
   bool didThrottle = false;
   for (PRCList *l = PR_LIST_HEAD(&mElementData); l != &mElementData;
        l = PR_NEXT_LINK(l)) {
-    ElementAnimationCollection *ea =
+    ElementAnimationCollection* collection =
       static_cast<ElementAnimationCollection*>(l);
     bool canThrottleTick = aFlags == Can_Throttle &&
-      ea->CanPerformOnCompositorThread(
+      collection->CanPerformOnCompositorThread(
         ElementAnimationCollection::CanAnimateFlags(0)) &&
-      ea->CanThrottleAnimation(now);
+      collection->CanThrottleAnimation(now);
 
-    nsRefPtr<css::AnimValuesStyleRule> oldStyleRule = ea->mStyleRule;
-    UpdateStyleAndEvents(ea, now, canThrottleTick
-                                  ? EnsureStyleRule_IsThrottled
-                                  : EnsureStyleRule_IsNotThrottled);
-    if (oldStyleRule != ea->mStyleRule) {
-      ea->PostRestyleForAnimation(mPresContext);
+    nsRefPtr<css::AnimValuesStyleRule> oldStyleRule = collection->mStyleRule;
+    UpdateStyleAndEvents(collection, now, canThrottleTick
+                                          ? EnsureStyleRule_IsThrottled
+                                          : EnsureStyleRule_IsNotThrottled);
+    if (oldStyleRule != collection->mStyleRule) {
+      collection->PostRestyleForAnimation(mPresContext);
     } else {
       didThrottle = true;
     }
   }
 
   if (didThrottle) {
     mPresContext->Document()->SetNeedStyleFlush();
   }
@@ -751,25 +757,27 @@ nsAnimationManager::UpdateThrottledStyle
   if (aContent->IsElement()) {
     element = aContent->AsElement();
   } else {
     element = nullptr;
   }
 
   nsRefPtr<nsStyleContext> newStyle;
 
-  ElementAnimationCollection* ea;
+  ElementAnimationCollection* collection;
   if (element &&
-      (ea = GetElementAnimations(element,
-                                 nsCSSPseudoElements::ePseudo_NotPseudoElement,
-                                 false))) {
+      (collection =
+        GetElementAnimations(element,
+                             nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                             false))) {
     // re-resolve our style
     newStyle = UpdateThrottledStyle(element, aParentStyle, aChangeList);
     // remove the current transition from the working set
-    ea->mFlushGeneration = mPresContext->RefreshDriver()->MostRecentRefresh();
+    collection->mFlushGeneration =
+      mPresContext->RefreshDriver()->MostRecentRefresh();
   } else {
     newStyle = ReparentContent(aContent, aParentStyle);
   }
 
   // walk the children
   if (newStyle) {
     for (nsIContent *child = aContent->GetFirstChild(); child;
          child = child->GetNextSibling()) {
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -80,25 +80,27 @@ nsTransitionManager::UpdateThrottledStyl
   if (aContent->IsElement()) {
     element = aContent->AsElement();
   } else {
     element = nullptr;
   }
 
   nsRefPtr<nsStyleContext> newStyle;
 
-  ElementAnimationCollection* et;
+  ElementAnimationCollection* collection;
   if (element &&
-      (et = GetElementTransitions(element,
-                                  nsCSSPseudoElements::ePseudo_NotPseudoElement,
-                                  false))) {
+      (collection =
+        GetElementTransitions(element,
+                              nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                              false))) {
     // re-resolve our style
     newStyle = UpdateThrottledStyle(element, aParentStyle, aChangeList);
     // remove the current transition from the working set
-    et->mFlushGeneration = mPresContext->RefreshDriver()->MostRecentRefresh();
+    collection->mFlushGeneration =
+      mPresContext->RefreshDriver()->MostRecentRefresh();
   } else {
     newStyle = ReparentContent(aContent, aParentStyle);
   }
 
   // walk the children
   if (newStyle) {
     for (nsIContent *child = aContent->GetFirstChild(); child;
          child = child->GetNextSibling()) {
@@ -191,19 +193,19 @@ nsTransitionManager::StyleContextChanged
                   aElement->Tag() == nsGkAtoms::mozgeneratedcontentafter),
                  "Unexpected aElement coming through");
 
     // Else the element we want to use from now on is the element the
     // :before or :after is attached to.
     aElement = aElement->GetParent()->AsElement();
   }
 
-  ElementAnimationCollection* et =
+  ElementAnimationCollection* collection =
     GetElementTransitions(aElement, pseudoType, false);
-  if (!et &&
+  if (!collection &&
       disp->mTransitionPropertyCount == 1 &&
       disp->mTransitions[0].GetDelay() == 0.0f &&
       disp->mTransitions[0].GetDuration() == 0.0f) {
     return nullptr;
   }
 
 
   if (aNewStyleContext->PresContext()->IsProcessingAnimationStyleChange()) {
@@ -241,40 +243,40 @@ nsTransitionManager::StyleContextChanged
       if (property == eCSSPropertyExtra_no_properties ||
           property == eCSSPropertyExtra_variable ||
           property == eCSSProperty_UNKNOWN) {
         // Nothing to do, but need to exclude this from cases below.
       } else if (property == eCSSPropertyExtra_all_properties) {
         for (nsCSSProperty p = nsCSSProperty(0);
              p < eCSSProperty_COUNT_no_shorthands;
              p = nsCSSProperty(p + 1)) {
-          ConsiderStartingTransition(p, t, aElement, et,
+          ConsiderStartingTransition(p, t, aElement, collection,
                                      aOldStyleContext, aNewStyleContext,
                                      &startedAny, &whichStarted);
         }
       } else if (nsCSSProps::IsShorthand(property)) {
         CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, property) {
-          ConsiderStartingTransition(*subprop, t, aElement, et,
+          ConsiderStartingTransition(*subprop, t, aElement, collection,
                                      aOldStyleContext, aNewStyleContext,
                                      &startedAny, &whichStarted);
         }
       } else {
-        ConsiderStartingTransition(property, t, aElement, et,
+        ConsiderStartingTransition(property, t, aElement, collection,
                                    aOldStyleContext, aNewStyleContext,
                                    &startedAny, &whichStarted);
       }
     }
   }
 
   // Stop any transitions for properties that are no longer in
   // 'transition-property'.
   // Also stop any transitions for properties that just changed (and are
   // still in the set of properties to transition), but we didn't just
   // start the transition because delay and duration are both zero.
-  if (et) {
+  if (collection) {
     bool checkProperties =
       disp->mTransitions[0].GetProperty() != eCSSPropertyExtra_all_properties;
     nsCSSPropertySet allTransitionProperties;
     if (checkProperties) {
       for (uint32_t i = disp->mTransitionPropertyCount; i-- != 0; ) {
         const StyleTransition& t = disp->mTransitions[i];
         // FIXME: Would be good to find a way to share code between this
         // interpretation of transition-property and the one above.
@@ -294,17 +296,17 @@ nsTransitionManager::StyleContextChanged
             allTransitionProperties.AddProperty(*subprop);
           }
         } else {
           allTransitionProperties.AddProperty(property);
         }
       }
     }
 
-    ElementAnimationPtrArray& animations = et->mAnimations;
+    ElementAnimationPtrArray& animations = collection->mAnimations;
     uint32_t i = animations.Length();
     NS_ABORT_IF_FALSE(i != 0, "empty transitions list?");
     StyleAnimationValue currentValue;
     do {
       --i;
       ElementAnimation* animation = animations[i];
       MOZ_ASSERT(animation->mProperties.Length() == 1,
                  "Should have one animation property for a transition");
@@ -317,32 +319,32 @@ nsTransitionManager::StyleContextChanged
            !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);
-        et->UpdateAnimationGeneration(mPresContext);
+        collection->UpdateAnimationGeneration(mPresContext);
       }
     } while (i != 0);
 
     if (animations.IsEmpty()) {
-      et->Destroy();
-      et = nullptr;
+      collection->Destroy();
+      collection = nullptr;
     }
   }
 
   if (!startedAny) {
     return nullptr;
   }
 
-  NS_ABORT_IF_FALSE(et, "must have element transitions if we started "
-                        "any transitions");
+  NS_ABORT_IF_FALSE(collection, "must have element transitions if we started "
+                                "any transitions");
 
   // In the CSS working group discussion (2009 Jul 15 telecon,
   // http://www.w3.org/mid/4A5E1470.4030904@inkedblade.net ) of
   // http://lists.w3.org/Archives/Public/www-style/2009Jun/0121.html ,
   // the working group decided that a transition property on an
   // element should not cause any transitions if the property change
   // is itself inheriting a value that is transitioning on an
   // ancestor.  So, to get the correct behavior, we continue the
@@ -351,31 +353,31 @@ 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;
 
-  ElementAnimationPtrArray& animations = et->mAnimations;
+  ElementAnimationPtrArray& animations = collection->mAnimations;
   for (uint32_t i = 0, i_end = animations.Length(); i < i_end; ++i) {
     ElementAnimation* animation = animations[i];
     MOZ_ASSERT(animation->mProperties.Length() == 1,
                "Should have one animation property for a transition");
     MOZ_ASSERT(animation->mProperties[0].mSegments.Length() == 1,
                "Animation property should have one segment for a transition");
     AnimationProperty& prop = animation->mProperties[0];
     AnimationPropertySegment& segment = prop.mSegments[0];
     if (whichStarted.HasProperty(prop.mProperty)) {
       coverRule->AddValue(prop.mProperty, segment.mFromValue);
     }
   }
 
-  et->mStyleRule = nullptr;
+  collection->mStyleRule = nullptr;
 
   return coverRule.forget();
 }
 
 void
 nsTransitionManager::ConsiderStartingTransition(
   nsCSSProperty aProperty,
   const StyleTransition& aTransition,
@@ -585,19 +587,20 @@ nsTransitionManager::ConsiderStartingTra
   aElementTransitions->UpdateAnimationGeneration(mPresContext);
   aElementTransitions->PostRestyleForAnimation(presContext);
 
   *aStartedAny = true;
   aWhichStarted->AddProperty(aProperty);
 }
 
 ElementAnimationCollection*
-nsTransitionManager::GetElementTransitions(dom::Element *aElement,
-                                           nsCSSPseudoElements::Type aPseudoType,
-                                           bool aCreateIfNeeded)
+nsTransitionManager::GetElementTransitions(
+  dom::Element *aElement,
+  nsCSSPseudoElements::Type aPseudoType,
+  bool aCreateIfNeeded)
 {
   if (!aCreateIfNeeded && PR_CLIST_IS_EMPTY(&mElementData)) {
     // Early return for the most common case.
     return nullptr;
   }
 
   nsIAtom *propName;
   if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
@@ -607,51 +610,52 @@ nsTransitionManager::GetElementTransitio
   } else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
     propName = nsGkAtoms::transitionsOfAfterProperty;
   } else {
     NS_ASSERTION(!aCreateIfNeeded,
                  "should never try to create transitions for pseudo "
                  "other than :before or :after");
     return nullptr;
   }
-  ElementAnimationCollection* et =
+  ElementAnimationCollection* collection =
     static_cast<ElementAnimationCollection*>(aElement->GetProperty(propName));
-  if (!et && aCreateIfNeeded) {
+  if (!collection && aCreateIfNeeded) {
     // FIXME: Consider arena-allocating?
-    et = new ElementAnimationCollection(aElement, propName, this,
+    collection = new ElementAnimationCollection(aElement, propName, this,
       mPresContext->RefreshDriver()->MostRecentRefresh());
     nsresult rv =
-      aElement->SetProperty(propName, et,
+      aElement->SetProperty(propName, collection,
                             &ElementAnimationCollection::PropertyDtor, false);
     if (NS_FAILED(rv)) {
       NS_WARNING("SetProperty failed");
-      delete et;
+      delete collection;
       return nullptr;
     }
     if (propName == nsGkAtoms::transitionsProperty) {
       aElement->SetMayHaveAnimations();
     }
 
-    AddElementData(et);
+    AddElementData(collection);
   }
 
-  return et;
+  return collection;
 }
 
 /*
  * nsIStyleRuleProcessor implementation
  */
 
 void
-nsTransitionManager::WalkTransitionRule(ElementDependentRuleProcessorData* aData,
-                                        nsCSSPseudoElements::Type aPseudoType)
+nsTransitionManager::WalkTransitionRule(
+  ElementDependentRuleProcessorData* aData,
+  nsCSSPseudoElements::Type aPseudoType)
 {
-  ElementAnimationCollection* et =
+  ElementAnimationCollection* collection =
     GetElementTransitions(aData->mElement, aPseudoType, false);
-  if (!et) {
+  if (!collection) {
     return;
   }
 
   if (!mPresContext->IsDynamic()) {
     // For print or print preview, ignore animations.
     return;
   }
 
@@ -659,27 +663,27 @@ nsTransitionManager::WalkTransitionRule(
       !aData->mPresContext->IsProcessingAnimationStyleChange()) {
     // If we're processing a normal style change rather than one from
     // animation, don't add the transition rule.  This allows us to
     // compute the new style value rather than having the transition
     // override it, so that we can start transitioning differently.
 
     // We need to immediately restyle with animation
     // after doing this.
-    et->PostRestyleForAnimation(mPresContext);
+    collection->PostRestyleForAnimation(mPresContext);
     return;
   }
 
-  et->mNeedsRefreshes = true;
-  et->EnsureStyleRuleFor(
+  collection->mNeedsRefreshes = true;
+  collection->EnsureStyleRuleFor(
     aData->mPresContext->RefreshDriver()->MostRecentRefresh(),
     EnsureStyleRule_IsNotThrottled);
 
-  if (et->mStyleRule) {
-    aData->mRuleWalker->Forward(et->mStyleRule);
+  if (collection->mStyleRule) {
+    aData->mRuleWalker->Forward(collection->mStyleRule);
   }
 }
 
 /* virtual */ void
 nsTransitionManager::RulesMatching(ElementRuleProcessorData* aData)
 {
   NS_ABORT_IF_FALSE(aData->mPresContext == mPresContext,
                     "pres context mismatch");
@@ -778,100 +782,102 @@ nsTransitionManager::FlushTransitions(Fl
   nsTArray<TransitionEventInfo> events;
   TimeStamp now = mPresContext->RefreshDriver()->MostRecentRefresh();
   bool didThrottle = false;
   // Trim transitions that have completed, post restyle events for frames that
   // are still transitioning, and start transitions with delays.
   {
     PRCList *next = PR_LIST_HEAD(&mElementData);
     while (next != &mElementData) {
-      ElementAnimationCollection* et =
+      ElementAnimationCollection* collection =
         static_cast<ElementAnimationCollection*>(next);
       next = PR_NEXT_LINK(next);
 
       bool canThrottleTick = aFlags == Can_Throttle &&
-        et->CanPerformOnCompositorThread(
+        collection->CanPerformOnCompositorThread(
           ElementAnimationCollection::CanAnimateFlags(0)) &&
-        et->CanThrottleAnimation(now);
+        collection->CanThrottleAnimation(now);
 
-      NS_ABORT_IF_FALSE(et->mElement->GetCrossShadowCurrentDoc() ==
+      NS_ABORT_IF_FALSE(collection->mElement->GetCrossShadowCurrentDoc() ==
                           mPresContext->Document(),
                         "Element::UnbindFromTree should have "
                         "destroyed the element transitions object");
 
-      uint32_t i = et->mAnimations.Length();
+      uint32_t i = collection->mAnimations.Length();
       NS_ABORT_IF_FALSE(i != 0, "empty transitions list?");
       bool transitionStartedOrEnded = false;
       do {
         --i;
-        ElementAnimation* anim = et->mAnimations[i];
+        ElementAnimation* anim = collection->mAnimations[i];
         if (anim->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) {
-            et->mAnimations.RemoveElementAt(i);
+            collection->mAnimations.RemoveElementAt(i);
           }
         } else {
           TimeDuration localTime = anim->GetLocalTimeAt(now);
           ComputedTiming computedTiming =
             ElementAnimation::GetComputedTimingAt(localTime, anim->mTiming);
           if (computedTiming.mPhase == ComputedTiming::AnimationPhase_After) {
             MOZ_ASSERT(anim->mProperties.Length() == 1,
                        "Should have one animation property for a transition");
             nsCSSProperty prop = anim->mProperties[0].mProperty;
             if (nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_REPORT_OTHER_NAME))
             {
               prop = nsCSSProps::OtherNameFor(prop);
             }
             events.AppendElement(
-              TransitionEventInfo(et->mElement, prop,
+              TransitionEventInfo(collection->mElement, prop,
                                   anim->mTiming.mIterationDuration,
-                                  et->PseudoElement()));
+                                  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();
-            et->UpdateAnimationGeneration(mPresContext);
+            collection->UpdateAnimationGeneration(mPresContext);
             transitionStartedOrEnded = true;
           } else if ((computedTiming.mPhase ==
                       ComputedTiming::AnimationPhase_Active) &&
                      canThrottleTick &&
                     !anim->mIsRunningOnCompositor) {
             // Start a transition with a delay where we should start the
             // transition proper.
-            et->UpdateAnimationGeneration(mPresContext);
+            collection->UpdateAnimationGeneration(mPresContext);
             transitionStartedOrEnded = true;
           }
         }
       } while (i != 0);
 
       // We need to restyle even if the transition rule no longer
       // applies (in which case we just made it not apply).
-      NS_ASSERTION(et->mElementProperty == nsGkAtoms::transitionsProperty ||
-                   et->mElementProperty == nsGkAtoms::transitionsOfBeforeProperty ||
-                   et->mElementProperty == nsGkAtoms::transitionsOfAfterProperty,
-                   "Unexpected element property; might restyle too much");
+      MOZ_ASSERT(
+        collection->mElementProperty == nsGkAtoms::transitionsProperty ||
+        collection->mElementProperty ==
+          nsGkAtoms::transitionsOfBeforeProperty ||
+        collection->mElementProperty == nsGkAtoms::transitionsOfAfterProperty,
+        "Unexpected element property; might restyle too much");
       if (!canThrottleTick || transitionStartedOrEnded) {
-        et->PostRestyleForAnimation(mPresContext);
+        collection->PostRestyleForAnimation(mPresContext);
       } else {
         didThrottle = true;
       }
 
-      if (et->mAnimations.IsEmpty()) {
-        et->Destroy();
-        // |et| is now a dangling pointer!
-        et = nullptr;
+      if (collection->mAnimations.IsEmpty()) {
+        collection->Destroy();
+        // |collection| is now a dangling pointer!
+        collection = nullptr;
       }
     }
   }
 
   if (didThrottle) {
     mPresContext->Document()->SetNeedStyleFlush();
   }