Bug 1225590 - Negate both X and Y for mouse wheel scrolling, which matches Android platform behaviour. r=kats a=lizzard
authorAndy Chen <andchen@blackberry.com>
Fri, 30 Oct 2015 15:32:59 -0400
changeset 305590 1802aa83ee3df1f1f85de08d2c0c7fbb345f7dfa
parent 305589 0b9508fe071f1654d18c87bb0b4fb7c32b174e75
child 305591 3999c84a3ba46bd597145487a8ec55cde95eb441
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, lizzard
bugs1225590
milestone44.0a2
Bug 1225590 - Negate both X and Y for mouse wheel scrolling, which matches Android platform behaviour. r=kats a=lizzard
mobile/android/app/mobile.js
mobile/android/b2gdroid/app/b2gdroid.js
mobile/android/base/gfx/JavaPanZoomController.java
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -687,18 +687,18 @@ pref("ui.scrolling.max_event_acceleratio
 pref("ui.scrolling.overscroll_decel_rate", -1);
 // The fraction of the surface which can be overscrolled before it must snap back, in 1000ths.
 pref("ui.scrolling.overscroll_snap_limit", -1);
 // The minimum amount of space that must be present for an axis to be considered scrollable,
 // in 1/1000ths of pixels.
 pref("ui.scrolling.min_scrollable_distance", -1);
 // The axis lock mode for panning behaviour - set between standard, free and sticky
 pref("ui.scrolling.axis_lock_mode", "standard");
-// Negate scrollY, true will make the mouse scroll wheel move the screen the same direction as with most desktops or laptops.
-pref("ui.scrolling.negate_wheel_scrollY", true);
+// Negate scroll, true will make the mouse scroll wheel move the screen the same direction as with most desktops or laptops.
+pref("ui.scrolling.negate_wheel_scroll", true);
 // Determine the dead zone for gamepad joysticks. Higher values result in larger dead zones; use a negative value to
 // auto-detect based on reported hardware values
 pref("ui.scrolling.gamepad_dead_zone", 115);
 
 // Prefs for fling acceleration
 pref("ui.scrolling.fling_accel_interval", -1);
 pref("ui.scrolling.fling_accel_base_multiplier", -1);
 pref("ui.scrolling.fling_accel_supplemental_multiplier", -1);
--- a/mobile/android/b2gdroid/app/b2gdroid.js
+++ b/mobile/android/b2gdroid/app/b2gdroid.js
@@ -673,18 +673,18 @@ pref("ui.scrolling.max_event_acceleratio
 pref("ui.scrolling.overscroll_decel_rate", -1);
 // The fraction of the surface which can be overscrolled before it must snap back, in 1000ths.
 pref("ui.scrolling.overscroll_snap_limit", -1);
 // The minimum amount of space that must be present for an axis to be considered scrollable,
 // in 1/1000ths of pixels.
 pref("ui.scrolling.min_scrollable_distance", -1);
 // The axis lock mode for panning behaviour - set between standard, free and sticky
 pref("ui.scrolling.axis_lock_mode", "standard");
-// Negate scrollY, true will make the mouse scroll wheel move the screen the same direction as with most desktops or laptops.
-pref("ui.scrolling.negate_wheel_scrollY", true);
+// Negate scroll, true will make the mouse scroll wheel move the screen the same direction as with most desktops or laptops.
+pref("ui.scrolling.negate_wheel_scroll", true);
 // Determine the dead zone for gamepad joysticks. Higher values result in larger dead zones; use a negative value to
 // auto-detect based on reported hardware values
 pref("ui.scrolling.gamepad_dead_zone", 115);
 
 // Prefs for fling acceleration
 pref("ui.scrolling.fling_accel_interval", -1);
 pref("ui.scrolling.fling_accel_base_multiplier", -1);
 pref("ui.scrolling.fling_accel_supplemental_multiplier", -1);
--- a/mobile/android/base/gfx/JavaPanZoomController.java
+++ b/mobile/android/base/gfx/JavaPanZoomController.java
@@ -116,18 +116,18 @@ class JavaPanZoomController
     /* Current state the pan/zoom UI is in. */
     private PanZoomState mState;
     /* The per-frame zoom delta for the currently-running AUTONAV animation. */
     private float mAutonavZoomDelta;
     /* The user selected panning mode */
     private AxisLockMode mMode;
     /* Whether or not to wait for a double-tap before dispatching a single-tap */
     private boolean mWaitForDoubleTap;
-    /* Used to change the scrollY direction */
-    private boolean mNegateWheelScrollY;
+    /* Used to change the scroll direction */
+    private boolean mNegateWheelScroll;
     /* Whether the current event has been default-prevented. */
     private boolean mDefaultPrevented;
     /* Whether longpress events are enabled, or suppressed by robocop tests. */
     private boolean isLongpressEnabled;
     /* Whether longpress detection should be ignored */
     private boolean mIgnoreLongPress;
     /* Pointer scrolling delta, scaled by the preferred list item height which matches Android platform behavior */
     private float mPointerScrollFactor;
@@ -151,17 +151,17 @@ class JavaPanZoomController
         mEventDispatcher.registerGeckoThreadListener(this,
             MESSAGE_ZOOM_RECT,
             MESSAGE_ZOOM_PAGE,
             MESSAGE_TOUCH_LISTENER);
 
         mMode = AxisLockMode.STANDARD;
 
         String[] prefs = { "ui.scrolling.axis_lock_mode",
-                           "ui.scrolling.negate_wheel_scrollY",
+                           "ui.scrolling.negate_wheel_scroll",
                            "ui.scrolling.gamepad_dead_zone" };
         PrefsHelper.getPrefs(prefs, new PrefsHelper.PrefHandlerBase() {
             @Override public void prefValue(String pref, String value) {
                 if (pref.equals("ui.scrolling.axis_lock_mode")) {
                     if (value.equals("standard")) {
                         mMode = AxisLockMode.STANDARD;
                     } else if (value.equals("free")) {
                         mMode = AxisLockMode.FREE;
@@ -173,18 +173,18 @@ class JavaPanZoomController
 
             @Override public void prefValue(String pref, int value) {
                 if (pref.equals("ui.scrolling.gamepad_dead_zone")) {
                     GamepadUtils.overrideDeadZoneThreshold(value / 1000f);
                 }
             }
 
             @Override public void prefValue(String pref, boolean value) {
-                if (pref.equals("ui.scrolling.negate_wheel_scrollY")) {
-                    mNegateWheelScrollY = value;
+                if (pref.equals("ui.scrolling.negate_wheel_scroll")) {
+                    mNegateWheelScroll = value;
                 }
             }
 
             @Override
             public boolean isObserver() {
                 return true;
             }
 
@@ -582,17 +582,18 @@ class JavaPanZoomController
         bounce();
         return false;
     }
 
     private boolean handlePointerScroll(MotionEvent event) {
         if (mState == PanZoomState.NOTHING || mState == PanZoomState.FLING) {
             float scrollX = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
             float scrollY = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
-            if (mNegateWheelScrollY) {
+            if (mNegateWheelScroll) {
+                scrollX *= -1.0;
                 scrollY *= -1.0;
             }
             scrollBy(scrollX * mPointerScrollFactor, scrollY * mPointerScrollFactor);
             bounce();
             return true;
         }
         return false;
     }