diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-17 10:54:16 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-17 10:54:16 +0200 |
commit | 807adfeec9f9dadb651e401b7dd69eeccda4dd7a (patch) | |
tree | 98790b3b20d4a49a6ce359ff4baa2f1934cba16e /src | |
parent | 1e52779f3c287d82820c91ddb0e9f666eef9054a (diff) | |
parent | 528088cb61eaacb63e87ea8e06f59d1536e43799 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: If4d8a25f5a2192a658d031252435935cbc675725
Diffstat (limited to 'src')
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 76 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.h | 1 | ||||
-rw-r--r-- | src/core/web_contents_adapter_client.h | 1 | ||||
-rw-r--r-- | src/core/web_event_factory.cpp | 6 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 6 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p.h | 4 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 3 | ||||
-rw-r--r-- | src/webengine/doc/src/qtwebengine-overview.qdoc | 4 | ||||
-rw-r--r-- | src/webengine/ui_delegates_manager.cpp | 27 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 6 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage_p.h | 1 | ||||
-rw-r--r-- | src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc | 10 | ||||
-rw-r--r-- | src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h | 2 |
14 files changed, 115 insertions, 32 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject ba36da6c1f59da7687f6924cc558105dcd1c44d +Subproject 77c17ae35f825cb70e46b880fb0b5ed7be83709 diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index a78e3a2c3..99e4da27e 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -71,6 +71,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 <QEvent> #include <QFocusEvent> #include <QGuiApplication> @@ -249,6 +253,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget RenderWidgetHostViewQt::~RenderWidgetHostViewQt() { + QObject::disconnect(m_adapterClientDestroyedConnection); #ifndef QT_NO_ACCESSIBILITY QAccessible::removeActivationObserver(this); #endif // QT_NO_ACCESSIBILITY @@ -264,6 +269,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); } @@ -434,7 +443,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; @@ -492,17 +504,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; @@ -519,16 +556,21 @@ 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. - 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)); } @@ -874,7 +916,21 @@ 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 ((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<ulong>(qGuiApp->styleHints()->mouseDoubleClickInterval())) diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 8c9e6b9f3..67e7461b3 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -235,6 +235,7 @@ private: bool m_didFirstVisuallyNonEmptyLayout; uint32_t 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 c50f38b38..7be9ca7b9 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -258,6 +258,7 @@ public: virtual void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) = 0; virtual bool isEnabled() const = 0; + virtual const QObject *holdingQObject() const = 0; virtual QSharedPointer<BrowserContextAdapter> browserContextAdapter() = 0; virtual WebContentsAdapter* webContentsAdapter() = 0; diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index fddafd1d3..505a684eb 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -486,11 +486,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/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 59b5d17db..ac25cd4d2 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -670,6 +670,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.h b/src/webengine/api/qquickwebengineview_p.h index b72f79f30..b9555d2d9 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -503,8 +503,8 @@ Q_SIGNALS: Q_REVISION(3) void webChannelWorldChanged(uint); 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; void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE; void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE; void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE; diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 909763614..1b5198110 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -175,7 +175,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<CertificateErrorController> &errorController); + virtual void allowCertificateError(const QSharedPointer<CertificateErrorController> &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; @@ -188,6 +188,7 @@ public: void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE; virtual bool isEnabled() const Q_DECL_OVERRIDE; + const QObject *holdingQObject() const Q_DECL_OVERRIDE; virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE; diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 7ae3afaf4..064dfb44b 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 diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index a82ed0f2e..6ff12b53f 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -209,7 +209,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); @@ -222,18 +222,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; } @@ -401,9 +401,12 @@ void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogControlle CHECK_QML_SIGNAL_PROPERTY(rejectSignal, authenticationDialogComponent->url()); 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"); diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 3f11e5aef..bb0db402b 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -494,6 +494,12 @@ WebContentsAdapter *QWebEnginePagePrivate::webContentsAdapter() return adapter.data(); } +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 26ef80e9a..c0b1b9a4e 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -136,6 +136,7 @@ public: void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE; virtual bool isEnabled() const Q_DECL_OVERRIDE; + const QObject *holdingQObject() const Q_DECL_OVERRIDE; virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc index 89d7cfb0c..f652b1d5f 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 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 e98e06417..9fd0cdc48 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -91,7 +91,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(); |