From 8b3815a88ad48f439df3188bd9c9138e8254b3c1 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 8 Feb 2017 17:44:36 +0100 Subject: Doc: Fix \sa links in the docs - Leave out the class name for the members of the class - Add brackets in the end of method names Change-Id: I5429be5620c5c192aa872d94ab047eebe39a13da Reviewed-by: Allan Sandfeld Jensen --- src/core/api/qwebengineurlrequestinfo.cpp | 8 ++++---- src/webengine/api/qquickwebengineprofile.cpp | 2 +- src/webenginewidgets/api/qwebenginedownloaditem.cpp | 4 ++-- src/webenginewidgets/api/qwebenginepage.cpp | 2 +- src/webenginewidgets/api/qwebenginescript.cpp | 4 ++-- src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index a3806fc63..877b376b0 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -96,7 +96,7 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q interceptor on the profile enables intercepting, blocking, and modifying URL requests before they reach the networking stack of Chromium. - \sa QWebEngineUrlRequestInterceptor::interceptRequest, QWebEngineUrlRequestInfo + \sa interceptRequest(), QWebEngineUrlRequestInfo */ /*! @@ -115,7 +115,7 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q \a info contains the information about the URL request and will track internally whether its members have been altered. - \sa QWebEngineProfile::setRequestInterceptor + \sa QWebEngineProfile::setRequestInterceptor() */ @@ -183,7 +183,7 @@ QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPriva /*! Returns the resource type of the request. - \sa QWebEngineUrlRequestInfo::ResourceType + \sa ResourceType */ QWebEngineUrlRequestInfo::ResourceType QWebEngineUrlRequestInfo::resourceType() const @@ -208,7 +208,7 @@ QWebEngineUrlRequestInfo::ResourceType QWebEngineUrlRequestInfo::resourceType() /*! Returns the navigation type of the request. - \sa QWebEngineUrlRequestInfo::NavigationType + \sa NavigationType */ QWebEngineUrlRequestInfo::NavigationType QWebEngineUrlRequestInfo::navigationType() const diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 871428f33..35efcb3b4 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -302,7 +302,7 @@ QQuickWebEngineProfile::~QQuickWebEngineProfile() The storage name that is used to create separate subdirectories for each profile that uses the disk for storing persistent data and cache. - \sa QQuickWebEngineProfile::persistentStoragePath, QQuickWebEngineProfile::cachePath + \sa persistentStoragePath, cachePath */ QString QQuickWebEngineProfile::storageName() const diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp index b777a0898..0bf02a7fc 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp +++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp @@ -179,7 +179,7 @@ quint32 QWebEngineDownloadItem::id() const This signal is emitted whenever the download's \a state changes. - \sa state(), QWebEngineDownloadItem::DownloadState + \sa state(), DownloadState */ /*! @@ -240,7 +240,7 @@ quint32 QWebEngineDownloadItem::id() const /*! Returns the download item's current state. - \sa QWebEngineDownloadItem::DownloadState + \sa DownloadState */ QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state() const diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 16e9438c9..abf91f5a4 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -823,7 +823,7 @@ QWebEngineSettings *QWebEnginePage::settings() const * that is exposed in the JavaScript context of this page as \c qt.webChannelTransport. * * \since 5.5 - * \sa setWebChannel + * \sa setWebChannel() */ QWebChannel *QWebEnginePage::webChannel() const { diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp index 04a9d979a..d5247cde1 100644 --- a/src/webenginewidgets/api/qwebenginescript.cpp +++ b/src/webenginewidgets/api/qwebenginescript.cpp @@ -196,7 +196,7 @@ ASSERT_ENUMS_MATCH(QWebEngineScript::DocumentCreation, UserScript::DocumentEleme * Returns the point in the loading process at which the script will be executed. * The default value is QWebEngineScript::Deferred. * - * \sa setInjectionPoint + * \sa setInjectionPoint() */ QWebEngineScript::InjectionPoint QWebEngineScript::injectionPoint() const { @@ -205,7 +205,7 @@ QWebEngineScript::InjectionPoint QWebEngineScript::injectionPoint() const /*! * Sets the point at which to execute the script to be \a p. * - * \sa QWebEngineScript::InjectionPoint + * \sa InjectionPoint */ void QWebEngineScript::setInjectionPoint(QWebEngineScript::InjectionPoint p) { diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 58abc9fa1..6dc9b20e2 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -538,7 +538,7 @@ This signal is emitted whenever the page requests the web browser window to be closed, for example through the JavaScript \c{window.close()} call. - \sa QWebEnginePage::RequestClose + \sa RequestClose */ /*! -- cgit v1.2.3 From b29e11ee4ee4afaf3b1658200692cd97f69f7fd4 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 1 Feb 2017 16:31:17 +0100 Subject: Add missing test files to qmltests.pro Change-Id: I1b4f10facdacde432a7b135419ae3c81acf6ce74 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/qmltests.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 4d4268324..60c11addc 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -32,8 +32,8 @@ OTHER_FILES += \ $$PWD/data/prompt.html \ $$PWD/data/multifileupload.html \ $$PWD/data/redirect.html \ + $$PWD/data/script-with-metadata.js \ $$PWD/data/singlefileupload.html \ - $$PWD/data/small-favicon.png \ $$PWD/data/test1.html \ $$PWD/data/test2.html \ $$PWD/data/test3.html \ @@ -41,6 +41,7 @@ OTHER_FILES += \ $$PWD/data/keyboardModifierMapping.html \ $$PWD/data/keyboardEvents.html \ $$PWD/data/titleupdate.js \ + $$PWD/data/tst_activeFocusOnPress.qml \ $$PWD/data/tst_desktopBehaviorLoadHtml.qml \ $$PWD/data/tst_download.qml \ $$PWD/data/tst_favicon.qml \ @@ -72,6 +73,7 @@ OTHER_FILES += \ $$PWD/data/tst_settings.qml \ $$PWD/data/tst_keyboardModifierMapping.qml \ $$PWD/data/tst_keyboardEvents.qml \ + $$PWD/data/webchannel-test.html \ $$PWD/data/icons/favicon.png \ $$PWD/data/icons/gray128.png \ $$PWD/data/icons/gray16.png \ -- cgit v1.2.3 From d122420a51671dcf1075438f3c084eb8cda53ace Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 20 Oct 2016 19:31:53 +0200 Subject: remove redundant load(qt_build_config) .qmake.conf already does it Change-Id: Iee7fd73d84e903aa10233e33151d22f164a1509c Reviewed-by: Joerg Bornemann --- qtwebengine.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/qtwebengine.pro b/qtwebengine.pro index 3fd5c12e6..b6e735876 100644 --- a/qtwebengine.pro +++ b/qtwebengine.pro @@ -1,4 +1,3 @@ -load(qt_build_config) load(qt_parts) isPlatformSupported() { -- cgit v1.2.3 From 309814bd7a160c44f91bf61c787af555a10a8eed Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 6 Feb 2017 12:50:46 +0100 Subject: Doc: Fix stray 'is' in featurePermissionRequest documentation Change-Id: Ia5629808a274b2a551bdf70517b24e9be8deb748 Reviewed-by: Leena Miettinen --- src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 6dc9b20e2..7616ebcee 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -729,7 +729,7 @@ /*! \fn void QWebEnginePage::featurePermissionRequested(const QUrl &securityOrigin, Feature feature) - This is signal is emitted when the web site identified by \a securityOrigin requests to make use of + This signal is emitted when the web site identified by \a securityOrigin requests to make use of the resource or device identified by \a feature. \sa featurePermissionRequestCanceled(), setFeaturePermission() @@ -738,7 +738,7 @@ /*! \fn void QWebEnginePage::featurePermissionRequestCanceled(const QUrl &securityOrigin, Feature feature) - This is signal is emitted when the web site identified by \a securityOrigin cancels a previously issued + This signal is emitted when the web site identified by \a securityOrigin cancels a previously issued request to make use of \a feature. \sa featurePermissionRequested(), setFeaturePermission() -- cgit v1.2.3 From 1f8154cd473bf57aad59ef1c4cf7c9a3be9a823d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Feb 2017 14:29:19 +0100 Subject: Initialize RenderWidgetHostViewQt::m_currentInputType inputMethodQuery can be called before TextInputStateChanged has initialized m_currentInputType. Change-Id: Icba5a622df0332b740477cd2d966f0dea5d86138 Reviewed-by: Michal Klocek --- src/core/render_widget_host_view_qt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 80337446f..a190380b2 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -238,6 +238,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget , m_needsDelegatedFrameAck(false) , m_loadVisuallyCommittedState(NotCommitted) , m_adapterClient(0) + , m_currentInputType(ui::TEXT_INPUT_TYPE_NONE) , m_imeInProgress(false) , m_receivedEmptyImeText(false) , m_anchorPositionWithinSelection(0) -- cgit v1.2.3 From aeefec9f3ff1925e9a663f1d84e44bdd0780f849 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Feb 2017 15:44:00 +0100 Subject: Fix MSVC version detection Do not check for exactly MSVC version 14.0 but compare if the actual version is less than the requested version. Task-number: QTBUG-58826 Change-Id: I249ed3c697ccb911784a83463b1c23185c9b3856 Reviewed-by: Oswald Buddenhagen --- tools/qmake/mkspecs/features/functions.prf | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 52bb5ec00..6545ef791 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -13,6 +13,18 @@ defineTest(isQtMinimum) { } } +defineTest(isMinMSVCVersion) { + actual = $$split(MSVC_VER, .) + actual_major = $$member(actual, 0) + actual_minor = $$member(actual, 1) + requested_major = $$1 + requested_minor = $$2 + lessThan(actual_major, $$requested_major): return(false) + greaterThan(actual_major, $$requested_major): return(true) + lessThan(actual_minor, $$requested_minor): return(false) + return(true) +} + defineTest(isPlatformSupported) { QT_FOR_CONFIG += gui-private linux { @@ -27,7 +39,7 @@ defineTest(isPlatformSupported) { return(false) } msvc { - !equals(MSVC_VER, "14.0") { + !isMinMSVCVersion(14, 0) { skipBuild("Qt WebEngine on Windows requires MSVC 2015 Update 2 or later.") return(false) } -- cgit v1.2.3 From 4578bc7173caa37f92cffe8f8dee4a5471d88af1 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 16 Feb 2017 11:34:52 +0100 Subject: test: blacklist tst_QQuickWebEngineView::changeLocale() on Windows Task-number: QTBUG-58960 Change-Id: I14da592796dea0fbdda66a91ff58d4bc7941d84f Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qquickwebengineview/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/quick/qquickwebengineview/BLACKLIST b/tests/auto/quick/qquickwebengineview/BLACKLIST index 2cde59454..6cfd71635 100644 --- a/tests/auto/quick/qquickwebengineview/BLACKLIST +++ b/tests/auto/quick/qquickwebengineview/BLACKLIST @@ -3,3 +3,6 @@ windows [inputEventForwardingDisabledWhenActiveFocusOnPressDisabled] * + +[changeLocale] +windows -- cgit v1.2.3 From 8666e9d50346ce4ae68b577812282b7bc17b41c9 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 16 Feb 2017 21:04:13 +0100 Subject: tests: blacklist tst_qwebengineview::changeLocale() on Windows and Linux Task-number: QTBUG-58022 Change-Id: I433c3b02a82494d6066338dab7a5991fab05040c Reviewed-by: Peter Varga --- tests/auto/widgets/qwebengineview/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/widgets/qwebengineview/BLACKLIST b/tests/auto/widgets/qwebengineview/BLACKLIST index 0a909d0f6..d249ac141 100644 --- a/tests/auto/widgets/qwebengineview/BLACKLIST +++ b/tests/auto/widgets/qwebengineview/BLACKLIST @@ -1,2 +1,5 @@ [doNotSendMouseKeyboardEventsWhenDisabled] windows +[changeLocale] +windows +linux -- cgit v1.2.3 From a6c6665d79e6d4097c0a1155ff5f963b9a9eab19 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 31 Jan 2017 15:01:43 +0100 Subject: Fix QWebEngineView::setFocus to properly set internal QQuickItem focus The widgets object hierarchy related to focus goes like this: QWebEngineView's focus proxy is -> RenderWidgetHostViewQtDelegateWidget, which has an internal QQuickRootItem defined by QQuickWidget, and the child of the item is -> RenderWidgetHostViewQuickItem. Previously when QWebEngineView::setFocus was called, the focus was set on the RenderWidgetHostViewQtDelegateWidget and the QQuickRootItem, but not on the RenderWidgetHostViewQuickItem. This caused for e.g. an active HTML text input not receiving focus. Make sure the RenderWidgetHostViewQuickItem is marked to have focus within its root item, so that if the root item receives active focus, so will RenderWidgetHostViewQuickItem receive it. Task-number: QTBUG-58515 Change-Id: I175610e3dfebc03733aefe26c16f47096df8ff5b Reviewed-by: Allan Sandfeld Jensen --- .../render_widget_host_view_qt_delegate_widget.cpp | 2 + .../widgets/qwebengineview/tst_qwebengineview.cpp | 50 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) 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 69ecbe160..e4c8996e1 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -64,6 +64,8 @@ public: RenderWidgetHostViewQuickItem(RenderWidgetHostViewQtDelegateClient *client) : m_client(client) { setFlag(ItemHasContents, true); + // Mark that this item should receive focus when the parent QQuickWidget receives focus. + setFocus(true); } protected: void focusInEvent(QFocusEvent *event) override diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 151b82b61..02e1d417e 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -84,6 +84,7 @@ private Q_SLOTS: void stopSettingFocusWhenDisabled_data(); void focusOnNavigation_data(); void focusOnNavigation(); + void focusInternalRenderWidgetHostViewQuickItem(); void changeLocale(); void inputMethodsTextFormat_data(); @@ -843,11 +844,60 @@ void tst_QWebEngineView::focusOnNavigation() webView->setFocus(); QTRY_COMPARE(webView->hasFocus(), true); + // Clean up. #undef loadAndTriggerFocusAndCompare #undef triggerJavascriptFocus } +void tst_QWebEngineView::focusInternalRenderWidgetHostViewQuickItem() +{ + // Create a container widget, that will hold a line edit that has initial focus, and a web + // engine view. + QScopedPointer containerWidget(new QWidget); + QLineEdit *label = new QLineEdit; + label->setText(QString::fromLatin1("Text")); + label->setFocus(); + + // Create the web view, and set its focusOnNavigation property to false, so it doesn't + // get initial focus. + QWebEngineView *webView = new QWebEngineView; + QWebEngineSettings *settings = webView->page()->settings(); + settings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false); + webView->resize(300, 300); + + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget(label); + layout->addWidget(webView); + + containerWidget->setLayout(layout); + containerWidget->show(); + QTest::qWaitForWindowExposed(containerWidget.data()); + + // Load the content, and check that focus is not set. + QSignalSpy loadSpy(webView, SIGNAL(loadFinished(bool))); + webView->setHtml("TitleHello" + ""); + QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE(webView->hasFocus(), false); + + // Manually trigger focus. + webView->setFocus(); + + // Check that focus is set in QWebEngineView and all internal classes. + QTRY_COMPARE(webView->hasFocus(), true); + + QQuickWidget *renderWidgetHostViewQtDelegateWidget = + qobject_cast(webView->focusProxy()); + QVERIFY(renderWidgetHostViewQtDelegateWidget); + QTRY_COMPARE(renderWidgetHostViewQtDelegateWidget->hasFocus(), true); + + QQuickItem *renderWidgetHostViewQuickItem = + renderWidgetHostViewQtDelegateWidget->rootObject(); + QVERIFY(renderWidgetHostViewQuickItem); + QTRY_COMPARE(renderWidgetHostViewQuickItem->hasFocus(), true); +} + void tst_QWebEngineView::changeLocale() { QUrl url("http://non.existent/"); -- cgit v1.2.3 From 905017117d38d799bc95d6cfdd0195b717b605b8 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Mon, 13 Feb 2017 08:48:37 -0800 Subject: Fix empty dialogs on window.onbeforeunload Custom texts are not supported anymore in unload dialogs. Fill them with a better message. Task-number: QTBUG-58673 Change-Id: I820155452461db90bf1df2ae8a8ec10ee752aab1 Reviewed-by: Joerg Bornemann --- src/core/javascript_dialog_manager_qt.cpp | 2 +- src/webengine/ui_delegates_manager.cpp | 5 ++++- src/webenginewidgets/api/qwebenginepage.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/javascript_dialog_manager_qt.cpp b/src/core/javascript_dialog_manager_qt.cpp index 2844dba5d..5fac12dd3 100644 --- a/src/core/javascript_dialog_manager_qt.cpp +++ b/src/core/javascript_dialog_manager_qt.cpp @@ -71,7 +71,7 @@ void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webCon void JavaScriptDialogManagerQt::RunBeforeUnloadDialog(content::WebContents *webContents, bool isReload, const content::JavaScriptDialogManager::DialogClosedCallback &callback) { Q_UNUSED(isReload); - runDialogForContents(webContents, WebContentsAdapterClient::UnloadDialog, QString()/*toQt(messageText).toHtmlEscaped()*/, QString() , QUrl(), callback); + runDialogForContents(webContents, WebContentsAdapterClient::UnloadDialog, QString(), QString(), QUrl(), callback); } bool JavaScriptDialogManagerQt::HandleJavaScriptDialog(content::WebContents *contents, bool accept, const base::string16 *promptOverride) diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index a37484023..4a47a49eb 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -330,7 +330,10 @@ void UIDelegatesManager::showDialog(QSharedPointer d item->setParentItem(m_view); dialog->setParent(m_view); QQmlProperty textProp(dialog, QStringLiteral("text")); - textProp.write(dialogController->message()); + if (dialogController->type() == WebContentsAdapterClient::UnloadDialog) + textProp.write(tr("Changes that you made may not be saved.")); + else + textProp.write(dialogController->message()); QQmlProperty titleProp(dialog, QStringLiteral("title")); titleProp.write(title); diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index abf91f5a4..9150525b5 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1436,7 +1436,7 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointertextProvided(promptResult); break; case UnloadDialog: - accepted = (QMessageBox::information(view, QCoreApplication::translate("QWebEnginePage", "Are you sure you want to leave this page?"), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes); + accepted = (QMessageBox::question(view, QCoreApplication::translate("QWebEnginePage", "Are you sure you want to leave this page?"), QCoreApplication::translate("QWebEnginePage", "Changes that you made may not be saved."), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok); break; case InternalAuthorizationDialog: accepted = (QMessageBox::question(view, controller->title(), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes); -- cgit v1.2.3 From 37206c2baf013b07cd26d416a8ab0db493d7d651 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 16 Feb 2017 15:33:02 +0100 Subject: Fix Q_ASSERT when dragging an item over WebEngineView When dragging something over a WebEngineView we're waiting for the result of the asynchronous DragTargetDragOver using a RunLoop. The result will be delivered by a call to updateDragAction. The RunLoop will call MessagePumpForUIQt::Run which spins a QEventLoop. The QEventLoop will dispatch more posted QDragMoveEvent objects while we're handling the current QDragMoveEvent. This triggers a recursion guard's Q_ASSERT when dragging from a QtQuick item onto a WebEngineView. When waiting for the DragTargetDragOver result we're not interested in Qt events. Instead of using a RunLoop, implement a poor man's chromium event loop and actively wait for updateDragAction being called. In practice, no more than two iterations of the loop are run until updateDragAction is called. Therefore the extra CPU and sleep times are negligible. Task-number: QTBUG-58920 Change-Id: Icfdf9c680c4c9987ac3dbb41fbc3e1403af0fa9f Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Alexandru Croitor --- src/core/web_contents_adapter.cpp | 78 ++++++++++++--------------------------- src/core/web_contents_adapter.h | 5 +-- src/core/web_contents_adapter_p.h | 5 +-- 3 files changed, 26 insertions(+), 62 deletions(-) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 373dc7a5a..cff8a025a 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -86,8 +86,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -337,8 +337,6 @@ WebContentsAdapterPrivate::WebContentsAdapterPrivate() , nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd) , lastFindRequestId(0) , currentDropAction(blink::WebDragOperationNone) - , inDragUpdateLoop(false) - , updateDragCursorMessagePollingTimer(new QTimer) { } @@ -381,7 +379,6 @@ WebContentsAdapter::WebContentsAdapter(content::WebContents *webContents) { Q_D(WebContentsAdapter); d->webContents.reset(webContents); - initUpdateDragCursorMessagePollingTimer(); } WebContentsAdapter::~WebContentsAdapter() @@ -1232,50 +1229,42 @@ Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const Q d->lastDragScreenPos = toGfx(screenPos); rvh->DragTargetDragOver(d->lastDragClientPos, d->lastDragScreenPos, toWeb(e->possibleActions()), toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers())); - - base::MessageLoop *currentMessageLoop = base::MessageLoop::current(); - DCHECK(currentMessageLoop); - if (!currentMessageLoop->NestableTasksAllowed()) { - // We're already inside a MessageLoop::RunTask call, and scheduled tasks will not be - // executed. That means, updateDragAction will never be called, and the RunLoop below will - // remain blocked forever. - qWarning("WebContentsAdapter::updateDragPosition called from MessageLoop::RunTask."); - return Qt::IgnoreAction; - } - - // Wait until we get notified via RenderViewHostDelegateView::UpdateDragCursor. This calls - // WebContentsAdapter::updateDragAction that will eventually quit the nested loop. - base::RunLoop loop; - d->inDragUpdateLoop = true; - d->dragUpdateLoopQuitClosure = loop.QuitClosure(); - - d->updateDragCursorMessagePollingTimer->start(); - loop.Run(); - d->updateDragCursorMessagePollingTimer->stop(); - + waitForUpdateDragActionCalled(); return toQt(d->currentDropAction); } -void WebContentsAdapter::updateDragAction(int action) +void WebContentsAdapter::waitForUpdateDragActionCalled() { Q_D(WebContentsAdapter); - d->currentDropAction = static_cast(action); - finishDragUpdate(); + const qint64 timeout = 3000; + QElapsedTimer t; + t.start(); + base::MessagePump::Delegate *delegate = base::MessageLoop::current(); + DCHECK(delegate); + d->updateDragActionCalled = false; + for (;;) { + while (delegate->DoWork() && !d->updateDragActionCalled) {} + if (d->updateDragActionCalled) + break; + if (t.hasExpired(timeout)) { + qWarning("WebContentsAdapter::updateDragAction was not called within %d ms.", + static_cast(timeout)); + return; + } + base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); + } } -void WebContentsAdapter::finishDragUpdate() +void WebContentsAdapter::updateDragAction(int action) { Q_D(WebContentsAdapter); - if (d->inDragUpdateLoop) { - d->dragUpdateLoopQuitClosure.Run(); - d->inDragUpdateLoop = false; - } + d->updateDragActionCalled = true; + d->currentDropAction = static_cast(action); } void WebContentsAdapter::endDragging(const QPoint &clientPos, const QPoint &screenPos) { Q_D(WebContentsAdapter); - finishDragUpdate(); content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); rvh->FilterDropData(d->currentDropData.get()); d->lastDragClientPos = toGfx(clientPos); @@ -1287,32 +1276,11 @@ void WebContentsAdapter::endDragging(const QPoint &clientPos, const QPoint &scre void WebContentsAdapter::leaveDrag() { Q_D(WebContentsAdapter); - finishDragUpdate(); content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); rvh->DragTargetDragLeave(); d->currentDropData.reset(); } -void WebContentsAdapter::initUpdateDragCursorMessagePollingTimer() -{ - Q_D(WebContentsAdapter); - // Poll for drag cursor updated message 60 times per second. In practice, the timer is fired - // at most twice, after which it is stopped. - d->updateDragCursorMessagePollingTimer->setInterval(16); - d->updateDragCursorMessagePollingTimer->setSingleShot(false); - - QObject::connect(d->updateDragCursorMessagePollingTimer.data(), &QTimer::timeout, [](){ - base::MessagePump::Delegate *delegate = base::MessageLoop::current(); - DCHECK(delegate); - - // Execute Chromium tasks if there are any present. Specifically we are interested to handle - // the RenderViewHostImpl::OnUpdateDragCursor message, that gets sent from the render - // process. - while (delegate->DoWork()) {} - }); -} - - void WebContentsAdapter::replaceMisspelling(const QString &word) { #if defined(ENABLE_SPELLCHECK) diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 5b2f9a942..803b1eb57 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -167,10 +167,8 @@ public: void enterDrag(QDragEnterEvent *e, const QPoint &screenPos); Qt::DropAction updateDragPosition(QDragMoveEvent *e, const QPoint &screenPos); void updateDragAction(int action); - void finishDragUpdate(); void endDragging(const QPoint &clientPos, const QPoint &screenPos); void leaveDrag(); - void initUpdateDragCursorMessagePollingTimer(); void printToPDF(const QPageLayout&, const QString&); quint64 printToPDFCallbackResult(const QPageLayout &, const bool colorMode = true); @@ -186,8 +184,9 @@ public: private: Q_DISABLE_COPY(WebContentsAdapter) Q_DECLARE_PRIVATE(WebContentsAdapter) - QScopedPointer d_ptr; + void waitForUpdateDragActionCalled(); + QScopedPointer d_ptr; }; } // namespace QtWebEngineCore diff --git a/src/core/web_contents_adapter_p.h b/src/core/web_contents_adapter_p.h index 9503b4401..f24070523 100644 --- a/src/core/web_contents_adapter_p.h +++ b/src/core/web_contents_adapter_p.h @@ -61,7 +61,6 @@ #include #include -QT_FORWARD_DECLARE_CLASS(QTimer) QT_FORWARD_DECLARE_CLASS(QWebChannel) class WebEngineContext; @@ -96,11 +95,9 @@ public: int lastFindRequestId; std::unique_ptr currentDropData; blink::WebDragOperation currentDropAction; - bool inDragUpdateLoop; + bool updateDragActionCalled; gfx::Point lastDragClientPos; gfx::Point lastDragScreenPos; - base::Closure dragUpdateLoopQuitClosure; - QScopedPointer updateDragCursorMessagePollingTimer; }; } // namespace QtWebEngineCore -- cgit v1.2.3 From 16d8518e58fcaf6495604ae2d9188cc59b3e661b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 27 Jan 2017 18:21:36 +0100 Subject: Fix building spellchecker example when Qt is not yet installed During the build of the spellchecker example, the dictionary conversion tool is executed to convert some dictionaries. The tool will fail to find the ICU data file because the file is not present at the Qt install location at examples build time. The fix is to allow passing the ICU data directory via an environment variable. Specifically the QtWebEngine build directory which contains the ICU data file will be passed when the spellchecker example is built. Task-number: QTBUG-58451 Change-Id: I6188f0b7aabe8b2e55cd2e0d59553282058c5035 Reviewed-by: Michal Klocek --- src/tools/qwebengine_convert_dict/main.cpp | 31 +++++++++++++++++++--- .../qwebengine_convert_dict.pro | 7 +++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/tools/qwebengine_convert_dict/main.cpp b/src/tools/qwebengine_convert_dict/main.cpp index 2142b5f0d..61e26c4a3 100644 --- a/src/tools/qwebengine_convert_dict/main.cpp +++ b/src/tools/qwebengine_convert_dict/main.cpp @@ -120,9 +120,34 @@ int main(int argc, char *argv[]) return 1; } - PathService::Override(base::DIR_QT_LIBRARY_DATA, - toFilePath(QLibraryInfo::location(QLibraryInfo::DataPath) % - QLatin1String("/resources"))); + bool icuDataDirFound = false; + QString icuDataDir = QLibraryInfo::location(QLibraryInfo::DataPath) + % QLatin1String("/resources"); + + // Try to look up the path to the ICU data directory via an environment variable + // (e.g. for the case when the tool is ran during build phase, and regular installed + // ICU data file is not available). + QString icuPossibleEnvDataDir = QString::fromLatin1(qgetenv("QT_WEBENGINE_ICU_DATA_DIR")); + if (!icuPossibleEnvDataDir.isEmpty() && QFileInfo::exists(icuPossibleEnvDataDir)) { + icuDataDir = icuPossibleEnvDataDir; + icuDataDirFound = true; + } + // Try to find the ICU data directory in the installed Qt location. + else if (QFileInfo::exists(icuDataDir)) { + icuDataDirFound = true; + } + + if (icuDataDirFound) { + PathService::Override(base::DIR_QT_LIBRARY_DATA, toFilePath(icuDataDir)); + } else { + QTextStream out(stdout); + out << "Couldn't find ICU data directory. Please check that the following path exists: " + << icuDataDir + << "\nAlternatively provide the directory path via the QT_WEBENGINE_ICU_DAT_DIR " + "environment variable.\n" << endl; + return 1; + } + base::AtExitManager exit_manager; base::i18n::InitializeICU(); diff --git a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro index 715081b5f..f2dbb12cf 100644 --- a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro +++ b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro @@ -23,4 +23,11 @@ INCLUDEPATH += $$CHROMIUM_SRC_DIR SOURCES += \ main.cpp +# Support converting dictionaries in a prefix build, by supplying +# the path to the ICU data file located in the Qt build path, rather +# than the install path (which is not present at build time). +icu_data_dir.name = QT_WEBENGINE_ICU_DATA_DIR +icu_data_dir.value = $$OUT_PWD/../../../src/core/$$getConfigDir() +QT_TOOL_ENV = icu_data_dir load(qt_tool) +QT_TOOL_ENV = -- cgit v1.2.3 From 19a45f7eb3525bcf923f03ae52d83228f17da16d Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Tue, 21 Feb 2017 11:24:19 +0100 Subject: Abort findText when destroying QWebEnginePage In the destructor of QWebEnginePage and QQuickWebEngineView, we now call adapter->stopFinding() to suppress callbacks that would cause segmentation faults if a findText request is still active at that point. Task-number: QTBUG-58563 Change-Id: I9d5d8407ee6c28cd76bf6ecf0b62808394e151cd Reviewed-by: Peter Varga Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Michal Klocek --- src/webengine/api/qquickwebengineview.cpp | 2 ++ src/webenginewidgets/api/qwebenginepage.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 4cef45f8c..c1f1c9d0b 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -879,6 +879,8 @@ QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent) QQuickWebEngineView::~QQuickWebEngineView() { Q_D(QQuickWebEngineView); + if (d->adapter) + d->adapter->stopFinding(); if (d->faviconProvider) d->faviconProvider->detach(this); } diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 9150525b5..69697d626 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -802,6 +802,8 @@ QWebEnginePage::QWebEnginePage(QWebEngineProfile *profile, QObject* parent) QWebEnginePage::~QWebEnginePage() { Q_D(QWebEnginePage); + if (d->adapter) + d->adapter->stopFinding(); QWebEngineViewPrivate::bind(d->view, 0); } -- cgit v1.2.3 From 7e7dd26251c355a54b5c34ea4fb27dcda9ee7b94 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 12 Feb 2017 15:44:01 +0100 Subject: Use Qt::ToolTip as window type for dropdown popus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 58467ed1950ee070d0907cbdabb8466aba277305, the window type for dropdown popups was changed from Qt::ToolTip to Qt:Tool to fix issues when using a QWebEngineView inside a modal dialog on macOS. However, this causes a separate window to pop up at least under Linux, so we use Qt::ToolTip again there. Task-number: QTBUG-58488 Task-number: QTBUG-58544 Change-Id: I951b91980be89a37ee07b19fca684d13b6098af0 Reviewed-by: Alexandru Croitor Reviewed-by: Michael BrĂ¼ning --- src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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 e4c8996e1..e7ad5b107 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -182,10 +182,14 @@ void RenderWidgetHostViewQtDelegateWidget::initAsPopup(const QRect& screenRect) setAttribute(Qt::WA_ShowWithoutActivating); setFocusPolicy(Qt::NoFocus); +#ifdef Q_OS_MACOS // macOS doesn't like Qt::ToolTip when QWebEngineView is inside a modal dialog, specifically by // not forwarding click events to the popup. So we use Qt::Tool which behaves the same way, but // works on macOS too. setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); +#else + setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); +#endif setGeometry(screenRect); show(); -- cgit v1.2.3 From 5ff4702ea7e567eecc767a2e40d383a27f4ee4fb Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 22 Feb 2017 11:00:30 +0100 Subject: Update chromium Update chromium to include following fixes: 93db3776 Don't schedule wholeSubtreeInvalid sets 42e3484e Allow Service Workers without HTTP headers 589f21d2 Allow using quota management API for non-standard URLsi 015d648e Fix Linux kernel lacking V4L2_CID_POWER_LINE_FREQUENCY_AUTO 675c165d Fix not working pkg-config on some older distros Change-Id: Idd503d1ceec50483e69d757ce2daf09f9c9c5c54 Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 965b67f25..675c165d4 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 965b67f25e8af81ce1313287fe842f7a83e7d5ed +Subproject commit 675c165d44ac5d39e9b37263e561dc1673f3bfa4 -- cgit v1.2.3 From 91b1ceb4838e9b9140a966a1e161ab3b649a36bc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 22 Feb 2017 13:14:40 +0100 Subject: Fix crash on context menu Instead of calling deleteLater, just tell close to delete the menu itself. Task-number: QTBUG-59080 Change-Id: I3eae382781f813ed3c6f27b78088b94ed1c486dd Reviewed-by: Michal Klocek Reviewed-by: Peter Varga --- examples/webenginewidgets/demobrowser/webview.cpp | 2 +- examples/webenginewidgets/simplebrowser/webview.cpp | 1 - src/webenginewidgets/api/qwebenginepage.cpp | 2 ++ src/webenginewidgets/api/qwebengineview.cpp | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/webenginewidgets/demobrowser/webview.cpp b/examples/webenginewidgets/demobrowser/webview.cpp index ab2a4f3c6..498df74fc 100644 --- a/examples/webenginewidgets/demobrowser/webview.cpp +++ b/examples/webenginewidgets/demobrowser/webview.cpp @@ -363,6 +363,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) QMenu *menu; if (page()->contextMenuData().linkUrl().isValid()) { menu = new QMenu(this); + menu->setAttribute(Qt::WA_DeleteOnClose, true); menu->addAction(page()->action(QWebEnginePage::OpenLinkInThisWindow)); menu->addAction(page()->action(QWebEnginePage::OpenLinkInNewWindow)); menu->addAction(page()->action(QWebEnginePage::OpenLinkInNewTab)); @@ -375,7 +376,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) } if (page()->contextMenuData().selectedText().isEmpty()) menu->addAction(page()->action(QWebEnginePage::SavePage)); - connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); menu->popup(event->globalPos()); } diff --git a/examples/webenginewidgets/simplebrowser/webview.cpp b/examples/webenginewidgets/simplebrowser/webview.cpp index 657993fc6..e4e7f5efa 100644 --- a/examples/webenginewidgets/simplebrowser/webview.cpp +++ b/examples/webenginewidgets/simplebrowser/webview.cpp @@ -151,7 +151,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu->insertAction(before, page()->action(QWebEnginePage::OpenLinkInNewWindow)); menu->insertAction(before, page()->action(QWebEnginePage::OpenLinkInNewTab)); } - connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); menu->popup(event->globalPos()); } diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 69697d626..eeb5524a0 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1615,6 +1615,8 @@ QMenu *QWebEnginePage::createStandardContextMenu() if (d->isFullScreenMode()) menu->addAction(QWebEnginePage::action(ExitFullScreen)); + menu->setAttribute(Qt::WA_DeleteOnClose, true); + return menu; } diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 8b4053e73..63cf30d67 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -322,7 +322,6 @@ bool QWebEngineView::event(QEvent *ev) void QWebEngineView::contextMenuEvent(QContextMenuEvent *event) { QMenu *menu = page()->createStandardContextMenu(); - connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); menu->popup(event->globalPos()); } -- cgit v1.2.3 From b70bdb111e16d9437f60725f8c2854014a569289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Wed, 22 Feb 2017 16:33:45 +0100 Subject: Ignore synthetic hover move events if the mouse has not actually moved 6f84a09dfb and b2501b0bda in qtdeclarative introduced a synthetic hover move event being sent once per frame if the item underneath the mouse is marked as dirty. This triggers a loop when the web contents changes reacting to mouse move events as the item needs to be marked dirty to be rerendered. Ignore hover move events if the position of the mouse has actually not changed to work around this. Task-number: QTBUG-58561 Change-Id: Ic7f3c06e7acf5dfeacc95e347bd026233c957556 Reviewed-by: Alexandru Croitor --- src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index f79b0ca22..4e4fc406f 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -323,7 +323,8 @@ void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event) void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event) { QQuickItem *parent = parentItem(); - if (!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { + if ((!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() + && !parent->hasActiveFocus()) || event->posF() == event->oldPosF()) { event->ignore(); return; } -- cgit v1.2.3 From 714bddf9921a4e12f03867118c6a4697083e6a14 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 22 Feb 2017 17:52:43 +0100 Subject: Add support for macOS Airplay to Demobrowser in presence of dual GPUs Previously when Airplay was activated and a new QWebEngineView instance was created, a black area would be rendered inside the view. This happened because of incompatible OpenGL contexts. The global Qt OpenGL context could not share its textures with the newly created "after-airplay" context, due to the contexts being used by different GPUs (only possible on a MacBook Pro). The fix is to add the NSSupportsAutomaticGraphicsSwitching option into the application plist file, which informs macOS that the application supports usage of dual GPUs, and thus allows sharing of contexts across GPUs. Task-number: QTBUG-54053 Change-Id: Ic37fb75f164922bcca6456054174171fa9ba2bfb Reviewed-by: Leena Miettinen Reviewed-by: Allan Sandfeld Jensen --- examples/webenginewidgets/demobrowser/Info_mac.plist | 2 ++ src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/examples/webenginewidgets/demobrowser/Info_mac.plist b/examples/webenginewidgets/demobrowser/Info_mac.plist index ccd4b3f28..25443f7be 100644 --- a/examples/webenginewidgets/demobrowser/Info_mac.plist +++ b/examples/webenginewidgets/demobrowser/Info_mac.plist @@ -41,5 +41,7 @@ NOTE DemoBrowser by The Qt Company Ltd. + NSSupportsAutomaticGraphicsSwitching + YES diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 615e3eed0..851507659 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -131,6 +131,13 @@ \li Text fields might be painted with a different style on Mountain Lion (\macos 10.8). \endlist + \section1 macOS Airplay Support on MacBooks with Dual GPUs + + To make Qt WebEngine work correctly when streaming to an AppleTV from a MacBook that supports + GPU switching, it is important to add the \c NSSupportsAutomaticGraphicsSwitching option to the + application Info.plist file, with the value set to \c YES. Otherwise rendering issues might + occur when creating new web engine view instances after Airplay is switched on or off. + \section1 Default QSurfaceFormat OpenGL Profile Support If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set -- cgit v1.2.3 From 47b498b1d05a5f13e8af8241fb6df9d09a631595 Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Mon, 27 Feb 2017 15:19:51 +0100 Subject: Update HTTP Cache when generating new cookie store Keeping the same Channel ID Service after changing the cookie store leads to segmentation fault on https connections, because chromium tries to reuse resources that have become invalid. Task-number: QTBUG-58650 Change-Id: I90a32ba8e05567b5ba990d2351c6e22324c89835 Reviewed-by: Allan Sandfeld Jensen --- src/core/url_request_context_getter_qt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index bf4661102..0cfde1cf4 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -268,6 +268,7 @@ void URLRequestContextGetterQt::updateCookieStore() if (m_contextInitialized && !m_updateAllStorage && !m_updateCookieStore) { m_updateCookieStore = true; + m_updateHttpCache = true; content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestContextGetterQt::generateCookieStore, this)); } @@ -337,6 +338,12 @@ void URLRequestContextGetterQt::generateCookieStore() const std::vector cookieableSchemes(kCookieableSchemes, kCookieableSchemes + arraysize(kCookieableSchemes)); cookieMonster->SetCookieableSchemes(cookieableSchemes); m_cookieDelegate->setCookieMonster(cookieMonster); + + if (!m_updateAllStorage) { + Q_ASSERT(m_updateHttpCache); + // HttpCache needs to be regenerated when we generate a new channel id service + generateHttpCache(); + } } void URLRequestContextGetterQt::updateUserAgent() -- cgit v1.2.3 From 3f1805f8569337a21b72324d5edad329d5dfe872 Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Tue, 28 Feb 2017 12:56:42 +0100 Subject: Pass result to correct RenderFrameHost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In WebContentsDelegateQt::RunFileChooser, we get a content::RenderFrameHost*, to which chromium wants us to pass the files that were selected. We now store that pointer in the FilePickerController, so that we can pass the files there in FilePickerController::filesSelectedInChooser. The attribute content::WebContents *m_contents is no longer needed then, because that was only used to obtain the main frame to which the files were sent (this caused problems when the file input was inside an iframe - we sent the result to the wrong frame in that case, so the file input object remained blocked). Task-number: QTBUG-59168 Change-Id: Ic2fdacb225e5a1a9e46ced6a1e4a9ff428f18a62 Reviewed-by: Michael BrĂ¼ning Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Michal Klocek --- src/core/file_picker_controller.cpp | 17 ++++++++--------- src/core/file_picker_controller.h | 8 ++++---- src/core/web_contents_delegate_qt.cpp | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 74b097ef6..158ff7f67 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -49,18 +49,18 @@ namespace QtWebEngineCore { -FilePickerController::FilePickerController(FileChooserMode mode, content::WebContents *contents, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent) +FilePickerController::FilePickerController(FileChooserMode mode, content::RenderFrameHost *frameHost, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent) : QObject(parent) , m_defaultFileName(defaultFileName) , m_acceptedMimeTypes(acceptedMimeTypes) - , m_contents(contents) + , m_frameHost(frameHost) , m_mode(mode) { } void FilePickerController::accepted(const QStringList &files) { - FilePickerController::filesSelectedInChooser(files, m_contents); + FilePickerController::filesSelectedInChooser(files, m_frameHost); } void FilePickerController::accepted(const QVariant &files) @@ -76,12 +76,12 @@ void FilePickerController::accepted(const QVariant &files) qWarning("An unhandled type '%s' was provided in FilePickerController::accepted(QVariant)", files.typeName()); } - FilePickerController::filesSelectedInChooser(stringList, m_contents); + FilePickerController::filesSelectedInChooser(stringList, m_frameHost); } void FilePickerController::rejected() { - FilePickerController::filesSelectedInChooser(QStringList(), m_contents); + FilePickerController::filesSelectedInChooser(QStringList(), m_frameHost); } static QStringList listRecursively(const QDir &dir) @@ -103,15 +103,14 @@ ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, content::FileChooserParam ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, content::FileChooserParams::UploadFolder) ASSERT_ENUMS_MATCH(FilePickerController::Save, content::FileChooserParams::Save) -void FilePickerController::filesSelectedInChooser(const QStringList &filesList, content::WebContents *contents) +void FilePickerController::filesSelectedInChooser(const QStringList &filesList, content::RenderFrameHost *frameHost) { - content::RenderViewHost *rvh = contents->GetRenderViewHost(); - Q_ASSERT(rvh); + Q_ASSERT(frameHost); QStringList files(filesList); if (this->m_mode == UploadFolder && !filesList.isEmpty() && QFileInfo(filesList.first()).isDir()) // Enumerate the directory files = listRecursively(QDir(filesList.first())); - rvh->GetMainFrame()->FilesSelectedInChooser(toVector(files), static_cast(this->m_mode)); + frameHost->FilesSelectedInChooser(toVector(files), static_cast(this->m_mode)); } QStringList FilePickerController::acceptedMimeTypes() const diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h index 14e8de42d..66f28c3fc 100644 --- a/src/core/file_picker_controller.h +++ b/src/core/file_picker_controller.h @@ -45,7 +45,7 @@ #include namespace content { - class WebContents; + class RenderFrameHost; } namespace QtWebEngineCore { @@ -60,7 +60,7 @@ public: Save }; - FilePickerController(FileChooserMode mode, content::WebContents *contents, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject * = 0); + FilePickerController(FileChooserMode mode, content::RenderFrameHost *contents, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject * = 0); QStringList acceptedMimeTypes() const; QString defaultFileName() const; FileChooserMode mode() const; @@ -71,10 +71,10 @@ public Q_SLOTS: void rejected(); private: - void filesSelectedInChooser(const QStringList &filesList, content::WebContents *contents); + void filesSelectedInChooser(const QStringList &filesList, content::RenderFrameHost *contents); QString m_defaultFileName; QStringList m_acceptedMimeTypes; - content::WebContents *m_contents; + content::RenderFrameHost *m_frameHost; FileChooserMode m_mode; }; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 87badc189..83fed35a0 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -327,7 +327,7 @@ void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost *frameHost, acceptedMimeTypes.append(toQt(*it)); m_filePickerController.reset(new FilePickerController(static_cast(params.mode), - web_contents(), toQt(params.default_file_name.value()), acceptedMimeTypes)); + frameHost, toQt(params.default_file_name.value()), acceptedMimeTypes)); // Defer the call to not block base::MessageLoop::RunTask with modal dialogs. QTimer::singleShot(0, [this] () { -- cgit v1.2.3