Bug 779358 - Fix mousemove event handled twice in content panning, r=cjones
authorCervantes Yu <cyu@mozilla.com>
Tue, 21 Aug 2012 20:30:34 +0800
changeset 103122 fca63fc533e2abb2aa003245e8112d76512c5c15
parent 103121 92ad8d042827fa246e21aecafd64c71bb8b575b0
child 103123 06f6eede6b774c09122233171093bdac54c6ad39
push id13835
push userechou@mozilla.com
push dateThu, 23 Aug 2012 08:16:32 +0000
treeherdermozilla-inbound@fca63fc533e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs779358
milestone17.0a1
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 779358 - Fix mousemove event handled twice in content panning, r=cjones
dom/browser-element/BrowserElementScrolling.js
--- a/dom/browser-element/BrowserElementScrolling.js
+++ b/dom/browser-element/BrowserElementScrolling.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const ContentPanning = {
   init: function cp_init() {
     ['mousedown', 'mouseup', 'mousemove'].forEach(function(type) {
-      addEventListener(type, ContentPanning, true);
+      addEventListener(type, ContentPanning, false);
     });
 
     addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
     addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
   },
 
   handleEvent: function cp_handleEvent(evt) {
     switch (evt.type) {
@@ -25,17 +25,17 @@ const ContentPanning = {
         break;
       case 'click':
         evt.stopPropagation();
         evt.preventDefault();
         
         let target = evt.target;
         let view = target.ownerDocument ? target.ownerDocument.defaultView
                                         : target;
-        view.removeEventListener('click', this, true, true);
+        view.removeEventListener('click', this, false, true);
         break;
     }
   },
 
   position: new Point(0 , 0),
 
   onTouchStart: function cp_onTouchStart(evt) {
     this.dragging = true;
@@ -78,17 +78,17 @@ const ContentPanning = {
 
     this.onTouchMove(evt);
 
     let click = evt.detail;
     if (this.target && click && (this.panning || this.preventNextClick)) {
       let target = this.target;
       let view = target.ownerDocument ? target.ownerDocument.defaultView
                                       : target;
-      view.addEventListener('click', this, true, true);
+      view.addEventListener('click', this, false, true);
     }
 
     if (this.panning)
       KineticPanning.start(this);
   },
 
   onTouchMove: function cp_onTouchMove(evt) {
     if (!this.dragging || !this.scrollCallback)
@@ -102,16 +102,18 @@ const ContentPanning = {
     this.scrollCallback(delta.scale(-1));
 
     // If a pan action happens, cancel the active state of the
     // current target.
     if (!this.panning && KineticPanning.isPan()) {
       this.panning = true;
       this._resetActive();
     }
+    evt.stopPropagation();
+    evt.preventDefault();
   },
 
 
   onKineticBegin: function cp_onKineticBegin(evt) {
   },
 
   onKineticPan: function cp_onKineticPan(delta) {
     return !this.scrollCallback(delta);