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 | |
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')
28 files changed, 204 insertions, 80 deletions
diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri index 998aedc40..493ea9766 100644 --- a/src/buildtools/config/linux.pri +++ b/src/buildtools/config/linux.pri @@ -164,9 +164,21 @@ host_build { gn_args += use_system_libpng=true qtConfig(webengine-printing-and-pdf): gn_args += pdfium_use_system_libpng=true } - qtConfig(webengine-system-jpeg): gn_args += use_system_libjpeg=true - qtConfig(webengine-system-freetype): gn_args += use_system_freetype=true - qtConfig(webengine-system-harfbuzz): gn_args += use_system_harfbuzz=true + qtConfig(webengine-system-jpeg) { + gn_args += use_system_libjpeg=true + } else { + gn_args += use_system_libjpeg=false + } + qtConfig(webengine-system-freetype) { + gn_args += use_system_freetype=true + } else { + gn_args += use_system_freetype=false + } + qtConfig(webengine-system-harfbuzz) { + gn_args += use_system_harfbuzz=true + } else { + gn_args += use_system_harfbuzz=false + } !qtConfig(webengine-system-glib): gn_args += use_glib=false qtConfig(webengine-pulseaudio) { gn_args += use_pulseaudio=true diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp index f91eabd25..abc63fed2 100644 --- a/src/core/api/qwebenginenotification.cpp +++ b/src/core/api/qwebenginenotification.cpp @@ -48,6 +48,22 @@ QT_BEGIN_NAMESPACE using QtWebEngineCore::UserNotificationController; /*! + \qmltype WebEngineNotification + \instantiates QWebEngineNotification + \inqmlmodule QtWebEngine + \since QtWebEngine 1.9 + \brief Encapsulates the data of an HTML5 web notification. + + This type contains the information and API for HTML5 desktop and push notifications. + + Web engine notifications are passed to the user in the + \l WebEngineProfile::presentNotification() signal. + + For more information about how to handle web notification, see the + \l{WebEngine Notifications Example}{Notification Example}. +*/ + +/*! \class QWebEngineNotification \brief The QWebEngineNotification class encapsulates the data of an HTML5 web notification. \since 5.13 @@ -56,10 +72,11 @@ using QtWebEngineCore::UserNotificationController; This class contains the information and API for HTML5 desktop and push notifications. - Web engine notifications are passed to the user in the - \l QWebEngineProfile::setNotificationPresenter() and - \l QQuickWebEngineProfile::presentNotification() calls and the - \l WebEngineProfile::presentNotification() signal. + Web engine notifications are passed to the user through the custom handler + provided with the \l QWebEngineProfile::setNotificationPresenter() call. + + For more information about how to handle web notification, see the + \l{WebEngine Notifications Example}{Notification Example}. */ class QWebEngineNotificationPrivate : public UserNotificationController::Client { @@ -115,6 +132,10 @@ bool QWebEngineNotification::matches(const QWebEngineNotification *other) const } /*! + \qmlproperty bool WebEngineNotification::title + \brief The title of the notification. +*/ +/*! \property QWebEngineNotification::title \brief The title of the notification. \sa message() @@ -126,6 +147,10 @@ QString QWebEngineNotification::title() const } /*! + \qmlproperty string WebEngineNotification::message + \brief The body of the notification message. +*/ +/*! \property QWebEngineNotification::message \brief The body of the notification message. \sa title() @@ -138,6 +163,13 @@ QString QWebEngineNotification::message() const } /*! + \qmlproperty string WebEngineNotification::tag + \brief The tag of the notification message. + + New notifications that have the same tag and origin URL as an existing + one should replace or update the old notification with the same tag. +*/ +/*! \property QWebEngineNotification::tag \brief The tag of the notification message. @@ -153,6 +185,10 @@ QString QWebEngineNotification::tag() const } /*! + \qmlproperty url WebEngineNotification::origin + \brief The URL of the page sending the notification. +*/ +/*! \property QWebEngineNotification::origin \brief The URL of the page sending the notification. */ @@ -175,6 +211,12 @@ QImage QWebEngineNotification::icon() const } /*! + \qmlproperty string WebEngineNotification::language + \brief The primary language for the notification's title and body. + + Its value is a valid BCP 47 language tag, or the empty string. +*/ +/*! \property QWebEngineNotification::language \brief The primary language for the notification's title and body. @@ -189,6 +231,14 @@ QString QWebEngineNotification::language() const } /*! + \qmlproperty enumeration WebEngineNotification::direction + \brief The text direction for the notification's title and body. + + \value Qt.LeftToRight Items are laid out from left to right. + \value Qt.RightToLeft Items are laid out from right to left. + \value Qt.LayoutDirectionAuto The direction to lay out items is determined automatically. +*/ +/*! \property QWebEngineNotification::direction \brief The text direction for the notification's title and body. \sa title(), message() @@ -200,6 +250,12 @@ Qt::LayoutDirection QWebEngineNotification::direction() const } /*! + \qmlmethod void WebEngineNotification::show() + Creates and dispatches a JavaScript \e {show event} on notification. + + Should be called by the notification platform when the notification has been shown to user. +*/ +/*! Creates and dispatches a JavaScript \e {show event} on notification. Should be called by the notification platform when the notification has been shown to user. @@ -212,6 +268,12 @@ void QWebEngineNotification::show() const } /*! + \qmlmethod void WebEngineNotification::click() + Creates and dispatches a JavaScript \e {click event} on notification. + + Should be called by the notification platform when the notification is activated by the user. +*/ +/*! Creates and dispatches a JavaScript \e {click event} on notification. Should be called by the notification platform when the notification is activated by the user. @@ -224,6 +286,13 @@ void QWebEngineNotification::click() const } /*! + \qmlmethod void WebEngineNotification::close() + Creates and dispatches a JavaScript \e {close event} on notification. + + Should be called by the notification platform when the notification is closed, + either by the underlying platform or by the user. +*/ +/*! Creates and dispatches a JavaScript \e {close event} on notification. Should be called by the notification platform when the notification is closed, @@ -237,6 +306,12 @@ void QWebEngineNotification::close() const } /*! + \qmlsignal WebEngineNotification::closed() + + This signal is emitted when the web page calls close steps for the notification, + and it no longer needs to be shown. +*/ +/*! \fn void QWebEngineNotification::closed() This signal is emitted when the web page calls close steps for the notification, diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp index 71465a1af..89c2980e3 100644 --- a/src/core/certificate_error_controller.cpp +++ b/src/core/certificate_error_controller.cpp @@ -79,14 +79,14 @@ CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_er const net::SSLInfo& ssl_info, const GURL &request_url, content::ResourceType resource_type, - bool _overridable, + bool fatal_error, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& cb ) : certError(CertificateErrorController::CertificateError(cert_error)) , requestUrl(toQt(request_url)) , resourceType(CertificateErrorController::ResourceType(resource_type)) - , overridable(_overridable) + , fatalError(fatal_error) , strictEnforcement(strict_enforcement) , callback(cb) { @@ -119,7 +119,7 @@ QUrl CertificateErrorController::url() const bool CertificateErrorController::overridable() const { - return d->overridable; + return !d->fatalError && !d->strictEnforcement; } bool CertificateErrorController::strictEnforcement() const diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h index f3b0c23fa..d51a559d0 100644 --- a/src/core/certificate_error_controller_p.h +++ b/src/core/certificate_error_controller_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class CertificateErrorControllerPrivate { public: - CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, content::ResourceType resource_type, bool overridable, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& callback); + CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, content::ResourceType resource_type, bool fatal_error, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& callback); void accept(bool accepted); @@ -68,7 +68,7 @@ public: QDateTime validStart; QDateTime validExpiry; CertificateErrorController::ResourceType resourceType; - bool overridable; + bool fatalError; bool strictEnforcement; const base::Callback<void(content::CertificateRequestResultType)> callback; QList<QSslCertificate> chain; diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index ee420d258..5816749c8 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -393,7 +393,7 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont ssl_info, request_url, resource_type, - !IsCertErrorFatal(cert_error), + IsCertErrorFatal(cert_error), strict_enforcement, callback))); contentsDelegate->allowCertificateError(errorController); diff --git a/src/core/core_common.pri b/src/core/core_common.pri index 2a9dc90c0..e10d14267 100644 --- a/src/core/core_common.pri +++ b/src/core/core_common.pri @@ -18,6 +18,3 @@ CONFIG -= ltcg # Chromium requires C++14 CONFIG += c++14 -#QTBUG-73216 ci has to be updated with latest yocto -boot2qt: CONFIG -= use_gold_linker - diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 3e64afd20..63b93c502 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -39,6 +39,9 @@ #include "file_picker_controller.h" #include "type_conversion.h" +#if defined(OS_WIN) +#include "base/files/file_path.h" +#endif #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/file_select_listener.h" @@ -64,12 +67,31 @@ FilePickerController::~FilePickerController() = default; void FilePickerController::accepted(const QStringList &files) { QStringList stringList; - - for (const QString &file : files) { - if (QDir(file).isAbsolute()) - stringList.append(file); - else - qWarning("Ignore invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(file)); + stringList.reserve(files.count()); + + for (const QString &urlString : files) { + // We accept strings on both absolute-path and file-URL form: + if (QDir::isAbsolutePath(urlString)) { + QString absolutePath = QDir::fromNativeSeparators(urlString); +#if defined(OS_WIN) + if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1())) + qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + else +#endif + stringList.append(absolutePath); + } else { + QUrl url(urlString, QUrl::StrictMode); + if (url.isLocalFile() && QDir::isAbsolutePath(url.toLocalFile())) { + QString absolutePath = url.toLocalFile(); +#if defined(OS_WIN) + if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1())) + qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + else +#endif + stringList.append(absolutePath); + } else + qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + } } FilePickerController::filesSelectedInChooser(stringList); @@ -77,21 +99,10 @@ void FilePickerController::accepted(const QStringList &files) void FilePickerController::accepted(const QVariant &files) { - QStringList stringList; - QList<QUrl> urlList = QUrl::fromStringList(files.toStringList()); - - if (urlList.isEmpty()) { - FilePickerController::accepted(stringList); - } else { - for (const QUrl &url : qAsConst(urlList)) { - if (url.isValid() && url.scheme() == "file" && !url.path().isEmpty()) - stringList.append(url.path()); - else - qWarning("Ignore invalid item in FilePickerController::accepted(QVariant): %s", qPrintable(url.toString())); - } + if (!files.canConvert(QVariant::StringList)) + qWarning("An unhandled type '%s' was provided in FilePickerController::accepted(QVariant)", files.typeName()); - FilePickerController::accepted(stringList); - } + accepted(files.toStringList()); } void FilePickerController::rejected() diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 38fe56f7d..5c87d87a2 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -239,9 +239,11 @@ extensions::ExtensionSystemQt* ProfileIODataQt::GetExtensionSystem() void ProfileIODataQt::initializeOnIOThread() { m_networkDelegate.reset(new NetworkDelegateQt(this)); + m_hostResolver = net::HostResolver::CreateStandaloneResolver(nullptr); m_urlRequestContext.reset(new net::URLRequestContext()); m_urlRequestContext->set_network_delegate(m_networkDelegate.get()); m_urlRequestContext->set_enable_brotli(base::FeatureList::IsEnabled(features::kBrotliEncoding)); + m_urlRequestContext->set_host_resolver(m_hostResolver.get()); // this binds factory to io thread m_weakPtr = m_weakPtrFactory.GetWeakPtr(); const std::lock_guard<QRecursiveMutex> lock(m_mutex); @@ -338,11 +340,6 @@ void ProfileIODataQt::generateStorage() ct_verifier->AddLogs(ct_logs); m_storage->set_cert_transparency_verifier(std::move(ct_verifier)); m_storage->set_ct_policy_enforcer(base::WrapUnique(new net::DefaultCTPolicyEnforcer())); -// static std::unique_ptr<net::HostResolverManager> s_hostResolverManager = -// std::make_unique<net::HostResolverManager>(net::HostResolver::Options(), nullptr); -// m_storage->set_host_resolver(net::HostResolver::CreateResolver(s_hostResolverManager.get())); - m_storage->set_host_resolver(net::HostResolver::CreateStandaloneResolver(nullptr)); - m_storage->set_ssl_config_service(std::make_unique<net::SSLConfigServiceDefaults>()); if (!m_httpAuthPreferences) { m_httpAuthPreferences.reset(new net::HttpAuthPreferences()); diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 4a5b9f77d..00a4de2b0 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -56,6 +56,7 @@ class ClientCertStore; class DhcpPacFileFetcherFactory; class HttpAuthPreferences; class HttpNetworkSession; +class HostResolver; class NetworkDelegate; class ProxyConfigService; class URLRequestContext; @@ -157,6 +158,7 @@ private: std::unique_ptr<net::HttpAuthPreferences> m_httpAuthPreferences; std::unique_ptr<net::URLRequestJobFactory> m_jobFactory; std::unique_ptr<net::TransportSecurityPersister> m_transportSecurityPersister; + std::unique_ptr<net::HostResolver> m_hostResolver; base::WeakPtr<ProfileIODataQt> m_weakPtr; scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate; content::URLRequestInterceptorScopedVector m_requestInterceptors; diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e741962fb..c98612192 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -770,8 +770,11 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana } ui::TextInputType type = getTextInputType(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu); - +#else + m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText); +#endif m_surroundingText = toQt(state->value); // Remove IME composition text from the surrounding text if (state->composition_start != -1 && state->composition_end != -1) @@ -1200,7 +1203,11 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) // TODO: Implement this return QVariant(); // No limit. case Qt::ImHints: +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu); +#else + return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText); +#endif default: return QVariant(); } diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp index da3c78b8a..0f44210d1 100644 --- a/src/core/touch_selection_controller_client_qt.cpp +++ b/src/core/touch_selection_controller_client_qt.cpp @@ -315,7 +315,7 @@ void TouchSelectionControllerClientQt::showMenu() WebContentsAdapterClient *adapterClient = m_rwhv->adapterClient(); Q_ASSERT(adapterClient); - adapterClient->showTouchSelectionMenu(m_menuController.get(), + adapterClient->showTouchSelectionMenu(m_menuController.data(), QRect(toQt(gfx::ToEnclosingRect(anchor_rect))), QSize(toQt(gfx::ToRoundedSize(max_handle_size)))); m_menuShowing = true; diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 7f5306e67..3598c1c78 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -926,7 +926,7 @@ static ui::DomKey domKeyForQtKey(int qtKey) return ui::DomKey::ZENKAKU; case Qt::Key_Zenkaku_Hankaku: return ui::DomKey::ZENKAKU_HANKAKU; - +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) // Dead keys (ui/events/keycodes/keyboard_code_conversion_xkb.cc) case Qt::Key_Dead_Grave: return ui::DomKey::DeadKeyFromCombiningCharacter(0x0300); @@ -994,7 +994,7 @@ static ui::DomKey domKeyForQtKey(int qtKey) return ui::DomKey::DeadKeyFromCombiningCharacter(0x00A4); case Qt::Key_Dead_Greek: return ui::DomKey::DeadKeyFromCombiningCharacter(0x037E); - +#endif // General-Purpose Function Keys case Qt::Key_F1: return ui::DomKey::F1; diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 57434e296..edad7ec44 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -157,7 +157,10 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC \fn QQuickWebEngineProfile::presentNotification(QWebEngineNotification *notification) This signal is emitted whenever there is a newly created user notification. - The \a notification argument holds the notification instance to query data and interact with. + The \a notification argument holds the \l {QWebEngineNotification} instance + to query data and interact with. + + \sa WebEngineProfile::presentNotification */ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter) @@ -395,7 +398,8 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb \since QtWebEngine 1.9 This signal is emitted whenever there is a newly created user notification. - The \a notification argument holds the notification instance to query data and interact with. + The \a notification argument holds the \l {WebEngineNotification} instance + to query data and interact with. */ /*! diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index 93a3668ed..9a102a504 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -250,7 +250,7 @@ bool QQuickWebEngineSettings::pluginsEnabled() const Tells the web engine whether fullscreen is supported in this application or not. - Enabled by default. + Disabled by default. */ bool QQuickWebEngineSettings::fullScreenSupportEnabled() const { diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 58d950cd9..8a1a3c516 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -297,7 +297,7 @@ void QQuickWebEngineViewPrivate::allowCertificateError(const QSharedPointer<Cert // mark the object for gc by creating temporary jsvalue qmlEngine(q)->newQObject(quickController); Q_EMIT q->certificateError(quickController); - if (!quickController->deferred() && !quickController->answered()) + if (!quickController->overridable() || (!quickController->deferred() && !quickController->answered())) quickController->rejectCertificate(); else m_certificateErrorControllers.append(errorController); @@ -1152,9 +1152,7 @@ void QQuickWebEngineViewPrivate::updateAdapter() adapter->setClient(this); if (wasInitialized) { if (!m_html.isEmpty()) - adapter->setContent(m_html.toUtf8(), defaultMimeType, m_url); - else if (m_url.isValid()) - adapter->load(m_url); + adapter->setContent(m_html.toUtf8(), defaultMimeType, activeUrl); else if (activeUrl.isValid()) adapter->load(activeUrl); else diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc index 08c189740..00b9cb496 100644 --- a/src/webengine/doc/src/qtwebengine-features.qdoc +++ b/src/webengine/doc/src/qtwebengine-features.qdoc @@ -126,7 +126,9 @@ so uniquely identifies the user and might violate privacy expectations. To activate support for client certificates, an application needs to listen to - the QWebEnginePage::selectClientCertificate signal and select one of the offered + the QWebEnginePage::selectClientCertificate or + \l{WebEnginePage::selectClientCertificate}{WebEnginePage.selectClientCertificate} + signals and select one of the offered certificates. For applications that can navigate to untrusted web sites, it is recommended to always give the user a choice before uniquely identifying them to a remote server. diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 5b7d750ff..5d32fa6c7 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -73,6 +73,8 @@ \list \li Visual Studio 2017 version 15.8 or later + \li Active Template Library (ATL), usually included in the Visual Studio + installation \li Windows 10 SDK \endlist diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc index 8f03774c8..9abc8f37b 100644 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ b/src/webengine/doc/src/webengineview_lgpl.qdoc @@ -396,7 +396,7 @@ runJavaScript("document.title", function(result) { console.log(result); }); \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}. @@ -407,7 +407,8 @@ \warning Do not execute lengthy routines in the callback function, because it might block the rendering of the web content. - See WebEngineView::userScripts for an alternative API to inject scripts. + For more information about injecting scripts, see \l {Script Injection}. + For an alternative way to inject scripts, see WebEngineView::userScripts. */ /*! @@ -444,14 +445,13 @@ To clear the search highlight, just pass an empty string. - The \a resultCallback must take a boolean parameter. It will be called with - a value of true if the \a subString was found; otherwise the callback value - will be false. + The \a resultCallback must take an integer parameter. It will be called with + the number of found occurrences of the \a subString. \code - findText("Qt", WebEngineView.FindCaseSensitively, function(success) { - if (success) - console.log("Qt was found!"); + findText("Qt", WebEngineView.FindCaseSensitively, function(matchCount) { + if (matchCount > 0) + console.log("'Qt' tokens found:", matchCount); }); \endcode diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index e47a46a95..5fb48d867 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -164,10 +164,12 @@ public: qmlRegisterUncreatableType<QWebEngineRegisterProtocolHandlerRequest>(uri, 1, 7, "RegisterProtocolHandlerRequest", msgUncreatableType("RegisterProtocolHandlerRequest")); qmlRegisterUncreatableType<QQuickWebEngineAction>(uri, 1, 8, "WebEngineAction", msgUncreatableType("WebEngineAction")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) qmlRegisterUncreatableType<QQuickWebEngineClientCertificateSelection>(uri, 1, 9, "WebEngineClientCertificateSelection", msgUncreatableType("WebEngineClientCertificateSelection")); qmlRegisterUncreatableType<QQuickWebEngineClientCertificateOption>(uri, 1, 9, "WebEngineClientCertificateOption", msgUncreatableType("WebEngineClientCertificateOption")); +#endif qmlRegisterUncreatableType<QWebEngineNotification>(uri, 1, 9, "WebEngineNotification", msgUncreatableType("WebEngineNotification")); qmlRegisterUncreatableType<QQuickWebEngineTooltipRequest>(uri, 1, 10, "TooltipRequest", msgUncreatableType("TooltipRequest")); diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index 3a103b9aa..ac32671aa 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -106,7 +106,11 @@ QRectF RenderWidgetHostViewQtDelegateQuick::viewGeometry() const const QPointF p2 = mapToGlobal(mapFromScene(QPointF(width(), height()))); QRectF geometry = QRectF(p1, p2).normalized(); // But keep the size untransformed to behave like other QQuickItems. +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) geometry.setSize(size()); +#else + geometry.setSize(QSizeF(width(), height())); +#endif return geometry; } diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp index 23b9e02c2..d3ebdbf27 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp @@ -48,7 +48,7 @@ RenderWidgetHostViewQtDelegateQuickWindow::RenderWidgetHostViewQtDelegateQuickWi : m_realDelegate(realDelegate) , m_virtualParent(nullptr) { - setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); + setFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); } RenderWidgetHostViewQtDelegateQuickWindow::~RenderWidgetHostViewQtDelegateQuickWindow() diff --git a/src/webengine/ui/ToolTip.qml b/src/webengine/ui/ToolTip.qml index 96033e8f1..2bfe9eaf5 100644 --- a/src/webengine/ui/ToolTip.qml +++ b/src/webengine/ui/ToolTip.qml @@ -47,8 +47,9 @@ Item { visible: false property alias text: toolTip.text - property int delayTimerInterval: 1000 - property int hideTimerInterval: 1500 + property int delayTimerInterval: 500 + property int hideTimerInterval: 10000 + property int toolTipMaxWidth: 400 Timer { id: delayTimer @@ -77,7 +78,8 @@ Item { Text { id: toolTip anchors {fill: parent; margins: 5} - wrapMode: Text.WrapAnywhere + wrapMode: Text.Wrap + width: Math.min(toolTipMaxWidth, (toolTip.text.length +1) * 8) } } 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} */ /*! |