Bug 1208938 part 1 - Rename AnimationCollection::mNeedsRefreshes to mStyleChanging; r=heycam
authorBrian Birtles <birtles@gmail.com>
Thu, 17 Sep 2015 15:43:15 +0900
changeset 266439 89ddaac287855d3a8b7578fdded85f7f4fb97044
parent 266438 ee3890805a7785d28254b3ba3fae679bd8598553
child 266440 05f79b5c5ef9565c5ab44d222c5f3e45ae286cfb
push id66189
push userbbirtles@mozilla.com
push dateWed, 07 Oct 2015 05:32:19 +0000
treeherdermozilla-inbound@649b90ba9363 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1208938
milestone44.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 1208938 part 1 - Rename AnimationCollection::mNeedsRefreshes to mStyleChanging; r=heycam This patch renames AnimationCollection::mNeedsRefreshes to indicate that it no longer has any relationship to whether or not we observe the refresh driver.
dom/animation/Animation.cpp
dom/animation/Animation.h
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/nsAnimationManager.cpp
layout/style/nsTransitionManager.cpp
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -568,27 +568,27 @@ Animation::CanThrottle() const
   }
 
   return IsRunningOnCompositor();
 }
 
 void
 Animation::ComposeStyle(nsRefPtr<AnimValuesStyleRule>& aStyleRule,
                         nsCSSPropertySet& aSetProperties,
-                        bool& aNeedsRefreshes)
+                        bool& aStyleChanging)
 {
   if (!mEffect) {
     return;
   }
 
   AnimationPlayState playState = PlayState();
   if (playState == AnimationPlayState::Running ||
       playState == AnimationPlayState::Pending ||
       HasEndEventToQueue()) {
-    aNeedsRefreshes = true;
+    aStyleChanging = true;
   }
 
   if (!IsInEffect()) {
     return;
   }
 
   // In order to prevent flicker, there are a few cases where we want to use
   // a different time for rendering that would otherwise be returned by
--- a/dom/animation/Animation.h
+++ b/dom/animation/Animation.h
@@ -280,23 +280,23 @@ public:
    * running on the compositor).
    */
   bool CanThrottle() const;
   /**
    * Updates |aStyleRule| with the animation values of this animation's effect,
    * if any.
    * Any properties already contained in |aSetProperties| are not changed. Any
    * properties that are changed are added to |aSetProperties|.
-   * |aNeedsRefreshes| will be set to true if this animation expects to update
+   * |aStyleChanging| will be set to true if this animation expects to update
    * the style rule on the next refresh driver tick as well (because it
    * is running and has an effect to sample).
    */
   void ComposeStyle(nsRefPtr<AnimValuesStyleRule>& aStyleRule,
                     nsCSSPropertySet& aSetProperties,
-                    bool& aNeedsRefreshes);
+                    bool& aStyleChanging);
 
 
   // FIXME: Because we currently determine if we need refresh driver ticks
   // during restyling (specifically ComposeStyle above) and not necessarily
   // during a refresh driver tick, we can arrive at a situation where we
   // have finished running an animation but are waiting until the next tick
   // to queue the final end event. This method tells us when we are in that
   // situation so we can avoid unregistering from the refresh driver until
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -692,17 +692,17 @@ AnimationCollection::Tick()
   }
 }
 
 void
 AnimationCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime)
 {
   mHasPendingAnimationRestyle = false;
 
-  if (!mNeedsRefreshes) {
+  if (!mStyleChanging) {
     mStyleRuleRefreshTime = aRefreshTime;
     return;
   }
 
   if (!mStyleRuleRefreshTime.IsNull() &&
       mStyleRuleRefreshTime == aRefreshTime) {
     // mStyleRule may be null and valid, if we have no style to apply.
     return;
@@ -711,27 +711,27 @@ AnimationCollection::EnsureStyleRuleFor(
   if (mManager->IsAnimationManager()) {
     // Update cascade results before updating the style rule, since the
     // cascade results can influence the style rule.
     static_cast<nsAnimationManager*>(mManager)->MaybeUpdateCascadeResults(this);
   }
 
   mStyleRuleRefreshTime = aRefreshTime;
   mStyleRule = nullptr;
-  // We'll set mNeedsRefreshes to true below in all cases where we need them.
-  mNeedsRefreshes = false;
+  // We'll set mStyleChanging to true below if necessary.
+  mStyleChanging = false;
 
   // If multiple animations specify behavior for the same property the
   // animation which occurs last in the value of animation-name wins.
   // As a result, we iterate from last animation to first and, if a
   // property has already been set, we don't leave it.
   nsCSSPropertySet properties;
 
   for (size_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
-    mAnimations[animIdx]->ComposeStyle(mStyleRule, properties, mNeedsRefreshes);
+    mAnimations[animIdx]->ComposeStyle(mStyleRule, properties, mStyleChanging);
   }
 }
 
 bool
 AnimationCollection::CanThrottleTransformChanges(TimeStamp aTime)
 {
   if (!nsLayoutUtils::AreAsyncAnimationsEnabled()) {
     return false;
@@ -837,17 +837,17 @@ AnimationCollection::RequestRestyle(Rest
     // Pres context will be null after the manager is disconnected.
     return;
   }
 
   // Steps for Restyle::Layer:
 
   if (aRestyleType == RestyleType::Layer) {
     mStyleRuleRefreshTime = TimeStamp();
-    mNeedsRefreshes = true;
+    mStyleChanging = true;
 
     // Prompt layers to re-sync their animations.
     presContext->ClearLastStyleUpdateForAllAnimations();
     presContext->RestyleManager()->IncrementAnimationGeneration();
     UpdateAnimationGeneration(presContext);
   }
 
   // Steps for RestyleType::Standard and above:
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -208,17 +208,17 @@ struct AnimationCollection : public Link
 {
   AnimationCollection(dom::Element *aElement, nsIAtom *aElementProperty,
                       CommonAnimationManager *aManager)
     : mElement(aElement)
     , mElementProperty(aElementProperty)
     , mManager(aManager)
     , mAnimationGeneration(0)
     , mCheckGeneration(0)
-    , mNeedsRefreshes(true)
+    , mStyleChanging(true)
     , mHasPendingAnimationRestyle(false)
 #ifdef DEBUG
     , mCalledPropertyDtor(false)
 #endif
   {
     MOZ_COUNT_CTOR(AnimationCollection);
   }
   ~AnimationCollection()
@@ -405,17 +405,17 @@ public:
                                          size_t aPropertyCount) const;
 
   // The refresh time associated with mStyleRule.
   TimeStamp mStyleRuleRefreshTime;
 
   // False when we know that our current style rule is valid
   // indefinitely into the future (because all of our animations are
   // either completed or paused).  May be invalidated by a style change.
-  bool mNeedsRefreshes;
+  bool mStyleChanging;
 
 private:
   // Whether or not we have already posted for animation restyle.
   // This is used to avoid making redundant requests and is reset each time
   // the animation restyle is performed.
   bool mHasPendingAnimationRestyle;
 
 #ifdef DEBUG
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -556,17 +556,17 @@ nsAnimationManager::CheckAnimationRule(n
     for (Animation* animation : newAnimations) {
       // FIXME: Bug 1134163 - As above, we have shouldn't actually need to
       // queue events here. (But we do for now since some tests expect
       // animationstart events to be dispatched immediately.)
       animation->AsCSSAnimation()->QueueEvents();
     }
   }
   collection->mAnimations.SwapElements(newAnimations);
-  collection->mNeedsRefreshes = true;
+  collection->mStyleChanging = true;
 
   // Cancel removed animations
   for (size_t newAnimIdx = newAnimations.Length(); newAnimIdx-- != 0; ) {
     newAnimations[newAnimIdx]->CancelFromStyle();
   }
 
   UpdateCascadeResults(aStyleContext, collection);
 
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -482,17 +482,17 @@ nsTransitionManager::StyleContextChanged
 
   if (collection) {
     UpdateCascadeResultsWithTransitions(collection);
 
     // Set the style rule refresh time to null so that EnsureStyleRuleFor
     // creates a new style rule if we started *or* stopped transitions.
     collection->mStyleRuleRefreshTime = TimeStamp();
     collection->UpdateCheckGeneration(mPresContext);
-    collection->mNeedsRefreshes = true;
+    collection->mStyleChanging = true;
     TimeStamp now = mPresContext->RefreshDriver()->MostRecentRefresh();
     collection->EnsureStyleRuleFor(now);
   }
 
   // We want to replace the new style context with the after-change style.
   *aNewStyleContext = afterChangeStyle;
   if (collection) {
     // Since we have transition styles, we have to undo this replacement.