summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_settings.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-15 13:53:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-12-02 15:01:47 +0000
commit03301c0fbdf034fb987e1c1ed1bec7c206dcd27e (patch)
treedeb25e6e6389f6237fac50ad2cd5e17da8501edf /src/core/web_engine_settings.cpp
parent11756734c84038b407bddc8524cdf488efbe846c (diff)
Add WebGL, WebAudio and Accelerated2dCanvas settings
These settings were in QtWebKit and are easily added in QtWebEngine. Without the preferences the same could be achieved using command line flags. The defaults are calculated to match what is set in RenderViewHostImpl. Change-Id: I0c80507574ebc3898fc409e47194246fb00abc75 Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src/core/web_engine_settings.cpp')
-rw-r--r--src/core/web_engine_settings.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 88d8a0c5c..96e87d4f1 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -38,6 +38,9 @@
#include "web_contents_adapter.h"
#include "type_conversion.h"
+#include "base/command_line.h"
+#include "content/browser/gpu/gpu_process_host.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/web_preferences.h"
#include <QFont>
@@ -230,6 +233,16 @@ void WebEngineSettings::initDefaults(bool offTheRecord)
m_defaultAttributes.insert(PluginsEnabled, false);
m_defaultAttributes.insert(FullScreenSupportEnabled, false);
m_defaultAttributes.insert(ScreenCaptureEnabled, false);
+ // The following defaults matches logic in render_view_host_impl.cc:
+ base::CommandLine* commandLine = base::CommandLine::ForCurrentProcess();
+ bool webGL = content::GpuProcessHost::gpu_enabled() &&
+ !commandLine->HasSwitch(switches::kDisable3DAPIs) &&
+ !commandLine->HasSwitch(switches::kDisableExperimentalWebGL);
+ bool accelerated2dCanvas = content::GpuProcessHost::gpu_enabled() &&
+ !commandLine->HasSwitch(switches::kDisableAccelerated2dCanvas);
+ m_defaultAttributes.insert(WebGLEnabled, webGL);
+ m_defaultAttributes.insert(WebAudioEnabled, false);
+ m_defaultAttributes.insert(Accelerated2dCanvasEnabled, accelerated2dCanvas);
}
m_attributes = m_defaultAttributes;
@@ -303,6 +316,9 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p
prefs->enable_error_page = testAttribute(ErrorPageEnabled);
prefs->plugins_enabled = testAttribute(PluginsEnabled);
prefs->fullscreen_supported = testAttribute(FullScreenSupportEnabled);
+ prefs->accelerated_2d_canvas_enabled = testAttribute(Accelerated2dCanvasEnabled);
+ prefs->webaudio_enabled = testAttribute(WebAudioEnabled);
+ prefs->experimental_webgl_enabled = testAttribute(WebGLEnabled);
// Fonts settings.
prefs->standard_font_family_map[content::kCommonScript] = toString16(fontFamily(StandardFont));