--- a/mobile/chrome/content/InputHandler.js
+++ b/mobile/chrome/content/InputHandler.js
@@ -427,17 +427,17 @@ function MouseModule(owner, browserViewC
this._clicker = null;
this._downUpEvents = [];
this._targetScrollInterface = null;
var self = this;
this._kinetic = new KineticController(
function _dragByBound(dx, dy) { return self._dragBy(dx, dy); },
- function _dragStopBound() { return self._doDragStop(0, 0, 0, true); }
+ function _dragStopBound() { return self._doDragStop(0, 0, true); }
);
}
MouseModule.prototype = {
handleEvent: function handleEvent(evInfo) {
if (evInfo.event.button !== 0) // avoid all but a clean left click
return;
@@ -598,54 +598,56 @@ MouseModule.prototype = {
},
/**
* Inform our dragger of a dragStart and update kinetic with new data.
*/
_doDragStart: function _doDragStart(event) {
let dragData = this._dragData;
+ // addData must be called before setDragStart. Otherwise addData may end kinetic panning and
+ // thus accidentally end the drag we've just begun.
+ this._kinetic.addData(event.screenX, event.screenY);
dragData.setDragStart(event.screenX, event.screenY);
- this._kinetic.addData(event.screenX, event.screenY, event.timeStamp);
this._dragger.dragStart(event.clientX, event.clientY, event.target, this._targetScrollInterface);
},
/**
* Finish a drag. The third parameter is a secret one used to distinguish
* between the supposed end of drag caused by a mouseup and the real end
* of drag which happens when KineticController::end() is called.
*/
- _doDragStop: function _doDragStop(sX, sY, t, kineticStop) {
+ _doDragStop: function _doDragStop(sX, sY, kineticStop) {
let dragData = this._dragData;
if (!kineticStop) { // we're not really done, since now it is
// kinetic's turn to scroll about
let dx = dragData.sX - sX;
let dy = dragData.sY - sY;
dragData.endDrag();
- this._kinetic.addData(sX, sY, t);
+ this._kinetic.addData(sX, sY);
this._kinetic.start();
} else { // now we're done, says our secret 3rd argument
this._dragger.dragStop(0, 0, this._targetScrollInterface);
dragData.reset();
}
},
/**
* Update kinetic with new data and drag.
*/
- _doDragMove: function _doDragMove(sX, sY, t) {
+ _doDragMove: function _doDragMove(sX, sY) {
let dragData = this._dragData;
let dX = dragData.sX - sX;
let dY = dragData.sY - sY;
- this._kinetic.addData(sX, sY, t);
+ this._kinetic.addData(sX, sY);
return this._dragBy(dX, dY);
},
/**
* Used by _doDragMove() above and by KineticController's timer to do the
* actual dragMove signalling to the dragger. We'd put this in _doDragMove()
* but then KineticController would be adding to its own data as it signals
* the dragger of dragMove()s.
@@ -903,17 +905,17 @@ DragData.prototype = {
sY = this.lockedY;
}
return [sX, sY];
}
// check to see if mouse move is after the timeout
let now = Date.now();
if (now - this._dragStartTime < kMsUntilLock) {
// Util.dumpLn("*** pre-lock, return no movement");
- return [this.sX, this.sY];
+ return [this.sX, this.sY];
}
// Util.dumpLn("*** this.sX/sY: ", this.sX, ",", this.sY, " sX/sY: ", sX, ",", sY);
// look at difference from stored coord to lock movement, but only
// do it if initial movement is sufficient to detect intent
let absX = Math.abs(this.sX - sX);
let absY = Math.abs(this.sY - sY);
@@ -1090,23 +1092,23 @@ KineticController.prototype = {
},
end: function end() {
if (this._beforeEnd)
this._beforeEnd();
this._reset();
},
- addData: function addData(sx, sy, t) {
+ addData: function addData(sx, sy) {
// if we're active, end that move before adding data
if (this.isActive())
this.end();
let mbLength = this.momentumBuffer.length;
- let now = t || Date.now();
+ let now = Date.now();
// avoid adding duplicates which would otherwise slow down the speed
if (mbLength > 0) {
let mbLast = this.momentumBuffer[mbLength - 1];
if ((mbLast.sx == sx && mbLast.sy == sy) || mbLast.t == now) {
mbLast.sx = sx;
mbLast.sy = sy;
mbLast.t = now;