Bug 593499 - Increase the double-tap thresholds [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Sun, 05 Sep 2010 07:23:01 -0700
changeset 1889 aeb8aa5a377f822c06bcd950b7a639aa8a8c2def
parent 1888 e99b086633096dbd93d98b4e50073aa5008ce32e
child 1890 8634ec07ce92f56ae38571e243b37a8930c1ea7d
push id1669
push usermbrubeck@mozilla.com
push dateSun, 05 Sep 2010 14:26:37 +0000
reviewersmfinkle
bugs593499
Bug 593499 - Increase the double-tap thresholds [r=mfinkle]
chrome/content/InputHandler.js
chrome/content/browser.js
chrome/content/content.js
--- a/chrome/content/InputHandler.js
+++ b/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/chrome/content/browser.js
+++ b/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/chrome/content/content.js
+++ b/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);