Bug 1573992 - Convert ui.scrolling.negate_wheel_scroll to static pref. r=njn

Converts ui.scrolling.negate_wheel_scroll to a static pref and updates its usages. This one is only enabled on android, so I used the IS_ANDROID value to fill it.

Differential Revision: https://phabricator.services.mozilla.com/D42394

--HG--
extra : moz-landing-system : lando
This commit is contained in:
kriswright 2019-08-26 20:25:43 +00:00
parent d489024871
commit c99009c207
3 changed files with 9 additions and 14 deletions

View File

@ -613,8 +613,6 @@ pref("ui.scrolling.overscroll_snap_limit", -1);
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 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);

View File

@ -6718,6 +6718,13 @@
#endif
mirror: always
# Negate scroll, true will make the mouse scroll wheel move the screen the
# same direction as with most desktops or laptops.
- name: ui.scrolling.negate_wheel_scroll
type: bool
value: @IS_ANDROID@
mirror: always
# If the user puts a finger down on an element and we think the user might be
# executing a pan gesture, how long do we wait before tentatively deciding the
# gesture is actually a tap and activating the target element?

View File

@ -15,6 +15,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/RWLock.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/TypeTraits.h"
#include "mozilla/Unused.h"
@ -363,8 +364,6 @@ class nsWindow::NPZCSupport final
: public PanZoomController::NativeProvider::Natives<NPZCSupport> {
using LockedWindowPtr = WindowPtr<NPZCSupport>::Locked;
static bool sNegateWheelScroll;
WindowPtr<NPZCSupport> mWindow;
PanZoomController::NativeProvider::WeakRef mNPZC;
int mPreviousButtons;
@ -413,13 +412,6 @@ class nsWindow::NPZCSupport final
const PanZoomController::NativeProvider::LocalRef& aNPZC)
: mWindow(aPtr, aWindow), mNPZC(aNPZC), mPreviousButtons(0) {
MOZ_ASSERT(mWindow);
static bool sInited;
if (!sInited) {
Preferences::AddBoolVarCache(&sNegateWheelScroll,
"ui.scrolling.negate_wheel_scroll");
sInited = true;
}
}
~NPZCSupport() {}
@ -508,7 +500,7 @@ class nsWindow::NPZCSupport final
ScreenPoint origin = ScreenPoint(aX, aY);
if (sNegateWheelScroll) {
if (StaticPrefs::ui_scrolling_negate_wheel_scroll()) {
aHScroll = -aHScroll;
aVScroll = -aVScroll;
}
@ -779,8 +771,6 @@ class nsWindow::NPZCSupport final
template <>
const char nsWindow::NativePtr<nsWindow::NPZCSupport>::sName[] = "NPZCSupport";
bool nsWindow::NPZCSupport::sNegateWheelScroll;
NS_IMPL_ISUPPORTS(nsWindow::AndroidView, nsIAndroidEventDispatcher,
nsIAndroidView)