Bug 1193062 - Don't use PanGestureInput events for instant wheel scrolling. r?kats draft
authorMarkus Stange <mstange@themasta.com>
Tue, 11 Aug 2015 15:46:33 -0400
changeset 288002 d536ea1959f9abec23596c70165e93e5182bf8cf
parent 288001 ff27a721138afee41dadb3c4385e53beca1f5b73
child 288003 e5bef19195a6283aa478148dce60ade111298273
push id4779
push usermstange@themasta.com
push dateWed, 26 Aug 2015 16:55:40 +0000
reviewerskats
bugs1193062, 1156606
milestone43.0a1
Bug 1193062 - Don't use PanGestureInput events for instant wheel scrolling. r?kats This will make bug 1156606 unnecessary.
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1556,38 +1556,36 @@ nsEventStatus AsyncPanZoomController::On
           NS_LITERAL_STRING("MozMouseScrollFailed"));
       }
     }
     return nsEventStatus_eConsumeNoDefault;
   }
 
   switch (aEvent.mScrollMode) {
     case ScrollWheelInput::SCROLLMODE_INSTANT: {
-      // Decompose into pan events for simplicity.
-      PanGestureInput start(PanGestureInput::PANGESTURE_START, aEvent.mTime, aEvent.mTimeStamp,
-                            aEvent.mOrigin, ScreenPoint(0, 0), aEvent.modifiers);
-      start.mLocalPanStartPoint = aEvent.mLocalOrigin;
-      OnPanBegin(start);
-
-      // Pan gestures use natural directions which are inverted from scroll
-      // wheel and touchpad scroll gestures, so we invert x/y here.
-      ParentLayerPoint panDelta = -delta;
-
-      PanGestureInput move(PanGestureInput::PANGESTURE_PAN, aEvent.mTime, aEvent.mTimeStamp,
-                           aEvent.mOrigin,
-                           ToScreenCoordinates(panDelta, aEvent.mLocalOrigin),
-                           aEvent.modifiers);
-      move.mLocalPanStartPoint = aEvent.mLocalOrigin;
-      move.mLocalPanDisplacement = panDelta;
-      OnPan(move, ScrollSource::Wheel, false);
-
-      PanGestureInput end(PanGestureInput::PANGESTURE_END, aEvent.mTime, aEvent.mTimeStamp,
-                            aEvent.mOrigin, ScreenPoint(0, 0), aEvent.modifiers);
-      end.mLocalPanStartPoint = aEvent.mLocalOrigin;
-      OnPanEnd(start);
+      ReentrantMonitorAutoEnter lock(mMonitor);
+
+      CancelAnimation();
+      SetState(WHEEL_SCROLL);
+
+
+
+      ParentLayerPoint distance(fabs(delta.x), fabs(delta.y));
+
+      OverscrollHandoffState handoffState(
+          *mInputQueue->CurrentWheelBlock()->GetOverscrollHandoffChain(),
+          ToScreenCoordinates(distance, aEvent.mLocalOrigin),
+          ScrollSource::Wheel);
+      CallDispatchScroll(aEvent.mLocalOrigin,
+                         aEvent.mLocalOrigin - delta,
+                         handoffState);
+
+      SetState(NOTHING);
+      RequestContentRepaint();
+
       break;
     }
 
     case ScrollWheelInput::SCROLLMODE_SMOOTH: {
       // The lock must be held across the entire update operation, so the
       // compositor doesn't end the animation before we get a chance to
       // update it.
       ReentrantMonitorAutoEnter lock(mMonitor);