Bug 841830: Allow scrolling while tap/pan gesture is still ambiguous, for perceived responsiveness. r=vingtetun
authorChris Jones <jones.chris.g@gmail.com>
Fri, 15 Feb 2013 11:41:23 -0800
changeset 122064 6f049c930bc22f773939c976d426c934c2ca2d33
parent 122063 727072808d9fca65cf4e29b271be44b3aec7b364
child 122065 ca388aedb410ed987bd4d6063f3052df81fbd09d
push id24317
push userryanvm@gmail.com
push dateSat, 16 Feb 2013 14:49:39 +0000
treeherdermozilla-central@484dbca61133 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs841830
milestone21.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 841830: Allow scrolling while tap/pan gesture is still ambiguous, for perceived responsiveness. r=vingtetun
dom/browser-element/BrowserElementPanning.js
--- a/dom/browser-element/BrowserElementPanning.js
+++ b/dom/browser-element/BrowserElementPanning.js
@@ -236,19 +236,20 @@ 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
+    if (!isPan && this.detectingScrolling) {
+      // If panning distance is not large enough and we're waiting to
+      // see whether we should use the sync scroll fallback or not,
+      // don't attempt scrolling.
       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.
@@ -257,25 +258,27 @@ const ContentPanning = {
         Services.obs.notifyObservers(docShell, 'cancel-default-pan-zoom', null);
       } else {
         // Let AsyncPanZoomController handle the scrolling gesture.
         this.scrollCallback = null;
         return;
       }
     }
 
-    // If a pan action happens, cancel the active state of the
+    // If we've detected a pan gesture, cancel the active state of the
     // current target.
     if (!this.panning && isPan) {
       this.panning = true;
       this._resetActive();
       this._activationTimer.cancel();
     }
 
     if (this.panning) {
+      // Only do this when we're actually executing a pan gesture.
+      // Otherwise synthetic mouse events will be canceled.
       evt.stopPropagation();
       evt.preventDefault();
     }
   },
 
   // nsITimerCallback
   notify: function cp_notify(timer) {
     this._setActive(this.pointerDownTarget);