From 4c1cde9a1909162fbddeabd958a5f5acc43c83d6 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Thu, 8 Jun 2017 15:48:55 +0200 Subject: Implement geometryChangeRequested signal in the Quick API Chromium includes the size of the frame in the requested geometry, but QWindow::setGeometry() and the related properties of QML Window expect a size without frame. This patch - fixes the geometry handling in Demobrowser example. - implements a new signal in the QML API which sends both frameless and extended geometries to the application, because QML doesn't have capability to determine the size of the frame and handle extended geometry correctly. Task-number: QTBUG-51181 Change-Id: I8595593aecca33d7cd46986c7abbad0cc7c18ec2 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_contents_delegate_qt.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/core/web_contents_delegate_qt.cpp') diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 31180a1c1..aafd50adc 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -76,6 +76,7 @@ #include #include +#include namespace QtWebEngineCore { @@ -420,8 +421,13 @@ void WebContentsDelegateQt::RequestMediaAccessPermission(content::WebContents *w void WebContentsDelegateQt::MoveContents(content::WebContents *source, const gfx::Rect &pos) { - Q_UNUSED(source) - m_viewClient->requestGeometryChange(toQt(pos)); + QRect frameGeometry(toQt(pos)); + QRect geometry; + if (RenderWidgetHostViewQt *rwhv = static_cast(web_contents()->GetRenderWidgetHostView())) { + if (rwhv->delegate() && rwhv->delegate()->window()) + geometry = frameGeometry.marginsRemoved(rwhv->delegate()->window()->frameMargins()); + } + m_viewClient->requestGeometryChange(geometry, frameGeometry); } bool WebContentsDelegateQt::IsPopupOrPanel(const content::WebContents *source) const -- cgit v1.2.3