Bug 602985 JS error: _dragger is null r=mbrubeck
authorBenjamin Stover <bstover@mozilla.com>
Fri, 08 Oct 2010 15:18:42 -0700
changeset 2177 a67f6b26894235df217118c54c5aaaefd09fc1c1
parent 2176 604c4cbfc09129765027d5c15a98fe47ef665641
child 2178 b823c73403baff2bc78739e616aa2dc5635ba9ae
push id1832
push userbstover@mozilla.com
push dateFri, 08 Oct 2010 22:09:26 +0000
reviewersmbrubeck
bugs602985
Bug 602985 JS error: _dragger is null r=mbrubeck
chrome/content/input.js
--- a/chrome/content/input.js
+++ b/chrome/content/input.js
@@ -315,22 +315,26 @@ MouseModule.prototype = {
     if (!this._kinetic.isActive())
       this._dragger.dragStart(event.clientX, event.clientY, event.target, this._targetScrollInterface);
   },
 
   /** Finish a drag. */
   _doDragStop: function _doDragStop() {
     this._dragData.endDrag();
 
+    // Note: it is possible for kinetic scrolling to be active from a
+    // mousedown/mouseup event previous to this one. In this case, we
+    // want the kinetic panner to tell our drag interface to stop.
+
     let dragData = this._dragData;
-    if (!dragData.isPan()) {
-      // There was no pan, so just stop dragger.
+    if (!dragData.isPan() && !this._kinetic.isActive()) {
+      // There was no pan and no kinetic scrolling, so just stop dragger.
       this._dragger.dragStop(0, 0, this._targetScrollInterface);
       this._dragger = null;
-    } else {
+    } else if (dragData.isPan()) {
       // Start kinetic pan.
       let [sX, sY] = dragData.panPosition();
       let dX = dragData.prevPanX - sX;
       let dY = dragData.prevPanY - sY;
       this._kinetic.addData(-dX, -dY);
       this._kinetic.start();
     }
   },