Bug 587814 - Smoother panning using mozAnimationFrame (pt 2) [r=mfinkle]
authorBenjamin Stover <bstover@mozilla.com>
Mon, 16 Aug 2010 14:58:20 -0700
changeset 66447 b0446d0c22ed8668aea7858c43b4f2802dd52658
parent 66446 709cb7795753dcf76a63e5a55a09cc6a8c3f1f39
child 66448 1b7ae6166091ffb00e0c154d32edd72d30eb25c2
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)
reviewersmfinkle
bugs587814
Bug 587814 - Smoother panning using mozAnimationFrame (pt 2) [r=mfinkle]
mobile/chrome/content/InputHandler.js
--- a/mobile/chrome/content/InputHandler.js
+++ b/mobile/chrome/content/InputHandler.js
@@ -982,32 +982,32 @@ function KineticController(aPanBy, aEndC
   // Number of milliseconds that can contain a swipe. Movements earlier than this are disregarded.
   this._swipeLength = Services.prefs.getIntPref("browser.ui.kinetic.swipeLength");
 
   this._reset();
 }
 
 KineticController.prototype = {
   _reset: function _reset() {
-    if (this._timer != null) {
-      this._timer.cancel();
-      this._timer = null;
+    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._timer != null);
+    return !!this._callback;
   },
 
   _startTimer: function _startTimer() {
     // Use closed form of a parabola to calculate each position for panning.
     // x(t) = v0*t + .5*t^2*a
     // where: v0 is initial velocity
     //        a is acceleration
     //        t is time elapsed