Bug 455352 - Stuck kinetic scrolling r=stuart
authorBrad Lassey <blassey@mozilla.com>
Mon, 15 Sep 2008 22:34:11 -0400
changeset 64832 7f3acc91462e5895803cc679a6055b0982a451a7
parent 64831 dac2b94d3b285f8382e7332cb6892b8e9374eee8
child 64833 43fcdd84876130911f4f6d53c3802c712b6bf80b
push id19389
push userffxbld
push dateWed, 06 Apr 2011 21:33:21 +0000
treeherdermozilla-central@8e9f90073a20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstuart
bugs455352
Bug 455352 - Stuck kinetic scrolling r=stuart
mobile/chrome/content/deckbrowser.xml
--- a/mobile/chrome/content/deckbrowser.xml
+++ b/mobile/chrome/content/deckbrowser.xml
@@ -766,16 +766,18 @@
                let [destPageX, destPageY] =  this._constrainPanCoords(this._screenToPage(this.dragData.dragX 
                                                                       + this.dragData.velocityX * 800),
                                                                       this._screenToPage(this.dragData.dragY 
                                                                       + this.dragData.velocityY * 800));
 
                this.dragData.destinationX = -this._pageToScreen(destPageX);
                this.dragData.destinationY = -this._pageToScreen(destPageY);
 
+               if (this.dragData.kineticId)
+                 window.clearInterval(this.dragData.kineticId);
                this.dragData.kineticId = window.setInterval(this._doKinetic, dt / (this.PAN_EVENTS_TO_TRACK - 1), 
                                                             this, dt / (this.PAN_EVENTS_TO_TRACK - 1));
              } else {
                this._endPan();
              }
            } else {
              this._endPan()
            }
@@ -894,40 +896,43 @@
           mousedown: function seh_mousedown(aEvent) {
             if (aEvent.button != 0)
               return;
 
             // cancel any pending canvas updates, since we're going to update again
             if (this._updateTimeout)
               clearTimeout(this._updateTimeout);
 
+            // stop any kinetic scrolling
+            var self = this.deckbrowser;
+            if (self.dragData.kineticId)
+               self._endKinetic(); 
+
             var zoomLevel = this.deckbrowser._zoomLevel;
             var dragData = this.deckbrowser.dragData;
 
             // The start of the current portion drag
             dragData.sX = aEvent.screenX;
             dragData.sY = aEvent.screenY;
 
             // The total delta between current mouse position and sX/sY
             dragData.dragX = 0;
             dragData.dragY = 0;
 
             //this.deckbrowser._updateCanvasPosition();
 
-            var self = this.deckbrowser;
             this.deckbrowser._dragStartTimeout = setTimeout(function () {
               self._dragStartTimer();
             }, 200);
 
             this._lastMouseDown = aEvent;
             for (var i = 0; i < self.PAN_EVENTS_TO_TRACK; i++) {
               self._panEventTracker[i] = null;
             }
-            if (self.dragData.kineticId)
-               self._endPan();
+            
           },
 
           mouseup: function seh_mouseup(aEvent) {
             if (aEvent.button == 0 && this.deckbrowser.dragData.dragging) {
               this.deckbrowser.dragData.dragging = false;
             } else if (aEvent.originalTarget == this.deckbrowser._canvas) {
               // Mouseup on canvas that isn't releasing from a drag
               // cancel scrollStart timer