diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-07 15:21:42 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-07 15:22:10 +0100 |
commit | 3fe3c36039a68df52ce072af034ada6b4b946cb4 (patch) | |
tree | 5d94f3ae084b30baff037f92446aee29cae21a3d /src | |
parent | d18b3e7c3b3cb1baa20c8fcc53038a91c8fa40af (diff) | |
parent | 7a39d2c3082822b9d4b2417d41f08b5def41b1db (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
src/3rdparty
src/webenginewidgets/api/qwebenginepage.cpp
src/webenginewidgets/api/qwebenginepage_p.h
Change-Id: I050b4c7691a070e04cace2663ad633903f6d96a9
Diffstat (limited to 'src')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 4 | ||||
-rw-r--r-- | src/core/web_contents_adapter_client.h | 1 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 5 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 1 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 22 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage_p.h | 2 |
6 files changed, 35 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 2e67b0e89..fbfa12e91 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -755,6 +755,10 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) Focus(); // Fall through. case QEvent::MouseButtonRelease: case QEvent::MouseMove: + // Skip second MouseMove event when a window is being adopted, so that Chromium + // can properly handle further move events. + if (m_adapterClient->isBeingAdopted()) + return false; handleMouseEvent(static_cast<QMouseEvent*>(event)); break; case QEvent::KeyPress: diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index f2a05c575..117e21e25 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -207,6 +207,7 @@ public: virtual void focusContainer() = 0; virtual void unhandledKeyEvent(QKeyEvent *event) = 0; virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0; + virtual bool isBeingAdopted() = 0; virtual void close() = 0; virtual void windowCloseRejected() = 0; virtual bool contextMenuRequested(const WebEngineContextMenuData&) = 0; diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 6f39f6dba..8b9374e08 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -505,6 +505,11 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten Q_EMIT q->newViewRequested(&request); } +bool QQuickWebEngineViewPrivate::isBeingAdopted() +{ + return false; +} + void QQuickWebEngineViewPrivate::close() { Q_Q(QQuickWebEngineView); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 8daf1f988..c83090907 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -142,6 +142,7 @@ public: virtual void focusContainer() Q_DECL_OVERRIDE; virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE; virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE; + virtual bool isBeingAdopted() Q_DECL_OVERRIDE; virtual void close() Q_DECL_OVERRIDE; virtual void windowCloseRejected() Q_DECL_OVERRIDE; virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 49c0cf5dd..f8f96af6a 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -90,6 +90,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) , view(0) , isLoading(false) , scriptCollection(new QWebEngineScriptCollectionPrivate(browserContextAdapter()->userScriptController(), adapter.data())) + , m_isBeingAdopted(false) , m_backgroundColor(Qt::white) , fullscreenMode(false) { @@ -210,7 +211,20 @@ void QWebEnginePagePrivate::adoptNewWindow(WebContentsAdapter *newWebContents, W { Q_Q(QWebEnginePage); Q_UNUSED(userGesture); + QWebEnginePage *newPage = q->createWindow(toWindowType(disposition)); + + // Mark the new page as being in the process of being adopted, so that a second mouse move event + // sent by newWebContents->initialize() gets filtered in RenderWidgetHostViewQt::forwardEvent. + // The first mouse move event is being sent by q->createWindow(). This is necessary because + // Chromium does not get a mouse move acknowledgment message between the two events, and + // InputRouterImpl::ProcessMouseAck is not executed, thus all subsequent mouse move events + // get coalesced together, and don't get processed at all. + // The mouse move events are actually sent as a result of show() being called on + // RenderWidgetHostViewQtDelegateWidget, both when creating the window and when initialize is + // called. + newPage->d_func()->m_isBeingAdopted = true; + // Overwrite the new page's WebContents with ours. if (newPage && newPage->d_func() != this) { newPage->d_func()->adapter = newWebContents; @@ -218,6 +232,14 @@ void QWebEnginePagePrivate::adoptNewWindow(WebContentsAdapter *newWebContents, W if (!initialGeometry.isEmpty()) emit newPage->geometryChangeRequested(initialGeometry); } + + // Page has finished the adoption process. + newPage->d_func()->m_isBeingAdopted = false; +} + +bool QWebEnginePagePrivate::isBeingAdopted() +{ + return m_isBeingAdopted; } void QWebEnginePagePrivate::close() diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index f6f76dec2..01f7ce42f 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -94,6 +94,7 @@ public: virtual void focusContainer() Q_DECL_OVERRIDE; virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE; virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry) Q_DECL_OVERRIDE; + virtual bool isBeingAdopted() Q_DECL_OVERRIDE; virtual void close() Q_DECL_OVERRIDE; virtual void windowCloseRejected() Q_DECL_OVERRIDE; virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) Q_DECL_OVERRIDE; @@ -146,6 +147,7 @@ public: QtWebEngineCore::WebEngineContextMenuData m_menuData; bool isLoading; QWebEngineScriptCollection scriptCollection; + bool m_isBeingAdopted; QColor m_backgroundColor; bool fullscreenMode; |