Back out bug 540008 because it causes jerky panning on device.
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 17 Aug 2010 14:50:07 -0700
changeset 66455 3ec69509aa52a104be1f4c0a4084d59477a3aadd
parent 66453 89dd39bfdf438fd9b8eb2f72ec281ca460f94ffb (current diff)
parent 66454 60f6c44808ea5ebf3b376d73621548e3b4d03e29 (diff)
child 66456 09ad2b1d62e66f35dd725f7881b4d45590ed9a7e
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)
bugs540008
Back out bug 540008 because it causes jerky panning on device.
mobile/chrome/content/InputHandler.js
--- 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) {