Bug 1266154 - Don't start a scroll snap animation if we're already at the destination. r=kats
authorBotond Ballo <botond@mozilla.com>
Mon, 18 Apr 2016 20:05:17 -0400
changeset 294167 e71e60f1459bdbe049b6baa8da439808e2455eb8
parent 294166 05176146dbf31778259f857e5166cdc9be97e94d
child 294168 d430b697c76d7402818653ba2b4fef3c249ffc4e
push id30201
push userkwierso@gmail.com
push dateThu, 21 Apr 2016 21:41:56 +0000
treeherdermozilla-central@0891f0fa044c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1266154
milestone48.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 1266154 - Don't start a scroll snap animation if we're already at the destination. r=kats MozReview-Commit-ID: EP7s414NQ4K
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -3961,17 +3961,19 @@ Maybe<CSSPoint> AsyncPanZoomController::
     return Some(scrollRange.ClampPoint(cssSnapPoint));
   }
   return Nothing();
 }
 
 void AsyncPanZoomController::ScrollSnapNear(const CSSPoint& aDestination) {
   if (Maybe<CSSPoint> snapPoint =
         FindSnapPointNear(aDestination, nsIScrollableFrame::DEVICE_PIXELS)) {
-    SmoothScrollTo(*snapPoint);
+    if (*snapPoint != mFrameMetrics.GetScrollOffset()) {
+      SmoothScrollTo(*snapPoint);
+    }
   }
 }
 
 void AsyncPanZoomController::ScrollSnap() {
   ReentrantMonitorAutoEnter lock(mMonitor);
   ScrollSnapNear(mFrameMetrics.GetScrollOffset());
 }