Bug 1573720 - Convert ui.touch_activation.duration_ms to a static pref. r=botond

The commit also adds a missing StaticPrefs_dom.h include for APZEventState.cpp.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-08-15 05:30:23 +00:00
parent cb6862ab2c
commit bcfea34a74
3 changed files with 13 additions and 17 deletions

View File

@ -35,6 +35,8 @@
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsIScrollableFrame.h" #include "nsIScrollableFrame.h"
#include "nsIScrollbarMediator.h" #include "nsIScrollbarMediator.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "mozilla/widget/nsAutoRollup.h" #include "mozilla/widget/nsAutoRollup.h"
@ -93,9 +95,6 @@ int32_t WidgetModifiersToDOMModifiers(mozilla::Modifiers aModifiers) {
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
static int32_t sActiveDurationMs = 10;
static bool sActiveDurationMsSet = false;
APZEventState::APZEventState(nsIWidget* aWidget, APZEventState::APZEventState(nsIWidget* aWidget,
ContentReceivedInputBlockCallback&& aCallback) ContentReceivedInputBlockCallback&& aCallback)
: mWidget(nullptr) // initialized in constructor body : mWidget(nullptr) // initialized in constructor body
@ -113,13 +112,6 @@ APZEventState::APZEventState(nsIWidget* aWidget,
MOZ_ASSERT(NS_SUCCEEDED(rv), MOZ_ASSERT(NS_SUCCEEDED(rv),
"APZEventState constructed with a widget that" "APZEventState constructed with a widget that"
" does not support weak references. APZ will NOT work!"); " does not support weak references. APZ will NOT work!");
if (!sActiveDurationMsSet) {
Preferences::AddIntVarCache(&sActiveDurationMs,
"ui.touch_activation.duration_ms",
sActiveDurationMs);
sActiveDurationMsSet = true;
}
} }
APZEventState::~APZEventState() {} APZEventState::~APZEventState() {}
@ -203,8 +195,9 @@ void APZEventState::ProcessSingleTap(const CSSPoint& aPoint,
} }
RefPtr<DelayedFireSingleTapEvent> callback = new DelayedFireSingleTapEvent( RefPtr<DelayedFireSingleTapEvent> callback = new DelayedFireSingleTapEvent(
mWidget, ldPoint, aModifiers, aClickCount, timer, touchRollup); mWidget, ldPoint, aModifiers, aClickCount, timer, touchRollup);
nsresult rv = timer->InitWithCallback(callback, sActiveDurationMs, nsresult rv = timer->InitWithCallback(
nsITimer::TYPE_ONE_SHOT); callback, StaticPrefs::ui_touch_activation_duration_ms(),
nsITimer::TYPE_ONE_SHOT);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
// Make |callback| not hold the timer, so they will both be destructed when // Make |callback| not hold the timer, so they will both be destructed when
// we leave the scope of this function. // we leave the scope of this function.

View File

@ -6484,6 +6484,14 @@
value: 100 value: 100
mirror: always mirror: always
# If the user has clicked an element, how long do we keep the :active state
# before it is cleared by the mouse sequences fired after a
# touchstart/touchend.
- name: ui.touch_activation.duration_ms
type: int32_t
value: 10
mirror: always
# Prevent system colors from being exposed to CSS or canvas. # Prevent system colors from being exposed to CSS or canvas.
- name: ui.use_standins_for_native_colors - name: ui.use_standins_for_native_colors
type: RelaxedAtomicBool type: RelaxedAtomicBool

View File

@ -4965,11 +4965,6 @@ pref("gfx.vr.osvr.clientKitLibPath", "");
// are rejecting frames, it determines the rate at which RAF callbacks will be called. // are rejecting frames, it determines the rate at which RAF callbacks will be called.
pref("dom.vr.display.rafMaxDuration", 50); pref("dom.vr.display.rafMaxDuration", 50);
// If the user has clicked an element, how long do we keep the
// :active state before it is cleared by the mouse sequences
// fired after a touchstart/touchend.
pref("ui.touch_activation.duration_ms", 10);
// nsMemoryInfoDumper can watch a fifo in the temp directory and take various // nsMemoryInfoDumper can watch a fifo in the temp directory and take various
// actions when the fifo is written to. Disable this in general. // actions when the fifo is written to. Disable this in general.
pref("memory_info_dumper.watch_fifo.enabled", false); pref("memory_info_dumper.watch_fifo.enabled", false);