diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-09-24 12:03:59 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-09-24 13:03:43 +0200 |
commit | 52345f558f55e04ea68a8fa30d9862ca69131a18 (patch) | |
tree | 3bd9da3e6842af2d0b9c04b46693c66ab437fd2e /src/webenginewidgets | |
parent | 16192598a84eaf9ac9a50b7cca6ac5e4c21bb5e8 (diff) | |
parent | d8fe250e542519012247952a034e78b0d492b730 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
config.tests/glibc/glibc.cpp
src/3rdparty
src/core/configure.json
src/core/profile_io_data_qt.cpp
src/webengine/configure.json
src/webenginewidgets/api/qwebenginepage.cpp
tests/auto/widgets/qwebenginepage/BLACKLIST
Change-Id: I3e1781048c3cb09bfbf7427dfc5dd1fec11a2b97
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 11 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebengineprofile.cpp | 3 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginescript.cpp | 2 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginescriptcollection.cpp | 2 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebengineview.cpp | 2 | ||||
-rw-r--r-- | src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 19 |
6 files changed, 24 insertions, 15 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index b22d47916..e4f4c4bc8 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -178,7 +178,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) wasShownTimer.setSingleShot(true); QObject::connect(&wasShownTimer, &QTimer::timeout, [this](){ ensureInitialized(); - adapter->setVisible(true); }); profile->d_ptr->addWebContentsAdapterClient(this); @@ -442,7 +441,7 @@ void QWebEnginePagePrivate::didPrintPage(quint64 requestId, QSharedPointer<QByte printerThread->start(); PrinterWorker *printerWorker = new PrinterWorker(result, currentPrinter); - QObject::connect(printerWorker, &PrinterWorker::resultReady, q, [=](bool success) { + QObject::connect(printerWorker, &PrinterWorker::resultReady, q, [requestId, this](bool success) { currentPrinter = nullptr; m_callbacks.invoke(requestId, success); }); @@ -1720,8 +1719,8 @@ void QWebEnginePagePrivate::allowCertificateError(const QSharedPointer<Certifica accepted = q->certificateError(error); if (error.deferred() && !error.answered()) m_certificateErrorControllers.append(controller); - else if (!error.answered() && error.isOverridable()) - controller->accept(accepted); + else if (!error.answered()) + controller->accept(error.isOverridable() && accepted); } void QWebEnginePagePrivate::selectClientCert(const QSharedPointer<ClientCertSelectController> &controller) @@ -1817,7 +1816,7 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText) } // Update tooltip if text was changed. - QString wrappedTip = QLatin1String("<p style=\"white-space:pre\">") + QString wrappedTip = QLatin1String("<p style=\"white-space:pre-wrap\">") % toolTipText.toHtmlEscaped().left(MaxTooltipLength) % QLatin1String("</p>"); if (view->toolTip() != wrappedTip) @@ -2178,7 +2177,7 @@ void QWebEnginePage::runJavaScript(const QString& scriptSource, quint32 worldId, In addition, a page might also execute scripts added through QWebEngineProfile::scripts(). - \sa QWebEngineScriptCollection, QWebEngineScript + \sa QWebEngineScriptCollection, QWebEngineScript, {Script Injection} */ QWebEngineScriptCollection &QWebEnginePage::scripts() diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 4a77eb8cf..09f5ce2fd 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -661,7 +661,8 @@ bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const Returns the collection of scripts that are injected into all pages that share this profile. - \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts() + \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts(), + {Script Injection} */ QWebEngineScriptCollection *QWebEngineProfile::scripts() const { diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp index d1e996b3a..af6b9aa8d 100644 --- a/src/webenginewidgets/api/qwebenginescript.cpp +++ b/src/webenginewidgets/api/qwebenginescript.cpp @@ -67,6 +67,8 @@ using QtWebEngineCore::UserScript; Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access the collection of scripts associated with a single page or a number of pages sharing the same profile. + + \sa {Script Injection} */ /*! \enum QWebEngineScript::InjectionPoint diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/webenginewidgets/api/qwebenginescriptcollection.cpp index 5ef0ffd44..8cbeeb804 100644 --- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp +++ b/src/webenginewidgets/api/qwebenginescriptcollection.cpp @@ -55,6 +55,8 @@ using QtWebEngineCore::UserScript; Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access the collection of scripts associated with a single page or a number of pages sharing the same profile. + + \sa {Script Injection} */ /*! diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index ac979e766..de81448a9 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -61,6 +61,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage Q_Q(QWebEngineView); if (oldPage) { + oldPage->setVisible(false); oldPage->disconnect(q); } @@ -74,6 +75,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage QObject::connect(newPage, &QWebEnginePage::loadFinished, q, &QWebEngineView::loadFinished); QObject::connect(newPage, &QWebEnginePage::selectionChanged, q, &QWebEngineView::selectionChanged); QObject::connect(newPage, &QWebEnginePage::renderProcessTerminated, q, &QWebEngineView::renderProcessTerminated); + newPage->setVisible(q->isVisible()); } auto oldUrl = oldPage ? oldPage->url() : QUrl(); diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 699d7f181..7701b9b3d 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -767,10 +767,15 @@ \fn void QWebEnginePage::runJavaScript(const QString &scriptSource, const QWebEngineCallback<const QVariant &> &resultCallback) \since 5.7 - Runs the JavaScript code contained in \a scriptSource in the world specified by \a worldId. - The world ID values are the same as provided by QWebEngineScript::ScriptWorldId, and between \c 0 - and \c 256. Using the \e runJavaScript() versions without the world ID is the same as running the - script in the \c MainWorld. + Runs the JavaScript code contained in \a scriptSource without checking + whether the DOM of the page has been constructed. If you need more + control over how the script is run, consider using \l scripts() instead. + + To avoid conflicts with other scripts executed on the page, the world in + which the script is run is specified by \a worldId. The world ID values are + the same as provided by QWebEngineScript::ScriptWorldId, and between \c 0 + and \c 256. If you leave out the \c world ID, the script is run in the + \c MainWorld. When the script has been executed, \a resultCallback is called with the result of the last executed statement. \c resultCallback can be any of a function pointer, a functor or a lambda, @@ -780,7 +785,7 @@ page.runJavaScript("document.title", [](const QVariant &v) { qDebug() << v.toString(); }); \endcode - Only "plain data" can be returned from JavaScript as the result value. + Only plain data can be returned from JavaScript as the result value. Supported data types include all of the JSON data types as well as, for example, \c{Date} and \c{ArrayBuffer}. Unsupported data types include, for example, \c{Function} and \c{Promise}. @@ -792,9 +797,7 @@ during page destruction. When QWebEnginePage is deleted, the callback is triggered with an invalid value and it is not safe to use the corresponding QWebEnginePage or QWebEngineView instance inside it. - See scripts() for an alternative API to inject scripts. - - \sa QWebEngineScript::ScriptWorldId + \sa scripts(), QWebEngineScript::ScriptWorldId, {Script Injection} */ /*! |