Bug 828367 - APZC should not perform scrolling if BES detects panning distance is too small. r=cjones.
authorShih-Chiang Chien <schien@mozilla.com>
Fri, 11 Jan 2013 11:02:02 +0100
changeset 118553 cae4668deecd49a12be817835822957d49e11276
parent 118552 22b5a4e8c639b2e706ce12215e66be64a5509382
child 118554 48acf4054a035c6de87eb63c6af3140cca0fcf61
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerscjones
bugs828367
milestone21.0a1
Bug 828367 - APZC should not perform scrolling if BES detects panning distance is too small. r=cjones.
dom/browser-element/BrowserElementScrolling.js
gfx/layers/ipc/AsyncPanZoomController.cpp
--- a/dom/browser-element/BrowserElementScrolling.js
+++ b/dom/browser-element/BrowserElementScrolling.js
@@ -228,31 +228,38 @@ const ContentPanning = {
     KineticPanning.record(delta, evt.timeStamp);
 
     // There's no possibility of us panning anything.
     if (!this.scrollCallback) {
       return;
     }
 
     let isPan = KineticPanning.isPan();
+    if (!isPan) {
+      // If panning distance is not large enough, both BES and APZC
+      // should not perform scrolling
+      evt.preventDefault();
+      return;
+    }
+
+    let isScroll = this.scrollCallback(delta.scale(-1));
+
     if (this.detectingScrolling) {
       this.detectingScrolling = false;
       // Stop async-pan-zooming if the user is panning the subframe.
-      if (isPan) {
+      if (isScroll) {
         // We're going to drive synchronously scrolling an inner frame.
         Services.obs.notifyObservers(docShell, 'cancel-default-pan-zoom', null);
       } else {
         // Let AsyncPanZoomController handle the scrolling gesture.
         this.scrollCallback = null;
         return;
       }
     }
 
-    this.scrollCallback(delta.scale(-1));
-
     // If a pan action happens, cancel the active state of the
     // current target.
     if (!this.panning && isPan) {
       this.panning = true;
       this._resetActive();
       this._activationTimer.cancel();
     }
 
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1416,17 +1416,17 @@ void AsyncPanZoomController::ContentRece
         SetState(NOTHING);
       }
     }
 
     mHandlingTouchQueue = true;
 
     while (!mTouchQueue.IsEmpty()) {
       // we need to reset mDelayPanning before handling scrolling gesture.
-      if (mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_MOVE) {
+      if (!aPreventDefault && mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_MOVE) {
         mDelayPanning = false;
       }
       if (!aPreventDefault) {
         HandleInputEvent(mTouchQueue[0]);
       }
 
       if (mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_END ||
           mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_CANCEL) {