Bug 522517: Panning sometimes causes link clicks [r=vingtetun]
--- a/mobile/chrome/content/InputHandler.js
+++ b/mobile/chrome/content/InputHandler.js
@@ -538,17 +538,17 @@ MouseModule.prototype = {
this._doDragStop(sX, sY, !dragData.checkPan(sX, sY));
if (this._clicker)
this._clicker.mouseUp(evInfo.event.clientX, evInfo.event.clientY);
if (this._targetIsContent(evInfo.event)) {
// User possibly clicked on something in content
this._recordEvent(evInfo);
- let commitToClicker = this._clicker && !dragData.checkPan(sX, sY);
+ let commitToClicker = this._clicker && dragData.checkClick(sX, sY);
if (commitToClicker)
// commit this click to the doubleclick timewait buffer
this._commitAnotherClick();
else
// clean the click buffer ourselves, since there was no clicker
// to commit to. when there is one, the path taken through
// _commitAnotherClick takes care of this.
this._cleanClickBuffer();
@@ -891,16 +891,21 @@ DragData.prototype = {
return false;
if (this._isPan)
return true;
let distanceSquared = (Math.pow(sX - this._originX, 2) + Math.pow(sY - this._originY, 2));
return (this._isPan = (distanceSquared > Math.pow(this._dragRadius, 2)));
},
+ /** Return true if drag should be parsed as a click. */
+ checkClick: function(sX, sY) {
+ return Date.now() - this._dragStartTime >= kMsUntilLock && !this.checkPan(sX, sY);
+ },
+
lockAxis: function lockAxis(sX, sY) {
if (this.locked) {
if (this.lockedX !== null) {
sX = this.lockedX;
}
else if (this.lockedY !== null) {
sY = this.lockedY;
}