Bug 609619 - "[Regression] Switching between browser control panes in intervals of 1/2 a second results in previous pane being shown" [r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Mon, 08 Nov 2010 08:03:00 -0500
changeset 67018 5702d990abac4f66b256a821a31c9f6b409f9b22
parent 67017 a83a8a6928f7cab63593c18eafe418c8dfdd3194
child 67019 a4061906c3a92ddc02c6f84a9ddd3df0921c0e85
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)
reviewersmark
bugs609619
Bug 609619 - "[Regression] Switching between browser control panes in intervals of 1/2 a second results in previous pane being shown" [r=mark.finkle]
mobile/chrome/content/input.js
--- a/mobile/chrome/content/input.js
+++ b/mobile/chrome/content/input.js
@@ -253,17 +253,17 @@ MouseModule.prototype = {
           this._cleanClickBuffer();
       }
     }
 
     this._longClickTimeout.clear();
     this._target = null;
 
     // Do pan
-    if (dragData.isPan()) {
+    if (dragData.isPan() && this._dragger) {
       // User was panning around, do not allow click
       let generatesClick = aEvent.detail;
       if (generatesClick)
         aEvent.target.addEventListener("click", this, true);
     }
 
     // Move the caret to the end of the target input field and focus it
     if (this._inputField && !this._dragData.isPan()) {
@@ -545,19 +545,19 @@ var ScrollUtils = {
   },
 
   /**
    * Determine is the distance between two points can be considered as a pan
    * action by using the same drag threshold as the one use in the platform 
    * ui.dragThresholdX
    */
   isPan: function isPan(aPoint, aPoint2) {
-    let distanceSquared = (Math.pow(aPoint.x - aPoint2.x, 2) +
-                           Math.pow(aPoint.y - aPoint2.y, 2));
-    return distanceSquared > Math.pow(this.tapRadius, 2);
+    if (Math.abs(aPoint.x - aPoint2.x) > this.tapRadius ||
+        Math.abs(aPoint.y - aPoint2.y) > this.tapRadius)
+    return true;
   },
 
   /**
    * The default dragger object used by MouseModule when dragging a scrollable
    * element that provides no customDragger.  Simply performs the expected
    * regular scrollBy calls on the scroller.
    */
   _defaultDragger: {