Bug 1208385 part 2 - Remove stored parent time from KeyframeEffectReadOnly and get the time directly from the owning animation; r=heycam
authorBrian Birtles <birtles@gmail.com>
Wed, 07 Oct 2015 14:30:28 +0900
changeset 266438 ee3890805a7785d28254b3ba3fae679bd8598553
parent 266437 8770acc7fd9ced0c3ae5c1de72ee423cd094b2a5
child 266439 89ddaac287855d3a8b7578fdded85f7f4fb97044
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
bugs1208385
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 1208385 part 2 - Remove stored parent time from KeyframeEffectReadOnly and get the time directly from the owning animation; r=heycam
dom/animation/Animation.cpp
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -53,22 +53,20 @@ Animation::SetEffect(KeyframeEffectReadO
 {
   nsRefPtr<Animation> kungFuDeathGrip(this);
 
   if (mEffect == aEffect) {
     return;
   }
   if (mEffect) {
     mEffect->SetAnimation(nullptr);
-    mEffect->SetParentTime(Nullable<TimeDuration>());
   }
   mEffect = aEffect;
   if (mEffect) {
     mEffect->SetAnimation(this);
-    mEffect->SetParentTime(GetCurrentTime());
   }
 
   UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
 }
 
 void
 Animation::SetTimeline(AnimationTimeline* aTimeline)
 {
@@ -907,17 +905,16 @@ Animation::UpdateFinishedState(SeekFlag 
   // changes the code above made.
   mPreviousCurrentTime = GetCurrentTime();
 }
 
 void
 Animation::UpdateEffect()
 {
   if (mEffect) {
-    mEffect->SetParentTime(GetCurrentTime());
     UpdateRelevance();
   }
 }
 
 void
 Animation::FlushStyle() const
 {
   nsIDocument* doc = GetRenderedDocument();
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -139,33 +139,39 @@ KeyframeEffectReadOnly::KeyframeEffectRe
 JSObject*
 KeyframeEffectReadOnly::WrapObject(JSContext* aCx,
                                    JS::Handle<JSObject*> aGivenProto)
 {
   return KeyframeEffectReadOnlyBinding::Wrap(aCx, this, aGivenProto);
 }
 
 void
-KeyframeEffectReadOnly::SetParentTime(Nullable<TimeDuration> aParentTime)
-{
-  mParentTime = aParentTime;
-}
-
-void
 KeyframeEffectReadOnly::SetTiming(const AnimationTiming& aTiming)
 {
   if (mTiming == aTiming) {
     return;
   }
   mTiming = aTiming;
   if (mAnimation) {
     mAnimation->NotifyEffectTimingUpdated();
   }
 }
 
+Nullable<TimeDuration>
+KeyframeEffectReadOnly::GetLocalTime() const
+{
+  // Since the *animation* start time is currently always zero, the local
+  // time is equal to the parent time.
+  Nullable<TimeDuration> result;
+  if (mAnimation) {
+    result = mAnimation->GetCurrentTime();
+  }
+  return result;
+}
+
 ComputedTiming
 KeyframeEffectReadOnly::GetComputedTimingAt(
                           const Nullable<TimeDuration>& aLocalTime,
                           const AnimationTiming& aTiming)
 {
   const TimeDuration zeroDuration;
 
   // Currently we expect negative durations to be picked up during CSS
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -242,31 +242,25 @@ public:
   // Temporary workaround to return both the target element and pseudo-type
   // until we implement PseudoElement (bug 1174575).
   void GetTarget(Element*& aTarget,
                  nsCSSPseudoElements::Type& aPseudoType) const {
     aTarget = mTarget;
     aPseudoType = mPseudoType;
   }
 
-  void SetParentTime(Nullable<TimeDuration> aParentTime);
-
   const AnimationTiming& Timing() const {
     return mTiming;
   }
   AnimationTiming& Timing() {
     return mTiming;
   }
   void SetTiming(const AnimationTiming& aTiming);
 
-  Nullable<TimeDuration> GetLocalTime() const {
-    // Since the *animation* start time is currently always zero, the local
-    // time is equal to the parent time.
-    return mParentTime;
-  }
+  Nullable<TimeDuration> GetLocalTime() const;
 
   // This function takes as input the timing parameters of an animation and
   // returns the computed timing at the specified local time.
   //
   // The local time may be null in which case only static parameters such as the
   // active duration are calculated. All other members of the returned object
   // are given a null/initial value.
   //
@@ -318,17 +312,16 @@ public:
   void SetIsRunningOnCompositor(nsCSSProperty aProperty, bool aIsRunning);
 
 protected:
   virtual ~KeyframeEffectReadOnly();
   void ResetIsRunningOnCompositor();
 
   nsCOMPtr<Element> mTarget;
   nsRefPtr<Animation> mAnimation;
-  Nullable<TimeDuration> mParentTime;
 
   AnimationTiming mTiming;
   nsCSSPseudoElements::Type mPseudoType;
 
   InfallibleTArray<AnimationProperty> mProperties;
 
   // Parallel array corresponding to CommonAnimationManager::sLayerAnimationInfo
   // such that mIsPropertyRunningOnCompositor[x] is true only if this effect has