Back out
bug 540008 because it causes jerky panning on device.
--- a/mobile/chrome/content/InputHandler.js
+++ b/mobile/chrome/content/InputHandler.js
@@ -22,17 +22,16 @@
*
* Contributor(s):
* Stuart Parmenter <stuart@mozilla.com>
* Brad Lassey <blassey@mozilla.com>
* Mark Finkle <mfinkle@mozilla.com>
* Gavin Sharp <gavin.sharp@gmail.com>
* Ben Combee <combee@mozilla.com>
* Roy Frostig <rfrostig@mozilla.com>
- * Matt Brubeck <mbrubeck@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
@@ -53,19 +52,16 @@ const kDoubleClickThreshold = 200;
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
const kStateActive = 0x00000001;
-// threshold in ms for touch and hold to stop kinetic scrolling
-const kKineticBrakesDelay = 50;
-
/**
* InputHandler
*
* The input handler is an arbiter between the Fennec chrome window inputs and any
* registered input modules. It keeps an array of input module objects. Incoming
* input events are wrapped in an EventInfo object and passed down to the input modules
* in the order of the modules array. Every registed module thus gets called with
* an EventInfo for each event that the InputHandler is registered to listen for.
@@ -428,23 +424,20 @@ MouseModule.prototype = {
}
dragData.reset();
// walk up the DOM tree in search of nearest scrollable ancestor. nulls are
// returned if none found.
let [targetScrollbox, targetScrollInterface]
= this.getScrollboxFromElement(aEvent.target);
- if (this._kinetic.isActive()) {
- let oldInterface = this._targetScrollInterface;
- if (targetScrollInterface != oldInterface)
- this._kinetic.end(); // stop right away if targetScrollbox has changed
- else
- this._kinetic.brakesApplied(); // otherwise, stop soon
- }
+ // stop kinetic panning if targetScrollbox has changed
+ let oldInterface = this._targetScrollInterface;
+ if (this._kinetic.isActive() && targetScrollInterface != oldInterface)
+ this._kinetic.end();
let targetClicker = this.getClickerFromElement(aEvent.target);
this._targetScrollInterface = targetScrollInterface;
this._dragger = (targetScrollInterface) ? (targetScrollbox.customDragger || this._defaultDragger)
: null;
this._clicker = (targetClicker) ? targetClicker.customClicker : null;
@@ -987,21 +980,16 @@ function KineticController(aPanBy, aEndC
KineticController.prototype = {
_reset: function _reset() {
if (this._callback) {
removeEventListener("MozBeforePaint", this._callback, false);
this._callback = null;
}
- if (this._brakesTimeout) {
- clearTimeout(this._brakesTimeout);
- delete this._brakesTimeout;
- }
-
this.momentumBuffer = [];
this._velocity.set(0, 0);
},
isActive: function isActive() {
return !!this._callback;
},
@@ -1140,30 +1128,16 @@ KineticController.prototype = {
if (this.isActive()) {
// Stop active movement when dragging in other direction.
if (dx * this._velocity.x < 0 || dy * this._velocity.y < 0)
this.end();
}
this.momentumBuffer.push({'t': now, 'dx' : dx, 'dy' : dy});
-
- if (dx > 0 && dy > 0 && this._brakesTimeout) {
- clearTimeout(this._brakesTimeout);
- delete this._brakesTimeout;
- }
- },
-
- /** Stop panning very soon if no more movement is added. */
- brakesApplied: function brakesApplied() {
- let self = this;
- this._brakesTimeout = setTimeout(function() {
- self.end();
- delete self._brakesTimeout;
- }, kKineticBrakesDelay);
}
};
/**
* Input module for basic key input.
*/
function KeyModule(owner, browserViewContainer) {