diff options
author | Michal Klocek <michal.klocek@qt.io> | 2022-10-10 14:55:02 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-19 17:19:08 +0000 |
commit | c33f8fae0e81685190f2da8992df5ecd52e9f292 (patch) | |
tree | ae5e0969a88ffad8c0fbdff30b169fa5fed41326 | |
parent | 2656991bb228b0079b3cd3e2dfae2943032c8421 (diff) |
Cleanup and document webEngineArgs command line option
Fix usage of badcode vs code.
This commit amends 82357352b49fdcba80727feec441053f676b5af2.
Fixes: QTBUG-107502
Change-Id: I50be8b37a81f33ef8e8dff3985d00f562542031a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 337f6fa60b1fd17549537ed16c83b57ac5318c25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/core/doc/src/qtwebengine-debugging.qdoc | 8 | ||||
-rw-r--r-- | src/core/doc/src/qtwebengine-features.qdoc | 30 | ||||
-rw-r--r-- | src/core/pref_service_adapter.cpp | 2 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 24 | ||||
-rw-r--r-- | src/core/web_engine_context.h | 3 |
5 files changed, 40 insertions, 27 deletions
diff --git a/src/core/doc/src/qtwebengine-debugging.qdoc b/src/core/doc/src/qtwebengine-debugging.qdoc index dd7e6bdad..3599ec55e 100644 --- a/src/core/doc/src/qtwebengine-debugging.qdoc +++ b/src/core/doc/src/qtwebengine-debugging.qdoc @@ -28,10 +28,14 @@ \QWE based browser, such as the Chrome browser. To activate the developer tools, start an application that uses \QWE - with the command-line arguments: + with the command-line argument \c {--remote-debugging-port=<portnumber>}. + + \note Any WebEngine command line options should be specified after the + \c {--webEngineArgs} option, which is used to separate the user's application + specific options from the WebEngine's ones. \badcode - --remote-debugging-port=<port_number> + --webEngineArgs --remote-debugging-port=<portnumber> \endcode Where \c <port_number> refers to a local network port. The web developer diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc index da5451221..dc38f5069 100644 --- a/src/core/doc/src/qtwebengine-features.qdoc +++ b/src/core/doc/src/qtwebengine-features.qdoc @@ -40,14 +40,14 @@ (MP3), have been enabled. Proprietary codecs can be enabled by passing the following option to the \c configure tool when configuring Qt: - \code + \badcode -webengine-proprietary-codecs \endcode For example, the following option could be passed when configuring Qt for building it at the top level: - \code + \badcode configure -webengine-proprietary-codecs \endcode @@ -57,7 +57,7 @@ command can be used to configure and build (in this example, the \QWE source code is located in \c {C:\qt\qtwebengine}): - \code + \badcode qt-configure-module C:\qt\qtwebengine -webengine-proprietary-codecs cmake --build . --parallel \endcode @@ -83,6 +83,14 @@ {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect to \c {http://localhost:[your-port]}. + \note Any WebEngine command line options should be specified after the + \c {--webEngineArgs} option, which is used to separate the user's application + specific options from the WebEngine's ones. + + \badcode + --webEngineArgs --remote-debugging-port=5000 + \endcode + The Chromium DevTools page can also be shown within the application. To set this up, you can call either QWebEnginePage::setInspectedPage() to the page to be inspected, which implicitly loads the DevTools into the \c this page, @@ -169,17 +177,17 @@ location can be also passed with \c {QTWEBENGINE_CHROMIUM_FLAGS} using \c {widevine-path}. On Windows: - \code + \badcode set QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="C:/some path/widevinecdm.dll" \endcode On Linux: - \code + \badcode export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.so" \endcode On macOS: - \code + \badcode export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.dylib" \endcode @@ -263,14 +271,14 @@ entries, separated by commas, that contain the file path and one or several MIME types, separated by semicolons: - \code + \badcode <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2> \endcode For example: - \code - --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" + \badcode + --webEngineArgs --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" \endcode The MIME type is important because it determines which embeds the plugin is @@ -541,14 +549,14 @@ For opening the source view in the current tab, URLs with \l{view-source URI scheme} are also supported. For example, you can type the following URL to the URL bar to view the HTML source of the qt.io web page: - \code + \badcode view-source:https://www.qt.io/ \endcode Auto-completion of incomplete URLs with \l{view-source URI scheme} makes the usage of this feature more comfortable. For example, the following incomplete URL also loads the source view of the qt.io web page: - \code + \badcode view-source:qt.io \endcode diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index 48deb5ced..27212f9b2 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -48,7 +48,7 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) DCHECK_CURRENTLY_ON(content::BrowserThread::UI); PrefServiceFactory factory; factory.set_command_line_prefs(base::MakeRefCounted<ChromeCommandLinePrefStore>( - WebEngineContext::commandLine())); + base::CommandLine::ForCurrentProcess())); QString userPrefStorePath = profileAdapter.dataPath(); if (!profileAdapter.isOffTheRecord() && !userPrefStorePath.isEmpty() && diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index c1507d3df..d27798d4f 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -631,16 +631,11 @@ WebEngineContext::WebEngineContext() // Allow us to inject javascript like any webview toolkit. content::RenderFrameHost::AllowInjectingJavaScript(); - QStringList appArgs = QCoreApplication::arguments(); - bool useEmbeddedSwitches = false; -#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) - useEmbeddedSwitches = !appArgs.contains(QStringLiteral("--disable-embedded-switches")); -#else - useEmbeddedSwitches = appArgs.contains(QStringLiteral("--enable-embedded-switches")); -#endif + bool enableGLSoftwareRendering = false; + base::CommandLine *parsedCommandLine = + initCommandLine(useEmbeddedSwitches, enableGLSoftwareRendering); - base::CommandLine* parsedCommandLine = commandLine(); setupProxyPac(parsedCommandLine); parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); @@ -696,7 +691,6 @@ WebEngineContext::WebEngineContext() // bitmaps, use software rendering via software OpenGL. This might be less // performant, but at least provides WebGL support. // TODO(miklocek), check if this still works with latest chromium - const bool enableGLSoftwareRendering = appArgs.contains(QStringLiteral("--enable-webgl-software-rendering")); const bool disableGpu = parsedCommandLine->HasSwitch(switches::kDisableGpu); const char *glType = getGLType(enableGLSoftwareRendering, disableGpu); @@ -835,7 +829,9 @@ gpu::SyncPointManager *WebEngineContext::syncPointManager() return s_syncPointManager.loadRelaxed(); } -base::CommandLine* WebEngineContext::commandLine() { +base::CommandLine *WebEngineContext::initCommandLine(bool &useEmbeddedSwitches, + bool &enableGLSoftwareRendering) +{ if (base::CommandLine::CreateEmpty()) { base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); QStringList appArgs = QCoreApplication::arguments(); @@ -850,9 +846,13 @@ base::CommandLine* WebEngineContext::commandLine() { appArgs = appArgs.mid(0, 1); } } -#ifdef Q_OS_WIN - appArgs.removeAll(QStringLiteral("--enable-webgl-software-rendering")); +#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) + useEmbeddedSwitches = !appArgs.contains(QStringLiteral("--disable-embedded-switches")); +#else + useEmbeddedSwitches = appArgs.contains(QStringLiteral("--enable-embedded-switches")); #endif + enableGLSoftwareRendering = + appArgs.removeAll(QStringLiteral("--enable-webgl-software-rendering")); appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); appArgs.removeAll(QStringLiteral("--enable-embedded-switches")); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 7e16fc7d3..f7dbd1e53 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -83,7 +83,8 @@ public: void addProfileAdapter(ProfileAdapter *profileAdapter); void removeProfileAdapter(ProfileAdapter *profileAdapter); void destroy(); - static base::CommandLine* commandLine(); + static base::CommandLine *initCommandLine(bool &useEmbeddedSwitches, + bool &enableGLSoftwareRendering); static gpu::SyncPointManager *syncPointManager(); |