diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-08-11 10:18:08 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-14 11:42:09 +0200 |
commit | 1ec53868363c41a4f08ca2660638da532eb56b10 (patch) | |
tree | ac982148b467a63e7d1ceb2a7f943c3f3f5bf8d0 /src/core/web_engine_settings.cpp | |
parent | 49b94b14d3da42f945f6d49a3288c3ede5b98d36 (diff) | |
parent | 59e35e033b8c8327db5b3fdbfb5d6ecee48a4405 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Includes sha1 bump of src/3rdparty to head of 58-based.
Change-Id: I37743c3979c1b6fb21f71eab7048e82f7aa5d78b
Diffstat (limited to 'src/core/web_engine_settings.cpp')
-rw-r--r-- | src/core/web_engine_settings.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index fe40298bb..31d120899 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -48,6 +48,7 @@ #include "content/browser/gpu/gpu_process_host.h" #include "content/public/common/content_switches.h" #include "content/public/common/web_preferences.h" +#include "ui/events/event_switches.h" #include <QFont> #include <QTimer> @@ -97,6 +98,29 @@ static inline bool isTouchScreenAvailable() { return touchScreenAvailable; } +static inline bool isTouchEventsAPIEnabled() { + static bool initialized = false; + static bool touchEventsAPIEnabled = false; + if (!initialized) { + base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); + + // By default the Touch Events API support (presence of 'ontouchstart' in 'window' object) + // will be determined based on the availability of touch screen devices. + const std::string touchEventsSwitchValue = + parsedCommandLine->HasSwitch(switches::kTouchEventFeatureDetection) ? + parsedCommandLine->GetSwitchValueASCII(switches::kTouchEventFeatureDetection) : + switches::kTouchEventFeatureDetectionAuto; + + if (touchEventsSwitchValue == switches::kTouchEventFeatureDetectionEnabled) + touchEventsAPIEnabled = true; + else if (touchEventsSwitchValue == switches::kTouchEventFeatureDetectionAuto) + touchEventsAPIEnabled = isTouchScreenAvailable(); + + initialized = true; + } + return touchEventsAPIEnabled; +} + WebEngineSettings::WebEngineSettings(WebEngineSettings *_parentSettings) : m_adapter(0) @@ -298,6 +322,7 @@ void WebEngineSettings::doApply() void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *prefs) { // Override for now + prefs->touch_event_feature_detection_enabled = isTouchEventsAPIEnabled(); prefs->device_supports_touch = isTouchScreenAvailable(); if (prefs->viewport_enabled) { // We should enable viewport and viewport-meta together, but since 5.7 we |