Bug 643770, stop autoscroll when mousewheel is moved, r=felipe
authorNeil Deakin <neil@mozilla.com>
Fri, 21 Oct 2016 11:22:25 -0400
changeset 319018 d3c97dbe7e36eb8032722833811f468be7c38c10
parent 319017 31ccffb49e72e3c02c39aebbb87c72cb495c7c20
child 319019 e7ebeead3cf5ecfae4950e89f7f2ba13812976f4
push id30858
push userryanvm@gmail.com
push dateSun, 23 Oct 2016 17:17:41 +0000
treeherdermozilla-central@a9a41b69f3f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs643770
milestone52.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 643770, stop autoscroll when mousewheel is moved, r=felipe
toolkit/content/widgets/browser.xml
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -1062,16 +1062,17 @@
       <method name="stopScroll">
         <body>
           <![CDATA[
             if (this._scrolling) {
               this._scrolling = false;
               window.removeEventListener("mousemove", this, true);
               window.removeEventListener("mousedown", this, true);
               window.removeEventListener("mouseup", this, true);
+              window.removeEventListener("DOMMouseScroll", this, true);
               window.removeEventListener("contextmenu", this, true);
               window.removeEventListener("keydown", this, true);
               window.removeEventListener("keypress", this, true);
               window.removeEventListener("keyup", this, true);
               this.messageManager.sendAsyncMessage("Autoscroll:Stop");
             }
          ]]>
        </body>
@@ -1081,16 +1082,17 @@
         <body>
           <![CDATA[
             const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
             var popup = document.createElementNS(XUL_NS, "panel");
             popup.className = "autoscroller";
             // We set this attribute on the element so that mousemove
             // events can be handled by browser-content.js.
             popup.setAttribute("mousethrough", "always");
+            popup.setAttribute("rolluponmousewheel", "true");
             return popup;
           ]]>
         </body>
       </method>
 
       <method name="startScroll">
         <parameter name="scrolldir"/>
         <parameter name="screenX"/>
@@ -1127,16 +1129,17 @@
             this._ignoreMouseEvents = true;
             this._scrolling = true;
             this._startX = screenX;
             this._startY = screenY;
 
             window.addEventListener("mousemove", this, true);
             window.addEventListener("mousedown", this, true);
             window.addEventListener("mouseup", this, true);
+            window.addEventListener("DOMMouseScroll", this, true);
             window.addEventListener("contextmenu", this, true);
             window.addEventListener("keydown", this, true);
             window.addEventListener("keypress", this, true);
             window.addEventListener("keyup", this, true);
          ]]>
         </body>
       </method>
 
@@ -1162,16 +1165,21 @@
                   // Use a timeout to prevent the mousedown from opening the popup again.
                   // Ideally, we could use preventDefault here, but contenteditable
                   // and middlemouse paste don't interact well. See bug 1188536.
                   setTimeout(() => this._autoScrollPopup.hidePopup(), 0);
                 }
                 this._ignoreMouseEvents = false;
                 break;
               }
+              case "DOMMouseScroll": {
+                this._autoScrollPopup.hidePopup();
+                event.preventDefault();
+                break;
+              }
               case "popuphidden": {
                 this._autoScrollPopup.removeEventListener("popuphidden", this, true);
                 this.stopScroll();
                 break;
               }
               case "keydown": {
                 if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
                   // the escape key will be processed by