Bug 639179 Part 1: Fix waitingForPaint bug when kinetic panning is active r=mbrubeck
☠☠ backed out by fe3f7889918b ☠ ☠
authorBenjamin Stover <bstover@mozilla.com>
Sat, 09 Apr 2011 12:38:18 -0700
changeset 67741 5d997f85c1b9c9a097d85640d5f7b3a3d557c349
parent 67740 f3a7ce5dbfcbda1e09b3325fd10913feef09b0f7
child 67742 195c8ad12184ad608834101a8985018cab58632b
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)
reviewersmbrubeck
bugs639179
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 639179 Part 1: Fix waitingForPaint bug when kinetic panning is active r=mbrubeck
mobile/chrome/content/input.js
--- a/mobile/chrome/content/input.js
+++ b/mobile/chrome/content/input.js
@@ -323,21 +323,18 @@ MouseModule.prototype = {
       //
       let [sX, sY] = dragData.panPosition();
       this.dX += dragData.prevPanX - sX;
       this.dY += dragData.prevPanY - sY;
 
       if (dragData.isPan()) {
         // Only pan when mouse event isn't part of a click. Prevent jittering on tap.
         this._kinetic.addData(sX - dragData.prevPanX, sY - dragData.prevPanY);
-        if (!this._waitingForPaint) {
-          this._dragBy(this.dX, this.dY);
-          this.dX = 0;
-          this.dY = 0;
-        }
+        this._dragBy(this.dX, this.dY);
+        // dragBy will reset dX and dY values to 0.
 
         // Let everyone know when mousemove begins a pan
         if (!oldIsPan && dragData.isPan()) {
           this._mouseOverTimeout.clear();
           this._longClickTimeout.clear();
 
           let event = document.createEvent("Events");
           event.initEvent("PanBegin", true, false);
@@ -389,21 +386,26 @@ MouseModule.prototype = {
 
   /**
    * Used by _onMouseMove() above and by KineticController's timer to do the
    * actual dragMove signalling to the dragger.  We'd put this in _onMouseMove()
    * but then KineticController would be adding to its own data as it signals
    * the dragger of dragMove()s.
    */
   _dragBy: function _dragBy(dX, dY, aIsKinetic) {
-    let dragData = this._dragData;
-    let dragged = this._dragger.dragMove(dX, dY, this._targetScrollInterface, aIsKinetic);
-    if (dragged && !this._waitingForPaint) {
-      this._waitingForPaint = true;
-      mozRequestAnimationFrame(this);
+    let dragged = true;
+    if (!this._waitingForPaint || aIsKinetic) {
+      let dragData = this._dragData;
+      dragged = this._dragger.dragMove(dX, dY, this._targetScrollInterface, aIsKinetic);
+      if (dragged && !this._waitingForPaint) {
+        this._waitingForPaint = true;
+        mozRequestAnimationFrame(this);
+      }
+      this.dX = 0;
+      this.dY = 0;
     }
     return dragged;
   },
 
   /** Callback for kinetic scroller. */
   _kineticStop: function _kineticStop() {
     // Kinetic panning could finish while user is panning, so don't finish
     // the pan just yet.