Bug 593499 - Increase the double-tap thresholds [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Sun, 05 Sep 2010 07:23:01 -0700
changeset 66533 e61598524de2a40480e035403942ac5d79a87aa8
parent 66532 84f3af5fd282f106bc31a460ae5259b89f32935f
child 66534 3d2d26bbd2a2531ae1be4343d042d2d2228d2e63
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs593499
Bug 593499 - Increase the double-tap thresholds [r=mfinkle]
mobile/chrome/content/InputHandler.js
mobile/chrome/content/browser.js
mobile/chrome/content/content.js
--- a/mobile/chrome/content/InputHandler.js
+++ b/mobile/chrome/content/InputHandler.js
@@ -41,17 +41,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // how many msecs elapse before two taps are not a double tap
 const kDoubleClickInterval = 400;
 
 // threshold in ms to detect if the click is possibly a dblClick
-const kDoubleClickThreshold = 200;
+const kDoubleClickThreshold = 300;
 
 // threshold in pixels for sensing a tap as opposed to a pan
 const kTapRadius = 25;
 
 // maximum drag distance in pixels while axis locking can still be reverted
 const kAxisLockRevertThreshold = 200;
 
 // Same as NS_EVENT_STATE_ACTIVE from nsIEventStateManager.h
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1627,21 +1627,23 @@ ContentCustomClicker.prototype = {
     this._dispatchMouseEvent("Browser:MouseCancel");
   },
 
   doubleClick: function doubleClick(aX1, aY1, aX2, aY2) {
     TapHighlightHelper.hide();
 
     this._dispatchMouseEvent("Browser:MouseCancel");
 
-    const kDoubleClickRadius = 32;
+    const kDoubleClickRadius = 100;
 
     let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel();
-    let isClickInRadius = (Math.abs(aX1 - aX2) < maxRadius && Math.abs(aY1 - aY2) < maxRadius);
-    if (isClickInRadius)
+    let dx = aX2 - aX1;
+    let dy = aY1 - aY2;
+
+    if (dx*dx + dy*dy < maxRadius*maxRadius)
       this._dispatchMouseEvent("Browser:ZoomToPoint", aX1, aY1);
   },
 
   toString: function toString() {
     return "[ContentCustomClicker] { }";
   }
 };
 
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -1,13 +1,13 @@
 // This stays here because otherwise it's hard to tell if there's a parsing error
 dump("###################################### content loaded\n");
 
 // how many milliseconds before the mousedown and the overlay of an element
-const kTapOverlayTimeout = 200;
+const kTapOverlayTimeout = 300;
 
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 let gFocusManager = Cc["@mozilla.org/focus-manager;1"]
@@ -496,17 +496,17 @@ Content.prototype = {
           this._overlayTimeout.once(kTapOverlayTimeout, function() {
             let rects = getContentClientRects(element);
             sendAsyncMessage("Browser:Highlight", { rects: rects });
           });
         }
 
         // We add a few milliseconds because of how the InputHandler wait before
         // dispatching a single click (default: 500)
-        this._contextTimeout.once(500 + 200, function() {
+        this._contextTimeout.once(500 + kTapOverlayTimeout, function() {
           let event = content.document.createEvent("PopupEvents");
           event.initEvent("contextmenu", true, true);
           element.dispatchEvent(event);
         });
         break;
 
       case "Browser:MouseUp": {
         let element = elementFromPoint(x, y);