From e9309d91ac3ec0ddd7076b5cf66655380aa82cac Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 8 Sep 2017 13:21:38 +0200 Subject: Fix position of keyboard-invoked context menu in QQuickWebEngineView In QQuickWebEngineView the context menu is a QtQuickControls.Menu item. This menu is shown by calling popup() which always displays the menu below the mouse cursor. Work around the problem by moving the mouse cursor temporarily to the right position. Use a QObject property "pos" to store the requested menu position between addMenu() and showMenu() calls, because the Menu item doesn't have a "pos" QML property. Change-Id: Id772a0bb1a7548cad932e9f499ade68be32d86d3 Reviewed-by: Peter Varga --- src/webengine/ui_delegates_manager.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 6cc496d5b..c9c013d52 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -257,7 +257,7 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title, if (!title.isEmpty()) QQmlProperty(menu, QStringLiteral("title")).write(title); if (!pos.isNull()) - QQmlProperty(menu, QStringLiteral("pos")).write(pos); + menu->setProperty("pos", pos); menu->setParent(parentMenu); @@ -496,9 +496,38 @@ void UIDelegatesManager::showFilePicker(QSharedPointer con QMetaObject::invokeMethod(filePicker, "open"); } +class TemporaryCursorMove +{ +public: + TemporaryCursorMove(const QQuickItem *item, const QPoint &pos) + { + if (pos.isNull() || !item->contains(pos)) + return; + const QPoint oldPos = QCursor::pos(); + const QPoint globalPos = item->mapToGlobal(QPointF(pos)).toPoint(); + if (oldPos == globalPos) + return; + m_oldCursorPos = oldPos; + QCursor::setPos(globalPos); + } + + ~TemporaryCursorMove() + { + if (!m_oldCursorPos.isNull()) + QCursor::setPos(m_oldCursorPos); + } + +private: + QPoint m_oldCursorPos; +}; + void UIDelegatesManager::showMenu(QObject *menu) { - QMetaObject::invokeMethod(menu, "popup"); + // QtQuick.Controls.Menu.popup() always shows the menu under the mouse cursor, i.e. the menu's + // position we set above is ignored. Work around the problem by moving the mouse cursor + // temporarily to the right position. + TemporaryCursorMove tcm(m_view, menu->property("pos").toPoint()); + QMetaObject::invokeMethod(menu, "popup"); } void UIDelegatesManager::showMessageBubble(const QRect &anchor, const QString &mainText, const QString &subText) -- cgit v1.2.3 From f3fdb0d2200ee1fa06bb8620f8bef84a37ab753a Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 3 Nov 2017 10:12:31 +0100 Subject: Do not stop findText on navigation if no finding in progress Avoid unnecessary unselect calls to prevent to lose active focus on an input field during background load. Task-number: QTBUG-64082 Change-Id: I13e8e2a96254360a78329d6ea2b6858da86a2b5a Reviewed-by: Viktor Engelmann --- src/core/web_contents_adapter.cpp | 6 ++++++ src/core/web_contents_adapter.h | 1 + src/webengine/api/qquickwebengineview.cpp | 2 +- src/webenginewidgets/api/qwebenginepage.cpp | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 7c74bb7fd..1930e7a0e 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1427,6 +1427,12 @@ void WebContentsAdapter::focusIfNecessary() d->webContents->Focus(); } +bool WebContentsAdapter::isFindTextInProgress() const +{ + Q_D(const WebContentsAdapter); + return d->lastFindRequestId != d->webContentsDelegate->lastReceivedFindReply(); +} + WebContentsAdapterClient::RenderProcessTerminationStatus WebContentsAdapterClient::renderProcessExitStatus(int terminationStatus) { auto status = WebContentsAdapterClient::RenderProcessTerminationStatus(-1); diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 67fcbe7af..51fd2891d 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -184,6 +184,7 @@ public: void viewSource(); bool canViewSource(); void focusIfNecessary(); + bool isFindTextInProgress() const; private: diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 53f4f5855..25f578528 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -356,7 +356,7 @@ void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const Q Q_EMIT q->navigationRequested(&navigationRequest); navigationRequestAction = navigationRequest.action(); - if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter) + if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter && adapter->isFindTextInProgress()) adapter->stopFinding(); } diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index c583c7f51..9d8d52886 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1433,7 +1433,7 @@ void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl & { Q_Q(QWebEnginePage); bool accepted = q->acceptNavigationRequest(url, static_cast(navigationType), isMainFrame); - if (accepted && adapter) + if (accepted && adapter && adapter->isFindTextInProgress()) adapter->stopFinding(); navigationRequestAction = accepted ? WebContentsAdapterClient::AcceptRequest : WebContentsAdapterClient::IgnoreRequest; } -- cgit v1.2.3 From 707c13fcdf2cbc7e6021cbca3cc4b30fd7b9dcfc Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 6 Nov 2017 17:01:10 +0100 Subject: Update Chromium Changes: 36d7224dff [Backport] Fix for CVE-2017-5124 3cc9c87e76 [Backport] Fix for CVE-2017-5129 ccaf2d569b [Backport] SkSafeMath for tracking size_t overflow 7b155d9f8d [Backport] Ensure IDN domains are in punycode format in extension host permissions fe7cc31259 [Backport] Fix for CVE-2017-5132 96c8d7944e [Backport] Fix for CVE-2017-5128 5de529d03d [Backport] Fix for CVE-2017-5127 edf0736427 [Backport] Fix for CVE-2017-5126 Change-Id: Ib0c76c846791f48820600ee5aaf55ca5389257bf Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index cfe8c6090..36d7224df 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit cfe8c60903b327ac94406661350f4ac05aa8c21b +Subproject commit 36d7224dff1d3e2ddff401e03b821725efbc00e0 -- cgit v1.2.3 From a87049cd7e188ea2185cf467765b60cb9de1210e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 8 Nov 2017 14:42:49 +0100 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: c394f9bd67 [Backport] Ensure REG_SZ and REG_MULTI_SZ are null 180b9b53aa [Backport] IDN display: Block U+0307 after i or U+0131 4398e36a05 [Backport] Fix for CVE-2017-15396 [2/2] 8d7c3609b1 [Backport] Fix for CVE-2017-15396 [1/2] d95317e241 [Backport] Remove getOptimalLanguageTag logic 2d6e9c3fc4 [Backport] Fix for CVE-2017-15387 f84377a4e0 [Backport] Fix for CVE-2017-15386 ebccd98fb3 [Backport] Cherry pick: Don't allow iteration through da91cdeb1f [Backport] Fix for CVE-2017-5133 Change-Id: Ie85db1786594bac1feba2c7ca3e26559edfff7f2 Reviewed-by: Michael BrĂ¼ning --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 36d7224df..c394f9bd6 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 36d7224dff1d3e2ddff401e03b821725efbc00e0 +Subproject commit c394f9bd67128f67bb26bbb47254549ea23a099f -- cgit v1.2.3 From 4de8486b6614896a2b84cc64b69606c7b3bd07e8 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 6 Nov 2017 16:04:45 +0100 Subject: Notify Chromium about leaving view Forward QEvent::Leave for Widget and QEvent::HoverLeave for Quick. Task-number: QTBUG-64265 Change-Id: Ide32768902956476d24b1d4115e305392b62feb3 Reviewed-by: Allan Sandfeld Jensen --- src/core/render_widget_host_view_qt.cpp | 4 ++++ src/core/web_event_factory.cpp | 18 +++++++++++++++--- src/core/web_event_factory.h | 2 ++ .../render_widget_host_view_qt_delegate_quick.cpp | 5 +++++ .../render_widget_host_view_qt_delegate_quick.h | 1 + 5 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 980550620..0d78d6743 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -960,6 +960,10 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) case QEvent::InputMethodQuery: handleInputMethodQueryEvent(static_cast(event)); break; + case QEvent::HoverLeave: + case QEvent::Leave: + m_host->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(event)); + break; default: return false; } diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index f5264708d..0e46aced5 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1019,12 +1019,14 @@ static ui::DomKey getDomKeyFromQKeyEvent(QKeyEvent *ev) } } -static inline double currentTimeForEvent(const QInputEvent* event) +static inline double currentTimeForEvent(const QEvent *event) { Q_ASSERT(event); - if (event->timestamp()) - return static_cast(event->timestamp()) / 1000; + if (const QInputEvent *inputEvent = static_cast(event)) { + if (inputEvent->timestamp()) + return static_cast(inputEvent->timestamp()) / 1000; + } static QElapsedTimer timer; if (!timer.isValid()) @@ -1211,6 +1213,16 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale) return webKitEvent; } +WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev) +{ + Q_ASSERT(ev->type() == QEvent::Leave || ev->type() == QEvent::HoverLeave); + + WebMouseEvent webKitEvent; + webKitEvent.timeStampSeconds = currentTimeForEvent(ev); + webKitEvent.type = WebInputEvent::MouseLeave; + return webKitEvent; +} + #ifndef QT_NO_GESTURES WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, double dpiScale) { diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index 859e97643..b28710d66 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -49,6 +49,7 @@ #include QT_BEGIN_NAMESPACE +class QEvent; class QHoverEvent; class QKeyEvent; class QMouseEvent; @@ -63,6 +64,7 @@ class WebEventFactory { public: static blink::WebMouseEvent toWebMouseEvent(QMouseEvent*, double dpiScale); static blink::WebMouseEvent toWebMouseEvent(QHoverEvent*, double dpiScale); + static blink::WebMouseEvent toWebMouseEvent(QEvent *); #ifndef QT_NO_GESTURES static blink::WebGestureEvent toWebGestureEvent(QNativeGestureEvent *, double dpiScale); #endif 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 5d8c4fa43..0d77a5040 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -332,6 +332,11 @@ void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event) m_client->forwardEvent(event); } +void RenderWidgetHostViewQtDelegateQuick::hoverLeaveEvent(QHoverEvent *event) +{ + m_client->forwardEvent(event); +} + QVariant RenderWidgetHostViewQtDelegateQuick::inputMethodQuery(Qt::InputMethodQuery query) const { return m_client->inputMethodQuery(query); diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h index 7a08e915b..eeb7db9cb 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.h +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h @@ -90,6 +90,7 @@ protected: virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; virtual void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE; virtual void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + virtual void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; virtual void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE; virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; -- cgit v1.2.3 From 2e54fc39cc49bd57541ac4a78a8622c37ef33769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Wed, 8 Nov 2017 17:23:48 +0100 Subject: URLRequestQrcJobQt: remove ineffective URL formatting options Remove strange options for call to QUrl::path and add test for "qrc" protocol. Change-Id: I6528d858b7661832852c333a7f932d4714f953f2 Reviewed-by: Alexandru Croitor --- src/core/url_request_qrc_job_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/url_request_qrc_job_qt.cpp b/src/core/url_request_qrc_job_qt.cpp index b4e960921..a2712653d 100644 --- a/src/core/url_request_qrc_job_qt.cpp +++ b/src/core/url_request_qrc_job_qt.cpp @@ -112,7 +112,7 @@ int URLRequestQrcJobQt::ReadRawData(IOBuffer *buf, int bufSize) void URLRequestQrcJobQt::startGetHead() { // Get qrc file path. - QString qrcFilePath = ':' + toQt(request_->url()).path(QUrl::RemovePath | QUrl::RemoveQuery); + QString qrcFilePath = ':' + toQt(request_->url()).path(); m_file.setFileName(qrcFilePath); QFileInfo qrcFileInfo(m_file); // Get qrc file mime type. -- cgit v1.2.3 From d53efba0b69e883ce70fa834856dcef61976725a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Fri, 10 Nov 2017 11:04:47 +0100 Subject: Fix invalid Q_ASSERT in WebChannelIPCTransport Task-number: QTBUG-64419 Change-Id: I094cfc654498c74f4d6b656ec5647a90700a4f6a Reviewed-by: Peter Varga Reviewed-by: Allan Sandfeld Jensen --- src/core/renderer/web_channel_ipc_transport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index 2420c4420..865bfc243 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -181,7 +181,7 @@ void WebChannelIPCTransport::installWebChannel(uint worldId) void WebChannelIPCTransport::uninstallWebChannel(uint worldId) { - Q_ASSERT(worldId = m_installedWorldId); + Q_ASSERT(worldId == m_installedWorldId); blink::WebView *webView = render_view()->GetWebView(); if (!webView) return; -- cgit v1.2.3 From 0f0d07ba0fc0792e78ebff1201b1034f7195b7cf Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 10 Nov 2017 13:33:08 +0100 Subject: Update Chromium Changes: a83d8cdb8d [Backport] Fix Stack Buffer Overflow in QuicClientPromisedInfo::OnPromiseHeaders Change-Id: I1a3f36a84d5f4838912bb5b6716f94282b064299 Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index c394f9bd6..a83d8cdb8 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit c394f9bd67128f67bb26bbb47254549ea23a099f +Subproject commit a83d8cdb8d8361eadb86ac48d020486f56543114 -- cgit v1.2.3