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
Родитель cb6862ab2c
Коммит bcfea34a74
3 изменённых файлов: 13 добавлений и 17 удалений

Просмотреть файл

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

Просмотреть файл

@ -6484,6 +6484,14 @@
value: 100
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.
- name: ui.use_standins_for_native_colors
type: RelaxedAtomicBool

Просмотреть файл

@ -4965,11 +4965,6 @@ pref("gfx.vr.osvr.clientKitLibPath", "");
// are rejecting frames, it determines the rate at which RAF callbacks will be called.
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
// actions when the fifo is written to. Disable this in general.
pref("memory_info_dumper.watch_fifo.enabled", false);