Bug 1153734 part 4 - Rename other uses of 'source' and 'source content'; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Wed, 15 Apr 2015 08:48:21 +0900
changeset 239183 a4694e8ae6dd666a600bbc29156c72b50aa259b9
parent 239182 d1b6e873a6bc52f72ebd56313c94c4ed3035cb49
child 239184 787fc1b170e3ed42d19dd2f680cb1c674c7e4d80
push id28584
push usercbook@mozilla.com
push dateWed, 15 Apr 2015 12:29:01 +0000
treeherdermozilla-central@b58b07945d30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1153734
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1153734 part 4 - Rename other uses of 'source' and 'source content'; r=jwatt This patch also tightens up a one or two references to 'target effect' replacing them with just 'effect'. This is because 'target effect' is longer and easily confused with 'target element'. 'effect' should be sufficient. 'target element' is a term from the Web Animations specification and in that context, simply referring to the 'effect' would sound a little odd.
dom/animation/AnimationPlayer.cpp
dom/animation/AnimationPlayer.h
layout/base/nsDisplayList.cpp
layout/style/AnimationCommon.cpp
layout/style/nsAnimationManager.cpp
--- a/dom/animation/AnimationPlayer.cpp
+++ b/dom/animation/AnimationPlayer.cpp
@@ -122,17 +122,17 @@ AnimationPlayer::SetCurrentTime(const Ti
   if (mPendingState == PendingState::PausePending) {
     CancelPendingTasks();
     if (mReady) {
       mReady->MaybeResolve(this);
     }
   }
 
   UpdateFinishedState(true);
-  UpdateSourceContent();
+  UpdateEffect();
   PostUpdate();
 }
 
 void
 AnimationPlayer::SetPlaybackRate(double aPlaybackRate)
 {
   Nullable<TimeDuration> previousTime = GetCurrentTime();
   mPlaybackRate = aPlaybackRate;
@@ -166,17 +166,17 @@ AnimationPlayer::PlayState() const
   if (currentTime.IsNull()) {
     return AnimationPlayState::Idle;
   }
 
   if (mStartTime.IsNull()) {
     return AnimationPlayState::Paused;
   }
 
-  if ((mPlaybackRate > 0.0 && currentTime.Value() >= SourceContentEnd()) ||
+  if ((mPlaybackRate > 0.0 && currentTime.Value() >= EffectEnd()) ||
       (mPlaybackRate < 0.0 && currentTime.Value().ToMilliseconds() <= 0.0)) {
     return AnimationPlayState::Finished;
   }
 
   return AnimationPlayState::Running;
 }
 
 static inline already_AddRefed<Promise>
@@ -362,24 +362,24 @@ AnimationPlayer::Cancel()
     mFinished->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
   }
   // Clear finished promise. We'll create a new one lazily.
   mFinished = nullptr;
 
   mHoldTime.SetNull();
   mStartTime.SetNull();
 
-  UpdateSourceContent();
+  UpdateEffect();
 }
 
 void
 AnimationPlayer::UpdateRelevance()
 {
   bool wasRelevant = mIsRelevant;
-  mIsRelevant = HasCurrentSource() || HasInEffectSource();
+  mIsRelevant = HasCurrentEffect() || IsInEffect();
 
   // Notify animation observers.
   if (wasRelevant && !mIsRelevant) {
     nsNodeUtils::AnimationRemoved(this);
   } else if (!wasRelevant && mIsRelevant) {
     nsNodeUtils::AnimationAdded(this);
   }
 }
@@ -471,18 +471,18 @@ AnimationPlayer::ComposeStyle(nsRefPtr<c
       if (timeToUse.IsNull() &&
           mTimeline &&
           !mTimeline->IsUnderTestControl()) {
         timeToUse = mTimeline->ToTimelineTime(TimeStamp::Now());
       }
       if (!timeToUse.IsNull()) {
         mHoldTime.SetValue((timeToUse.Value() - mStartTime.Value())
                             .MultDouble(mPlaybackRate));
-        // Push the change down to the source content
-        UpdateSourceContent();
+        // Push the change down to the effect
+        UpdateEffect();
         updatedHoldTime = true;
       }
     }
 
     mEffect->ComposeStyle(aStyleRule, aSetProperties);
 
     if (updatedHoldTime) {
       UpdateTiming();
@@ -503,24 +503,24 @@ AnimationPlayer::DoPlay(LimitBehavior aL
     reuseReadyPromise = true;
   }
 
   Nullable<TimeDuration> currentTime = GetCurrentTime();
   if (mPlaybackRate > 0.0 &&
       (currentTime.IsNull() ||
        (aLimitBehavior == LimitBehavior::AutoRewind &&
         (currentTime.Value().ToMilliseconds() < 0.0 ||
-         currentTime.Value() >= SourceContentEnd())))) {
+         currentTime.Value() >= EffectEnd())))) {
     mHoldTime.SetValue(TimeDuration(0));
   } else if (mPlaybackRate < 0.0 &&
              (currentTime.IsNull() ||
               (aLimitBehavior == LimitBehavior::AutoRewind &&
                (currentTime.Value().ToMilliseconds() <= 0.0 ||
-                currentTime.Value() > SourceContentEnd())))) {
-    mHoldTime.SetValue(TimeDuration(SourceContentEnd()));
+                currentTime.Value() > EffectEnd())))) {
+    mHoldTime.SetValue(TimeDuration(EffectEnd()));
   } else if (mPlaybackRate == 0.0 && currentTime.IsNull()) {
     mHoldTime.SetValue(TimeDuration(0));
   }
 
   // If the hold time is null then we're either already playing normally (and
   // we can ignore this call) or we aborted a pending pause operation (in which
   // case, for consistency, we need to go through the motions of doing an
   // asynchronous start even though we already have a resolved start time).
