From b6690b2334a6004ba7281cdfb34046e98e475502 Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Wed, 17 Jun 2015 16:43:25 +0200 Subject: Make it possible to run applications with chromium embedded options This patch adds --enable-embedded-switches command line switch to enable all the embedded switches on startup instead of during compile time. Among others this enables pinch-zoom, viewport and impl-side painting, to make it easy to run an application with these settings even if the library was not cross-compiled. On embedded these are enabled by default and can be disabled by --disable-embedded-switches. Change-Id: I366ed243f1b0e17cbeb900e672d0e15fb4a2b8b0 Reviewed-by: Allan Sandfeld Jensen --- src/core/core_gyp_generator.pro | 2 +- src/core/web_engine_context.cpp | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 4ab1b7b98..90d748c4b 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -18,7 +18,7 @@ DEFINES += QT_NO_KEYWORDS \ # Assume that we want mobile touch and low-end hardware behaviors # whenever we are cross compiling. -cross_compile: DEFINES += QTWEBENGINE_MOBILE_SWITCHES +cross_compile: DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES contains(QT_CONFIG, egl): CONFIG += egl else: DEFINES += QT_NO_EGL diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 10d6bdd74..f3659a7d2 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -185,6 +185,11 @@ WebEngineContext::WebEngineContext() Q_FOREACH (const QString& arg, QCoreApplication::arguments()) args << arg.toUtf8(); + bool useEmbeddedSwitches = args.removeAll("--enable-embedded-switches"); +#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) + useEmbeddedSwitches = !args.removeAll("--disable-embedded-switches"); +#endif + QVector argv(args.size()); for (int i = 0; i < args.size(); ++i) argv[i] = args[i].constData(); @@ -198,21 +203,20 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing); parsedCommandLine->AppendSwitch(switches::kInProcessGPU); -#if defined(QTWEBENGINE_MOBILE_SWITCHES) - // Inspired by the Android port's default switches - parsedCommandLine->AppendSwitch(switches::kEnableOverlayScrollbar); - parsedCommandLine->AppendSwitch(switches::kEnablePinch); - parsedCommandLine->AppendSwitch(switches::kEnableViewport); - parsedCommandLine->AppendSwitch(switches::kEnableViewportMeta); - parsedCommandLine->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges); - parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode); - parsedCommandLine->AppendSwitch(switches::kDisableGpuShaderDiskCache); - parsedCommandLine->AppendSwitch(switches::kDisable2dCanvasAntialiasing); - parsedCommandLine->AppendSwitch(switches::kEnableImplSidePainting); - parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing); - - parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); -#endif + if (useEmbeddedSwitches) { + // Inspired by the Android port's default switches + parsedCommandLine->AppendSwitch(switches::kEnableOverlayScrollbar); + parsedCommandLine->AppendSwitch(switches::kEnablePinch); + parsedCommandLine->AppendSwitch(switches::kEnableViewport); + parsedCommandLine->AppendSwitch(switches::kEnableViewportMeta); + parsedCommandLine->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges); + parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode); + parsedCommandLine->AppendSwitch(switches::kDisableGpuShaderDiskCache); + parsedCommandLine->AppendSwitch(switches::kDisable2dCanvasAntialiasing); + parsedCommandLine->AppendSwitch(switches::kEnableImplSidePainting); + parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing); + parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); + } GLContextHelper::initialize(); -- cgit v1.2.3