Bug 1031067 - Clear overscroll at the end of a pinch. r=kats, a=2.0+
authorBotond Ballo <botond@mozilla.com>
Tue, 08 Jul 2014 17:07:12 -0400
changeset 208892 06dd0707ddbf6145716949fb72ef7e69fd4c7e1d
parent 208891 dd403b084fd52d17e4cf65679203b487cb19a2d4
child 208893 9297a56e155ee31435b10084559dd75e2e3f6373
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, 2
bugs1031067
milestone32.0a2
Bug 1031067 - Clear overscroll at the end of a pinch. r=kats, a=2.0+
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -872,16 +872,20 @@ APZCTreeManager::DispatchScroll(AsyncPan
 
     next = mOverscrollHandoffChain[aOverscrollHandoffChainIndex];
   }
 
   if (next == nullptr) {
     return false;
   }
 
+  if (next->GetGuid().mLayersId != aPrev->GetGuid().mLayersId) {
+    NS_WARNING("Handing off scroll across a layer tree boundary; may need to revise approach to bug 1031067");
+  }
+
   // Convert the start and end points from |aPrev|'s coordinate space to
   // |next|'s coordinate space. Since |aPrev| may be the same as |next|
   // (if |aPrev| is the APZC that is initiating the scroll and there is no
   // scroll grabbing to grab the scroll from it), don't bother doing the
   // transformations in that case.
   if (next != aPrev) {
     TransformDisplacement(this, aPrev, next, aStartPoint, aEndPoint);
   }
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1238,16 +1238,25 @@ nsEventStatus AsyncPanZoomController::On
   if (!TouchActionAllowPinchZoom()) {
     return nsEventStatus_eIgnore;
   }
 
   SetState(NOTHING);
 
   {
     ReentrantMonitorAutoEnter lock(mMonitor);
+
+    // We can get into a situation where we are overscrolled at the end of a
+    // pinch if we go into overscroll with a two-finger pan, and then turn
+    // that into a pinch by increasing the span sufficiently. In such a case,
+    // there is no snap-back animation to get us out of overscroll, so we need
+    // to get out of it somehow.
+    mX.ClearOverscroll();
+    mY.ClearOverscroll();
+
     ScheduleComposite();
     RequestContentRepaint();
     UpdateSharedCompositorFrameMetrics();
   }
 
   return nsEventStatus_eConsumeNoDefault;
 }