diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-10-07 17:38:05 +0300 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-10-07 17:44:32 +0300 |
| commit | 183d0101f41fd5a1007708a9416d1f12db31c1cb (patch) | |
| tree | 969a5e91aef3b4c6805331e56c24fa6be8738f6b /src/core | |
| parent | 17e9f29577ea6573c7c348083ff510ee60c7e8cc (diff) | |
| parent | 13381ca9e80578d038835c8a4dc609d75dfdec4c (diff) | |
Merge tag 'v6.2.10-lts' into tqtc/lts-6.2-opensourcev6.2.10-lts-lgpl6.2.10
Qt 6.2.10-lts release
Conflicts solved:
CHROMIUM_VERSION
dependencies.yaml
src/core/web_engine_context.cpp
Change-Id: Ia54316ba0df3488d8e13c8f14fead1d90099519b
Diffstat (limited to 'src/core')
33 files changed, 225 insertions, 84 deletions
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt index 922adfd8c..94ed3c852 100644 --- a/src/core/api/CMakeLists.txt +++ b/src/core/api/CMakeLists.txt @@ -95,7 +95,7 @@ add_code_attributions_target( BUILDDIR ${buildDir}/${config}/${arch} ) add_dependencies(generate_chromium_attributions run_core_GnDone) -add_dependencies(docs generate_chromium_attributions) +add_dependencies(prepare_docs_WebEngineCore generate_chromium_attributions) ## # WEBENGINECORE RESOURCES diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 2736e1a33..7029cebbd 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -212,7 +212,12 @@ static void initialize() // QCoreApplication is not yet instantiated, ensuring the call will be deferred qAddPreRoutine(QtWebEngineCore::initialize); auto api = QQuickWindow::graphicsApi(); - if (api != QSGRendererInterface::OpenGL && api != QSGRendererInterface::Vulkan) + if (api != QSGRendererInterface::OpenGL +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + && api != QSGRendererInterface::Vulkan + && api != QSGRendererInterface::Metal && api != QSGRendererInterface::Direct3D11 +#endif + ) QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); #endif // QT_CONFIG(opengl) } diff --git a/src/core/api/qwebenginefilesystemaccessrequest.cpp b/src/core/api/qwebenginefilesystemaccessrequest.cpp index 6527e1766..3f901b671 100644 --- a/src/core/api/qwebenginefilesystemaccessrequest.cpp +++ b/src/core/api/qwebenginefilesystemaccessrequest.cpp @@ -27,6 +27,25 @@ QT_BEGIN_NAMESPACE either call accept() or reject(). */ +/*! + \enum QWebEngineFileSystemAccessRequest::AccessFlag + + This enum describes the type of the requested access: read, write or both. The options + can be OR-ed together from the following list: + + \value Read + \value Write +*/ + +/*! + \enum QWebEngineFileSystemAccessRequest::HandleType + + This enum describes the type of the requested file system entry. + + \value File + \value Directory +*/ + QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest( const QWebEngineFileSystemAccessRequest &other) = default; QWebEngineFileSystemAccessRequest &QWebEngineFileSystemAccessRequest::operator=( diff --git a/src/core/api/qwebenginehistory.cpp b/src/core/api/qwebenginehistory.cpp index b70c0b73d..5d2fc8e9e 100644 --- a/src/core/api/qwebenginehistory.cpp +++ b/src/core/api/qwebenginehistory.cpp @@ -242,13 +242,6 @@ QWebEngineHistory::QWebEngineHistory(QWebEngineHistoryPrivate *d) : d_ptr(d) { } QWebEngineHistory::~QWebEngineHistory() { } -/*! - \qmlmethod void WebEngineHistory::clear() - \since QtWebEngine 1.11 - - Clears the history. -*/ - void QWebEngineHistory::clear() { Q_D(const QWebEngineHistory); diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp index 62244c787..a435e2c0c 100644 --- a/src/core/api/qwebenginemessagepumpscheduler.cpp +++ b/src/core/api/qwebenginemessagepumpscheduler.cpp @@ -11,9 +11,14 @@ QWebEngineMessagePumpScheduler::QWebEngineMessagePumpScheduler(std::function<voi : m_callback(std::move(callback)) {} -void QWebEngineMessagePumpScheduler::scheduleWork() +void QWebEngineMessagePumpScheduler::scheduleImmediateWork() { - QCoreApplication::postEvent(this, new QTimerEvent(0)); + QCoreApplication::postEvent(this, new QTimerEvent(0), Qt::NormalEventPriority); +} + +void QWebEngineMessagePumpScheduler::scheduleIdleWork() +{ + QCoreApplication::postEvent(this, new QTimerEvent(0), Qt::LowEventPriority); } void QWebEngineMessagePumpScheduler::scheduleDelayedWork(int delay) diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h index 7e84b4190..4ec7ef125 100644 --- a/src/core/api/qwebenginemessagepumpscheduler_p.h +++ b/src/core/api/qwebenginemessagepumpscheduler_p.h @@ -28,7 +28,8 @@ class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QOb Q_OBJECT public: QWebEngineMessagePumpScheduler(std::function<void()> callback); - void scheduleWork(); + void scheduleImmediateWork(); + void scheduleIdleWork(); void scheduleDelayedWork(int delay); protected: diff --git a/src/core/api/qwebenginenavigationrequest.cpp b/src/core/api/qwebenginenavigationrequest.cpp index c14a7bf41..0a30f6472 100644 --- a/src/core/api/qwebenginenavigationrequest.cpp +++ b/src/core/api/qwebenginenavigationrequest.cpp @@ -89,7 +89,10 @@ void QWebEngineNavigationRequest::setAction(QWebEngineNavigationRequest::Navigat return; acceptRequest ? accept() : reject(); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit actionChanged(); +QT_WARNING_POP } #endif /*! diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index dff2418b5..78021248c 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -103,7 +103,9 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) { memset(actions, 0, sizeof(actions)); +#if QT_DEPRECATED_SINCE(6, 5) qRegisterMetaType<QWebEngineQuotaRequest>(); +#endif qRegisterMetaType<QWebEngineRegisterProtocolHandlerRequest>(); qRegisterMetaType<QWebEngineFileSystemAccessRequest>(); qRegisterMetaType<QWebEngineFindTextResult>(); @@ -508,6 +510,15 @@ void QWebEnginePagePrivate::runRegisterProtocolHandlerRequest(QWebEngineRegister Q_EMIT q->registerProtocolHandlerRequested(request); } +/*! + \fn void QWebEnginePage::fileSystemAccessRequested(QWebEngineFileSystemAccessRequest request) + \since 6.4 + + This signal is emitted when the web page requests access to local files or directories. + + The request object \a request can be used to accept or reject the request. +*/ + void QWebEnginePagePrivate::runFileSystemAccessRequest(QWebEngineFileSystemAccessRequest request) { Q_Q(QWebEnginePage); @@ -1502,7 +1513,7 @@ void QWebEnginePagePrivate::contextMenuRequested(QWebEngineContextMenuRequest *d } /*! - \fn bool QWebEnginePage::navigationRequested(QWebEngineNavigationRequest &request) + \fn void QWebEnginePage::navigationRequested(QWebEngineNavigationRequest &request) \since 6.2 This signal is emitted on navigation together with the call the acceptNavigationRequest(). @@ -1643,6 +1654,17 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText) view->setToolTip(toolTipText); } +/*! + \fn void QWebEnginePage::printRequested() + \since 5.12 + + This signal is emitted when the JavaScript \c{window.print()} method is called or the user pressed the print + button of PDF viewer plugin. + Typically, the signal handler can simply call printToPdf(). + + \sa printToPdf() +*/ + void QWebEnginePagePrivate::printRequested() { Q_Q(QWebEnginePage); diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 49a193b05..299eb7bb3 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -13,10 +13,6 @@ #include "render_widget_host_view_qt.h" // WebContentsAccessibilityQt #include "content/browser/accessibility/browser_accessibility.h" -#if QT_CONFIG(webengine_extensions) -#include "content/browser/renderer_host/render_frame_host_impl.h" -#include "content/public/browser/web_contents.h" -#endif // QT_CONFIG(webengine_extensions) #include "ui/accessibility/ax_enums.mojom.h" #include <QtGui/qaccessible.h> @@ -34,12 +30,10 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( QtWebEngineCore::WebContentsAccessibilityQt *access = nullptr; access = static_cast<QtWebEngineCore::WebContentsAccessibilityQt *>(delegate->AccessibilityGetWebContentsAccessibility()); -#if QT_CONFIG(webengine_extensions) - // Accessibility is not supported for guest views. + // Accessibility is not supported for guest views and child frames. if (!access) { return nullptr; } -#endif // QT_CONFIG(webengine_extensions) return new BrowserAccessibilityManagerQt(access, initialTree, delegate); #else diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index d1cdd4b20..24c006dc5 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -25,10 +25,7 @@ public: BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, ui::AXNode *node); ~BrowserAccessibilityQt(); - QtWebEngineCore::BrowserAccessibilityInterface *interface() const { return m_interface; } - -private: - QtWebEngineCore::BrowserAccessibilityInterface *m_interface = nullptr; + QtWebEngineCore::BrowserAccessibilityInterface *interface = nullptr; }; class BrowserAccessibilityInterface @@ -41,6 +38,7 @@ class BrowserAccessibilityInterface { public: BrowserAccessibilityInterface(BrowserAccessibilityQt *chromiumInterface); + ~BrowserAccessibilityInterface() override; void destroy(); @@ -133,15 +131,17 @@ private: BrowserAccessibilityQt *q; }; -BrowserAccessibilityQt::BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, ui::AXNode *node) - : content::BrowserAccessibility(manager, node), - m_interface(new BrowserAccessibilityInterface(this)) +BrowserAccessibilityQt::BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, + ui::AXNode *node) + : content::BrowserAccessibility(manager, node) + , interface(new BrowserAccessibilityInterface(this)) { } BrowserAccessibilityQt::~BrowserAccessibilityQt() { - m_interface->destroy(); + if (interface) + interface->destroy(); } BrowserAccessibilityInterface::BrowserAccessibilityInterface(BrowserAccessibilityQt *chromiumInterface) @@ -157,6 +157,11 @@ BrowserAccessibilityInterface::BrowserAccessibilityInterface(BrowserAccessibilit m_id = QAccessible::registerAccessibleInterface(this); } +BrowserAccessibilityInterface::~BrowserAccessibilityInterface() +{ + q->interface = nullptr; +} + void BrowserAccessibilityInterface::destroy() { QAccessible::deleteAccessibleInterface(m_id); @@ -1140,12 +1145,12 @@ std::unique_ptr<BrowserAccessibility> BrowserAccessibility::Create(BrowserAccess QAccessibleInterface *toQAccessibleInterface(BrowserAccessibility *obj) { - return static_cast<QtWebEngineCore::BrowserAccessibilityQt *>(obj)->interface(); + return static_cast<QtWebEngineCore::BrowserAccessibilityQt *>(obj)->interface; } const QAccessibleInterface *toQAccessibleInterface(const BrowserAccessibility *obj) { - return static_cast<const QtWebEngineCore::BrowserAccessibilityQt *>(obj)->interface(); + return static_cast<const QtWebEngineCore::BrowserAccessibilityQt *>(obj)->interface; } } // namespace content diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index e58822c29..93522d239 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -50,6 +50,7 @@ #include "web_engine_context.h" #include "web_usb_detector_qt.h" +#include <QDeadlineTimer> #include <QtGui/qtgui-config.h> #include <QStandardPaths> @@ -120,7 +121,7 @@ public: { // NOTE: This method may called from any thread at any time. ensureDelegate(); - m_scheduler.scheduleWork(); + m_scheduler.scheduleImmediateWork(); } void ScheduleDelayedWork(const Delegate::NextWorkInfo &next_work_info) override @@ -193,13 +194,16 @@ private: { ScopedGLContextChecker glContextChecker; + QDeadlineTimer timer(std::chrono::milliseconds(2)); base::MessagePump::Delegate::NextWorkInfo more_work_info = m_delegate->DoWork(); + while (more_work_info.is_immediate() && !timer.hasExpired()) + more_work_info = m_delegate->DoWork(); if (more_work_info.is_immediate()) - return ScheduleWork(); + return m_scheduler.scheduleImmediateWork(); if (m_delegate->DoIdleWork()) - return ScheduleWork(); + return m_scheduler.scheduleIdleWork(); ScheduleDelayedWork(more_work_info.delayed_run_time); } diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 009235a72..fe56a5db1 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -27,6 +27,8 @@ #include <QImageWriter> #include <QMimeData> +#include <memory> + namespace QtWebEngineCore { static void registerMetaTypes() @@ -60,12 +62,12 @@ using namespace QtWebEngineCore; namespace { -QScopedPointer<QMimeData> uncommittedData; +std::unique_ptr<QMimeData> uncommittedData; QMimeData *getUncommittedData() { if (!uncommittedData) uncommittedData.reset(new QMimeData); - return uncommittedData.data(); + return uncommittedData.get(); } } // namespace @@ -104,7 +106,7 @@ void ClipboardQt::WritePortableAndPlatformRepresentations(ui::ClipboardBuffer ty // Commit the accumulated data. if (uncommittedData) - QGuiApplication::clipboard()->setMimeData(uncommittedData.take(), + QGuiApplication::clipboard()->setMimeData(uncommittedData.release(), type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index fab8a5abb..3d7a157bd 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -61,7 +61,7 @@ static QString webenginePluginsPath() { // Look for plugins in /plugins/webengine or application dir. static bool initialized = false; - static QString potentialPluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath) % QLatin1String("/webengine"); + static QString potentialPluginsPath = QLibraryInfo::path(QLibraryInfo::PluginsPath) % QLatin1String("/webengine"); if (!initialized) { initialized = true; if (!QFileInfo::exists(potentialPluginsPath)) @@ -105,7 +105,7 @@ static QString ppapiPluginsPath() { // Look for plugins in /plugins/ppapi or application dir. static bool initialized = false; - static QString potentialPluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath) % QLatin1String("/ppapi"); + static QString potentialPluginsPath = QLibraryInfo::path(QLibraryInfo::PluginsPath) % QLatin1String("/ppapi"); if (!initialized) { initialized = true; if (!QFileInfo::exists(potentialPluginsPath)) diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 52e23399e..feaaaaa9a 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -14,7 +14,6 @@ #include "content/public/browser/browser_main_runner.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" -#include "media/gpu/buildflags.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_paths.h" #include "ui/base/resource/resource_bundle.h" @@ -39,9 +38,6 @@ #include "ui/base/ui_base_switches.h" #endif -// must be included before vaapi_wrapper.h -#include <QtCore/qcoreapplication.h> - #if BUILDFLAG(IS_WIN) #include "media/gpu/windows/dxva_video_decode_accelerator_win.h" #include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h" @@ -53,9 +49,7 @@ #include "media/gpu/mac/vt_video_decode_accelerator_mac.h" #endif -#if BUILDFLAG(USE_VAAPI) -#include "media/gpu/vaapi/vaapi_wrapper.h" -#endif +#include <QtCore/qcoreapplication.h> namespace content { ContentClient *GetContentClient(); @@ -171,21 +165,21 @@ void ContentMainDelegateQt::PreSandboxStartup() setlocale(LC_NUMERIC, "C"); #endif - // from gpu_main.cc: -#if BUILDFLAG(USE_VAAPI) - media::VaapiWrapper::PreSandboxInitialization(); -#endif + bool isBrowserProcess = !parsedCommandLine->HasSwitch(switches::kProcessType); + if (isBrowserProcess) { + // from gpu_main.cc: #if BUILDFLAG(IS_WIN) - media::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); - media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization(); + media::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); + media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization(); #endif #if BUILDFLAG(IS_MAC) - { - TRACE_EVENT0("gpu", "Initialize VideoToolbox"); - media::InitializeVideoToolbox(); - } + { + TRACE_EVENT0("gpu", "Initialize VideoToolbox"); + media::InitializeVideoToolbox(); + } #endif + } if (parsedCommandLine->HasSwitch(switches::kApplicationName)) { std::string appName = parsedCommandLine->GetSwitchValueASCII(switches::kApplicationName); diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 731414db9..3fddd3410 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -62,7 +62,7 @@ DevToolsFrontendQt *DevToolsFrontendQt::Show(QSharedPointer<WebContentsAdapter> new DevToolsFrontendQt(frontendAdapter, inspectedContents); if (contents->GetURL() == GURL(GetFrontendURL())) { - contents->GetController().Reload(content::ReloadType::ORIGINAL_REQUEST_URL, false); + contents->GetController().LoadOriginalRequestURL(); } else { content::NavigationController::LoadURLParams loadParams((GURL(GetFrontendURL()))); loadParams.transition_type = ui::PageTransitionFromInt(ui::PAGE_TRANSITION_AUTO_TOPLEVEL @@ -162,7 +162,7 @@ void DevToolsFrontendQt::ActivateWindow() web_contents()->Focus(); } -void DevToolsFrontendQt::InspectElementCompleted() +void DevToolsFrontendQt::OnLoadCompleted() { m_bindings->CallClientMethod("DevToolsAPI", "setUseSoftMenu", base::Value(true)); } @@ -204,4 +204,9 @@ void DevToolsFrontendQt::InspectedContentsClosing() web_contents()->ClosePage(); } +void DevToolsFrontendQt::CloseWindow() +{ + web_contents()->Close(); +} + } // namespace QtWebEngineCore diff --git a/src/core/devtools_frontend_qt.h b/src/core/devtools_frontend_qt.h index 3b722c9ad..9b739033a 100644 --- a/src/core/devtools_frontend_qt.h +++ b/src/core/devtools_frontend_qt.h @@ -54,18 +54,18 @@ private: // DevToolsUIBindings::Delegate overrides void ActivateWindow() override; - void InspectElementCompleted() override; void SetEyeDropperActive(bool active) override; void OpenInNewTab(const std::string &url) override; void InspectedContentsClosing() override; + void OnLoadCompleted() override; - void CloseWindow() override{}; + void InspectElementCompleted() override{}; + void CloseWindow() override; void Inspect(scoped_refptr<content::DevToolsAgentHost>) override{}; void SetInspectedPageBounds(const gfx::Rect &) override{}; void SetIsDocked(bool) override{}; void SetWhitelistedShortcuts(const std::string &) override{}; void OpenNodeFrontend() override{}; - void OnLoadCompleted() override{}; void ReadyForTest() override{}; void ConnectionReady() override{}; void SetOpenNewWindowForPopups(bool) override{}; diff --git a/src/core/doc/about_credits_entry.tmpl b/src/core/doc/about_credits_entry.tmpl index aa94f2945..2bb9cff4e 100644 --- a/src/core/doc/about_credits_entry.tmpl +++ b/src/core/doc/about_credits_entry.tmpl @@ -1,6 +1,5 @@ /*! -\page qtwebengine-3rdparty-{{name-sanitized}}.html -\attribution +\page qtwebengine-3rdparty-{{name-sanitized}}.html attribution \ingroup qtwebengine-licensing \brief {{license-type}} \title {{name}} diff --git a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc index ee22ea774..9a7370d62 100644 --- a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc +++ b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc @@ -7,5 +7,5 @@ QT += webenginecore //! [2] find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) -target_link_libraries(target PRIVATE Qt::WebEngineCore) +target_link_libraries(target PRIVATE Qt6::WebEngineCore) //! [2] diff --git a/src/core/doc/src/qtwebengine-deploying.qdoc b/src/core/doc/src/qtwebengine-deploying.qdoc index 7504965e3..625570fee 100644 --- a/src/core/doc/src/qtwebengine-deploying.qdoc +++ b/src/core/doc/src/qtwebengine-deploying.qdoc @@ -4,6 +4,7 @@ /*! \page qtwebengine-deploying.html \title Deploying Qt WebEngine Applications + \ingroup explanations-webtechnologies The way to package and deploy applications varies between operating systems. For Windows and \macos, \l{The Windows Deployment Tool}{windeployqt} and diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc index 3d6d0fea8..29e7b0f06 100644 --- a/src/core/doc/src/qtwebengine-features.qdoc +++ b/src/core/doc/src/qtwebengine-features.qdoc @@ -4,6 +4,7 @@ /*! \page qtwebengine-features.html \title Qt WebEngine Features + \ingroup explanations-webtechnologies \brief Summarizes \QWE features. @@ -304,6 +305,10 @@ {Location services}, \uicontrol {Let apps access your location} and \uicontrol {Let desktop apps access your location}. + \note On macOS add a description text explaining why use of the location is needed + using the \c NSLocationUsageDescription in your application's \c Info.plist file + and sign the application to trigger \c macos to ask the user for permission. + See \l{Qt Positioning} for a possible backend setup like the GPS or IP based positioning. Support for this feature was added in Qt 5.5.0. diff --git a/src/core/doc/src/qtwebengine-overview.qdoc b/src/core/doc/src/qtwebengine-overview.qdoc index b1e8ee3da..6eccc669e 100644 --- a/src/core/doc/src/qtwebengine-overview.qdoc +++ b/src/core/doc/src/qtwebengine-overview.qdoc @@ -4,6 +4,7 @@ /*! \page qtwebengine-overview.html \title Qt WebEngine Overview + \ingroup explanations-webtechnologies The \QWE module provides a web browser engine that makes it easy to embed content from the World Wide Web into your Qt application on platforms that do not have a native web engine. diff --git a/src/core/doc/src/qwebengine-licensing.qdoc b/src/core/doc/src/qwebengine-licensing.qdoc index 796a9664d..ed1c5f376 100644 --- a/src/core/doc/src/qwebengine-licensing.qdoc +++ b/src/core/doc/src/qwebengine-licensing.qdoc @@ -22,8 +22,7 @@ Third party licenses included in the sources are: */ /*! -\page qtwebengine-3rdparty-chromium-global.html -\attribution +\page qtwebengine-3rdparty-chromium-global.html attribution \ingroup qtwebengine-licensing \title Chromium License \brief BSD diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 6ec7258b9..9b4521358 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -136,7 +136,7 @@ void FilePickerController::accepted(const QVariant &files) { QStringList stringList; - if (files.canConvert(QMetaType::QStringList)) { + if (files.canConvert(QMetaType{QMetaType::QStringList})) { stringList = files.toStringList(); } else if (files.canConvert<QList<QUrl> >()) { const QList<QUrl> urls = files.value<QList<QUrl>>(); diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp index 70bcb59b4..fcce08550 100644 --- a/src/core/net/proxy_config_service_qt.cpp +++ b/src/core/net/proxy_config_service_qt.cpp @@ -16,14 +16,15 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qtProxy) { - net::HostPortPair hostPortPair(qtProxy.hostName().toStdString(), qtProxy.port()); + std::string host = qtProxy.hostName().toStdString(); + uint16_t port = qtProxy.port(); switch (qtProxy.type()) { case QNetworkProxy::Socks5Proxy: - return net::ProxyServer(net::ProxyServer::SCHEME_SOCKS5, hostPortPair); + return net::ProxyServer::FromSchemeHostAndPort(net::ProxyServer::SCHEME_SOCKS5, host, port); case QNetworkProxy::HttpProxy: case QNetworkProxy::HttpCachingProxy: case QNetworkProxy::FtpCachingProxy: - return net::ProxyServer(net::ProxyServer::SCHEME_HTTP, hostPortPair); + return net::ProxyServer::FromSchemeHostAndPort(net::ProxyServer::SCHEME_HTTP, host, port); case QNetworkProxy::NoProxy: case QNetworkProxy::DefaultProxy: return net::ProxyServer(net::ProxyServer::SCHEME_DIRECT, net::HostPortPair()); diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index 70ec61b34..2c61015e6 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -126,8 +126,6 @@ public: void PauseReadingBodyFromNet() override; void ResumeReadingBodyFromNet() override; - static inline void cleanup(QWebEngineUrlRequestInfo *info) { delete info; } - private: void InterceptOnUIThread(); void ContinueAfterIntercept(); @@ -169,7 +167,13 @@ private: const net::MutableNetworkTrafficAnnotationTag traffic_annotation_; - QScopedPointer<QWebEngineUrlRequestInfo, InterceptedRequest> request_info_; + struct RequestInfoDeleter + { + void operator()(QWebEngineUrlRequestInfo *ptr) const + { delete ptr; } + }; + + std::unique_ptr<QWebEngineUrlRequestInfo, RequestInfoDeleter> request_info_; mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_; mojo::Remote<network::mojom::URLLoaderClient> target_client_; @@ -349,7 +353,7 @@ void InterceptedRequest::ContinueAfterIntercept() if (request_info_) { // cleanup in scope because of delete this and it's not needed else where after - decltype(request_info_) scoped_request_info(request_info_.take()); + const auto scoped_request_info = std::move(request_info_); QWebEngineUrlRequestInfoPrivate &info = *scoped_request_info->d_ptr; if (info.changed) { diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp index ab66acac0..a8b4e4388 100644 --- a/src/core/net/qrc_url_scheme_handler.cpp +++ b/src/core/net/qrc_url_scheme_handler.cpp @@ -10,6 +10,8 @@ #include <QMimeDatabase> #include <QMimeType> +#include <memory> + namespace QtWebEngineCore { void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) @@ -22,7 +24,7 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QUrl requestUrl = job->requestUrl(); QString requestPath = requestUrl.path(); - QScopedPointer<QFile> file(new QFile(':' + requestPath, job)); + auto file = std::make_unique<QFile>(':' + requestPath, job); if (!file->exists() || file->size() == 0) { qWarning("QResource '%s' not found or is empty", qUtf8Printable(requestPath)); job->fail(QWebEngineUrlRequestJob::UrlNotFound); @@ -32,9 +34,9 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QMimeDatabase mimeDatabase; QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo); if (mimeType.name() == QStringLiteral("application/x-extension-html")) - job->reply("text/html", file.take()); + job->reply("text/html", file.release()); else - job->reply(mimeType.name().toUtf8(), file.take()); + job->reply(mimeType.name().toUtf8(), file.release()); } } // namespace QtWebEngineCore diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp index 7d8a796f7..892c9e406 100644 --- a/src/core/printing/print_view_manager_qt.cpp +++ b/src/core/printing/print_view_manager_qt.cpp @@ -336,12 +336,23 @@ void PrintViewManagerQt::ShowScriptedPrintPreview(bool /*source_is_modifiable*/) // ignore for now } -void PrintViewManagerQt::RequestPrintPreview(printing::mojom::RequestPrintPreviewParamsPtr /*params*/) +void PrintViewManagerQt::RequestPrintPreview(printing::mojom::RequestPrintPreviewParamsPtr params) { + if (!m_printPreviewRfh && params->webnode_only) { + // The preview was requested by the print button of PDF viewer plugin. The code path ends up here, because + // Chromium automatically initiated a preview generation. We don't want that, just notify our embedder + // like we do in SetupScriptedPrintPreview() after window.print() and let them decide what to do. + content::WebContentsView *view = static_cast<content::WebContentsImpl*>(web_contents()->GetOutermostWebContents())->GetView(); + if (WebContentsAdapterClient *client = WebContentsViewQt::from(view)->client()) + client->printRequested(); + return; + } + if (m_printSettings.empty()) { PrintPreviewDone(); return; } + mojo::AssociatedRemote<printing::mojom::PrintRenderFrame> printRenderFrame; m_printPreviewRfh->GetRemoteAssociatedInterfaces()->GetInterface(&printRenderFrame); printRenderFrame->PrintPreview(m_printSettings.Clone()); diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index 410340fb8..c912c9898 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -46,7 +46,12 @@ #endif #if BUILDFLAG(ENABLE_EXTENSIONS) +#include "base/command_line.h" #include "components/guest_view/browser/guest_view_manager.h" +#include "extensions/browser/extension_pref_value_map_factory.h" +#include "extensions/browser/extension_prefs.h" +#include "extensions/browser/extension_prefs_factory.h" +#include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/pref_names.h" #include "extensions/browser/process_manager.h" #include "extensions/common/constants.h" @@ -246,6 +251,7 @@ content::FileSystemAccessPermissionContext *ProfileQt::GetFileSystemAccessPermis void ProfileQt::setupPrefService() { + const bool recreation = m_prefServiceAdapter.prefService() != nullptr; profile_metrics::SetBrowserProfileType(this, IsOffTheRecord() ? profile_metrics::BrowserProfileType::kIncognito @@ -253,12 +259,28 @@ void ProfileQt::setupPrefService() // Remove previous handler before we set a new one or we will assert // TODO: Remove in Qt6 - if (m_prefServiceAdapter.prefService() != nullptr) { + if (recreation) { user_prefs::UserPrefs::Remove(this); m_prefServiceAdapter.commit(); } m_prefServiceAdapter.setup(*m_profileAdapter); user_prefs::UserPrefs::Set(this, m_prefServiceAdapter.prefService()); + +#if BUILDFLAG(ENABLE_EXTENSIONS) + if (recreation) { + // Recreate ExtensionPrefs to update its pointer to the new PrefService + extensions::ExtensionsBrowserClient *client = extensions::ExtensionsBrowserClient::Get(); + std::vector<extensions::EarlyExtensionPrefsObserver *> prefsObservers; + client->GetEarlyExtensionPrefsObservers(this, &prefsObservers); + extensions::ExtensionPrefs *extensionPrefs = extensions::ExtensionPrefs::Create( + this, client->GetPrefServiceForContext(this), + this->GetPath().AppendASCII(extensions::kInstallDirectoryName), + ExtensionPrefValueMapFactory::GetForBrowserContext(this), + client->AreExtensionsDisabled(*base::CommandLine::ForCurrentProcess(), this), + prefsObservers); + extensions::ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting(this, base::WrapUnique(extensionPrefs)); + } +#endif } PrefServiceAdapter &ProfileQt::prefServiceAdapter() diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 3d4e5bbc2..aa903577f 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -368,6 +368,9 @@ gfx::Rect RenderWidgetHostViewQt::GetViewBounds() void RenderWidgetHostViewQt::UpdateBackgroundColor() { + if (!m_delegate) + return; + DCHECK(GetBackgroundColor()); SkColor color = *GetBackgroundColor(); diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp index 1b30e9953..b66c53ceb 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -346,6 +346,7 @@ QVariant RenderWidgetHostViewQtDelegateClient::inputMethodQuery(Qt::InputMethodQ } return QVariant(); } + case Qt::ImAbsolutePosition: case Qt::ImCursorPosition: return m_cursorPosition; case Qt::ImAnchorPosition: @@ -528,7 +529,7 @@ void RenderWidgetHostViewQtDelegateClient::handleTouchEvent(QTouchEvent *event) m_eventsToNowDelta = (base::TimeTicks::Now() - eventTimestamp).InMicroseconds(); eventTimestamp += base::Microseconds(m_eventsToNowDelta); - auto touchPoints = mapTouchPointIds(event->touchPoints()); + auto touchPoints = mapTouchPointIds(event->points()); // Make sure that POINTER_DOWN action is delivered before MOVE, and MOVE before POINTER_UP std::sort(touchPoints.begin(), touchPoints.end(), [] (const TouchPoint &l, const TouchPoint &r) { return l.second.state() < r.second.state(); diff --git a/src/core/render_widget_host_view_qt_delegate_item.cpp b/src/core/render_widget_host_view_qt_delegate_item.cpp index e6145f7a6..9723fcf2c 100644 --- a/src/core/render_widget_host_view_qt_delegate_item.cpp +++ b/src/core/render_widget_host_view_qt_delegate_item.cpp @@ -22,8 +22,10 @@ RenderWidgetHostViewQtDelegateItem::RenderWidgetHostViewQtDelegateItem(RenderWid { setFlag(ItemHasContents); setAcceptedMouseButtons(Qt::AllButtons); + setKeepMouseGrab(true); setAcceptHoverEvents(true); setAcceptTouchEvents(true); + setKeepTouchGrab(true); if (!isPopup) { setFocus(true); setActiveFocusOnTab(true); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d0da744d7..973da88a7 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -4,6 +4,7 @@ #include "web_engine_context.h" #include <math.h> +#include <QtGui/private/qrhi_p.h> #include "base/base_switches.h" #include "base/bind.h" @@ -177,6 +178,31 @@ bool usingSoftwareDynamicGL() #endif } +#if defined(Q_OS_WIN) +static QString getAdapterLuid() { + static const bool preferSoftwareDevice = qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER"); + QRhiD3D11InitParams rhiParams; + QRhi::Flags flags; + if (preferSoftwareDevice) { + flags |= QRhi::PreferSoftwareRenderer; + } + QScopedPointer<QRhi> rhi(QRhi::create(QRhi::D3D11,&rhiParams,flags,nullptr)); + // mimic what QSGRhiSupport and QBackingStoreRhi does + if (!rhi && !preferSoftwareDevice) { + flags |= QRhi::PreferSoftwareRenderer; + rhi.reset(QRhi::create(QRhi::D3D11, &rhiParams, flags)); + } + if (rhi) { + const QRhiD3D11NativeHandles *handles = + static_cast<const QRhiD3D11NativeHandles *>(rhi->nativeHandles()); + Q_ASSERT(handles); + return QString("%1,%2").arg(handles->adapterLuidHigh).arg(handles->adapterLuidLow); + } else { + return QString(); + } +} +#endif + static bool openGLPlatformSupport() { return QGuiApplicationPrivate::platformIntegration()->hasCapability( @@ -727,6 +753,14 @@ WebEngineContext::WebEngineContext() } #endif +#if defined(Q_OS_WIN) + if (QQuickWindow::graphicsApi() == QSGRendererInterface::Direct3D11) { + const QString luid = getAdapterLuid(); + if (!luid.isEmpty()) + parsedCommandLine->AppendSwitchASCII(switches::kUseAdapterLuid, luid.toStdString()); + } +#endif + initializeFeatureList(parsedCommandLine, enableFeatures, disableFeatures); GLContextHelper::initialize(); @@ -937,7 +971,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "114.0.5735.133"; // FIXME: Remember to update + return "117.0.5938.63"; // FIXME: Remember to update } QT_END_NAMESPACE diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 508a4b557..b2fb74016 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -558,6 +558,8 @@ static int windowsKeyCodeForQtKey(int qtKey, bool isKeypad) case Qt::Key_QuoteDbl: return VK_OEM_7; // case '\'': case '"': return 0xDE; // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. + case Qt::Key_AltGr: + return 0xE1; // (E1) VK_OEM_AX = ui::VKEY_ALTGR see ui/events/keycodes/keyboard_codes_win.h // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard case Qt::Key_AudioRewind: @@ -1677,10 +1679,12 @@ content::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *e ui::DomCodeToUsLayoutKeyboardCode(static_cast<ui::DomCode>(webKitEvent.dom_code)); const ushort* text = qtText.utf16(); - size_t textSize = std::min(sizeof(webKitEvent.text), size_t(qtText.length() * 2)); - memcpy(&webKitEvent.text, text, textSize); - memcpy(&webKitEvent.unmodified_text, text, textSize); - + size_t size = std::char_traits<char16_t>::length((char16_t *)text); + if (size <= blink::WebKeyboardEvent::kTextLengthCap - 1) { // should be null terminated + size_t textSize = std::min(sizeof(webKitEvent.text), size * sizeof(char16_t)); + memcpy(&webKitEvent.text, text, textSize); + memcpy(&webKitEvent.unmodified_text, text, textSize); + } if (webKitEvent.windows_key_code == VK_RETURN) { // This is the same behavior as GTK: // We need to treat the enter key as a key press of character \r. This |
