Bug 1112480 part 8 - Remove AnimationTimeline::FastForward; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Fri, 09 Jan 2015 07:57:58 +0900
changeset 248645 632d54874ed20d94da6db401e3459f7b1998fd10
parent 248644 1d3d4759f4edead98212fee17aa81f26a2da08e9
child 248646 2081656d2497d4803e35d5962e34b2642a42e999
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1112480
milestone37.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 1112480 part 8 - Remove AnimationTimeline::FastForward; r=jwatt Now that we don't actually start pending animations until the following refresh driver tick we no longer need to be able to fast-forward the AnimationTimeline between ticks.
dom/animation/AnimationTimeline.cpp
dom/animation/AnimationTimeline.h
--- a/dom/animation/AnimationTimeline.cpp
+++ b/dom/animation/AnimationTimeline.cpp
@@ -33,49 +33,16 @@ AnimationTimeline::GetCurrentTime() cons
 }
 
 Nullable<double>
 AnimationTimeline::GetCurrentTimeAsDouble() const
 {
   return AnimationUtils::TimeDurationToDouble(GetCurrentTime());
 }
 
-void
-AnimationTimeline::FastForward(const TimeStamp& aTimeStamp)
-{
-  // If we have already been fast-forwarded to an equally or more
-  // recent time, ignore this call.
-  if (!mFastForwardTime.IsNull() && aTimeStamp <= mFastForwardTime) {
-    return;
-  }
-
-  // If the refresh driver is under test control then its values have little
-  // connection to TimeStamp values and it doesn't make sense to fast-forward
-  // the timeline to a TimeStamp value.
-  //
-  // Furthermore, when the refresh driver is under test control,
-  // nsDOMWindowUtils::AdvanceTimeAndRefresh automatically starts any
-  // pending animation players so we don't need to fast-forward the timeline
-  // anyway.
-  nsRefreshDriver* refreshDriver = GetRefreshDriver();
-  if (refreshDriver && refreshDriver->IsTestControllingRefreshesEnabled()) {
-    return;
-  }
-
-  MOZ_ASSERT(!refreshDriver || aTimeStamp >= refreshDriver->MostRecentRefresh(),
-             "aTimeStamp must be >= the refresh driver time");
-
-  // FIXME: For all animations attached to this timeline, we should mark
-  // their target elements as needing restyling. Otherwise, tasks that run
-  // in between now and the next refresh driver tick might see inconsistencies
-  // between the timing of an animation and the computed style of its target.
-
-  mFastForwardTime = aTimeStamp;
-}
-
 TimeStamp
 AnimationTimeline::GetCurrentTimeStamp() const
 {
   nsRefreshDriver* refreshDriver = GetRefreshDriver();
   TimeStamp refreshTime = refreshDriver
                           ? refreshDriver->MostRecentRefresh()
                           : TimeStamp();
 
@@ -92,45 +59,16 @@ AnimationTimeline::GetCurrentTimeStamp()
       result = timing->GetNavigationStartTimeStamp();
       // Also, let this time represent the current refresh time. This way
       // we'll save it as the last refresh time and skip looking up
       // navigation timing each time.
       refreshTime = result;
     }
   }
 
-  // The timeline may have been fast-forwarded to account for animations
-  // that begin playing between ticks of the refresh driver. If so, we should
-  // use the fast-forward time unless we've already gone past that time.
-  //
-  // (If the refresh driver were ever to go backwards then we would need to
-  //  ignore the fast-forward time in that case to prevent the timeline getting
-  //  "stuck" until the refresh driver caught up. However, the only time the
-  //  refresh driver goes backwards is when it is restored from test control
-  //  and FastForward makes sure we don't set the fast foward time when we
-  //  are under test control.)
-  MOZ_ASSERT(refreshTime.IsNull() || mLastRefreshDriverTime.IsNull() ||
-             refreshTime >= mLastRefreshDriverTime ||
-             mFastForwardTime.IsNull(),
-             "The refresh driver time should not go backwards when the"
-             " fast-forward time is set");
-
-  // We need to check if mFastForwardTime is ahead of the refresh driver
-  // time. This is because mFastForwardTime can still be set after the next
-  // refresh driver tick since we don't clear mFastForwardTime on a call to
-  // Tick() as we aren't currently guaranteed to get only one call to Tick()
-  // per refresh-driver tick.
-  if (result.IsNull() ||
-       (!mFastForwardTime.IsNull() && mFastForwardTime > result)) {
-    result = mFastForwardTime;
-  } else {
-    // Make sure we continue to ignore the fast-forward time.
-    mFastForwardTime = TimeStamp();
-  }
-
   if (!refreshTime.IsNull()) {
     mLastRefreshDriverTime = refreshTime;
   }
 
   return result;
 }
 
 Nullable<TimeDuration>
--- a/dom/animation/AnimationTimeline.h
+++ b/dom/animation/AnimationTimeline.h
@@ -50,31 +50,16 @@ public:
   // Converts a TimeStamp to the equivalent value in timeline time.
   // Note that when IsUnderTestControl() is true, there is no correspondence
   // between timeline time and wallclock time. In such a case, passing a
   // timestamp from TimeStamp::Now() to this method will not return a
   // meaningful result.
   Nullable<TimeDuration> ToTimelineTime(const TimeStamp& aTimeStamp) const;
   TimeStamp ToTimeStamp(const TimeDuration& aTimelineTime) const;
 
-  // Force the timeline to advance to |aTimeStamp|.
-  //
-  // Normally the timeline uses the refresh driver time but when we have
-  // animations that are timed from when their first frame is rendered we need
-  // to bring the timeline forward to that moment. If we don't, calling
-  // IsRunning() will incorrectly return false (because GetCurrentTime() will
-  // return a negative time) until the next refresh driver tick causes the
-  // timeline to catch up.
-  //
-  // |aTimeStamp| must be greater or equal to the current refresh driver
-  // time for the document with which this timeline is associated unless the
-  // refresh driver is under test control, in which case this method will
-  // be a no-op.
-  void FastForward(const TimeStamp& aTimeStamp);
-
   nsRefreshDriver* GetRefreshDriver() const;
   // Returns true if this timeline is driven by a refresh driver that is
   // under test control. In such a case, there is no correspondence between
   // TimeStamp values returned by the refresh driver and wallclock time.
   // As a result, passing a value from TimeStamp::Now() to ToTimelineTime()
   // would not return a meaningful result.
   bool IsUnderTestControl() const
   {
@@ -86,18 +71,14 @@ protected:
   TimeStamp GetCurrentTimeStamp() const;
 
   nsCOMPtr<nsIDocument> mDocument;
 
   // The most recently used refresh driver time. This is used in cases where
   // we don't have a refresh driver (e.g. because we are in a display:none
   // iframe).
   mutable TimeStamp mLastRefreshDriverTime;
-
-  // The time to which the timeline has been forced-to in order to account for
-  // animations that are started in-between frames.
-  mutable TimeStamp mFastForwardTime;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_AnimationTimeline_h