summaryrefslogtreecommitdiffstats
path: root/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-01-24 13:34:51 +0100
committerJüri Valdmann <juri.valdmann@qt.io>2019-02-13 12:30:56 +0000
commitab67256fe8d9df5be95919852100f7f914ddbb81 (patch)
treef9ce6177615a33a8a7b092b1c8bf45b4e2245b9c /src/webengine/render_widget_host_view_qt_delegate_quick.cpp
parentc4328812031d1efd3409335e63b0e82f76f00924 (diff)
Simplify visual properties handling in RenderWidgetHostViewQt
Replace separate notifications from delegate with one combined notification and change detection. Store view rect, window rect and screen info in RWHVQ to ensure the properties are in a consistent state. Change-Id: Icef8a17e72882f56db249f5553b6cf554e1f91dc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webengine/render_widget_host_view_qt_delegate_quick.cpp')
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp32
1 files changed, 5 insertions, 27 deletions
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 2f65db97a..ba7e99c47 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -99,19 +99,9 @@ void RenderWidgetHostViewQtDelegateQuick::initAsPopup(const QRect &r)
setVisible(true);
}
-QRectF RenderWidgetHostViewQtDelegateQuick::screenRect() const
+QRectF RenderWidgetHostViewQtDelegateQuick::viewGeometry() const
{
- QPointF pos = mapToScene(QPointF(0,0));
- return QRectF(pos.x(), pos.y(), width(), height());
-}
-
-QRectF RenderWidgetHostViewQtDelegateQuick::contentsRect() const
-{
- QPointF scenePoint = mapToScene(QPointF(0, 0));
- QPointF screenPos;
- if (window())
- screenPos = window()->mapToGlobal(scenePoint.toPoint());
- return QRectF(screenPos.x(), screenPos.y(), width(), height());
+ return QRectF(mapToGlobal(QPointF(0, 0)), size());
}
void RenderWidgetHostViewQtDelegateQuick::setKeyboardFocus()
@@ -322,16 +312,7 @@ void RenderWidgetHostViewQtDelegateQuick::inputMethodEvent(QInputMethodEvent *ev
void RenderWidgetHostViewQtDelegateQuick::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
QQuickItem::geometryChanged(newGeometry, oldGeometry);
-
- if (window()) {
- const QPointF globalPos = QQuickItem::mapToGlobal(position());
- if (globalPos != m_lastGlobalPos) {
- m_lastGlobalPos = globalPos;
- m_client->windowBoundsChanged();
- }
- }
-
- m_client->notifyResize();
+ m_client->visualPropertiesChanged();
}
void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const ItemChangeData &value)
@@ -347,8 +328,7 @@ void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const It
if (!m_isPopup)
m_windowConnections.append(connect(value.window, SIGNAL(closing(QQuickCloseEvent *)), SLOT(onHide())));
}
-
- m_client->windowChanged();
+ m_client->visualPropertiesChanged();
} else if (change == QQuickItem::ItemVisibleHasChanged) {
if (!m_isPopup && !value.boolValue)
onHide();
@@ -362,9 +342,7 @@ QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode,
void RenderWidgetHostViewQtDelegateQuick::onWindowPosChanged()
{
- if (window())
- m_lastGlobalPos = QQuickItem::mapToGlobal(position());
- m_client->windowBoundsChanged();
+ m_client->visualPropertiesChanged();
}
void RenderWidgetHostViewQtDelegateQuick::onHide()