Bug 1526725 - Make dom.event.default_to_passive_touch_listeners a static pref. r=smaug

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-12-11 22:15:08 +00:00
Родитель 3e2272dc20
Коммит d70493e15e
3 изменённых файлов: 7 добавлений и 19 удалений

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

@ -661,24 +661,10 @@ bool EventListenerManager::ListenerCanHandle(const Listener* aListener,
return aListener->mEventMessage == aEventMessage;
}
static bool DefaultToPassiveTouchListeners() {
static bool sDefaultToPassiveTouchListeners = false;
static bool sIsPrefCached = false;
if (!sIsPrefCached) {
sIsPrefCached = true;
Preferences::AddBoolVarCache(
&sDefaultToPassiveTouchListeners,
"dom.event.default_to_passive_touch_listeners");
}
return sDefaultToPassiveTouchListeners;
}
void EventListenerManager::MaybeMarkPassive(EventMessage aMessage,
EventListenerFlags& aFlags) {
if ((aMessage == eTouchStart || aMessage == eTouchMove) && mIsMainThreadELM &&
DefaultToPassiveTouchListeners()) {
StaticPrefs::dom_event_default_to_passive_touch_listeners()) {
nsCOMPtr<nsINode> node;
nsCOMPtr<nsPIDOMWindowInner> win;
if ((win = GetTargetAsInnerWindow()) ||

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

@ -1456,6 +1456,12 @@
value: true
mirror: always
# Whether touch event listeners are passive by default.
- name: dom.event.default_to_passive_touch_listeners
type: bool
value: true
mirror: always
# Enable clipboard readText() and writeText() by default
- name: dom.events.asyncClipboard
type: bool

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

@ -4679,10 +4679,6 @@ pref("dom.noopener.newprocess.enabled", true);
// loops with faulty converters involved.
pref("general.document_open_conversion_depth_limit", 20);
// If true, touchstart and touchmove listeners on window, document,
// documentElement and document.body are passive by default.
pref("dom.event.default_to_passive_touch_listeners", true);
// Should only be enabled in tests
pref("dom.events.testing.asyncClipboard", false);