Bug 1016035 - Set overscroll information on potential swipe start events that have been processed by APZ. r?masayuki draft
authorMarkus Stange <mstange@themasta.com>
Sat, 08 Aug 2015 14:50:43 -0400
changeset 288175 e162e68cc21c54435329bda07dc8a2c386d355f5
parent 288174 e3ac9dd1bb3dcb763f8e24b269cf696ec83141fa
child 288176 cf0b020e74c63f9c15680a5051e94a6619020a20
push id4815
push usermstange@themasta.com
push dateThu, 27 Aug 2015 05:31:12 +0000
reviewersmasayuki
bugs1016035
milestone43.0a1
Bug 1016035 - Set overscroll information on potential swipe start events that have been processed by APZ. r?masayuki
dom/events/EventStateManager.cpp
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -3065,16 +3065,27 @@ EventStateManager::PostHandleEvent(nsPre
       // When APZ is enabled, the actual scroll animation might be handled by
       // the compositor.
       WheelPrefs::Action action;
       if (wheelEvent->mFlags.mHandledByAPZ) {
         action = WheelPrefs::ACTION_NONE;
       } else {
         action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent);
       }
+
+      if (wheelEvent->mFlags.mHandledByAPZ && wheelEvent->mFlags.mCanTriggerSwipe &&
+          !ComputeScrollTarget(aTargetFrame, wheelEvent, COMPUTE_DEFAULT_ACTION_TARGET)) {
+        // No scrollframe is available for scrolling in the requested direction.
+        wheelEvent->mViewPortIsOverscrolled = true;
+        wheelEvent->overflowDeltaX = wheelEvent->deltaX;
+        wheelEvent->overflowDeltaY = wheelEvent->deltaY;
+        WheelPrefs::GetInstance()->
+          CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
+      }
+
       switch (action) {
         case WheelPrefs::ACTION_SCROLL: {
           // For scrolling of default action, we should honor the mouse wheel
           // transaction.
 
           ScrollbarsForWheel::PrepareToScrollText(this, aTargetFrame, wheelEvent);
 
           if (aEvent->mMessage != NS_WHEEL_WHEEL ||