mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 1452751 - add a pref to control whether to default to passive touch listeners on window/document/documentElement/body , r=kats
--HG-- extra : rebase_source : ba015d60e7ab7da183048dc59dfb0fe42930df6d
This commit is contained in:
parent
a403c9345b
commit
a2485252b4
@ -686,6 +686,21 @@ 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::AddEventListenerByType(
|
||||
EventListenerHolder aListenerHolder,
|
||||
@ -702,7 +717,8 @@ EventListenerManager::AddEventListenerByType(
|
||||
EventListenerFlags flags = aFlags;
|
||||
if (aPassive.WasPassed()) {
|
||||
flags.mPassive = aPassive.Value();
|
||||
} else if (message == eTouchStart || message == eTouchMove) {
|
||||
} else if ((message == eTouchStart || message == eTouchMove) &&
|
||||
mIsMainThreadELM && DefaultToPassiveTouchListeners()) {
|
||||
nsCOMPtr<nsINode> node;
|
||||
nsCOMPtr<nsPIDOMWindowInner> win;
|
||||
if ((win = GetTargetAsInnerWindow()) ||
|
||||
|
@ -76,7 +76,8 @@ var subtests = [
|
||||
["apz.test.fails_with_native_injection", isWindows]]},
|
||||
|
||||
{'file': 'helper_tap_default_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
|
||||
["apz.test.fails_with_native_injection", isWindows]]},
|
||||
["apz.test.fails_with_native_injection", isWindows],
|
||||
["dom.event.default_to_passive_touch_listeners", true]]},
|
||||
|
||||
// Simple test to exercise touch-action CSS property
|
||||
{'file': 'helper_touch_action.html', 'prefs': touch_action_prefs},
|
||||
|
@ -5917,3 +5917,7 @@ pref("layers.omtp.dump-capture", false);
|
||||
// a content to view. This is mostly intended to prevent infinite
|
||||
// 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", false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user