From f4ea34857d02f6cd5066bc1f4f2f573f11c77e17 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 2 Dec 2021 18:04:45 +0100 Subject: QPdf namespace: export the staticMetaObject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise users outside the module can't access it. Fixes: QTBUG-99144 Change-Id: I8348f64bca9a4cd9bcdbddb8fbfd7554c29f5357 Reviewed-by: Fabian Kosmale (cherry picked from commit cf9ecc2019f9800e33f2963770ccb1ea1bb20813) Reviewed-by: Mårten Nordheim --- src/pdf/qpdfnamespace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pdf/qpdfnamespace.h b/src/pdf/qpdfnamespace.h index 4c7105035..9c2d3bf0d 100644 --- a/src/pdf/qpdfnamespace.h +++ b/src/pdf/qpdfnamespace.h @@ -41,12 +41,13 @@ #ifndef QPDFNAMESPACE_H #define QPDFNAMESPACE_H +#include #include QT_BEGIN_NAMESPACE namespace QPdf { - Q_NAMESPACE + Q_NAMESPACE_EXPORT(Q_PDF_EXPORT) enum Rotation { Rotate0, -- cgit v1.2.3 From 9c283ff160eae82df6661f863b64a2cc7772512a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 14 Dec 2021 18:22:23 +0100 Subject: Switch examples to build as isolated sub-builds Task-number: QTBUG-90820 Change-Id: I8539fee3ea7311acf9ee4e736fb19e6ff595fcae Reviewed-by: Alexey Edelev (cherry picked from commit 6f75de32c2a8b8ac81ef40489fa9f64ec0435087) Reviewed-by: Qt Cherry-pick Bot --- examples/pdf/CMakeLists.txt | 4 ++-- examples/pdfwidgets/CMakeLists.txt | 2 +- examples/webenginequick/CMakeLists.txt | 12 ++++++------ examples/webenginewidgets/CMakeLists.txt | 26 +++++++++++++------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/pdf/CMakeLists.txt b/examples/pdf/CMakeLists.txt index cca6c03db..265d2ab8f 100644 --- a/examples/pdf/CMakeLists.txt +++ b/examples/pdf/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory(pdfviewer) -add_subdirectory(multipage) +qt_internal_add_example(pdfviewer) +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/pdfwidgets/CMakeLists.txt b/examples/pdfwidgets/CMakeLists.txt index 37496ebe3..dbde7f1c2 100644 --- a/examples/pdfwidgets/CMakeLists.txt +++ b/examples/pdfwidgets/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(pdfviewer) +qt_internal_add_example(pdfviewer) diff --git a/examples/webenginequick/CMakeLists.txt b/examples/webenginequick/CMakeLists.txt index b08d03980..8105b6c9a 100644 --- a/examples/webenginequick/CMakeLists.txt +++ b/examples/webenginequick/CMakeLists.txt @@ -1,8 +1,8 @@ -add_subdirectory(customdialogs) -add_subdirectory(lifecycle) -add_subdirectory(minimal) -add_subdirectory(quicknanobrowser) -add_subdirectory(webengineaction) +qt_internal_add_example(customdialogs) +qt_internal_add_example(lifecycle) +qt_internal_add_example(minimal) +qt_internal_add_example(quicknanobrowser) +qt_internal_add_example(webengineaction) if(TARGET Qt::QuickControls2) - add_subdirectory(recipebrowser) + qt_internal_add_example(recipebrowser) endif() diff --git a/examples/webenginewidgets/CMakeLists.txt b/examples/webenginewidgets/CMakeLists.txt index a0dc6330d..d9b12607f 100644 --- a/examples/webenginewidgets/CMakeLists.txt +++ b/examples/webenginewidgets/CMakeLists.txt @@ -1,22 +1,22 @@ -add_subdirectory(minimal) -add_subdirectory(contentmanipulation) -add_subdirectory(cookiebrowser) -add_subdirectory(notifications) -add_subdirectory(simplebrowser) -add_subdirectory(stylesheetbrowser) -add_subdirectory(videoplayer) -add_subdirectory(webui) +qt_internal_add_example(minimal) +qt_internal_add_example(contentmanipulation) +qt_internal_add_example(cookiebrowser) +qt_internal_add_example(notifications) +qt_internal_add_example(simplebrowser) +qt_internal_add_example(stylesheetbrowser) +qt_internal_add_example(videoplayer) +qt_internal_add_example(webui) if(QT_FEATURE_webengine_geolocation) - add_subdirectory(maps) + qt_internal_add_example(maps) endif() if(QT_FEATURE_webengine_webchannel) - add_subdirectory(markdowneditor) + qt_internal_add_example(markdowneditor) endif() if(QT_FEATURE_webengine_printing_and_pdf) - add_subdirectory(printme) - add_subdirectory(html2pdf) + qt_internal_add_example(printme) + qt_internal_add_example(html2pdf) endif() if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING AND NOT QT_FEATURE_webengine_native_spellchecker AND NOT WIN32) - add_subdirectory(spellchecker) + qt_internal_add_example(spellchecker) endif() -- cgit v1.2.3 From 6501578643062c1eff8c7315565cfd9d991e71cd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 16 Dec 2021 14:33:28 +0100 Subject: Stabilize tst_qwebengineurlrequestinterceptor One of our macOS test machines has become remarkably slower recently. Change-Id: I375c92f9c52054190a79d7793849f2783c98baa8 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 4754121b79ae9129742d141bccf436cf9b30b986) Reviewed-by: Qt Cherry-pick Bot --- .../tst_qwebengineurlrequestinterceptor.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 94669c4ca..14d045613 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -231,7 +231,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest() QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); page.load(QUrl("qrc:///resources/index.html")); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); QVariant success = loadSpy.takeFirst().takeFirst(); QVERIFY(success.toBool()); loadSpy.clear(); @@ -247,7 +247,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest() interceptor.shouldRedirect = true; page.load(QUrl("qrc:///resources/__placeholder__")); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); success = loadSpy.takeFirst().takeFirst(); // The redirection for __placeholder__ should succeed. QVERIFY(success.toBool()); @@ -258,7 +258,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest() TestRequestInterceptor observer(/* intercept */ false); profile.setUrlRequestInterceptor(&observer); page.load(QUrl("qrc:///resources/__placeholder__")); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); success = loadSpy.takeFirst().takeFirst(); // Since we do not intercept, loading an invalid path should not succeed. QVERIFY(!success.toBool()); @@ -331,7 +331,7 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl() page.setUrl(QUrl("qrc:///resources/__placeholder__")); QVERIFY(spy.wait()); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000); QVERIFY(interceptor.requestInfos.count() >= 1); QCOMPARE(interceptor.requestInfos.at(0).requestUrl, QUrl("qrc:///resources/content.html")); QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__")); @@ -340,14 +340,14 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl() interceptor.shouldRedirect = false; page.setUrl(QUrl("qrc:/non-existent.html")); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 20000); QVERIFY(interceptor.requestInfos.count() >= 3); QCOMPARE(interceptor.requestInfos.at(2).requestUrl, QUrl("qrc:/non-existent.html")); QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__")); QCOMPARE(page.url(), QUrl("qrc:///resources/content.html")); page.setUrl(QUrl("http://abcdef.abcdef")); - QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 15000); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 20000); QVERIFY(interceptor.requestInfos.count() >= 4); QCOMPARE(interceptor.requestInfos.at(3).requestUrl, QUrl("http://abcdef.abcdef/")); QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__")); @@ -444,7 +444,7 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes() QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); page.setUrl(requestUrl); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); QVERIFY(interceptor.requestInfos.count() >= 1); RequestInfo info = interceptor.requestInfos.at(0); @@ -534,7 +534,7 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType() QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); page.setUrl(firstPartyUrl); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); QTRY_COMPARE(interceptor.getUrlRequestForType(static_cast(resourceType)).count(), 1); QList infos = interceptor.getUrlRequestForType(static_cast(resourceType)); @@ -735,7 +735,7 @@ void tst_QWebEngineUrlRequestInterceptor::jsServiceWorker() QVERIFY(loadSync(page.get(), server.url("/sw.html"))); // We expect only one message here, because logging of services workers is not exposed in our API. - QTRY_COMPARE(page->messages.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(page->messages.count(), 1, 20000); QCOMPARE(page->levels.at(0), QWebEnginePage::InfoMessageLevel); QUrl firstPartyUrl = QUrl(server.url().toString() + "sw.js"); @@ -804,7 +804,7 @@ void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor() }); page.setUrl(server.url("/favicon.html")); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 20000); QTRY_VERIFY(fetchFinished); QString s; QDebug d(&s); @@ -848,7 +848,7 @@ void tst_QWebEngineUrlRequestInterceptor::replaceOnIntercept() }; page.setUrl(server.url("/favicon.html")); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000); QTRY_COMPARE(profileInterceptor.requestInfos.size(), 2); // if interceptor for page was replaced on intercept call in profile then, since request first -- cgit v1.2.3 From 1c98e3bd74018d725a958605b21b664041d4e15a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 11 Dec 2021 17:41:19 +0100 Subject: Stabilize tst_QWebEngineCookieStore Centralize and increase the timeout for all QTRY_COMPARE and QTRY_VERIFY to 30s. Change-Id: I582b3694ede65890f2707b50a78d2970e11b3fe8 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 2681f86b2b24440950ea5c254b3d2e2bf8d40688) Reviewed-by: Qt Cherry-pick Bot --- .../tst_qwebenginecookiestore.cpp | 92 +++++++++++----------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp index a712fb288..8b4f17a65 100644 --- a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp +++ b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -35,6 +35,10 @@ #include "httpserver.h" #include "httpreqrep.h" +// locally overwrite the default timeout of QTY_(COMPARE|VERIFY) +#define QWE_TRY_COMPARE(x, y) QTRY_COMPARE_WITH_TIMEOUT(x, y, 30000) +#define QWE_TRY_VERIFY(x) QTRY_VERIFY_WITH_TIMEOUT(x, 30000) + class tst_QWebEngineCookieStore : public QObject { Q_OBJECT @@ -104,22 +108,22 @@ void tst_QWebEngineCookieStore::cookieSignals() page.load(QUrl("qrc:///resources/index.html")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVariant success = loadSpy.takeFirst().takeFirst(); QVERIFY(success.toBool()); - QTRY_COMPARE(cookieAddedSpy.count(), 2); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 2); // try whether updating a cookie to be expired results in that cookie being removed. QNetworkCookie expiredCookie(QNetworkCookie::parseCookies(QByteArrayLiteral("SessionCookie=delete; expires=Thu, 01-Jan-1970 00:00:00 GMT; path=///resources")).first()); client->setCookie(expiredCookie, QUrl("qrc:///resources/index.html")); - QTRY_COMPARE(cookieRemovedSpy.count(), 1); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 1); cookieRemovedSpy.clear(); // try removing the other cookie. QNetworkCookie nonSessionCookie(QNetworkCookie::parseCookies(QByteArrayLiteral("CookieWithExpiresField=QtWebEngineCookieTest; path=///resources")).first()); client->deleteCookie(nonSessionCookie, QUrl("qrc:///resources/index.html")); - QTRY_COMPARE(cookieRemovedSpy.count(), 1); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 1); } void tst_QWebEngineCookieStore::setAndDeleteCookie() @@ -140,33 +144,33 @@ void tst_QWebEngineCookieStore::setAndDeleteCookie() client->loadAllCookies(); // /* FIXME remove 'blank' navigation once loadAllCookies api is fixed page.load(QUrl("about:blank")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 1); // */ // check if pending cookies are set and removed client->setCookie(cookie1); client->setCookie(cookie2); - QTRY_COMPARE(cookieAddedSpy.count(), 2); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 2); client->deleteCookie(cookie1); - QTRY_COMPARE(cookieRemovedSpy.count(), 1); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 1); page.load(QUrl("qrc:///resources/content.html")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 2, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 2); QVariant success = loadSpy.takeFirst().takeFirst(); QVERIFY(success.toBool()); - QTRY_COMPARE(cookieAddedSpy.count(), 2); - QTRY_COMPARE(cookieRemovedSpy.count(), 1); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 2); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 1); cookieAddedSpy.clear(); cookieRemovedSpy.clear(); client->setCookie(cookie3); - QTRY_COMPARE(cookieAddedSpy.count(), 1); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 1); // updating a cookie with an expired 'expires' field should remove the cookie with the same name client->setCookie(expiredCookie3); client->deleteCookie(cookie2); - QTRY_COMPARE(cookieAddedSpy.count(), 1); - QTRY_COMPARE(cookieRemovedSpy.count(), 2); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 1); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 2); } void tst_QWebEngineCookieStore::batchCookieTasks() @@ -185,29 +189,29 @@ void tst_QWebEngineCookieStore::batchCookieTasks() client->loadAllCookies(); // /* FIXME remove 'blank' navigation once loadAllCookies api is fixed page.load(QUrl("about:blank")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 1); // */ client->setCookie(cookie1); client->setCookie(cookie2); - QTRY_COMPARE(cookieAddedSpy.count(), 2); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 2); page.load(QUrl("qrc:///resources/index.html")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 2, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 2); QVariant success = loadSpy.takeFirst().takeFirst(); QVERIFY(success.toBool()); - QTRY_COMPARE(cookieAddedSpy.count(), 4); - QTRY_COMPARE(cookieRemovedSpy.count(), 0); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 4); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 0); cookieAddedSpy.clear(); cookieRemovedSpy.clear(); client->deleteSessionCookies(); - QTRY_COMPARE(cookieRemovedSpy.count(), 3); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 3); client->deleteAllCookies(); - QTRY_COMPARE(cookieRemovedSpy.count(), 4); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 4); } void tst_QWebEngineCookieStore::basicFilter() @@ -224,19 +228,19 @@ void tst_QWebEngineCookieStore::basicFilter() page.load(QUrl("qrc:///resources/index.html")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); - QTRY_COMPARE(cookieAddedSpy.count(), 2); - QTRY_COMPARE(accessTested.loadAcquire(), 2); // FIXME? + QWE_TRY_COMPARE(cookieAddedSpy.count(), 2); + QWE_TRY_COMPARE(accessTested.loadAcquire(), 2); // FIXME? client->deleteAllCookies(); - QTRY_COMPARE(cookieRemovedSpy.count(), 2); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 2); client->setCookieFilter([&](const QWebEngineCookieStore::FilterRequest &){ ++accessTested; return false; }); page.triggerAction(QWebEnginePage::ReloadAndBypassCache); - QTRY_COMPARE(loadSpy.count(), 1); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); - QTRY_COMPARE(accessTested.loadAcquire(), 4); // FIXME? + QWE_TRY_COMPARE(accessTested.loadAcquire(), 4); // FIXME? // Test cookies are NOT added: QTest::qWait(100); QCOMPARE(cookieAddedSpy.count(), 2); @@ -280,25 +284,25 @@ void tst_QWebEngineCookieStore::basicFilterOverHTTP() QUrl firstPartyUrl = httpServer.url("/test.html"); page.load(firstPartyUrl); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); - QTRY_COMPARE(cookieAddedSpy.count(), 1); - QTRY_COMPARE(accessTested.loadAcquire(), 4); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 1); + QWE_TRY_COMPARE(accessTested.loadAcquire(), 4); QVERIFY(cookieRequestHeader.isEmpty()); - QTRY_COMPARE(serverSpy.count(), 3); + QWE_TRY_COMPARE(serverSpy.count(), 3); page.triggerAction(QWebEnginePage::Reload); - QTRY_COMPARE(loadSpy.count(), 1); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); QVERIFY(!cookieRequestHeader.isEmpty()); - QTRY_COMPARE(cookieAddedSpy.count(), 1); - QTRY_COMPARE(accessTested.loadAcquire(), 6); + QWE_TRY_COMPARE(cookieAddedSpy.count(), 1); + QWE_TRY_COMPARE(accessTested.loadAcquire(), 6); - QTRY_COMPARE(serverSpy.count(), 5); + QWE_TRY_COMPARE(serverSpy.count(), 5); client->deleteAllCookies(); - QTRY_COMPARE(cookieRemovedSpy.count(), 1); + QWE_TRY_COMPARE(cookieRemovedSpy.count(), 1); client->setCookieFilter([&](const QWebEngineCookieStore::FilterRequest &request) { resourceFirstParty.append(qMakePair(request.origin, request.firstPartyUrl)); @@ -306,24 +310,24 @@ void tst_QWebEngineCookieStore::basicFilterOverHTTP() return false; }); page.triggerAction(QWebEnginePage::ReloadAndBypassCache); - QTRY_COMPARE(loadSpy.count(), 1); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); QVERIFY(cookieRequestHeader.isEmpty()); // Test cookies are NOT added: QTest::qWait(100); QCOMPARE(cookieAddedSpy.count(), 1); - QTRY_COMPARE(accessTested.loadAcquire(), 9); + QWE_TRY_COMPARE(accessTested.loadAcquire(), 9); - QTRY_COMPARE(serverSpy.count(), 7); + QWE_TRY_COMPARE(serverSpy.count(), 7); page.triggerAction(QWebEnginePage::Reload); - QTRY_COMPARE(loadSpy.count(), 1); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); QVERIFY(cookieRequestHeader.isEmpty()); QCOMPARE(cookieAddedSpy.count(), 1); // Wait for last GET /favicon.ico - QTRY_COMPARE(serverSpy.count(), 9); + QWE_TRY_COMPARE(serverSpy.count(), 9); (void) httpServer.stop(); QCOMPARE(resourceFirstParty.size(), accessTested.loadAcquire()); @@ -344,17 +348,17 @@ void tst_QWebEngineCookieStore::html5featureFilter() page.load(QUrl("qrc:///resources/content.html")); - QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 30000); + QWE_TRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); QCOMPARE(accessTested.loadAcquire(), 0); // FIXME? QTest::ignoreMessage(QtCriticalMsg, QRegularExpression(".*Uncaught SecurityError.*sessionStorage.*")); page.runJavaScript("sessionStorage.test = 5;"); - QTRY_COMPARE(accessTested.loadAcquire(), 1); + QWE_TRY_COMPARE(accessTested.loadAcquire(), 1); QTest::ignoreMessage(QtCriticalMsg, QRegularExpression(".*Uncaught SecurityError.*sessionStorage.*")); QAtomicInt callbackTriggered = 0; page.runJavaScript("sessionStorage.test", [&](const QVariant &v) { QVERIFY(!v.isValid()); callbackTriggered = 1; }); - QTRY_VERIFY(callbackTriggered); + QWE_TRY_VERIFY(callbackTriggered); } QTEST_MAIN(tst_QWebEngineCookieStore) -- cgit v1.2.3 From 30113ef46fbeb2a063df29ec3ef14bdb0d22fc5b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Sun, 19 Dec 2021 20:32:46 +0100 Subject: Blacklist failing tests on macos Seems to have started failing while the team is on holiday Change-Id: Id47f5c328ae105305c883f9ce00fea36199830d6 Reviewed-by: Jani Heikkinen (cherry picked from commit 4b6d5daf527a565bd659668d63a1d14fad0acb27) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/qwebenginepage/BLACKLIST | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST index 0c84b8de1..7eb97b3bb 100644 --- a/tests/auto/widgets/qwebenginepage/BLACKLIST +++ b/tests/auto/widgets/qwebenginepage/BLACKLIST @@ -7,3 +7,9 @@ macos # Can't move cursor (QTBUG-76312) [acceptNavigationRequestNavigationType] b2qt arm + +[comboBoxPopupPositionAfterMove] +macos + +[comboBoxPopupPositionAfterChildMove] +macos -- cgit v1.2.3 From bc9677e43afd9a566cce08420c86ac322fb81259 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 22 Dec 2021 11:24:09 +0100 Subject: Increase timeout to help slow CI Change-Id: I5f0dd43e0c1eb6bc43f263227b12ec0e1b9f7a20 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 4cc4f765a9cfc11668c6274dfe77153a68ff1ec5) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/quick/inspectorserver/tst_inspectorserver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp index 7b85c7348..8aa88b34d 100644 --- a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp +++ b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp @@ -121,7 +121,7 @@ void tst_InspectorServer::testPageList() + QLatin1String("/html/basic_page.html")); QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadingInfo))); webView()->setUrl(testPageUrl); - QTRY_VERIFY(loadSpy.size() && !webView()->isLoading()); + QTRY_VERIFY_WITH_TIMEOUT(loadSpy.size() && !webView()->isLoading(), 10000); // Our page has developerExtrasEnabled and should be the only one in the list. QJsonArray pageList = fetchPageList(); @@ -135,7 +135,7 @@ void tst_InspectorServer::testRemoteDebuggingMessage() + QLatin1String("/html/basic_page.html")); QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadingInfo))); webView()->setUrl(testPageUrl); - QTRY_VERIFY(loadSpy.size() && !webView()->isLoading()); + QTRY_VERIFY_WITH_TIMEOUT(loadSpy.size() && !webView()->isLoading(), 10000); QJsonArray pageList = fetchPageList(); QCOMPARE(pageList.size(), 1); @@ -170,7 +170,7 @@ void tst_InspectorServer::openRemoteDebuggingSession() + QLatin1String("/html/basic_page.html")); QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadingInfo))); webView()->setUrl(testPageUrl); - QTRY_VERIFY(loadSpy.size() && !webView()->isLoading()); + QTRY_VERIFY_WITH_TIMEOUT(loadSpy.size() && !webView()->isLoading(), 10000); QJsonArray pageList = fetchPageList(); QCOMPARE(pageList.size(), 1); -- cgit v1.2.3 From 5d1c2d65b61f8b94ecd1a0629529ea4098d89a55 Mon Sep 17 00:00:00 2001 From: Balazs Egedi Date: Tue, 14 Dec 2021 15:45:24 +0100 Subject: FIXUP: Add onTouchSelectionMenuRequested QML handler Fixed CodeChecker warnings, added missing documentation. Change-Id: I723ea2b0952ded52f513a3cd53ac443b727f1e58 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 56005ae3d52568b469db32498afebd9c52e4881b) Reviewed-by: Qt Cherry-pick Bot --- src/core/touch_selection_menu_controller.h | 2 +- .../api/qquickwebenginetouchselectionmenurequest.cpp | 4 +++- .../api/qquickwebenginetouchselectionmenurequest_p.h | 4 ++-- src/webenginequick/doc/src/webengineview_lgpl.qdoc | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/core/touch_selection_menu_controller.h b/src/core/touch_selection_menu_controller.h index a90695c80..1167d8bc9 100644 --- a/src/core/touch_selection_menu_controller.h +++ b/src/core/touch_selection_menu_controller.h @@ -55,7 +55,7 @@ public: Copy = 0x2, Paste = 0x4 }; - Q_DECLARE_FLAGS(TouchSelectionCommandFlags, TouchSelectionCommandFlag); + Q_DECLARE_FLAGS(TouchSelectionCommandFlags, TouchSelectionCommandFlag) Q_FLAG(TouchSelectionCommandFlag) TouchSelectionMenuController(TouchSelectionControllerClientQt *touchSelectionControllerClient); diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp index f406587d3..0ba2a496a 100644 --- a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp +++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp @@ -90,7 +90,9 @@ QQuickWebEngineTouchSelectionMenuRequestPrivate::QQuickWebEngineTouchSelectionMe /*! Destroys the touch selection menu request. */ -QQuickWebEngineTouchSelectionMenuRequest::~QQuickWebEngineTouchSelectionMenuRequest() = default; +QQuickWebEngineTouchSelectionMenuRequest::~QQuickWebEngineTouchSelectionMenuRequest() +{ +} /*! Returns the number of buttons that must be displayed, based on the available actions. diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h index c6a8fc8c6..b7ea4f06b 100644 --- a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h +++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h @@ -79,13 +79,13 @@ public: Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) Q_PROPERTY(QRect selectionBounds READ selectionBounds CONSTANT FINAL REVISION(1)) Q_PROPERTY(TouchSelectionCommandFlags touchSelectionCommandFlags READ touchSelectionCommandFlags CONSTANT FINAL REVISION(1)) - QML_NAMED_ELEMENT(QQuickWebEngineTouchSelectionMenuRequest) + QML_NAMED_ELEMENT(TouchSelectionMenuRequest) QML_ADDED_IN_VERSION(6, 3) QML_UNCREATABLE("") QQuickWebEngineTouchSelectionMenuRequest(QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController); - virtual ~QQuickWebEngineTouchSelectionMenuRequest(); + ~QQuickWebEngineTouchSelectionMenuRequest(); int buttonCount(); bool isAccepted() const; diff --git a/src/webenginequick/doc/src/webengineview_lgpl.qdoc b/src/webenginequick/doc/src/webengineview_lgpl.qdoc index f0f6fc8fe..7063a92ff 100644 --- a/src/webenginequick/doc/src/webengineview_lgpl.qdoc +++ b/src/webenginequick/doc/src/webengineview_lgpl.qdoc @@ -1473,3 +1473,19 @@ \sa renderProcessPid */ + +/*! + \qmlsignal WebEngineView::touchSelectionMenuRequested(TouchSelectionMenuRequest *request) + \since QtWebEngine 6.3 + \readonly + + This signal is emitted when a touch selection menu is requested at a specified position. + + The \a request can be handled by using the methods of the TouchSelectionMenuRequest + type. + + \note Signal handlers need to call \c{request.accepted = true} to prevent a default touch + selection menu from showing up. + + \sa TouchSelectionMenuRequest +*/ -- cgit v1.2.3 From aaa4fa345d7a60528eafbc04d728c71c05fce594 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 13 Dec 2021 12:57:25 +0100 Subject: Fix headers in GN sources Change-Id: Ib2faa3e0242799e1088d4ec7c610fa89a4d15bbb Reviewed-by: Michal Klocek (cherry picked from commit 540b1cadb1888a9adde8cf338fcdbd8630423c0b) Reviewed-by: Qt Cherry-pick Bot --- src/core/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 7c17dc1f9..7eb131e2d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -118,8 +118,8 @@ foreach(arch ${archs}) net/client_cert_store_data.cpp net/client_cert_store_data.h net/cookie_monster_delegate_qt.cpp net/cookie_monster_delegate_qt.h net/custom_url_loader_factory.cpp net/custom_url_loader_factory.h - net/proxy_config_monitor.cpp - net/proxy_config_service_qt.cpp + net/proxy_config_monitor.cpp net/proxy_config_monitor.h + net/proxy_config_service_qt.cpp net/proxy_config_service_qt.h net/proxying_restricted_cookie_manager_qt.cpp net/proxying_restricted_cookie_manager_qt.h net/proxying_url_loader_factory_qt.cpp net/proxying_url_loader_factory_qt.h net/qrc_url_scheme_handler.cpp net/qrc_url_scheme_handler.h @@ -144,8 +144,6 @@ foreach(arch ${archs}) profile_adapter_client.cpp profile_adapter_client.h profile_io_data_qt.cpp profile_io_data_qt.h profile_qt.cpp profile_qt.h - proxy_config_monitor.h - proxy_config_service_qt.h quota_permission_context_qt.cpp quota_permission_context_qt.h quota_request_controller.h quota_request_controller_impl.cpp quota_request_controller_impl.h -- cgit v1.2.3 From 93775031d51f42db4f4ec1efc02e4bd3be201def Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 10 Dec 2021 13:45:53 +0100 Subject: Fix Windows SDK paths passed to GN GN doesn't use them currently, but I will need them to build ANGLE. Change-Id: Ide4d9b93d822abbfff9af4dba1e2f4e6a5cd4cde Reviewed-by: Michal Klocek (cherry picked from commit 006bf354b80d16ec63ec7ade958b54dfbb9e18d8) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 07791e0e9..f366380a8 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -780,8 +780,8 @@ macro(append_compiler_linker_sdk_setup) endif() if(WIN32) - get_filename_component(windowsSdkPath $ENV{WINDOWSSDKDIR} DIRECTORY) - get_filename_component(visualStudioPath $ENV{VSINSTALLDIR} DIRECTORY) + get_filename_component(windowsSdkPath $ENV{WINDOWSSDKDIR} ABSOLUTE) + get_filename_component(visualStudioPath $ENV{VSINSTALLDIR} ABSOLUTE) list(APPEND gnArgArg win_linker_timing=true use_incremental_linking=false -- cgit v1.2.3 From 594c8595553ec302a3852e6bf55425023c5897c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Wed, 22 Dec 2021 00:58:52 +0100 Subject: Blacklist tst_InspectorServer::openRemoteDebuggingSession It is causing trouble on some (more) platforms. Might be a regression in qtdeclarative. Change-Id: If0195abe085f1f4cf59864fa89c9611da4f213ec Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/inspectorserver/BLACKLIST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/quick/inspectorserver/BLACKLIST b/tests/auto/quick/inspectorserver/BLACKLIST index 076dd5f10..318dae7a5 100644 --- a/tests/auto/quick/inspectorserver/BLACKLIST +++ b/tests/auto/quick/inspectorserver/BLACKLIST @@ -1,2 +1,2 @@ [openRemoteDebuggingSession] -macos +* -- cgit v1.2.3 From 99e34e9c99453b4990c82468260f431dede4e256 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Mon, 13 Dec 2021 14:51:55 +0100 Subject: Fix crash on meet.google.com Hangout Services extension has a background WebContents. Do not try to access its delegate and settings. Task-number: QTBUG-99119 Change-Id: Ib46867ba98644e14af6263253daa253ef2e6b12a Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 1552ad5d3e66460bbbb5bbd71ca2083fb9d17d3f) Reviewed-by: Qt Cherry-pick Bot --- src/core/content_browser_client_qt.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 893eca09d..8f62d727c 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -157,6 +157,7 @@ #include "extensions/browser/guest_view/web_view/web_view_guest.h" #include "extensions/browser/process_map.h" #include "extensions/browser/url_loader_factory_manager.h" +#include "extensions/browser/view_type_utils.h" #include "extensions/common/constants.h" #include "extensions/common/manifest_handlers/mime_types_handler.h" #include "extensions/extension_web_contents_observer_qt.h" @@ -1094,9 +1095,14 @@ void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int if (web_contents) url = web_contents->GetVisibleURL(); + bool is_background_page = false; +#if BUILDFLAG(ENABLE_EXTENSIONS) + is_background_page = extensions::GetViewType(web_contents) == extensions::mojom::ViewType::kExtensionBackgroundPage; +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + // Install file scheme if necessary: bool install_file_scheme = false; - if (web_contents) { + if (web_contents && !is_background_page) { const auto *settings = static_cast(web_contents->GetResponsibleWebContents()->GetDelegate())->webEngineSettings(); if (settings->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)) { for (const auto &local_scheme : url::GetLocalSchemes()) { -- cgit v1.2.3 From 387a5ee0c35364f6b4c9ce3bd3d50f5b825626ca Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Tue, 30 Nov 2021 13:01:39 +0100 Subject: Cleanup code and clang build warnings Fix build noise as reported by clang for issues like api deprecation, unused variables, sign/unsigned mismatch and other non critical issues. Change-Id: I4fba25406eea8170e3283c42e908ae86bd512e3a Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 02d58a067fb5f0db32c254e783170f9f283aeb9d) Reviewed-by: Michal Klocek --- src/core/api/qwebenginehttprequest.cpp | 8 ++++---- src/core/api/qwebenginepage.cpp | 2 -- src/core/compositor/display_gl_output_surface.cpp | 2 +- src/core/content_browser_client_qt.cpp | 9 ++++----- src/core/content_client_qt.cpp | 4 ---- src/core/delegated_frame_host_client_qt.h | 2 +- ...lugin_response_interceptor_url_loader_throttle.cpp | 3 +-- .../plugin_response_interceptor_url_loader_throttle.h | 4 +--- .../net/proxying_restricted_cookie_manager_qt.cpp | 18 ++---------------- src/core/net/proxying_restricted_cookie_manager_qt.h | 14 +------------- .../render_widget_host_view_qt_delegate_client.cpp | 6 +++--- src/core/renderer/content_renderer_client_qt.cpp | 2 -- .../extensions/extensions_renderer_client_qt.cpp | 1 - src/core/tools/main.cpp | 1 - src/core/web_contents_adapter.cpp | 2 -- src/core/web_engine_error.cpp | 2 -- tests/auto/core/origins/tst_origins.cpp | 5 +++-- tests/auto/quick/qmltests/tst_qmltests.cpp | 19 +++++++------------ .../widgets/qwebenginescript/tst_qwebenginescript.cpp | 2 +- .../widgets/qwebengineview/tst_qwebengineview.cpp | 6 +++--- 20 files changed, 32 insertions(+), 80 deletions(-) diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp index f5733cde4..d199bff1d 100644 --- a/src/core/api/qwebenginehttprequest.cpp +++ b/src/core/api/qwebenginehttprequest.cpp @@ -182,16 +182,16 @@ QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url, QWebEngineHttpRequest result(url); result.setMethod(QWebEngineHttpRequest::Post); - QString buffer; + 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()); if (buffer.length() > 0) - buffer += QLatin1Char('&'); - buffer += key + QLatin1Char('=') + value; + buffer += '&'; + buffer.append(key).append('=').append(value); } - result.setPostData(buffer.toLatin1()); + result.setPostData(buffer); result.setHeader(QByteArrayLiteral("Content-Type"), QByteArrayLiteral("application/x-www-form-urlencoded")); diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 758bf3905..8e03aea0d 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -456,8 +456,6 @@ void QWebEnginePagePrivate::didFetchDocumentInnerText(quint64 requestId, const Q void QWebEnginePagePrivate::didPrintPage(quint64 requestId, QSharedPointer result) { #if QT_CONFIG(webengine_printing_and_pdf) - Q_Q(QWebEnginePage); - // If no currentPrinter is set that means that were printing to PDF only. if (!currentPrinter) { if (!result.data()) diff --git a/src/core/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp index 68ba957b0..7f27b6ac4 100644 --- a/src/core/compositor/display_gl_output_surface.cpp +++ b/src/core/compositor/display_gl_output_surface.cpp @@ -231,7 +231,7 @@ void DisplayGLOutputSurface::swapBuffersOnVizThread() } const auto now = base::TimeTicks::Now(); - m_client->DidReceiveSwapBuffersAck(gfx::SwapTimings{now, now}, gfx::GpuFenceHandle()); + m_client->DidReceiveSwapBuffersAck(gfx::SwapTimings{now, now, {}, {}, {}}, gfx::GpuFenceHandle()); m_client->DidReceivePresentationFeedback( gfx::PresentationFeedback(now, base::TimeDelta(), gfx::PresentationFeedback::Flags::kVSync)); diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 8f62d727c..2b1485b2d 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -613,9 +613,9 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R content::BrowserContext *browser_context, const url::Origin & /*origin*/, const net::IsolationInfo & /*isolation_info*/, - bool is_service_worker, - int process_id, - int routing_id, + bool /*is_service_worker*/, + int /*process_id*/, + int /*routing_id*/, mojo::PendingReceiver *receiver) { mojo::PendingReceiver orig_receiver = std::move(*receiver); @@ -626,7 +626,6 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R ProxyingRestrictedCookieManagerQt::CreateAndBind( ProfileIODataQt::FromBrowserContext(browser_context), std::move(target_rcm_remote), - is_service_worker, process_id, routing_id, std::move(orig_receiver)); return false; // only made a proxy, still need the actual impl to be made. @@ -783,7 +782,7 @@ ContentBrowserClientQt::CreateURLLoaderThrottles( ProtocolHandlerRegistryFactory::GetForBrowserContext(browser_context))); #if BUILDFLAG(ENABLE_EXTENSIONS) result.push_back(std::make_unique( - browser_context, request.destination, frame_tree_node_id)); + request.destination, frame_tree_node_id)); #endif return result; } diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 67e2bed4f..90e604e7b 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -136,10 +136,6 @@ static QString getProgramFilesDir(bool x86Dir = false) #include "content/public/common/pepper_plugin_info.h" #include "ppapi/shared_impl/ppapi_permissions.h" -namespace switches { -const char kPpapiWidevinePath[] = "ppapi-widevine-path"; -} - static QString ppapiPluginsPath() { // Look for plugins in /plugins/ppapi or application dir. diff --git a/src/core/delegated_frame_host_client_qt.h b/src/core/delegated_frame_host_client_qt.h index f9bc99d24..89cd3700c 100644 --- a/src/core/delegated_frame_host_client_qt.h +++ b/src/core/delegated_frame_host_client_qt.h @@ -40,7 +40,7 @@ #ifndef DELEGATED_FRAME_HOST_CLIENT_QT_H #define DELEGATED_FRAME_HOST_CLIENT_QT_H -#include "qtwebenginecoreglobal_p.h" +#include #include "content/browser/renderer_host/delegated_frame_host.h" #include "content/browser/renderer_host/render_widget_host_impl.h" 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 d66e69ef4..0fc518a9b 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -68,10 +68,9 @@ namespace QtWebEngineCore { PluginResponseInterceptorURLLoaderThrottle::PluginResponseInterceptorURLLoaderThrottle( - content::BrowserContext *browser_context, network::mojom::RequestDestination request_destination, int frame_tree_node_id) - : m_browser_context(browser_context), m_request_destination(request_destination), m_frame_tree_node_id(frame_tree_node_id) + : m_request_destination(request_destination), m_frame_tree_node_id(frame_tree_node_id) {} void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL &response_url, 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 0e10b2124..d4ff87846 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.h +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.h @@ -54,8 +54,7 @@ namespace QtWebEngineCore { class PluginResponseInterceptorURLLoaderThrottle : public blink::URLLoaderThrottle { public: - PluginResponseInterceptorURLLoaderThrottle(content::BrowserContext *browser_context, - network::mojom::RequestDestination request_destination, + PluginResponseInterceptorURLLoaderThrottle(network::mojom::RequestDestination request_destination, int frame_tree_node_id); ~PluginResponseInterceptorURLLoaderThrottle() override = default; @@ -67,7 +66,6 @@ private: // layer chance to initialize its browser side state. void ResumeLoad(); - content::BrowserContext *m_browser_context = nullptr; const network::mojom::RequestDestination m_request_destination; const int m_frame_tree_node_id; diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp index f86c0e997..f66a4c1a7 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp +++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp @@ -61,9 +61,6 @@ namespace QtWebEngineCore { // static void ProxyingRestrictedCookieManagerQt::CreateAndBind(ProfileIODataQt *profileIoData, mojo::PendingRemote underlying_rcm, - bool is_service_worker, - int process_id, - int frame_id, mojo::PendingReceiver receiver) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -72,7 +69,6 @@ void ProxyingRestrictedCookieManagerQt::CreateAndBind(ProfileIODataQt *profileIo base::BindOnce(&ProxyingRestrictedCookieManagerQt::CreateAndBindOnIoThread, profileIoData, std::move(underlying_rcm), - is_service_worker, process_id, frame_id, std::move(receiver))); } @@ -80,31 +76,21 @@ void ProxyingRestrictedCookieManagerQt::CreateAndBind(ProfileIODataQt *profileIo // static void ProxyingRestrictedCookieManagerQt::CreateAndBindOnIoThread(ProfileIODataQt *profileIoData, mojo::PendingRemote underlying_rcm, - bool is_service_worker, - int process_id, - int frame_id, mojo::PendingReceiver receiver) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); auto wrapper = base::WrapUnique(new ProxyingRestrictedCookieManagerQt( profileIoData->getWeakPtrOnIOThread(), - std::move(underlying_rcm), - is_service_worker, process_id, frame_id)); + std::move(underlying_rcm))); mojo::MakeSelfOwnedReceiver(std::move(wrapper), std::move(receiver)); } ProxyingRestrictedCookieManagerQt::ProxyingRestrictedCookieManagerQt( base::WeakPtr profileIoData, - mojo::PendingRemote underlyingRestrictedCookieManager, - bool is_service_worker, - int32_t process_id, - int32_t frame_id) + mojo::PendingRemote underlyingRestrictedCookieManager) : m_profileIoData(std::move(profileIoData)) , underlying_restricted_cookie_manager_(std::move(underlyingRestrictedCookieManager)) - , is_service_worker_(is_service_worker) - , process_id_(process_id) - , frame_id_(frame_id) , weak_factory_(this) { 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 3d4765b3b..37271dfd3 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.h +++ b/src/core/net/proxying_restricted_cookie_manager_qt.h @@ -56,9 +56,6 @@ public: // Expects to be called on the UI thread. static void CreateAndBind(ProfileIODataQt *profileIoData, mojo::PendingRemote underlying_rcm, - bool is_service_worker, - int process_id, - int frame_id, mojo::PendingReceiver receiver); ~ProxyingRestrictedCookieManagerQt() override; @@ -98,24 +95,15 @@ public: private: ProxyingRestrictedCookieManagerQt(base::WeakPtr profileIoData, - mojo::PendingRemote underlying_rcm, - bool is_service_worker, - int32_t process_id, - int32_t frame_id); + mojo::PendingRemote underlying_rcm); static void CreateAndBindOnIoThread(ProfileIODataQt *profileIoData, mojo::PendingRemote underlying_rcm, - bool is_service_worker, - int process_id, - int frame_id, mojo::PendingReceiver receiver); base::WeakPtr m_profileIoData; mojo::Remote underlying_restricted_cookie_manager_; - bool is_service_worker_; - int process_id_; - int frame_id_; base::WeakPtrFactory weak_factory_; 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 1af0b782d..009f2f0ef 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -589,13 +589,13 @@ void RenderWidgetHostViewQtDelegateClient::handleTouchEvent(QTouchEvent *event) // Check first if the touch event should be routed to the selectionController if (!touchPoints.isEmpty()) { switch (touchPoints[0].second.state()) { - case Qt::TouchPointPressed: + case QEventPoint::Pressed: action = ui::MotionEvent::Action::DOWN; break; - case Qt::TouchPointMoved: + case QEventPoint::Updated: action = ui::MotionEvent::Action::MOVE; break; - case Qt::TouchPointReleased: + case QEventPoint::Released: action = ui::MotionEvent::Action::UP; break; default: diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 474c9e765..e407c4f2c 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -120,8 +120,6 @@ namespace QtWebEngineCore { -static const char kHttpErrorDomain[] = "http"; - ContentRendererClientQt::ContentRendererClientQt() { #if BUILDFLAG(ENABLE_EXTENSIONS) diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp index 4c214c45f..0506be876 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp @@ -71,7 +71,6 @@ namespace chrome { const char kExtensionInvalidRequestURL[] = "chrome-extension://invalid/"; -const char kExtensionResourceInvalidRequestURL[] = "chrome-extension-resource://invalid/"; } namespace QtWebEngineCore { diff --git a/src/core/tools/main.cpp b/src/core/tools/main.cpp index a23de0f8b..1721f71d3 100644 --- a/src/core/tools/main.cpp +++ b/src/core/tools/main.cpp @@ -197,7 +197,6 @@ int main(int argc, char *argv[]) } #endif // USE_ICU_FILE - base::AtExitManager exit_manager; base::i18n::InitializeICU(); base::FilePath file_in_path = toFilePath(argv[1]); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 9472e7748..6137d2223 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -133,8 +133,6 @@ namespace QtWebEngineCore { return; \ } -static const int kTestWindowWidth = 800; -static const int kTestWindowHeight = 600; static const int kHistoryStreamVersion = 4; static QVariant fromJSValue(const base::Value *result) diff --git a/src/core/web_engine_error.cpp b/src/core/web_engine_error.cpp index 0d326473b..52a84494c 100644 --- a/src/core/web_engine_error.cpp +++ b/src/core/web_engine_error.cpp @@ -44,12 +44,10 @@ const int WebEngineError::UserAbortedError = net::ERR_ABORTED; namespace { const int noError = 0; -const int systemRelatedErrors = -1; const int connectionRelatedErrors = -100; const int certificateErrors = -200; const int httpErrors = -300; const int cacheErrors = -400; -const int internalErrors = -500; const int ftpErrors = -600; const int certificateManagerErrors = -700; const int dnsResolverErrors = -800; diff --git a/tests/auto/core/origins/tst_origins.cpp b/tests/auto/core/origins/tst_origins.cpp index ac937037f..1731bee8a 100644 --- a/tests/auto/core/origins/tst_origins.cpp +++ b/tests/auto/core/origins/tst_origins.cpp @@ -200,8 +200,9 @@ private: if (url.path().startsWith("/qtwebchannel/")) pathPrefix = QSL(":"); QString pathSuffix = url.path(); - QFile *file = new QFile(pathPrefix + pathSuffix, job); + auto file = std::make_unique(pathPrefix + pathSuffix, job); if (!file->open(QIODevice::ReadOnly)) { + qWarning() << "Failed to read data for:" << url << file->errorString(); job->fail(QWebEngineUrlRequestJob::RequestFailed); return; } @@ -210,7 +211,7 @@ private: mimeType = QBAL("application/javascript"); else if (pathSuffix.endsWith(QSL(".css"))) mimeType = QBAL("text/css"); - job->reply(mimeType, file); + job->reply(mimeType, file.release()); } QList m_requests; diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp index 00c6478e9..967cabfec 100644 --- a/tests/auto/quick/qmltests/tst_qmltests.cpp +++ b/tests/auto/quick/qmltests/tst_qmltests.cpp @@ -251,22 +251,17 @@ int main(int argc, char **argv) sigaction(SIGSEGV, &sigAction, 0); #endif - QScopedPointer app; + QtWebEngineQuick::initialize(); // Force to use English language for testing due to error message checks QLocale::setDefault(QLocale("en")); static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")}; - QList w_argv(argc); \ - for (int i = 0; i < argc; ++i) \ - w_argv[i] = argv[i]; \ - for (int i = 0; i < params.size(); ++i) \ - w_argv.append(params[i].data()); \ - int w_argc = w_argv.size(); \ - - if (!QCoreApplication::instance()) { - app.reset(new Application(w_argc, const_cast(w_argv.data()))); - } - QtWebEngineQuick::initialize(); + QList w_argv(argc); + for (int i = 0; i < argc; ++i) w_argv[i] = argv[i]; + for (int i = 0; i < params.size(); ++i) w_argv.append(params[i].data()); + int w_argc = w_argv.size(); + Application app(w_argc, const_cast(w_argv.data())); + QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true); qmlRegisterType("Test.util", 1, 0, "TempDir"); qmlRegisterType("Test.util", 1, 0, "TestInputContext"); diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp index 5df9f035f..26ba71ae3 100644 --- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp +++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp @@ -218,7 +218,7 @@ void tst_QWebEngineScript::loadEvents() // Using window.open from JS QVERIFY(profile.pages.size() == 1); page.load(QUrl("qrc:/resources/test_window_open.html")); - QTRY_COMPARE(profile.pages.size(), 2); + QTRY_COMPARE(profile.pages.size(), 2u); QTRY_COMPARE(profile.pages.front().spy.count(), 1); QTRY_COMPARE(profile.pages.back().spy.count(), 1); QVERIFY(verifyOrder(profile.pages.front().eval("window.log", QWebEngineScript::MainWorld).toStringList())); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index d6a945e65..bbd1fbd16 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -592,6 +592,7 @@ void tst_QWebEngineView::focusInputTypes() class KeyEventRecordingWidget : public QWidget { public: + ~KeyEventRecordingWidget() { qDeleteAll(pressEvents); qDeleteAll(releaseEvents); } QList pressEvents; QList releaseEvents; void keyPressEvent(QKeyEvent *e) override { pressEvents << e->clone(); } @@ -1676,11 +1677,10 @@ void tst_QWebEngineView::postData() void tst_QWebEngineView::inputFieldOverridesShortcuts() { + QWebEngineView view; bool actionTriggered = false; - QAction *action = new QAction; + QAction *action = new QAction(&view); connect(action, &QAction::triggered, [&actionTriggered] () { actionTriggered = true; }); - - QWebEngineView view; view.addAction(action); QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool))); -- cgit v1.2.3 From 90983b3b673f0af1d862051c542bcb56387eee87 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 14 Dec 2021 10:58:59 +0100 Subject: QtPdf: add a very rudimentary test for QPdfSelection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... as part of tst_QPdfDocument. The smaller QtPdf classes should probably all have their own tests. The existing tests are far from being sufficient. Change-Id: I01ff2b7abbdbe43ee596d682c256001539fde1bf Reviewed-by: Fabian Kosmale Reviewed-by: Mårten Nordheim Reviewed-by: Shawn Rutledge (cherry picked from commit 154cb38a7744c1cb46e9c2194c696724936beacd) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp | 36 ++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp index 24c4e988d..a0f73bb88 100644 --- a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp +++ b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp @@ -69,12 +69,23 @@ private slots: void status(); void passwordClearedOnClose(); void metaData(); + +private: + void consistencyCheck(QPdfDocument &doc) const; }; struct TemporaryPdf: public QTemporaryFile { TemporaryPdf(); QPageLayout pageLayout; + + static QString pageText(int page) { + switch (page) { + case 0: return QStringLiteral("Hello Page 1"); + case 1: return QStringLiteral("Hello Page 2"); + default: return {}; + } + } }; @@ -91,9 +102,9 @@ TemporaryPdf::TemporaryPdf() { QPainter painter(&printer); - painter.drawText(100, 100, QStringLiteral("Hello Page 1")); + painter.drawText(100, 100, pageText(0)); printer.newPage(); - painter.drawText(100, 100, QStringLiteral("Hello Page 2")); + painter.drawText(100, 100, pageText(1)); } } @@ -130,6 +141,19 @@ void tst_QPdfDocument::loadFromIODevice() QCOMPARE(doc.pageCount(), 2); QCOMPARE(pageCountChangedSpy.count(), 1); QCOMPARE(pageCountChangedSpy[0][0].toInt(), doc.pageCount()); + + consistencyCheck(doc); +} + +void tst_QPdfDocument::consistencyCheck(QPdfDocument &doc) const +{ + for (int i = 0; i < doc.pageCount(); ++i) { + const QString expected = TemporaryPdf::pageText(i); + QPdfSelection page = doc.getAllText(i); + QCOMPARE(page.text(), expected); + auto pageMoved = std::move(page); + QCOMPARE(pageMoved.text(), expected); + } } void tst_QPdfDocument::loadAsync() @@ -153,6 +177,8 @@ void tst_QPdfDocument::loadAsync() QCOMPARE(doc.pageCount(), 2); QCOMPARE(pageCountChangedSpy.count(), 1); QCOMPARE(pageCountChangedSpy[0][0].toInt(), doc.pageCount()); + + consistencyCheck(doc); } void tst_QPdfDocument::password() @@ -192,6 +218,10 @@ void tst_QPdfDocument::close() statusChangedSpy.clear(); pageCountChangedSpy.clear(); + consistencyCheck(doc); + if (QTest::currentTestFailed()) + return; + doc.close(); QCOMPARE(statusChangedSpy.count(), 2); QCOMPARE(statusChangedSpy[0][0].value(), QPdfDocument::Unloading); @@ -235,6 +265,8 @@ void tst_QPdfDocument::loadAfterClose() QCOMPARE(doc.pageCount(), 2); QCOMPARE(pageCountChangedSpy.count(), 1); QCOMPARE(pageCountChangedSpy[0][0].toInt(), doc.pageCount()); + + consistencyCheck(doc); } void tst_QPdfDocument::closeOnDestroy() -- cgit v1.2.3 From 875611e155bd144a9df6cb1d62a16981b2201b88 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 16 Dec 2021 10:32:27 +0100 Subject: Update SG backend code Correct the debug output and remove references to dead code like ANGLE. Change-Id: I261ecf23a200c4328ea79514f7f75fce991960f5 Reviewed-by: Michal Klocek (cherry picked from commit 3d0b32c93c0d45bf61a77e76ef9ab54efd2b2eeb) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 74 ++++++++++++----------------------------- 1 file changed, 21 insertions(+), 53 deletions(-) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 94dd4119e..ee31a7eae 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -145,6 +145,7 @@ #include #include #include +#include #include #if QT_CONFIG(opengl) @@ -156,40 +157,10 @@ QT_END_NAMESPACE namespace QtWebEngineCore { #if QT_CONFIG(opengl) -static bool usingANGLE() -{ -#if defined(Q_OS_WIN) - if (qt_gl_global_share_context()) - return qt_gl_global_share_context()->isOpenGLES(); - return QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES; -#else - return false; -#endif -} -static bool usingDefaultSGBackend() +static bool usingSupportedSGBackend() { - if (QQuickWindow::graphicsApi() != QSGRendererInterface::OpenGL) - return false; - - const QStringList args = QGuiApplication::arguments(); - - // follow the logic from contextFactory in src/quick/scenegraph/qsgcontextplugin.cpp - QString device = QQuickWindow::sceneGraphBackend(); - - for (int index = 0; index < args.count(); ++index) { - if (args.at(index).startsWith(QLatin1String("--device="))) { - device = args.at(index).mid(9); - break; - } - } - - if (device.isEmpty()) - device = qEnvironmentVariable("QT_QUICK_BACKEND"); - if (device.isEmpty()) - device = qEnvironmentVariable("QMLSCENE_DEVICE"); - - return device.isEmpty(); + return QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL; } bool usingSoftwareDynamicGL() @@ -210,7 +181,7 @@ bool usingSoftwareDynamicGL() static const char *getGLType(bool enableGLSoftwareRendering) { const char *glType = nullptr; - const bool tryGL = (usingDefaultSGBackend() && !usingSoftwareDynamicGL() + const bool tryGL = (usingSupportedSGBackend() && !usingSoftwareDynamicGL() && QGuiApplicationPrivate::platformIntegration()->hasCapability( QPlatformIntegration::OpenGL)) || enableGLSoftwareRendering; @@ -225,7 +196,7 @@ static const char *getGLType(bool enableGLSoftwareRendering) glType = gl::kGLImplementationDesktopName; // Check if Core profile was requested and is supported. if (sharedFormat.profile() == QSurfaceFormat::CoreProfile) { -#ifdef Q_OS_MACOS +#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) glType = gl::kGLImplementationCoreProfileName; #else qWarning("An OpenGL Core Profile was requested, but it is not supported " @@ -235,8 +206,7 @@ static const char *getGLType(bool enableGLSoftwareRendering) } break; case QSurfaceFormat::OpenGLES: - glType = usingANGLE() ? gl::kGLImplementationANGLEName - : gl::kGLImplementationEGLName; + glType = gl::kGLImplementationEGLName; break; case QSurfaceFormat::OpenVG: case QSurfaceFormat::DefaultRenderableType: @@ -282,13 +252,16 @@ static void logContext(const char *glType, base::CommandLine *cmd) "Surface Type: %s\n" "Surface Profile: %s\n" "Surface Version: %d.%d\n" - "Using Default SG Backend: %s\n" + "QSG RHI Backend: %s\n" + "Using Supported QSG Backend: %s\n" "Using Software Dynamic GL: %s\n" - "Using Angle: %s\n\n" + "Using Multithreaded OpenGL: %s\n\n" "Init Parameters:\n %s", glType, type, profile, sharedFormat.majorVersion(), sharedFormat.minorVersion(), - usingDefaultSGBackend() ? "yes" : "no", usingSoftwareDynamicGL() ? "yes" : "no", - usingANGLE() ? "yes" : "no", qPrintable(params.join(" "))); + qUtf8Printable(QSGRhiSupport::instance()->rhiBackendName()), + usingSupportedSGBackend() ? "yes" : "no", usingSoftwareDynamicGL() ? "yes" : "no", + !WebEngineContext::isGpuServiceOnUIThread() ? "yes" : "no", + qPrintable(params.join(" "))); #else qCInfo(webEngineContextLog) << "WebEngine compiled with no opengl enabled."; #endif //QT_CONFIG(opengl) @@ -730,7 +703,13 @@ WebEngineContext::WebEngineContext() if (glType) { #if QT_CONFIG(opengl) - parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType); +#if defined(Q_OS_WIN) + // See below + if (glType == gl::kGLImplementationCoreProfileName) + parsedCommandLine->AppendSwitchASCII(switches::kUseGL, gl::kGLImplementationDesktopName); + else +#endif + parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType); parsedCommandLine->AppendSwitch(switches::kInProcessGPU); if (enableGLSoftwareRendering) { parsedCommandLine->AppendSwitch(switches::kDisableGpuRasterization); @@ -745,18 +724,7 @@ WebEngineContext::WebEngineContext() // Core Profile context, even if Qt uses a legacy profile, which causes // "Could not share GL contexts" warnings, because it's not possible to share between Core and // legacy profiles. See GLContextWGL::Initialize(). - // Given that Desktop GL Core profile is not currently supported on Windows anyway, pass this - // switch to get rid of the warnings. - // - // The switch is also used to determine which version of OpenGL ES to use (2 or 3) when using - // ANGLE. - // If the switch is not set, Chromium will always try to create an ES3 context, even if Qt uses - // an ES2 context, which causes resource sharing issues (black screen), - // see gpu::gles2::GenerateGLContextAttribs(). - // Make sure to disable ES3 context creation when using ES2. - const bool isGLES2Context = QOpenGLContext::globalShareContext()->isOpenGLES() - && QOpenGLContext::globalShareContext()->format().majorVersion() == 2; - if (!usingANGLE() || isGLES2Context) + if (glType != gl::kGLImplementationCoreProfileName) parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext); #endif #endif //QT_CONFIG(opengl) -- cgit v1.2.3 From 4bfaf160253156ad871296f2dd4943c0662114aa Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 5 Jan 2022 11:53:43 +0100 Subject: Always generate printing buildflags We include them unconditionally Fixes: QTBUG-99511 Change-Id: I4d9ebbf5777099ade38740ceb41532f0088df4c0 Reviewed-by: Michal Klocek (cherry picked from commit 7720aa45fa8419da4c90ffed9954fbf7502d062e) Reviewed-by: Qt Cherry-pick Bot --- src/core/configure/BUILD.root.gn.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 4af30131b..1c20b6e4b 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -218,6 +218,7 @@ source_set("qtwebengine_sources") { "//components/performance_manager", "//components/plugins/renderer/", "//extensions/buildflags:buildflags", + "//printing/buildflags:buildflags", "//qtwebengine/common:mojo_bindings", "//rlz/buildflags:buildflags", "//third_party/blink/public/mojom:mojom_platform", @@ -356,9 +357,6 @@ source_set("qtwebengine_sources") { "//chrome/browser/printing/print_job_worker.cc", "//chrome/browser/printing/print_job_worker.h", ] - deps += [ - "//printing/buildflags:buildflags", - ] } if (enable_pdf) { deps += [ -- cgit v1.2.3 From dd2e489e5b5f77a2cd598480796692404faf3655 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 6 Jan 2022 14:43:52 +0100 Subject: Add missing BUILD.gn template dependency Change-Id: Ic075eaff01c6536ce9d6a12bab7ee0cd8d5764bd Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit b195d4851cd14dd6b61340f9b7cd91ec4a73ee13) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index f366380a8..c6e553c41 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -999,6 +999,7 @@ function(add_gn_command) WORKING_DIRECTORY ${WEBENGINE_ROOT_BUILD_DIR} COMMENT "Run gn for target ${arg_CMAKE_TARGET} in ${arg_BUILDDIR}" DEPENDS ${gnArgArgFile} run_${arg_MODULE}_GnReady + "${WEBENGINE_ROOT_SOURCE_DIR}/src/${arg_MODULE}/configure/BUILD.root.gn.in" USES_TERMINAL ) add_custom_target(runGn_${arg_GN_TARGET} -- cgit v1.2.3 From 41458fd0ca1d771d719657dcd94f4414e5aa52bc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 6 Jan 2022 14:32:43 +0100 Subject: Fix inspector overlay Was missing resources that had moved Fixes: QTBUG-99526 Change-Id: I68b05b9de3dbd6c6460e5495a939e2599623a047 Reviewed-by: Michal Klocek (cherry picked from commit 6617cb8edb51bce85861e44035948d8f634c985b) Reviewed-by: Qt Cherry-pick Bot --- src/core/configure/BUILD.root.gn.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 1c20b6e4b..445454706 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -578,10 +578,12 @@ repack("qtwebengine_repack_resources_200") { repack("qtwebengine_repack_resources_devtools") { sources = [ "$root_gen_dir/content/browser/devtools/devtools_resources.pak", + "$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak", ] output = "$root_out_dir/qtwebengine_devtools_resources.pak" deps = [ "//content/browser/devtools:devtools_resources_grit", + "//third_party/blink/public:devtools_inspector_resources_grit", ] } -- cgit v1.2.3 From 368ae18df30b800add91f162302ca8bf087634a2 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 6 Jan 2022 22:41:25 +0000 Subject: Update dependencies on '6.3' in qt/qtwebengine Change-Id: I39b89bbc254f297240f68ba0266054c7fc7287da 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 ea6b23da3..9b93336c2 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: a9f9a97f79e00fc0f82566a130f9f6692f73c5d7 + ref: e2dfb864cef9557217379377d04475b2e7c4552d required: true ../qtpositioning: - ref: b2fd1c6607afbcf2630d0fc5a52446828299e3a0 + ref: c9a22beb66bb855b4d72c7ede67f030240f6b322 required: false ../qttools: - ref: 0dcc470164ab5de13023f03bc9c1e84a412ff454 + ref: 482e86af2965036f00803bfa518fdb761bf40dfd required: false ../qtwebchannel: - ref: f2f4e5235d07250531878592e8207982ec7910c1 + ref: 061fbd937c32553353ee9f42e42ea7ea0ccd3f41 required: false -- cgit v1.2.3 From bcb7ab3412275f97d71baa819c1f715a8e225bf1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 5 Jan 2022 14:30:32 +0100 Subject: Add objectName to webengine accessibility objects This requires adding a QObject to represent the backing node. Fixes: QTBUG-99485 Change-Id: I4d8c722a0dfb1f374995f3feab23b93ed5d8752a Reviewed-by: Kirill Burtsev (cherry picked from commit d95f6a6b23e3052c39a32f50d6e604cf17e698e3) Reviewed-by: Qt Cherry-pick Bot --- src/core/browser_accessibility_manager_qt.cpp | 24 ++++++---- src/core/browser_accessibility_manager_qt.h | 8 +++- src/core/browser_accessibility_qt.cpp | 24 ++++++---- src/core/browser_accessibility_qt.h | 5 ++ .../widgets/accessibility/tst_accessibility.cpp | 53 ++++++++++++++++++++++ 5 files changed, 95 insertions(+), 19 deletions(-) diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index b1d7f1a22..8587229d1 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -55,12 +55,9 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( { #if QT_CONFIG(accessibility) Q_ASSERT(delegate); - QObject *parent = nullptr; - if (delegate->AccessibilityIsMainFrame()) { - auto *access = static_cast(delegate->AccessibilityGetWebContentsAccessibility()); - parent = access ? access->accessibilityParentObject() : nullptr; - } - return new BrowserAccessibilityManagerQt(parent, initialTree, delegate); + QtWebEngineCore::WebContentsAccessibilityQt *access = nullptr; + access = static_cast(delegate->AccessibilityGetWebContentsAccessibility()); + return new BrowserAccessibilityManagerQt(access, initialTree, delegate); #else return nullptr; #endif // QT_CONFIG(accessibility) @@ -79,10 +76,11 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create( #if QT_CONFIG(accessibility) BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt( - QObject *parentObject, const ui::AXTreeUpdate &initialTree, + QtWebEngineCore::WebContentsAccessibilityQt *webContentsAccessibility, + const ui::AXTreeUpdate &initialTree, BrowserAccessibilityDelegate* delegate) : BrowserAccessibilityManager(delegate) - , m_parentObject(parentObject) + , m_webContentsAccessibility(webContentsAccessibility) { Initialize(initialTree); m_valid = true; // BrowserAccessibilityQt can start using the AXTree @@ -95,7 +93,15 @@ BrowserAccessibilityManagerQt::~BrowserAccessibilityManagerQt() QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible() { - return QAccessible::queryAccessibleInterface(m_parentObject); + content::BrowserAccessibility *parent_node = GetParentNodeFromParentTree(); + if (!parent_node) { + Q_ASSERT(m_webContentsAccessibility); + return QAccessible::queryAccessibleInterface(m_webContentsAccessibility->accessibilityParentObject()); + } + + auto *parent_manager = + static_cast(parent_node->manager()); + return parent_manager->rootParentAccessible(); } void BrowserAccessibilityManagerQt::FireBlinkEvent(ax::mojom::Event event_type, diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h index 2a1d273b9..de0022a49 100644 --- a/src/core/browser_accessibility_manager_qt.h +++ b/src/core/browser_accessibility_manager_qt.h @@ -49,12 +49,16 @@ QT_FORWARD_DECLARE_CLASS(QAccessibleInterface) +namespace QtWebEngineCore { +class WebContentsAccessibilityQt; +} + namespace content { class BrowserAccessibilityManagerQt : public BrowserAccessibilityManager { public: - BrowserAccessibilityManagerQt(QObject *parentObject, + BrowserAccessibilityManagerQt(QtWebEngineCore::WebContentsAccessibilityQt *webContentsAccessibility, const ui::AXTreeUpdate &initialTree, BrowserAccessibilityDelegate *delegate); ~BrowserAccessibilityManagerQt() override; @@ -68,7 +72,7 @@ public: private: Q_DISABLE_COPY(BrowserAccessibilityManagerQt) - QObject *m_parentObject; + QtWebEngineCore::WebContentsAccessibilityQt *m_webContentsAccessibility; bool m_valid = false; }; diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 76e76c12e..7cb7c81d1 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -59,11 +59,7 @@ namespace content { // static BrowserAccessibility *BrowserAccessibility::Create() { -#if QT_CONFIG(accessibility) return new BrowserAccessibilityQt(); -#else - return nullptr; -#endif // QT_CONFIG(accessibility) } const BrowserAccessibilityQt *ToBrowserAccessibilityQt(const BrowserAccessibility *obj) @@ -78,7 +74,6 @@ QAccessibleInterface *toQAccessibleInterface(BrowserAccessibility *obj) BrowserAccessibilityQt::BrowserAccessibilityQt() { - QAccessible::registerAccessibleInterface(this); } bool BrowserAccessibilityQt::isValid() const @@ -89,7 +84,7 @@ bool BrowserAccessibilityQt::isValid() const QObject *BrowserAccessibilityQt::object() const { - return nullptr; + return m_object; } QAccessibleInterface *BrowserAccessibilityQt::childAt(int x, int y) const @@ -655,11 +650,24 @@ QAccessible::State BrowserAccessibilityQt::state() const return state; } +void BrowserAccessibilityQt::Init(BrowserAccessibilityManager *manager, ui::AXNode *node) +{ + BrowserAccessibility::Init(manager, node); + + Q_ASSERT(parent()); + Q_ASSERT(parent()->object()); + m_object = new QObject(parent()->object()); + QString name = toQt(GetAuthorUniqueId()); + if (!name.isEmpty()) + m_object->setObjectName(name); + + m_id = QAccessible::registerAccessibleInterface(this); +} + void BrowserAccessibilityQt::Destroy() { // delete this - QAccessible::Id interfaceId = QAccessible::uniqueId(this); - QAccessible::deleteAccessibleInterface(interfaceId); + QAccessible::deleteAccessibleInterface(m_id); } QStringList BrowserAccessibilityQt::actionNames() const diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h index 32a4fc76b..c02e51c8f 100644 --- a/src/core/browser_accessibility_qt.h +++ b/src/core/browser_accessibility_qt.h @@ -80,6 +80,7 @@ public: QAccessible::State state() const override; // BrowserAccessible + void Init(BrowserAccessibilityManager *manager, ui::AXNode *node) override; void Destroy() override; // QAccessibleActionInterface @@ -142,6 +143,10 @@ public: QAccessibleInterface* table() const override; void modelChange(QAccessibleTableModelChangeEvent *event) override; + +private: + QObject *m_object = nullptr; + QAccessible::Id m_id; }; const BrowserAccessibilityQt *ToBrowserAccessibilityQt(const BrowserAccessibility *obj); diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index 054559f13..4429ff8bf 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -48,6 +48,8 @@ private Q_SLOTS: void value(); void roles_data(); void roles(); + void objectName(); + void crossTreeParent(); }; // This will be called before the first test function is executed. @@ -552,6 +554,57 @@ void tst_Accessibility::roles() QCOMPARE(element->role(), role); } +void tst_Accessibility::objectName() +{ + QWebEngineView webView; + QSignalSpy spyFinished(&webView, &QWebEngineView::loadFinished); + webView.setHtml("

