Bug 511898: Double-click with two clicks on different areas of the page results in zoom of area of second click [r=combee]
authorVivien Nicolas <21@vingtetun.org>
Sat, 24 Oct 2009 01:06:29 -0400
changeset 65707 a3ff6c9d34685d9d1896fdc685e5275666769ef2
parent 65706 91ec70f2310d5b750ebf78af17219181baa75af2
child 65708 9e1a3d0f82af3b165d9a87b5600e8f00769c3b7f
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)
reviewerscombee
bugs511898
Bug 511898: Double-click with two clicks on different areas of the page results in zoom of area of second click [r=combee]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1524,18 +1524,22 @@ ContentCustomClicker.prototype = {
         let element = Browser.elementFromPoint(elementX, elementY);
         let uri = Util.getHrefForElement(element);
         if (uri)
           Browser.addTab(uri, false);
       }
     },
 
     doubleClick: function doubleClick(cX1, cY1, cX2, cY2) {
-      if (!Browser.zoomToPoint(cX2, cY2))
-        Browser.zoomFromPoint(cX2, cY2);
+      const kDoubleClickRadius = 32;
+      
+      let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel();
+      let isClickInRadius = (Math.abs(cX1 - cX2) < maxRadius && Math.abs(cY1 - cY2) < maxRadius);
+      if (isClickInRadius && !Browser.zoomToPoint(cX1, cY1))
+        Browser.zoomFromPoint(cX1, cY1);
     },
 
     toString: function toString() {
       return "[ContentCustomClicker] { }";
     }
 };
 
 /**