Backed out changeset 954189d579d5 (bug 1263975) for failures in test_mousescroll.xul
authorWes Kocher <wkocher@mozilla.com>
Thu, 14 Apr 2016 11:05:01 -0700
changeset 351775 b0628853f89996c5ddab16df37dbdebdc4bbc3d7
parent 351774 dc8cdaac96f3a9c68d80e5fbbef18f05097e751c
child 351776 77d53bf103a26592944ae70cd45a80f0204cd4b9
push id15527
push userbmo:rail@mozilla.com
push dateFri, 15 Apr 2016 01:44:41 +0000
bugs1263975
milestone48.0a1
backs out954189d579d5db542624d10c11108db60af13816
Backed out changeset 954189d579d5 (bug 1263975) for failures in test_mousescroll.xul MozReview-Commit-ID: 9fXzw19FUeb
toolkit/content/widgets/scrollbox.xml
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -492,52 +492,51 @@
             this.setAttribute("scrolledtostart", "true");
           else
             this.removeAttribute("scrolledtostart");
         ]]></body>
       </method>
     </implementation>
 
     <handlers>
-      <handler event="wheel"><![CDATA[
+      <handler event="DOMMouseScroll"><![CDATA[
         if (this.orient == "vertical") {
-          if (event.deltaMode == event.DOM_DELTA_PIXEL)
-            this.scrollByPixels(event.deltaY);
-          else
-            this.scrollByIndex(event.deltaY);
+          // prevent horizontal scrolling from scrolling a vertical scrollbox
+          if (event.axis == event.HORIZONTAL_AXIS)
+            return;
+          this.scrollByIndex(event.detail);
         }
         // We allow vertical scrolling to scroll a horizontal scrollbox
         // because many users have a vertical scroll wheel but no
         // horizontal support.
         // Because of this, we need to avoid scrolling chaos on trackpads
         // and mouse wheels that support simultaneous scrolling in both axes.
         // We do this by scrolling only when the last two scroll events were
         // on the same axis as the current scroll event.
-        // For diagonal scroll events we only respect the dominant axis.
         else {
-          let isVertical = Math.abs(event.deltaY) > Math.abs(event.deltaX);
-          let delta = isVertical ? event.deltaY : event.deltaX;
-          let scrollByDelta = isVertical && this._isRTLScrollbox ? -delta : delta;
+          let isVertical = event.axis == event.VERTICAL_AXIS;
 
-          if (this._prevMouseScrolls.every(prev => prev == isVertical)) {
-            if (event.deltaMode == event.DOM_DELTA_PIXEL)
-              this.scrollByPixels(scrollByDelta);
-            else
-              this.scrollByIndex(scrollByDelta);
-          }
+          if (this._prevMouseScrolls.every(prev => prev == isVertical))
+            this.scrollByIndex(isVertical && this._isRTLScrollbox ? -event.detail :
+                                                                    event.detail);
 
           if (this._prevMouseScrolls.length > 1)
             this._prevMouseScrolls.shift();
           this._prevMouseScrolls.push(isVertical);
         }
 
         event.stopPropagation();
         event.preventDefault();
       ]]></handler>
 
+      <handler event="MozMousePixelScroll"><![CDATA[
+        event.stopPropagation();
+        event.preventDefault();
+      ]]></handler>
+
       <handler event="underflow" phase="capturing"><![CDATA[
         // filter underflow events which were dispatched on nested scrollboxes
         if (event.target != this)
           return;
 
         // Ignore events that doesn't match our orientation.
         // Scrollport event orientation:
         //   0: vertical