@@ -642,40 +642,39 @@ AnimationPlayer::PauseAt(const TimeDurat
   if (mReady) {
     mReady->MaybeResolve(this);
   }
 }
 
 void
 AnimationPlayer::UpdateTiming()
 {
-  // We call UpdateFinishedState before UpdateSourceContent because the former
+  // We call UpdateFinishedState before UpdateEffect because the former
   // can change the current time, which is used by the latter.
   UpdateFinishedState();
-  UpdateSourceContent();
+  UpdateEffect();
 }
 
 void
 AnimationPlayer::UpdateFinishedState(bool aSeekFlag)
 {
   Nullable<TimeDuration> currentTime = GetCurrentTime();
-  TimeDuration targetEffectEnd = TimeDuration(SourceContentEnd());
+  TimeDuration effectEnd = TimeDuration(EffectEnd());
 
   if (!mStartTime.IsNull() &&
       mPendingState == PendingState::NotPending) {
     if (mPlaybackRate > 0.0 &&
         !currentTime.IsNull() &&
-        currentTime.Value() >= targetEffectEnd) {
+        currentTime.Value() >= effectEnd) {
       if (aSeekFlag) {
         mHoldTime = currentTime;
       } else if (!mPreviousCurrentTime.IsNull()) {
-        mHoldTime.SetValue(std::max(mPreviousCurrentTime.Value(),
-                                    targetEffectEnd));
+        mHoldTime.SetValue(std::max(mPreviousCurrentTime.Value(), effectEnd));
       } else {
-        mHoldTime.SetValue(targetEffectEnd);
+        mHoldTime.SetValue(effectEnd);
       }
     } else if (mPlaybackRate < 0.0 &&
                !currentTime.IsNull() &&
                currentTime.Value().ToMilliseconds() <= 0.0) {
       if (aSeekFlag) {
         mHoldTime = currentTime;
       } else {
         mHoldTime.SetValue(0);
@@ -701,17 +700,17 @@ AnimationPlayer::UpdateFinishedState(boo
   }
   mIsPreviousStateFinished = currentFinishedState;
   // We must recalculate the current time to take account of any mHoldTime
   // changes the code above made.
   mPreviousCurrentTime = GetCurrentTime();
 }
 
 void
-AnimationPlayer::UpdateSourceContent()
+AnimationPlayer::UpdateEffect()
 {
   if (mEffect) {
     mEffect->SetParentTime(GetCurrentTime());
     UpdateRelevance();
   }
 }
 
 void
@@ -759,37 +758,37 @@ bool
 AnimationPlayer::IsFinished() const
 {
   // Unfortunately there's some weirdness in the spec at the moment where if
   // you're finished and paused, the playState is paused. This prevents us
   // from just checking |PlayState() == AnimationPlayState::Finished| here,
   // and we need this much more messy check to see if we're finished.
   Nullable<TimeDuration> currentTime = GetCurrentTime();
   return !currentTime.IsNull() &&
-      ((mPlaybackRate > 0.0 && currentTime.Value() >= SourceContentEnd()) ||
+      ((mPlaybackRate > 0.0 && currentTime.Value() >= EffectEnd()) ||
        (mPlaybackRate < 0.0 && currentTime.Value().ToMilliseconds() <= 0.0));
 }
 
 bool
 AnimationPlayer::IsPossiblyOrphanedPendingPlayer() const
 {
   // Check if we are pending but might never start because we are not being
   // tracked.
   //
   // This covers the following cases:
   //
-  // * We started playing but our source content's target element was orphaned
+  // * We started playing but our effect's target element was orphaned
   //   or bound to a different document.
-  //   (note that for the case of our source content changing we should handle
-  //   that in SetSource)
+  //   (note that for the case of our effect changing we should handle
+  //   that in SetEffect)
   // * We started playing but our timeline became inactive.
   //   In this case the pending player tracker will drop us from its hashmap
   //   when we have been painted.
   // * When we started playing we couldn't find a PendingPlayerTracker to
-  //   register with (perhaps the source content had no document) so we simply
+  //   register with (perhaps the effect had no document) so we simply
   //   set mPendingState in DoPlay and relied on this method to catch us on the
   //   next tick.
 
   // If we're not pending we're ok.
   if (mPendingState == PendingState::NotPending) {
     return false;
   }
 
@@ -818,17 +817,17 @@ AnimationPlayer::IsPossiblyOrphanedPendi
 
   PendingPlayerTracker* tracker = doc->GetPendingPlayerTracker();
   return !tracker ||
          (!tracker->IsWaitingToPlay(*this) &&
           !tracker->IsWaitingToPause(*this));
 }
 
 StickyTimeDuration
-AnimationPlayer::SourceContentEnd() const
+AnimationPlayer::EffectEnd() const
 {
   if (!mEffect) {
     return StickyTimeDuration(0);
   }
 
   return mEffect->Timing().mDelay
          + mEffect->GetComputedTiming().mActiveDuration;
 }
--- a/dom/animation/AnimationPlayer.h
+++ b/dom/animation/AnimationPlayer.h
@@ -115,17 +115,17 @@ public:
 
   void SetEffect(KeyframeEffectReadonly* aEffect);
   void Tick();
 
   /**
    * Set the time to use for starting or pausing a pending player.
    *
    * Typically, when a player is played, it does not start immediately but is
-   * added to a table of pending players on the document of its source content.
+   * added to a table of pending players on the document of its effect.
    * In the meantime it sets its hold time to the time from which playback
    * should begin.
    *
    * When the document finishes painting, any pending players in its table
    * are marked as being ready to start by calling StartOnNextTick.
    * The moment when the paint completed is also recorded, converted to a
    * timeline time, and passed to StartOnTick. This is so that when these
    * players do start, they can be timed from the point when painting
@@ -207,64 +207,64 @@ public:
   }
 
   bool IsPausedOrPausing() const
   {
     return PlayState() == AnimationPlayState::Paused ||
            mPendingState == PendingState::PausePending;
   }
 
-  bool HasInPlaySource() const
+  bool HasInPlayEffect() const
   {
     return GetEffect() && GetEffect()->IsInPlay(*this);
   }
-  bool HasCurrentSource() const
+  bool HasCurrentEffect() const
   {
     return GetEffect() && GetEffect()->IsCurrent(*this);
   }
-  bool HasInEffectSource() const
+  bool IsInEffect() const
   {
     return GetEffect() && GetEffect()->IsInEffect();
   }
 
   /**
    * "Playing" is different to "running". An animation in its delay phase is
    * still running but we only consider it playing when it is in its active
    * interval. This definition is used for fetching the animations that are
    * are candidates for running on the compositor (since we don't ship
    * animations to the compositor when they are in their delay phase or
    * paused).
    */
   bool IsPlaying() const
   {
-    // We need to have a source animation in its active interval, and
+    // We need to have an effect in its active interval, and
     // be either running or waiting to run.
-    return HasInPlaySource() &&
+    return HasInPlayEffect() &&
            (PlayState() == AnimationPlayState::Running ||
             mPendingState == PendingState::PlayPending);
   }
 
   bool IsRelevant() const { return mIsRelevant; }
   void UpdateRelevance();
 
   void SetIsRunningOnCompositor() { mIsRunningOnCompositor = true; }
   void ClearIsRunningOnCompositor() { mIsRunningOnCompositor = false; }
 
   // Returns true if this animation does not currently need to update
   // style on the main thread (e.g. because it is empty, or is
   // running on the compositor).
   bool CanThrottle() const;
 
-  // Updates |aStyleRule| with the animation values of this player's source
-  // content, if any.
+  // Updates |aStyleRule| with the animation values of this player'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 player expects to update
   // the style rule on the next refresh driver tick as well (because it
-  // is running and has source content to sample).
+  // is running and has an effect to sample).
   void ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule,
                     nsCSSPropertySet& aSetProperties,
                     bool& aNeedsRefreshes);
 
 protected:
   void DoPlay(LimitBehavior aLimitBehavior);
   void DoPause();
   void ResumeAt(const TimeDuration& aReadyTime);
@@ -277,30 +277,30 @@ protected:
       PauseAt(aReadyTime);
     } else {
       NS_NOTREACHED("Can't finish pending if we're not in a pending state");
     }
   }
 
   void UpdateTiming();
   void UpdateFinishedState(bool aSeekFlag = false);
-  void UpdateSourceContent();
+  void UpdateEffect();
   void FlushStyle() const;
   void PostUpdate();
   /**
    * Remove this player from the pending player tracker and reset
    * mPendingState as necessary. The caller is responsible for resolving or
    * aborting the mReady promise as necessary.
    */
   void CancelPendingTasks();
 
   bool IsFinished() const;
 
   bool IsPossiblyOrphanedPendingPlayer() const;
-  StickyTimeDuration SourceContentEnd() const;
+  StickyTimeDuration EffectEnd() const;
 
   nsIDocument* GetRenderedDocument() const;
   nsPresContext* GetPresContext() const;
   virtual css::CommonAnimationManager* GetAnimationManager() const = 0;
   AnimationPlayerCollection* GetCollection() const;
 
   nsRefPtr<DocumentTimeline> mTimeline;
   nsRefPtr<KeyframeEffectReadonly> mEffect;
@@ -312,17 +312,17 @@ protected:
   double mPlaybackRate;
 
   // A Promise that is replaced on each call to Play() (and in future Pause())
   // and fulfilled when Play() is successfully completed.
   // This object is lazily created by GetReady.
   // See http://w3c.github.io/web-animations/#current-ready-promise
   nsRefPtr<Promise> mReady;
 
-  // A Promise that is resolved when we reach the end of the source content, or
+  // A Promise that is resolved when we reach the end of the effect, or
   // 0 when playing backwards. The Promise is replaced if the animation is
   // finished but then a state change makes it not finished.
   // This object is lazily created by GetFinished.
   // See http://w3c.github.io/web-animations/#current-finished-promise
   nsRefPtr<Promise> mFinished;
 
   // Indicates if the player is in the pending state (and what state it is
   // waiting to enter when it finished pending). We use this rather than
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -417,17 +417,17 @@ AddAnimationsForProperty(nsIFrame* aFram
 
   // Add from first to last (since last overrides)
   for (size_t playerIdx = 0; playerIdx < aPlayers.Length(); playerIdx++) {
     AnimationPlayer* player = aPlayers[playerIdx];
     if (!player->IsPlaying()) {
       continue;
     }
     dom::KeyframeEffectReadonly* effect = player->GetEffect();
-    MOZ_ASSERT(effect, "A playing player should have a target effect");
+    MOZ_ASSERT(effect, "A playing player should have an effect");
     const AnimationProperty* property =
       effect->GetAnimationOfProperty(aProperty);
     if (!property) {
       continue;
     }
 
     // Note that if mWinsInCascade on property was  false,
     // GetAnimationOfProperty returns null instead.
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -909,17 +909,17 @@ AnimationPlayerCollection::UpdateCheckGe
   mCheckGeneration =
     aPresContext->RestyleManager()->GetAnimationGeneration();
 }
 
 bool
 AnimationPlayerCollection::HasCurrentAnimations() const
 {
   for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
-    if (mPlayers[playerIdx]->HasCurrentSource()) {
+    if (mPlayers[playerIdx]->HasCurrentEffect()) {
       return true;
     }
   }
 
   return false;
 }
 
 bool
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -225,17 +225,17 @@ nsAnimationManager::QueueEvents(Animatio
 
 void
 nsAnimationManager::MaybeUpdateCascadeResults(AnimationPlayerCollection* aCollection)
 {
   for (size_t playerIdx = aCollection->mPlayers.Length(); playerIdx-- != 0; ) {
     CSSAnimationPlayer* player =
       aCollection->mPlayers[playerIdx]->AsCSSAnimationPlayer();
 
-    if (player->HasInEffectSource() != player->mInEffectForCascadeResults) {
+    if (player->IsInEffect() != player->mInEffectForCascadeResults) {
       // Update our own cascade results.
       mozilla::dom::Element* element = aCollection->GetElementToRestyle();
       if (element) {
         nsIFrame* frame = element->GetPrimaryFrame();
         if (frame) {
           UpdateCascadeResults(frame->StyleContext(), aCollection);
         }
       }
@@ -801,17 +801,17 @@ nsAnimationManager::UpdateCascadeResults
 
   bool changed = false;
   for (size_t playerIdx = aElementAnimations->mPlayers.Length();
        playerIdx-- != 0; ) {
     CSSAnimationPlayer* player =
       aElementAnimations->mPlayers[playerIdx]->AsCSSAnimationPlayer();
     KeyframeEffectReadonly* effect = player->GetEffect();
 
-    player->mInEffectForCascadeResults = player->HasInEffectSource();
+    player->mInEffectForCascadeResults = player->IsInEffect();
 
     if (!effect) {
       continue;
     }
 
     for (size_t propIdx = 0, propEnd = effect->Properties().Length();
          propIdx != propEnd; ++propIdx) {
       AnimationProperty& prop = effect->Properties()[propIdx];