Bug 1326686 - Only use the most recent refresh time as the start time of an AsyncScroll when the refresh driver is under test control. r=kip draft
authorBotond Ballo <botond@mozilla.com>
Fri, 20 Jan 2017 19:28:29 -0500
changeset 464543 58ea615484a54b74b76f17e859136cf371b7c05f
parent 463391 2233e03ef6fcee477e6436f932d7464dff161054
child 542929 fb6e3750f8278a89908e3589c29902442eafac73
push id42362
push userbballo@mozilla.com
push dateSat, 21 Jan 2017 00:30:02 +0000
reviewerskip
bugs1326686
milestone53.0a1
Bug 1326686 - Only use the most recent refresh time as the start time of an AsyncScroll when the refresh driver is under test control. r=kip MozReview-Commit-ID: FkyJfbaPPVl
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2277,17 +2277,19 @@ ScrollFrameHelper::ScrollToWithOrigin(ns
   if (aMode == nsIScrollableFrame::INSTANT) {
     // Asynchronous scrolling is not allowed, so we'll kill any existing
     // async-scrolling process and do an instant scroll.
     CompleteAsyncScroll(range, aOrigin);
     return;
   }
 
   nsPresContext* presContext = mOuter->PresContext();
-  TimeStamp now = presContext->RefreshDriver()->MostRecentRefresh();
+  TimeStamp now = presContext->RefreshDriver()->IsTestControllingRefreshesEnabled()
+                ? presContext->RefreshDriver()->MostRecentRefresh()
+                : TimeStamp::Now();
   bool isSmoothScroll = (aMode == nsIScrollableFrame::SMOOTH) &&
                           IsSmoothScrollingEnabled();
 
   nsSize currentVelocity(0, 0);
 
   if (gfxPrefs::ScrollBehaviorEnabled()) {
     if (aMode == nsIScrollableFrame::SMOOTH_MSD) {
       mIgnoreMomentumScroll = true;