"); + webView.show(); + QVERIFY(spyFinished.wait()); + QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView); + QAccessibleInterface *document = view->child(0); + QTRY_COMPARE(document->childCount(), 1); + QAccessibleInterface *p = document->child(0); + QVERIFY(p); + QVERIFY(p->object()); + QCOMPARE(p->role(), QAccessible::Paragraph); + QCOMPARE(p->object()->objectName(), QStringLiteral("my_id")); +} + +void tst_Accessibility::crossTreeParent() +{ + QWebEngineView webView; + QSignalSpy spyFinished(&webView, &QWebEngineView::loadFinished); + webView.setHtml(""); + webView.show(); + QVERIFY(spyFinished.wait()); + QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView); + QAccessibleInterface *document = view->child(0); + QCOMPARE(document->role(), QAccessible::WebDocument); + QTRY_COMPARE(document->childCount(), 1); + QAccessibleInterface *p = document->child(0); + QVERIFY(p); + QCOMPARE(p->parent(), document); + p = p->child(0); + QVERIFY(p); + QCOMPARE(p->role(), QAccessible::WebDocument); + QCOMPARE(p->parent()->parent(), document); + QTRY_COMPARE(p->childCount(), 1); + p = p->child(0); + QVERIFY(p); + QAccessibleInterface *subdocument = p; + QCOMPARE(p->role(), QAccessible::WebDocument); + QCOMPARE(p->parent()->parent()->parent(), document); + p = p->child(0); + QVERIFY(p); + QVERIFY(p->object()); + QCOMPARE(p->role(), QAccessible::Paragraph); + QCOMPARE(p->parent(), subdocument); + QCOMPARE(p->parent()->parent()->parent()->parent(), document); + QCOMPARE(p->parent()->parent()->parent()->parent()->parent(), view); + QCOMPARE(p->object()->objectName(), QStringLiteral("my_id")); +} + static QByteArrayList params = QByteArrayList() << "--force-renderer-accessibility" << "--enable-features=AccessibilityExposeARIAAnnotations"; -- cgit v1.2.3 From 2c1102fec26a89e0b25733bf3ffae826eef1e4b0 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Sat, 8 Jan 2022 11:50:19 +0000 Subject: Update dependencies on '6.3' in qt/qtwebengine Change-Id: Iac0f6b6180b589aad430e8ef08dbb329476a4248 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 9b93336c2..bf12a30cb 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: e2dfb864cef9557217379377d04475b2e7c4552d + ref: d394b2e0cefa27ea8729fca67c2144b887914e3f required: true ../qtpositioning: - ref: c9a22beb66bb855b4d72c7ede67f030240f6b322 + ref: e4dff4d456a5da8383956ba23d0d31a98fd3f468 required: false ../qttools: - ref: 482e86af2965036f00803bfa518fdb761bf40dfd + ref: c409efed1d11eff0a3c45beffedd01ef8e6c1ba7 required: false ../qtwebchannel: - ref: 061fbd937c32553353ee9f42e42ea7ea0ccd3f41 + ref: cc48737e917a6565a1a6b50b4af3ec8cb3fff460 required: false -- cgit v1.2.3 From f4c7aa17cfd7cdbf5f0a61d103ad394cfe7d5ead Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 11 Jan 2022 15:50:34 +0100 Subject: PDF viewer examples: use QtQuick.Dialogs FileDialog Qt.labs.platform is becoming obsolete, and creates a widgets dependency. QtQuick.Dialogs uses platform dialogs when available. Change-Id: I9b608e28cc7b9a99d0aaeec2aa24fee9d569dfe8 Reviewed-by: Oliver Eftevaag (cherry picked from commit 2f4307e06d93aeebd492fde0f1bd85cc607f1301) Reviewed-by: Qt Cherry-pick Bot --- examples/pdf/multipage/viewer.qml | 6 +++--- examples/pdf/pdfviewer/viewer.qml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml index ed84d5547..a4f3234dd 100644 --- a/examples/pdf/multipage/viewer.qml +++ b/examples/pdf/multipage/viewer.qml @@ -50,11 +50,11 @@ import QtQml // workaround for QTBUG-82873 import QtQuick import QtQuick.Controls +import QtQuick.Dialogs import QtQuick.Layouts import QtQuick.Pdf import QtQuick.Shapes import QtQuick.Window -import Qt.labs.platform as Platform ApplicationWindow { id: root @@ -186,11 +186,11 @@ ApplicationWindow { } } - Platform.FileDialog { + FileDialog { id: fileDialog title: "Open a PDF file" nameFilters: [ "PDF files (*.pdf)" ] - onAccepted: document.source = file + onAccepted: document.source = selectedFile } Dialog { diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml index 8c85a09da..ef52b0b99 100644 --- a/examples/pdf/pdfviewer/viewer.qml +++ b/examples/pdf/pdfviewer/viewer.qml @@ -50,12 +50,12 @@ import QtQml // workaround for QTBUG-82873 import QtQuick import QtQuick.Controls +import QtQuick.Dialogs import QtQuick.Layouts import QtQuick.Pdf import QtQuick.Shapes import QtQuick.Window import Qt.labs.animation -import Qt.labs.platform as Platform ApplicationWindow { id: root @@ -189,11 +189,11 @@ ApplicationWindow { } } - Platform.FileDialog { + FileDialog { id: fileDialog title: "Open a PDF file" nameFilters: [ "PDF files (*.pdf)" ] - onAccepted: document.source = file + onAccepted: document.source = selectedFile } Dialog { -- cgit v1.2.3 From 888a6dfc315d279b15ffb2abd5f35cdea41a8645 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 13 Jan 2022 12:47:39 +0100 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule src/3rdparty 735b1a398..dd2725bea: > Do not overwrite signal handlers in the browser process. > Quiet false error message > FIXUP: Stop using C++20 initialization > [Backport] Security bug 1259899 > [Backport] CVE-2021-4057: Use after free in file API > [Backport] CVE-2021-4078: Type confusion in V8 > [Backport] CVE-2021-4059: Insufficient data validation in loader > [Backport] CVE-2021-4062: Heap buffer overflow in BFCache > Fix crashes with MSVC > Bundle all localisation files for DevTools > Speculative fixes for build race conditions > Allow DevTools to download remote translations > FIXUP: Fix disabling reporting > Use wglSetPixelFormat directly only if in software mode > Fix jumbo build: syntax error in v8 token.h(211) > [Backport] CVE-2021-38017: Insufficient policy enforcement in iframe sandbox > [Backport] CVE-2021-37987 : Use after free in Network APIs > [Backport] CVE-2021-38015: Inappropriate implementation in input > [Backport] CVE-2021-38018: Inappropriate implementation in navigation > [Backport] CVE-2021-38021: Inappropriate implementation in referrer > [Backport] CVE-2021-38005: Use after free in loader (3/3) > [Backport] CVE-2021-38005: Use after free in loader (2/3) > [Backport] CVE-2021-38005: Use after free in loader (1/3) > [Backport] CVE-2021-38019: Insufficient policy enforcement in CORS > [Backport] CVE-2021-38007: Type Confusion in V8 > [Backport] CVE-2021-38009: Inappropriate implementation in cache > [Backport] Dependency for CVE-2021-38009 > [Backport] CVE-2021-38012: Type Confusion in V8 > [Backport] CVE-2021-38010: Inappropriate implementation in service workers > [Backport] Security bug 1252858 > [Backport] Security bug 1241912 > [Backport] CVE-2021-37994 : Inappropriate implementation in iFrame Sandbox > [Backport] Dependency for CVE-2021-37994 > [Backport] CVE-2021-37996 : Insufficient validation of untrusted input in Downloads > [Backport] CVE-2021-37989 : Inappropriate implementation in Blink > [Backport] CVE-2021-37985 : Use after free in V8 > [Backport] Security bug 1245870 > [Backport] CVE-2021-37992 : Out of bounds read in WebAudio > [Backport] CVE-2021-37993 : Use after free in PDF Accessibility Change-Id: I1d284f43d5042d094736b89385c638089b9c8c2f Reviewed-by: Michael Brüning (cherry picked from commit 026de53d131990c0560e6b037eb93574c8163e8d) --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 735b1a398..dd2725bea 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 735b1a398df409a98e84ed0eb1afb0bafdd9dff9 +Subproject commit dd2725bea8f4d044a5740461b4cd685bf4cb8cab -- cgit v1.2.3 From 2947d79d8210a7ae4ce2bc02e058628e66011be3 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 10 Jan 2022 23:01:18 +0100 Subject: Fix not working web ui popup (html comboboxes) due to focus out events Recent change in qtdeclarative 42d411e2e8 causes a focus out event being delivered in case of popups to "root" item of quickwidget. This is not expected as events are forwarded to parent "view" and loosing a focus will hint Blink to trigger a pop up close request. As a communication with a render process is asynchronous this creates several race conditions in our tests and the Blink's popup close request can close unexpectedly windows creating dangling pointers. Moreover, the focus in never gained back leaving the Blink's logic in a limbo state. Simply ignore a focus out event in case of popups. Fixes: QTBUG-99215 Change-Id: I5ca6eda227101d4f19f15735e41f066cfd8ccea0 Reviewed-by: Kirill Burtsev (cherry picked from commit ba2e26f3d94f0a4bb0077bed19f2b04a7b5104f0) Reviewed-by: Qt Cherry-pick Bot --- .../render_widget_host_view_qt_delegate_widget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index aa136b662..4fa0667b8 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -76,11 +76,16 @@ protected: } void focusInEvent(QFocusEvent *event) override { + Q_ASSERT(event->reason() != Qt::PopupFocusReason); m_client->forwardEvent(event); } void focusOutEvent(QFocusEvent *event) override { - m_client->forwardEvent(event); + // The keyboard events are supposed to go to the parent RenderHostView and WebUI + // popups should never have focus, therefore ignore focusOutEvent as losing focus + // will trigger pop close request from blink + if (event->reason() != Qt::PopupFocusReason) + m_client->forwardEvent(event); } void inputMethodEvent(QInputMethodEvent *event) override { -- cgit v1.2.3 From 52a8f96750ad560615874f3a37dc4e9dbf1c60ee Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 13 Jan 2022 19:08:24 +0000 Subject: Update dependencies on '6.3' in qt/qtwebengine Change-Id: Idd8e01ceff37abdbf3ef3664c470968d77fe7e06 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 bf12a30cb..9ee5e364b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: d394b2e0cefa27ea8729fca67c2144b887914e3f + ref: 6f3c748d0cb0fb52f43bb171660d78e5190d84f1 required: true ../qtpositioning: - ref: e4dff4d456a5da8383956ba23d0d31a98fd3f468 + ref: b2f4536c2fe44af9d36a91816182a1c0cbad3f17 required: false ../qttools: - ref: c409efed1d11eff0a3c45beffedd01ef8e6c1ba7 + ref: 7ca45f260567de3622831a679291c1e9a41abb04 required: false ../qtwebchannel: - ref: cc48737e917a6565a1a6b50b4af3ec8cb3fff460 + ref: 7185139b11fe4e708fc7299481408fde0e6230b4 required: false -- cgit v1.2.3 From 307d1f26c5039fbcbe2f18d3a3a883bc70193934 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 3 Dec 2021 14:41:20 +0100 Subject: Minor. Fix cmake warning Change-Id: I940db4bc953db9e571370886f142387dce5f12bb Reviewed-by: Alexandru Croitor (cherry picked from commit 85e6646d66b50b9fe471052cbc84b8c7bc253df0) Reviewed-by: Qt Cherry-pick Bot --- src/pdf/plugins/imageformats/pdf/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdf/plugins/imageformats/pdf/CMakeLists.txt b/src/pdf/plugins/imageformats/pdf/CMakeLists.txt index ee290782b..517d152c7 100644 --- a/src/pdf/plugins/imageformats/pdf/CMakeLists.txt +++ b/src/pdf/plugins/imageformats/pdf/CMakeLists.txt @@ -1,6 +1,6 @@ qt_internal_add_plugin(QPdfPlugin OUTPUT_NAME qpdf - TYPE imageformats + PLUGIN_TYPE imageformats SOURCES main.cpp qpdfiohandler.cpp qpdfiohandler_p.h -- cgit v1.2.3 From 257d817491566b391541639f58f537c7e6e70fab Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 11 Jan 2022 10:50:56 +0100 Subject: Fix moc path in case of top level cross build Fixes: QTBUG-99511 Change-Id: I8b9550c8a7e331e319fc7784224571beef0410b1 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 3cfc627a19005d818a24398e410162484ef3b5b5) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index c6e553c41..b3640e00c 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -79,7 +79,11 @@ function(create_cxx_config cmakeTarget arch configFileName) if(NOT QT_SUPERBUILD AND QT_WILL_INSTALL) get_target_property(mocFilePath Qt6::moc IMPORTED_LOCATION) else() - set(mocFilePath "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/moc${CMAKE_EXECUTABLE_SUFFIX}") + if(CMAKE_CROSSCOMPILING) + set(mocFilePath "${QT_HOST_PATH}/${INSTALL_LIBEXECDIR}/moc${CMAKE_EXECUTABLE_SUFFIX}") + else() + set(mocFilePath "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/moc${CMAKE_EXECUTABLE_SUFFIX}") + endif() endif() file(GENERATE OUTPUT $/${arch}/${configFileName} -- cgit v1.2.3 From b9698d13843680cac871634612413108452788c7 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 10 Jan 2022 10:51:53 +0100 Subject: Fix multi config generator and add checks for configs,archs Fix typo config -> configs. Add checks for configs and archs, otherwise we silently do not set right dependencies and continue the build. This can end up in weird looking errors. Task-number: QTBUG-99511 Change-Id: Ief727033e7b3ac32ab9f42bd96babd9be97f63a6 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 511d360d4f196d739975fbdfb80b99bfa4f4cc80) Reviewed-by: Qt Cherry-pick Bot --- cmake/Functions.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index b3640e00c..9f5344ad3 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -936,8 +936,14 @@ function(add_gn_build_aritfacts_to_target cmakeTarget ninjaTarget module buildDi # config loop is a workaround to be able to add_custom_command per config # note this is fixed in CMAKE.3.20 and should be cleaned up when 3.20 is # the minimum cmake we support - get_configs(config) + get_configs(configs) get_architectures(archs) + if(NOT configs) + message(FATAL_ERROR "No valid configurations found !") + endif() + if(NOT archs) + message(FATAL_ERROR "No valid architectures found. In case of cross-compiling make sure you have CMAKE_SYSTEM_PROCESSOR in your toolchain file.") + endif() foreach(config ${configs}) foreach(arch ${archs}) set(target ${ninjaTarget}_${config}_${arch}) -- cgit v1.2.3 From 63e37ba2ad2c0752b9b54b7ed78bc7bbb2dbc77d Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Tue, 11 Jan 2022 14:53:00 +0100 Subject: Fix printing PDF files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delegate printing task down to the guest WebContents if any is present. Also update PrintWebViewHelperDelegateQt to find the plugin element properly for printing. Task-number: QTBUG-98941 Change-Id: I81004a2275e0870a17565af527b1450472afb24b Reviewed-by: Michael Brüning (cherry picked from commit 455efe7ef204c6cd8de72b9b1f922f1681f58589) Reviewed-by: Qt Cherry-pick Bot --- .../renderer/print_web_view_helper_delegate_qt.cpp | 25 +++++++++++++++++----- src/core/web_contents_adapter.cpp | 21 +++++++++++++----- src/core/web_contents_adapter.h | 1 + 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.cpp b/src/core/renderer/print_web_view_helper_delegate_qt.cpp index beae6ecfa..5dcfaafd6 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.cpp +++ b/src/core/renderer/print_web_view_helper_delegate_qt.cpp @@ -43,11 +43,17 @@ #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_view.h" +#include "extensions/buildflags/buildflags.h" #include "extensions/common/constants.h" #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_element.h" #include "third_party/blink/public/web/web_local_frame.h" +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/common/webui_url_constants.h" +#include "extensions/common/constants.h" +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + #include "print_web_view_helper_delegate_qt.h" #include "web_engine_library_info.h" @@ -56,14 +62,23 @@ PrintWebViewHelperDelegateQt::~PrintWebViewHelperDelegateQt() {} blink::WebElement PrintWebViewHelperDelegateQt::GetPdfElement(blink::WebLocalFrame *frame) { +#if BUILDFLAG(ENABLE_EXTENSIONS) GURL url = frame->GetDocument().Url(); - if (url.SchemeIs(extensions::kExtensionScheme) && url.host() == extension_misc::kPdfExtensionId) { + bool inside_print_preview = url.GetOrigin() == chrome::kChromeUIPrintURL; + bool inside_pdf_extension = url.SchemeIs(extensions::kExtensionScheme) && + url.host_piece() == extension_misc::kPdfExtensionId; + if (inside_print_preview || inside_pdf_extension) { // with id="plugin" is created in - // chrome/browser/resources/pdf/pdf.js. - auto plugin_element = frame->GetDocument().GetElementById("plugin"); - CHECK(!plugin_element.IsNull()); - return plugin_element; + // chrome/browser/resources/pdf/pdf_viewer_base.js. + auto viewer_element = frame->GetDocument().GetElementById("viewer"); + if (!viewer_element.IsNull() && !viewer_element.ShadowRoot().IsNull()) { + auto plugin_element = viewer_element.ShadowRoot().QuerySelector("#plugin"); + if (!plugin_element.IsNull()) + return plugin_element; + } + NOTREACHED(); } +#endif // BUILDFLAG(ENABLE_EXTENSIONS) return blink::WebElement(); } diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 6137d2223..6f35513b7 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1321,7 +1321,10 @@ void WebContentsAdapter::printToPDF(const QPageLayout &pageLayout, const QPageRa PrintViewManagerQt::PrintToPDFFileCallback callback = base::BindOnce(&callbackOnPdfSavingFinished, m_adapterClient, filePath); - PrintViewManagerQt::FromWebContents(m_webContents.get())->PrintToPDFFileWithCallback(pageLayout, + content::WebContents *webContents = m_webContents.get(); + if (content::WebContents *guest = guestWebContents()) + webContents = guest; + PrintViewManagerQt::FromWebContents(webContents)->PrintToPDFFileWithCallback(pageLayout, pageRanges, true, filePath, @@ -1339,7 +1342,10 @@ quint64 WebContentsAdapter::printToPDFCallbackResult(const QPageLayout &pageLayo PrintViewManagerQt::PrintToPDFCallback callback = base::BindOnce(&callbackOnPrintingFinished, m_adapterClient, m_nextRequestId); - PrintViewManagerQt::FromWebContents(m_webContents.get())->PrintToPDFWithCallback(pageLayout, + content::WebContents *webContents = m_webContents.get(); + if (content::WebContents *guest = guestWebContents()) + webContents = guest; + PrintViewManagerQt::FromWebContents(webContents)->PrintToPDFWithCallback(pageLayout, pageRanges, colorMode, useCustomMargins, @@ -1438,6 +1444,12 @@ content::WebContents *WebContentsAdapter::webContents() const return m_webContents.get(); } +content::WebContents *WebContentsAdapter::guestWebContents() const +{ + std::vector innerWebContents = m_webContents->GetInnerWebContents(); + return !innerWebContents.empty() ? innerWebContents[0] : nullptr; +} + #if QT_CONFIG(webengine_webchannel) QWebChannel *WebContentsAdapter::webChannel() const { @@ -1545,9 +1557,8 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD // dropping data into them. We don't even try to support dropping into PDF input fields, // since it's not working in Chrome right now. content::WebContents *targetWebContents = m_webContents.get(); - std::vector innerWebContents = m_webContents->GetInnerWebContents(); - if (!innerWebContents.empty()) - targetWebContents = innerWebContents[0]; + if (content::WebContents *guest = guestWebContents()) + targetWebContents = guest; content::RenderViewHost *rvh = targetWebContents->GetRenderViewHost(); if (rvh) { diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 3e1657634..9066e7a72 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -240,6 +240,7 @@ public: // meant to be used within WebEngineCore only void initialize(content::SiteInstance *site); content::WebContents *webContents() const; + content::WebContents *guestWebContents() const; void updateRecommendedState(); void setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor); QWebEngineUrlRequestInterceptor* requestInterceptor() const; -- cgit v1.2.3 From 8e48ca5bd24aec8400270975ac4dce11f8982e89 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 6 Jan 2022 15:02:53 +0100 Subject: Do not override signal handlers We used to have this, but it got dropped at some point in an adaptions. Fixes: QTBUG-99263 Change-Id: I3bf86a1b42edca0cd792723c85d7dcb7877fea37 Reviewed-by: Michal Klocek (cherry picked from commit fbaab46becbf5ea063a8b4a01abf8cd1d4a1725d) Reviewed-by: Qt Cherry-pick Bot --- src/core/web_engine_context.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index ee31a7eae..a0dc40430 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -737,6 +737,7 @@ WebEngineContext::WebEngineContext() registerMainThreadFactories(); content::ContentMainParams contentMainParams(m_mainDelegate.get()); + contentMainParams.setup_signal_handlers = false; #if defined(OS_WIN) contentMainParams.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo(); sandbox::SandboxInterfaceInfo sandbox_info = {0}; -- cgit v1.2.3 From befaf5b5a9235aad39a3bbec84d99cadcda8977b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Fri, 14 Jan 2022 15:23:34 +0100 Subject: Doc: Fix find_package() call for Qt PDF Change-Id: Id19aa463db605c861a1bd3502eb964c8f9340e4d Reviewed-by: Michal Klocek (cherry picked from commit 4f592dbbb1069ef03595e083e34ee6cdbf7c0fec) Reviewed-by: Qt Cherry-pick Bot --- src/pdf/doc/snippets/qtpdf-build.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pdf/doc/snippets/qtpdf-build.cmake b/src/pdf/doc/snippets/qtpdf-build.cmake index d46b9c3ee..b4372d411 100644 --- a/src/pdf/doc/snippets/qtpdf-build.cmake +++ b/src/pdf/doc/snippets/qtpdf-build.cmake @@ -1,2 +1,2 @@ -find_package(Qt5 COMPONENTS Pdf REQUIRED) -target_link_libraries(mytarget Qt5::Pdf) +find_package(Qt6 REQUIRED COMPONENTS Pdf) +target_link_libraries(mytarget Qt6::Pdf) -- cgit v1.2.3 From ae563bc847744a9103bc114192f277f751bbae97 Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Wed, 19 Jan 2022 00:26:17 +0000 Subject: Update dependencies on '6.3' in qt/qtwebengine Change-Id: Icb276b93cbeeacb6d9b5b1796d45a10449d7f823 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 9ee5e364b..951fe10e1 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../qtdeclarative: - ref: 6f3c748d0cb0fb52f43bb171660d78e5190d84f1 + ref: e53b255b67c4ef4674d3e8b18617956c979bde4b required: true ../qtpositioning: - ref: b2f4536c2fe44af9d36a91816182a1c0cbad3f17 + ref: 62325a8cc4b3749cc5cb9059082bc791a11f255f required: false ../qttools: - ref: 7ca45f260567de3622831a679291c1e9a41abb04 + ref: 1e863772d902254afe80a629034cdc18f47bf486 required: false ../qtwebchannel: - ref: 7185139b11fe4e708fc7299481408fde0e6230b4 + ref: b008d6ecb71abb4eca815142706292653955bbaf required: false -- cgit v1.2.3 From ebe08bc74a25ece42787b1925beb706ec4fbdf1b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 18 Jan 2022 17:27:25 +0100 Subject: Find GIO like qtbase does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise it can conflict and cause issue on reconfigure Change-Id: I3e7756b4720bc5a1e82ef0f327b8c9dbc76667ec Fixes: QTBUG-99669 Reviewed-by: Mårten Nordheim Reviewed-by: Shawn Rutledge Reviewed-by: Joerg Bornemann (cherry picked from commit 0b6310bf48cfe9772be6ca2b51c685acce3f4ba6) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/configure.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/api/configure.cmake b/src/core/api/configure.cmake index 164c48a1f..5e67c1ad4 100644 --- a/src/core/api/configure.cmake +++ b/src/core/api/configure.cmake @@ -1,11 +1,11 @@ #### Libraries if(NOT QT_CONFIGURE_RUNNING) + find_package(GLIB2 COMPONENTS gio) find_package(PkgConfig) if(PkgConfig_FOUND) pkg_check_modules(ALSA alsa IMPORTED_TARGET) pkg_check_modules(PULSEAUDIO libpulse>=0.9.10 libpulse-mainloop-glib) - pkg_check_modules(GIO gio-2.0) pkg_check_modules(XDAMAGE xdamage) endif() @@ -109,7 +109,7 @@ qt_feature("webengine-webrtc-pipewire" PRIVATE LABEL "PipeWire over GIO" PURPOSE "Provides PipeWire support in WebRTC using GIO." AUTODETECT false - CONDITION QT_FEATURE_webengine_webrtc AND GIO_FOUND + CONDITION QT_FEATURE_webengine_webrtc AND TARGET GLIB2::GIO ) qt_feature("webengine-full-debug-info" PRIVATE SECTION "WebEngine" -- cgit v1.2.3 From 9a0e9b43ef660531fd4fa5c3ddf23ff2899ed676 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 18 Jan 2022 12:00:37 +0100 Subject: Add xkbfile to pkgconfig To get the correct includes if they are less standard Fixes: QTBUG-99890 Change-Id: Ibd751d46dce7e00e4ce8433549e778d4814dae30 Reviewed-by: Peter Varga (cherry picked from commit 52f0ca90445c633c68694fde84b4630a13c3c14e) Reviewed-by: Qt Cherry-pick Bot --- src/core/ozone/BUILD.gn | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/ozone/BUILD.gn b/src/core/ozone/BUILD.gn index 61ca197e5..aa7b282ae 100644 --- a/src/core/ozone/BUILD.gn +++ b/src/core/ozone/BUILD.gn @@ -5,8 +5,8 @@ import("//ui/base/ui_features.gni") import("//build/config/linux/pkg_config.gni") if (use_xkbcommon) { - pkg_config("xkbcommon") { - packages = [ "xkbcommon" ] + pkg_config("xkb") { + packages = [ "xkbcommon", "xkbfile" ] } } @@ -29,8 +29,7 @@ source_set("qt") { defines = [ "OZONE_IMPLEMENTATION" ] libs = [] if (use_xkbcommon) { - configs += [ ":xkbcommon" ] - libs += [ "xkbfile" ] + configs += [ ":xkb" ] } if (ozone_platform_x11) { -- cgit v1.2.3 From 077c5dcb7088b694cdc03b21bb7201a46b12ce43 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 17 Nov 2021 15:08:14 +0100 Subject: Widgets: Add FileSelectionMode::FileSelectSave Now we have an example to trigger this type of dialog, we can expose this as public API. Change-Id: If0964d07a532daaff5e798dac63dc02ec7781d4d Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 99b46c0959ec6280ee51c0d9ef8df432fd96a5bc) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginepage.cpp | 1 + src/core/api/qwebenginepage.h | 1 + src/core/doc/src/qwebenginepage_lgpl.qdoc | 2 ++ tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 15 ++++++++++++--- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 8e03aea0d..b793daed0 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -2148,6 +2148,7 @@ void QWebEnginePage::setDevToolsPage(QWebEnginePage *devToolsPage) ASSERT_ENUMS_MATCH(FilePickerController::Open, QWebEnginePage::FileSelectOpen) ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, QWebEnginePage::FileSelectOpenMultiple) ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, QWebEnginePage::FileSelectUploadFolder) +ASSERT_ENUMS_MATCH(FilePickerController::Save, QWebEnginePage::FileSelectSave) // TODO: remove virtuals QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes) diff --git a/src/core/api/qwebenginepage.h b/src/core/api/qwebenginepage.h index fcff3ab1e..45829f603 100644 --- a/src/core/api/qwebenginepage.h +++ b/src/core/api/qwebenginepage.h @@ -211,6 +211,7 @@ public: FileSelectOpen, FileSelectOpenMultiple, FileSelectUploadFolder, + FileSelectSave }; Q_ENUM(FileSelectionMode) diff --git a/src/core/doc/src/qwebenginepage_lgpl.qdoc b/src/core/doc/src/qwebenginepage_lgpl.qdoc index 43195deb2..4a058460b 100644 --- a/src/core/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/core/doc/src/qwebenginepage_lgpl.qdoc @@ -252,6 +252,8 @@ Return multiple file names. \value FileSelectUploadFolder Allows users to specify a single existing folder for upload. + \value FileSelectSave + Specify a new file to be created. \sa chooseFiles() */ diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index c86e89b42..d95c246fc 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -4758,6 +4758,8 @@ void tst_QWebEnginePage::testChooseFilesParameters_data() << QWebEnginePage::FileSelectOpenMultiple << QStringList(); QTest::addRow("Folder upload") << QString("multiple webkitdirectory") << QString() << QWebEnginePage::FileSelectUploadFolder << QStringList(); + QTest::addRow("Save file") << QString("") << QString() + << QWebEnginePage::FileSelectSave << QStringList(); mimeTypes = QStringList() << "audio/*"; QTest::addRow("MIME type: audio") << QString() << QString("accept='%1'").arg(mimeTypes.join(',')) << QWebEnginePage::FileSelectOpen << mimeTypes; @@ -4791,9 +4793,16 @@ void tst_QWebEnginePage::testChooseFilesParameters() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - page.setHtml(QString("" - "" - "").arg(uploadAttribute, mimeTypeAttribute)); + if (expectedFileSelectionMode != QWebEnginePage::FileSelectSave) { + page.setHtml(QString("" + "" + "").arg(uploadAttribute, mimeTypeAttribute)); + } else { + page.setHtml(QString("" + "