Bug 1217515 - Clean up the way touch event support is configured. r=roc

- all.js now sets dom.w3c_touch_events.enabled to auto-detect on all
  platforms except windows and mac
- auto-detect always returns true for android and b2g
- graphene and tests override the all.js pref with their own value

--HG--
extra : rebase_source : 85a88985f77dfb47301cab17d939a88f3043a7a1
extra : source : 95e992d129c32f5e5f39b67f6f946e5d1dcbf530
This commit is contained in:
Botond Ballo 2015-10-26 16:06:27 -04:00
parent 87ec2d3a8f
commit f7282ab158
8 changed files with 11 additions and 23 deletions

View File

@ -344,10 +344,6 @@ pref("image.mem.surfacecache.size_factor", 8); // 1/8 of main memory
pref("image.mem.surfacecache.discard_factor", 2); // Discard 1/2 of the surface cache at a time.
pref("image.mem.surfacecache.min_expiration_ms", 86400000); // 24h, we rely on the out of memory hook
// XXX this isn't a good check for "are touch events supported", but
// we don't really have a better one at the moment.
// enable touch events interfaces
pref("dom.w3c_touch_events.enabled", 1);
pref("dom.w3c_touch_events.safetyX", 0); // escape borders in units of 1/240"
pref("dom.w3c_touch_events.safetyY", 120); // escape borders in units of 1/240"

View File

@ -486,10 +486,6 @@ pref("dom.disable_window_move_resize", false);
// prevent JS from monkeying with window focus, etc
pref("dom.disable_window_flip", true);
// Disable touch events on Desktop Firefox by default until they are properly
// supported (bug 736048)
pref("dom.w3c_touch_events.enabled", 0);
// popups.policy 1=allow,2=reject
pref("privacy.popups.policy", 1);
pref("privacy.popups.usecustom", true);

View File

@ -53,7 +53,7 @@ if (!('BrowserElementIsPreloaded' in this)) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
}
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") != 0) {
if (docShell.asyncPanZoomEnabled === false) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanningAPZDisabled.js");
ContentPanningAPZDisabled.init();

View File

@ -181,7 +181,10 @@ TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
int32_t flag = 0;
if (NS_SUCCEEDED(Preferences::GetInt("dom.w3c_touch_events.enabled", &flag))) {
if (flag == 2) {
#if defined(XP_WIN) || MOZ_WIDGET_GTK == 3
#if defined(MOZ_B2G) || defined(MOZ_WIDGET_ANDROID)
// Touch support is always enabled on B2G and android.
prefValue = true;
#elif defined(XP_WIN) || MOZ_WIDGET_GTK == 3
static bool sDidCheckTouchDeviceSupport = false;
static bool sIsTouchDeviceSupportPresent = false;
// On Windows and GTK3 we auto-detect based on device support.

View File

@ -92,7 +92,7 @@ var DoPreloadPostfork = function(aCallback) {
} catch (e) {
}
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") != 0) {
try {
if (Services.prefs.getBoolPref("layers.async-pan-zoom.enabled") === false) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanningAPZDisabled.js", global);

View File

@ -605,9 +605,6 @@ pref("image.downscale-during-decode.enabled", true);
pref("shumway.disabled", true);
#endif
// enable touch events interfaces
pref("dom.w3c_touch_events.enabled", 1);
#ifdef MOZ_SAFE_BROWSING
pref("browser.safebrowsing.enabled", true);
pref("browser.safebrowsing.malware.enabled", true);

View File

@ -606,9 +606,6 @@ pref("image.downscale-during-decode.enabled", true);
pref("shumway.disabled", true);
#endif
// enable touch events interfaces
pref("dom.w3c_touch_events.enabled", 1);
#ifdef MOZ_SAFE_BROWSING
pref("browser.safebrowsing.enabled", true);
pref("browser.safebrowsing.malware.enabled", true);

View File

@ -4556,12 +4556,11 @@ pref("dom.mozSettings.enabled", false);
pref("dom.mozPermissionSettings.enabled", false);
// W3C touch events
// 0 - disabled, 1 - enabled, 2 - autodetect (win/gtk3)
#ifdef XP_WIN
pref("dom.w3c_touch_events.enabled", 2);
#endif
#if MOZ_WIDGET_GTK == 3
// 0 - disabled, 1 - enabled, 2 - autodetect
// Enabling it for Windows is tracked by bug 736048.
#if defined(XP_WIN) || defined(XP_MACOSX)
pref("dom.w3c_touch_events.enabled", 0);
#else
pref("dom.w3c_touch_events.enabled", 2);
#endif