diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2016-12-05 09:59:03 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2016-12-05 09:59:50 +0100 |
commit | 60ab7cb732433a495faad7f8d85f3210ad132c2c (patch) | |
tree | e188c2eefd2018906c3ee83616a7273229325e66 /src | |
parent | a40688a63d131bb024e46d817a388011ccab3ca2 (diff) | |
parent | 265bbb01766ca06f64624f20b1396b6a68b59028 (diff) |
Merge remote-tracking branch 'origin/5.8.0' into 5.8
Change-Id: Ifa26409c722bd4eb373b9ced55f5a58132702ad5
Diffstat (limited to 'src')
-rw-r--r-- | src/core/web_engine_context.cpp | 43 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 7 | ||||
-rw-r--r-- | src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 4 | ||||
-rw-r--r-- | src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp | 5 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 5 |
5 files changed, 40 insertions, 24 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 227918d51..152859bee 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -240,17 +240,15 @@ QObject *WebEngineContext::globalQObject() #define CHROMIUM_VERSION // This is solely to keep Qt Creator happy. #endif +const static char kChromiumFlagsEnv[] = "QTWEBENGINE_CHROMIUM_FLAGS"; +const static char kDisableSandboxEnv[] = "QTWEBENGINE_DISABLE_SANDBOX"; + WebEngineContext::WebEngineContext() : m_mainDelegate(new ContentMainDelegateQt) , m_contentRunner(content::ContentMainRunner::Create()) , m_browserRunner(content::BrowserMainRunner::Create()) , m_globalQObject(new QObject()) { - QStringList appArgs = QCoreApplication::arguments(); - bool useEmbeddedSwitches = appArgs.removeAll(QStringLiteral("--enable-embedded-switches")); -#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) - useEmbeddedSwitches = !appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); -#endif #ifdef Q_OS_LINUX // Call qputenv before BrowserMainRunnerImpl::Initialize is called. @@ -261,32 +259,35 @@ WebEngineContext::WebEngineContext() // Allow us to inject javascript like any webview toolkit. content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); -#if defined(Q_OS_WIN) - // We must initialize the command line with the UTF-16 arguments vector we got from - // QCoreApplication. CommandLine::Init ignores its arguments on Windows and calls - // GetCommandLineW() instead. base::CommandLine::CreateEmpty(); base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); + QStringList appArgs = QCoreApplication::arguments(); + if (qEnvironmentVariableIsSet(kChromiumFlagsEnv)) { + appArgs = appArgs.mid(0, 1); // Take application name and drop the rest + appArgs.append(QString::fromLocal8Bit(qgetenv(kChromiumFlagsEnv)).split(' ')); + } + + bool useEmbeddedSwitches = false; +#if defined(QTWEBENGINE_EMBEDDED_SWITCHES) + useEmbeddedSwitches = !appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); +#else + useEmbeddedSwitches = appArgs.removeAll(QStringLiteral("--enable-embedded-switches")); +#endif base::CommandLine::StringVector argv; argv.resize(appArgs.size()); - std::transform(appArgs.constBegin(), appArgs.constEnd(), argv.begin(), &toString16); - parsedCommandLine->InitFromArgv(argv); +#if defined(Q_OS_WIN) + for (int i = 0; i < appArgs.size(); ++i) + argv[i] = toString16(appArgs[i]); #else - QVector<QByteArray> args; - Q_FOREACH (const QString& arg, appArgs) - args << arg.toUtf8(); - - QVector<const char*> argv(args.size()); - for (int i = 0; i < args.size(); ++i) - argv[i] = args[i].constData(); - base::CommandLine::Init(argv.size(), argv.constData()); - base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); + for (int i = 0; i < appArgs.size(); ++i) + argv[i] = appArgs[i].toStdString(); #endif + parsedCommandLine->InitFromArgv(argv); parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); // Enable sandboxing on OS X and Linux (Desktop / Embedded) by default. - bool disable_sandbox = qEnvironmentVariableIsSet("QTWEBENGINE_DISABLE_SANDBOX"); + bool disable_sandbox = qEnvironmentVariableIsSet(kDisableSandboxEnv); if (!disable_sandbox) { #if defined(Q_OS_WIN) parsedCommandLine->AppendSwitch(switches::kNoSandbox); diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 547be2246..f0811014b 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -1309,6 +1309,10 @@ void QQuickWebEngineView::printToPdf(const QString& filePath, PrintedPageSizeId QPageLayout pageLayout(layoutSize, layoutOrientation, QMarginsF(0.0, 0.0, 0.0, 0.0)); d->adapter->printToPDF(pageLayout, filePath); +#else + Q_UNUSED(filePath); + Q_UNUSED(pageSizeId); + Q_UNUSED(orientation); #endif } @@ -1326,6 +1330,9 @@ void QQuickWebEngineView::printToPdf(const QJSValue &callback, PrintedPageSizeId quint64 requestId = d->adapter->printToPDFCallbackResult(pageLayout); d->m_callbacks.insert(requestId, callback); #else + Q_UNUSED(pageSizeId); + Q_UNUSED(orientation); + // Call back with null result. QJSValueList args; args.append(QJSValue(QByteArray().data())); diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index c5ebe0f06..615e3eed0 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -62,14 +62,14 @@ On all platforms, the following tools are required: \list - \li \l Python 2.7 or later + \li \l Python 2.7.5 or later \li Bison, Flex \li GPerf \endlist \section2 Windows - On Windows, Visual Studio 2013 or Visual Studio 2015 is required. + On Windows, Visual Studio 2015 and Windows 10 SDK are required. \section2 Linux diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp index bf3514f71..a39c0e483 100644 --- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp +++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp @@ -49,10 +49,13 @@ namespace QtWebEngineCore QT_BEGIN_NAMESPACE +#ifndef QT_NO_OPENGL Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); +#endif static void initialize() { +#ifndef QT_NO_OPENGL if (QCoreApplication::instance()) { //On window/ANGLE, calling QtWebEngine::initialize from DllMain will result in a crash. if (!qt_gl_global_share_context()) { @@ -62,9 +65,9 @@ static void initialize() } return; } - //QCoreApplication is not yet instantiated, ensuring the call will be deferred qAddPreRoutine(QtWebEngineCore::initialize); +#endif // QT_NO_OPENGL } Q_CONSTRUCTOR_FUNCTION(initialize) diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index f769ea0f4..16e9438c9 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1957,6 +1957,9 @@ void QWebEnginePage::printToPdf(const QString &filePath, const QPageLayout &page } #endif d->adapter->printToPDF(pageLayout, filePath); +#else + Q_UNUSED(filePath); + Q_UNUSED(pageLayout); #endif // if defined(ENABLE_PDF) } @@ -1990,6 +1993,7 @@ void QWebEnginePage::printToPdf(const QWebEngineCallback<const QByteArray&> &res quint64 requestId = d->adapter->printToPDFCallbackResult(pageLayout); d->m_callbacks.registerCallback(requestId, resultCallback); #else // if defined(ENABLE_PDF) + Q_UNUSED(pageLayout); d->m_callbacks.invokeEmpty(resultCallback); #endif // if defined(ENABLE_PDF) } @@ -2025,6 +2029,7 @@ void QWebEnginePage::print(QPrinter *printer, const QWebEngineCallback<bool> &re quint64 requestId = d->adapter->printToPDFCallbackResult(printer->pageLayout(), printer->colorMode() == QPrinter::Color); d->m_callbacks.registerCallback(requestId, resultCallback); #else // if defined(ENABLE_PDF) + Q_UNUSED(printer); d->m_callbacks.invokeDirectly(resultCallback, false); #endif // if defined(ENABLE_PDF) } |