From bcc580aaa9ae5121db701d2e5ad03ef312f4e4ab Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 9 Jun 2016 15:01:36 +0200 Subject: Fix memory leak of authentication qml dialog Change-Id: I951c78e53ff0e05918daf34076fffc44b813a8d2 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/ui_delegates_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 96b3e3a77..16554da68 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -359,9 +359,12 @@ void UIDelegatesManager::showDialog(QSharedPointerurl()); static int acceptIndex = dialogController->metaObject()->indexOfSlot("accept(QString,QString)"); + static int deleteLaterIndex = authenticationDialog->metaObject()->indexOfSlot("deleteLater()"); QObject::connect(authenticationDialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex)); + QObject::connect(authenticationDialog, acceptSignal.method(), authenticationDialog, authenticationDialog->metaObject()->method(deleteLaterIndex)); static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()"); QObject::connect(authenticationDialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex)); + QObject::connect(authenticationDialog, rejectSignal.method(), authenticationDialog, authenticationDialog->metaObject()->method(deleteLaterIndex)); authenticationDialogComponent->completeCreate(); QMetaObject::invokeMethod(authenticationDialog, "open"); -- cgit v1.2.3 From 9764fa47ee9b4f8ccf1c7cb0dc073bdc8a4f9c86 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 9 Jun 2016 16:02:10 +0200 Subject: Fix memory leak of qml menu Current qml menu implementation uses always WebEngineView as the parent of the menu. However menu can be triggered several times during WebEngineView lifetime, each time creating new menu component. Use onDone menu signal instead to delete menu. Change-Id: I1a6064451e95453268a2cd46899e297e769dc1f1 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/ui_delegates_manager.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 16554da68..88c4b7c19 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -204,7 +204,7 @@ void UIDelegatesManager::addMenuSeparator(QObject *menu) QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title, const QPoint& pos) { - + Q_ASSERT(parentMenu); if (!ensureComponentLoaded(Menu)) return 0; QQmlContext *context = qmlContext(m_view); @@ -217,18 +217,18 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title, QQmlProperty(menu, QStringLiteral("title")).write(title); if (!pos.isNull()) QQmlProperty(menu, QStringLiteral("pos")).write(pos); - if (!parentMenu) { - QQmlProperty doneSignal(menu, QStringLiteral("onDone")); - static int deleteLaterIndex = menu->metaObject()->indexOfSlot("deleteLater()"); - if (doneSignal.isSignalProperty()) - QObject::connect(menu, doneSignal.method(), menu, menu->metaObject()->method(deleteLaterIndex)); - } else { - menu->setParent(parentMenu); - QQmlListReference entries(parentMenu, defaultPropertyName(parentMenu), qmlEngine(m_view)); - if (entries.isValid()) - entries.append(menu); - } + menu->setParent(parentMenu); + + QQmlProperty doneSignal(menu, QStringLiteral("onDone")); + static int deleteLaterIndex = menu->metaObject()->indexOfSlot("deleteLater()"); + CHECK_QML_SIGNAL_PROPERTY(doneSignal, menuComponent->url()); + QObject::connect(menu, doneSignal.method(), menu, menu->metaObject()->method(deleteLaterIndex)); + + QQmlListReference entries(parentMenu, defaultPropertyName(parentMenu), qmlEngine(m_view)); + if (entries.isValid()) + entries.append(menu); + menuComponent->completeCreate(); return menu; } -- cgit v1.2.3 From 31d568295a2d8dcfe12ff62348aa768c75d2dfe7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Jun 2016 10:58:23 +0200 Subject: Add missing Q_DECL_OVERRIDE specifiers. Fixes warnings when building with clang. Task-number: QTBUG-51295 Change-Id: I4ede7e4ea5c1c3924b3bba852834b8066b539825 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview_p.h | 4 ++-- src/webengine/api/qquickwebengineview_p_p.h | 2 +- src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 93ef9e4fb..0654471cf 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -317,8 +317,8 @@ Q_SIGNALS: Q_REVISION(2) void windowCloseRequested(); protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - void itemChange(ItemChange, const ItemChangeData &); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(QQuickWebEngineView) diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index c01603cff..9ac86aa5c 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -163,7 +163,7 @@ public: virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE; #endif // QT_NO_ACCESSIBILITY virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE; - virtual void allowCertificateError(const QSharedPointer &errorController); + virtual void allowCertificateError(const QSharedPointer &errorController) Q_DECL_OVERRIDE; virtual void runGeolocationPermissionRequest(QUrl const&) Q_DECL_OVERRIDE; virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) Q_DECL_OVERRIDE; virtual void hideValidationMessage() Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h index fddc79c2f..bccfeb0f4 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -88,7 +88,7 @@ protected: void initializeGL() Q_DECL_OVERRIDE; void paintGL() Q_DECL_OVERRIDE; - QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; private slots: void onWindowPosChanged(); -- cgit v1.2.3 From cf8bc1899abbce736a29841a10119fc0ca8b8b42 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 14 Jun 2016 12:46:23 +0200 Subject: Stop forwarding OS synthesized touch-to-mouse events. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the change, chromium would process an onclick handler twice, once due to a touch event, and another time due to the OS synthesized mouse event. Patch makes sure only the touch events are forwarded to Chromium. This is consistent with mainline Chrome behavior. Task-number: QTBUG-53201 Change-Id: I16f46b94890c2f6fa9a9089f7c721ec79e0bc96b Reviewed-by: Kai Koehne Reviewed-by: Michael Brüning --- src/core/render_widget_host_view_qt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index cc0510666..5183f6732 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -878,6 +878,13 @@ bool RenderWidgetHostViewQt::IsPopup() const void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event) { + // Don't forward mouse events synthesized by the system, which are caused by genuine touch + // events. Chromium would then process for e.g. a mouse click handler twice, once due to the + // system synthesized mouse event, and another time due to a touch-to-gesture-to-mouse + // transformation done by Chromium. + if (event->source() == Qt::MouseEventSynthesizedBySystem) + return; + blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale()); if (event->type() == QMouseEvent::MouseButtonPress) { if (event->button() != m_clickHelper.lastPressButton -- cgit v1.2.3 From 818a2ce5dc773db55938968d5f6e7a2fd758f68a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 14 Jun 2016 16:19:29 +0200 Subject: Fix translation of multiple pressed mouse buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were reporting any mouse button event where the left mouse button was held as a left mouse button event. We should instead separate the button changed and the ones held. Also adds test of the translation. Change-Id: I1139d6615d54a036dfe843fdb1d1c90b23b467b5 Reviewed-by: Alexandru Croitor Reviewed-by: Michael Brüning --- src/core/web_event_factory.cpp | 8 ++--- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 36 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 2e6fde214..da230479a 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -483,11 +483,11 @@ static inline double currentTimeForEvent(const QInputEvent* event) static WebMouseEvent::Button mouseButtonForEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton || (event->buttons() & Qt::LeftButton)) + if (event->button() == Qt::LeftButton) return WebMouseEvent::ButtonLeft; - else if (event->button() == Qt::RightButton || (event->buttons() & Qt::RightButton)) + else if (event->button() == Qt::RightButton) return WebMouseEvent::ButtonRight; - else if (event->button() == Qt::MidButton || (event->buttons() & Qt::MidButton)) + else if (event->button() == Qt::MidButton) return WebMouseEvent::ButtonMiddle; return WebMouseEvent::ButtonNone; } diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index f8012c1df..4cff50d3b 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -236,6 +236,7 @@ private Q_SLOTS: void toPlainTextLoadFinishedRace_data(); void toPlainTextLoadFinishedRace(); void setZoomFactor(); + void mouseButtonTranslation(); private: QWebEngineView* m_view; @@ -4990,5 +4991,40 @@ void tst_QWebEnginePage::setZoomFactor() delete page; } +void tst_QWebEnginePage::mouseButtonTranslation() +{ + QWebEngineView *view = new QWebEngineView; + + QSignalSpy spy(view, SIGNAL(loadFinished(bool))); + view->setHtml(QStringLiteral( + "\ + \ +
\ +
\ + ")); + view->show(); + QTest::qWaitForWindowExposed(view); + QTRY_VERIFY(spy.count() == 1); + + QVERIFY(view->focusProxy() != nullptr); + + QMouseEvent evpres(QEvent::MouseButtonPress, view->rect().center(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QGuiApplication::sendEvent(view->focusProxy(), &evpres); + + QTRY_COMPARE(evaluateJavaScriptSync(view->page(), "lastEvent.button").toInt(), 0); + QCOMPARE(evaluateJavaScriptSync(view->page(), "lastEvent.buttons").toInt(), 1); + + QMouseEvent evpres2(QEvent::MouseButtonPress, view->rect().center(), Qt::RightButton, Qt::LeftButton | Qt::RightButton, Qt::NoModifier); + QGuiApplication::sendEvent(view->focusProxy(), &evpres2); + + QTRY_COMPARE(evaluateJavaScriptSync(view->page(), "lastEvent.button").toInt(), 2); + QCOMPARE(evaluateJavaScriptSync(view->page(), "lastEvent.buttons").toInt(), 3); + + delete view; +} + QTEST_MAIN(tst_QWebEnginePage) #include "tst_qwebenginepage.moc" -- cgit v1.2.3 From 60d790a2da2f85c1a5eaca4a51a743147e5694e7 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 15 Jun 2016 14:28:20 +0200 Subject: Doc: Make Chromium security fix information less specific MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New security fixes are added for new Qt 5.6.x versions. Change-Id: Ibf67bde7003b99d729fe8ac23b86c8ff46182ee6 Reviewed-by: Joerg Bornemann Reviewed-by: Michael Brüning --- src/webengine/doc/src/qtwebengine-overview.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index bf4e7a315..1fcae3dfa 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -104,8 +104,8 @@ \l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview} that is part of the documentation in the \l {Chromium Project} upstream source tree. - This version of Qt WebEngine is based on Chromium snapshot version 45.0.2554.101, with - additional security fixes from the 46, 47 and 48 branches of the \l {Chromium Project}. + This version of Qt WebEngine is based on Chromium version 45.0.2554.101, with + additional security fixes from newer versions. \section2 Qt WebEngine Process -- cgit v1.2.3 From 134b8e304f376e38d25f4d34de73e44fb31b2a70 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 14 Jun 2016 16:27:03 +0200 Subject: Do not forward invalid mouse events to blink MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Blink can not handle more than the three main mouse-buttons, and we were translating a press of an extra mouse-button as a mouse-down of the button ButtonNone. Instead ignore mouse-button events blink does not currently support. Task-number: QTBUG-53799 Change-Id: If1d3ba6bd331ec8ad0ff45bcd674e67763ee9097 Reviewed-by: Michael Brüning --- src/core/render_widget_host_view_qt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 5183f6732..c088b09e9 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -886,6 +886,13 @@ void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event) return; blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale()); + if ((webEvent.type == blink::WebInputEvent::MouseDown || webEvent.type == blink::WebInputEvent::MouseUp) + && webEvent.button == blink::WebMouseEvent::ButtonNone) { + // Blink can only handle the 3 main mouse-buttons and may assert when processing mouse-down for no button. + return; + } + + if (event->type() == QMouseEvent::MouseButtonPress) { if (event->button() != m_clickHelper.lastPressButton || (event->timestamp() - m_clickHelper.lastPressTimestamp > static_cast(qGuiApp->styleHints()->mouseDoubleClickInterval())) -- cgit v1.2.3 From 6a658bb9779f995d9b06bf769f920773fd9b6b8a Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 15 Jun 2016 08:39:04 +0800 Subject: Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit" See http://comments.gmane.org/gmane.comp.lib.qt.devel/25771 Change-Id: I17d14f31f608d0665c04598f7899238b86113ae5 Reviewed-by: Allan Sandfeld Jensen --- LICENSE.GPLv2 | 2 +- LICENSE.GPLv3 | 2 +- LICENSE.LGPLv3 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE.GPLv2 b/LICENSE.GPLv2 index 6dbb032fd..a42447778 100644 --- a/LICENSE.GPLv2 +++ b/LICENSE.GPLv2 @@ -3,7 +3,7 @@ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ - You may use, distribute and copy the Qt GUI Toolkit under the terms of + You may use, distribute and copy the Qt Toolkit under the terms of GNU General Public License version 2, which is displayed below. ------------------------------------------------------------------------- diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3 index 4e49b122a..71c4ad49c 100644 --- a/LICENSE.GPLv3 +++ b/LICENSE.GPLv3 @@ -3,7 +3,7 @@ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ - You may use, distribute and copy the Qt GUI Toolkit under the terms of + You may use, distribute and copy the Qt Toolkit under the terms of GNU Lesser General Public License version 3. That license references the General Public License version 3, that is displayed below. Other portions of the Qt Toolkit may be licensed directly under this license. diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3 index 26d0bf16f..1f78e0508 100644 --- a/LICENSE.LGPLv3 +++ b/LICENSE.LGPLv3 @@ -3,7 +3,7 @@ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ - You may use, distribute and copy the Qt GUI Toolkit under the terms of + You may use, distribute and copy the Qt Toolkit under the terms of GNU Lesser General Public License version 3, which is displayed below. This license makes reference to the version 3 of the GNU General Public License, which you can find in the LICENSE.GPLv3 file. -- cgit v1.2.3 From ed581090eaf6f6d683fc70852b3b1c573e4f6aaf Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 8 Jun 2016 14:15:17 +0200 Subject: Follow hotspot hints in custom cursors We shouldn't ignore defined hotspots for cursors we adapt from pixmaps. Change-Id: Ia9c1e29e6374116d4564b306d0e199baaf5d494f Reviewed-by: Joerg Bornemann --- src/core/render_widget_host_view_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index c088b09e9..a0dcb8197 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -540,7 +540,7 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) case blink::WebCursorInfo::TypeCustom: if (cursorInfo.custom_image.colorType() == SkColorType::kN32_SkColorType) { QImage cursor = toQImage(cursorInfo.custom_image, QImage::Format_ARGB32); - m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor))); + m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor), cursorInfo.hotspot.x(), cursorInfo.hotspot.y())); return; } // Use arrow cursor as fallback in case the Chromium implementation changes. -- cgit v1.2.3 From df6d3709a442591b286ceb47a3fd984a16da5d8b Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 14 Jun 2016 11:49:26 +0200 Subject: Doc: Add canceling authentication to porting instructions It has changed from how it was done in Qt WebKit. The following sentence needs to be changed, because "this" no longer refers to the correct thing. Task-number: QTBUG-53849 Change-Id: I11be382c92a4ab729585d334a4f3c0abe46bb3e4 Reviewed-by: Allan Sandfeld Jensen --- src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc index 96b33c9ca..c21a58d73 100644 --- a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc +++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc @@ -207,7 +207,15 @@ connect(&page, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authenticate(QNetworkReply*,QAuthenticator*))); \endcode - This also affects the way in which certificates are managed. For more information, see + \note In Qt WebEngine, the QAuthenticator must be explicitly set to null to + cancel authentication: + + \code + *authenticator = QAuthenticator(); + \endcode + + Omitting the \c QNetworkAccessManager also affects the way in which + certificates are managed. For more information, see \l {Managing Certificates}. \section1 Notes About Individual Methods -- cgit v1.2.3 From aaa91ea2551f7df5ff9023c8fa7743e76070bac9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 8 Jun 2016 14:03:43 +0200 Subject: Support WebCursors Qt doesn't have cursor types for Use Chromium's Aura cursors when we don't have Qt equivalents. These cursors were also supported in QtWebKit. Note this depends on Aura being used, which means OS X still doesn't have the new cursors. Task-number: QTBUG-53593 Change-Id: I9fbbf102dd313da5a6836069b4d7ece057d8c946 Reviewed-by: Alexandru Croitor Reviewed-by: Joerg Bornemann --- src/core/render_widget_host_view_qt.cpp | 55 +++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index a0dcb8197..220761ef3 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -68,6 +68,10 @@ #include "ui/events/gesture_detection/motion_event.h" #include "ui/gfx/geometry/size_conversions.h" +#if defined(USE_AURA) +#include "ui/base/cursor/cursors_aura.h" +#endif + #include #include #include @@ -455,7 +459,10 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) { content::WebCursor::CursorInfo cursorInfo; webCursor.GetCursorInfo(&cursorInfo); - Qt::CursorShape shape; + Qt::CursorShape shape = Qt::ArrowCursor; +#if defined(USE_AURA) + int auraType = -1; +#endif switch (cursorInfo.type) { case blink::WebCursorInfo::TypePointer: shape = Qt::ArrowCursor; @@ -513,17 +520,42 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) case blink::WebCursorInfo::TypeMove: shape = Qt::SizeAllCursor; break; + case blink::WebCursorInfo::TypeProgress: + shape = Qt::BusyCursor; + break; +#if defined(USE_AURA) case blink::WebCursorInfo::TypeVerticalText: + auraType = ui::kCursorVerticalText; + break; case blink::WebCursorInfo::TypeCell: + auraType = ui::kCursorCell; + break; case blink::WebCursorInfo::TypeContextMenu: + auraType = ui::kCursorContextMenu; + break; case blink::WebCursorInfo::TypeAlias: - case blink::WebCursorInfo::TypeProgress: + auraType = ui::kCursorAlias; + break; case blink::WebCursorInfo::TypeCopy: + auraType = ui::kCursorCopy; + break; case blink::WebCursorInfo::TypeZoomIn: + auraType = ui::kCursorZoomIn; + break; case blink::WebCursorInfo::TypeZoomOut: - // FIXME: Load from the resource bundle. - shape = Qt::ArrowCursor; + auraType = ui::kCursorZoomOut; + break; +#else + case blink::WebCursorInfo::TypeVerticalText: + case blink::WebCursorInfo::TypeCell: + case blink::WebCursorInfo::TypeContextMenu: + case blink::WebCursorInfo::TypeAlias: + case blink::WebCursorInfo::TypeCopy: + case blink::WebCursorInfo::TypeZoomIn: + case blink::WebCursorInfo::TypeZoomOut: + // FIXME: Support on OS X break; +#endif case blink::WebCursorInfo::TypeNoDrop: case blink::WebCursorInfo::TypeNotAllowed: shape = Qt::ForbiddenCursor; @@ -543,13 +575,18 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor), cursorInfo.hotspot.x(), cursorInfo.hotspot.y())); return; } - // Use arrow cursor as fallback in case the Chromium implementation changes. - shape = Qt::ArrowCursor; break; - default: - Q_UNREACHABLE(); - shape = Qt::ArrowCursor; } +#if defined(USE_AURA) + if (auraType > 0) { + SkBitmap bitmap; + gfx::Point hotspot; + if (ui::GetCursorBitmap(auraType, &bitmap, &hotspot)) { + m_delegate->updateCursor(QCursor(QPixmap::fromImage(toQImage(bitmap)), hotspot.x(), hotspot.y())); + return; + } + } +#endif m_delegate->updateCursor(QCursor(shape)); } -- cgit v1.2.3 From d5cde6f1b4f7a8a2cfd4a9dbdf63cd2e2502c000 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 15 Jun 2016 10:42:05 +0200 Subject: Fix access to deleted memory on QWebEnginePage destruction Suppose QWebEnginePage is destroyed while there's still a combobox popup open. We would crash with the following stack trace: 1 QtWebEngineCore::RenderWidgetHostViewQt::dpiScale 2 QtWebEngineCore::RenderWidgetHostViewQt::GetViewBounds 3 content::RenderWidgetHostImpl::SendScreenRects 4 content::RenderWidgetHostImpl::OnRenderViewReady ... 16 base::MessageLoop::DoWork 17 WebEngineContext::destroy 18 `anonymous namespace'::destroyContext 19 qt_call_post_routines 20 QApplication::~QApplication RenderWidgetHostViewQt still holds a pointer to WebContentsAdapterClient. To fix this, expose the QObject owning the adapter client, and hide RenderWidgetHostViewQt when it is destroyed so it won't try to render. Change-Id: Ide5543197b35038a3e1c7491ceda3f5ad10f6f07 Reviewed-by: Allan Sandfeld Jensen --- src/core/render_widget_host_view_qt.cpp | 5 +++++ src/core/render_widget_host_view_qt.h | 1 + src/core/web_contents_adapter_client.h | 1 + src/webengine/api/qquickwebengineview.cpp | 6 ++++++ src/webengine/api/qquickwebengineview_p_p.h | 1 + src/webenginewidgets/api/qwebenginepage.cpp | 6 ++++++ src/webenginewidgets/api/qwebenginepage_p.h | 1 + 7 files changed, 21 insertions(+) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 220761ef3..24b148ca5 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -273,6 +273,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget RenderWidgetHostViewQt::~RenderWidgetHostViewQt() { + QObject::disconnect(m_adapterClientDestroyedConnection); #ifndef QT_NO_ACCESSIBILITY QAccessible::removeActivationObserver(this); #endif // QT_NO_ACCESSIBILITY @@ -288,6 +289,10 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC Q_ASSERT(!m_adapterClient); m_adapterClient = adapterClient; + QObject::disconnect(m_adapterClientDestroyedConnection); + m_adapterClientDestroyedConnection = QObject::connect(adapterClient->holdingQObject(), + &QObject::destroyed, [this] { + m_adapterClient = nullptr; }); if (m_initPending) InitAsChild(0); } diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 2a56f61a4..2e6563a67 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -226,6 +226,7 @@ private: bool m_didFirstVisuallyNonEmptyLayout; uint32 m_pendingOutputSurfaceId; + QMetaObject::Connection m_adapterClientDestroyedConnection; WebContentsAdapterClient *m_adapterClient; MultipleMouseClickHelper m_clickHelper; diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index e6d25a8fb..f0927c9e5 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -240,6 +240,7 @@ public: virtual void requestGeometryChange(const QRect &geometry) = 0; virtual void allowCertificateError(const QSharedPointer &errorController) = 0; virtual bool isEnabled() const = 0; + virtual const QObject *holdingQObject() const = 0; virtual QSharedPointer browserContextAdapter() = 0; diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index f0458b869..357f95bc4 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -628,6 +628,12 @@ WebEngineSettings *QQuickWebEngineViewPrivate::webEngineSettings() const return m_settings->d_ptr.data(); } +const QObject *QQuickWebEngineViewPrivate::holdingQObject() const +{ + Q_Q(const QQuickWebEngineView); + return q; +} + void QQuickWebEngineViewPrivate::setDevicePixelRatio(qreal devicePixelRatio) { Q_Q(QQuickWebEngineView); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 9ac86aa5c..2a6c2c879 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -172,6 +172,7 @@ public: int exitCode) Q_DECL_OVERRIDE; virtual void requestGeometryChange(const QRect &geometry) Q_DECL_OVERRIDE { Q_UNUSED(geometry); } virtual bool isEnabled() const Q_DECL_OVERRIDE; + const QObject *holdingQObject() const Q_DECL_OVERRIDE; virtual QSharedPointer browserContextAdapter() Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 2fd026682..0279c9343 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -440,6 +440,12 @@ QSharedPointer QWebEnginePagePrivate::browserContextAdapt return profile->d_ptr->browserContext(); } +const QObject *QWebEnginePagePrivate::holdingQObject() const +{ + Q_Q(const QWebEnginePage); + return q; +} + QWebEnginePage::QWebEnginePage(QObject* parent) : QObject(parent) , d_ptr(new QWebEnginePagePrivate()) diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 8e5be51d0..7b16ed667 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -125,6 +125,7 @@ public: int exitCode) Q_DECL_OVERRIDE; virtual void requestGeometryChange(const QRect &geometry) Q_DECL_OVERRIDE; virtual bool isEnabled() const Q_DECL_OVERRIDE; + const QObject *holdingQObject() const Q_DECL_OVERRIDE; virtual QSharedPointer browserContextAdapter() Q_DECL_OVERRIDE; -- cgit v1.2.3 From 92a28473afb97ee50332f6fe81960c7241ca82d5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 16 Jun 2016 11:34:07 +0200 Subject: Stabilize FilePicker QML autotests Switch from timed wait to using tryCompare. Task-number: QTBUG-53777 Change-Id: I845fb8ee7b84641bd23314794512960634423d54 Reviewed-by: Joerg Bornemann --- tests/auto/quick/qmltests/data/tst_filePicker.qml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/auto/quick/qmltests/data/tst_filePicker.qml b/tests/auto/quick/qmltests/data/tst_filePicker.qml index 02b2dd024..f9c50c4e8 100644 --- a/tests/auto/quick/qmltests/data/tst_filePicker.qml +++ b/tests/auto/quick/qmltests/data/tst_filePicker.qml @@ -81,10 +81,8 @@ TestWebEngineView { FilePickerParams.selectedFilesUrl.push(Qt.resolvedUrl("test1.html")) keyPress(Qt.Key_Enter) // Focus is on the button. Open FileDialog. - wait(100) // The ui delegate is invoked asynchronously - verify(FilePickerParams.filePickerOpened) - titleSpy.wait() - compare(webEngineView.title, "test1.html") + tryCompare(FilePickerParams, "filePickerOpened", true) + tryCompare(webEngineView, "title", "test1.html") } function test_acceptMultipleFilesSelection() { @@ -96,10 +94,8 @@ TestWebEngineView { FilePickerParams.selectedFilesUrl.push(Qt.resolvedUrl("test2.html")) keyPress(Qt.Key_Enter) // Focus is on the button. Open FileDialog. - wait(100) - verify(FilePickerParams.filePickerOpened) - titleSpy.wait() - compare(webEngineView.title, "test1.html,test2.html") + tryCompare(FilePickerParams, "filePickerOpened", true) + tryCompare(webEngineView, "title", "test1.html,test2.html") } function test_acceptDirectory() { @@ -110,10 +106,8 @@ TestWebEngineView { FilePickerParams.selectedFilesUrl.push(Qt.resolvedUrl("../data")) keyPress(Qt.Key_Enter) // Focus is on the button. Open FileDialog. - wait(100) // The ui delegate is invoked asynchronously - verify(FilePickerParams.filePickerOpened) - titleSpy.wait() - compare(webEngineView.title, "data") + tryCompare(FilePickerParams, "filePickerOpened", true) + tryCompare(webEngineView, "title", "data") } function test_reject() { -- cgit v1.2.3 From 528088cb61eaacb63e87ea8e06f59d1536e43799 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 8 Jun 2016 14:44:15 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pulls in the PDB location fix, an updated libjpeg_turbo and the backport of a crash fix. Task-number: QTBUG-52938 Task-number: QTBUG-53800 Task-number: QTBUG-54023 Change-Id: Ic773b082d26825758e8986e8d77f8f5bc7b80f83 Reviewed-by: Michael Brüning --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index dc08e3972..d0dbe5636 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit dc08e3972d36a63dd477de0de005b3e81a5674d9 +Subproject commit d0dbe5636cb9d424db0c7ee7850c97d578150138 -- cgit v1.2.3