summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-14 12:51:02 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-14 14:38:13 +0200
commitc75c32cc9dff47b1230366e1044bdf6b5ba6495c (patch)
tree6a5f3b9f74041d5d83a9c810c4fe5d69cc271643 /src
parent31f41cf9b98b1ff3dde61e667693b2106b906e2c (diff)
Fix RenderWidgetHostViewQt::GetViewBounds
GetViewBounds should return the bounds of the view, not the screen rect. The view bounds are for example used to calculate the screen position of accessible objects (which gets fixed with this patch). Change-Id: I5b342113af737847c1756a13183cd2b8b8db648a Reviewed-by: Andras Becsi <andras.becsi@digia.com> Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/render_widget_host_view_qt.cpp2
-rw-r--r--src/core/render_widget_host_view_qt_delegate.h1
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp7
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h1
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp5
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.h1
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp6
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h1
8 files changed, 23 insertions, 1 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index f29e36ae5..76d599ea2 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -316,7 +316,7 @@ bool RenderWidgetHostViewQt::IsShowing()
// Retrieve the bounds of the View, in screen coordinates.
gfx::Rect RenderWidgetHostViewQt::GetViewBounds() const
{
- QRectF p = m_delegate->screenRect();
+ QRectF p = m_delegate->contentsRect();
float s = dpiScale();
gfx::Point p1(floor(p.x() / s), floor(p.y() / s));
gfx::Point p2(ceil(p.right() /s), ceil(p.bottom() / s));
diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h
index a8515e0e3..122b7c6eb 100644
--- a/src/core/render_widget_host_view_qt_delegate.h
+++ b/src/core/render_widget_host_view_qt_delegate.h
@@ -76,6 +76,7 @@ public:
virtual void initAsChild(WebContentsAdapterClient*) = 0;
virtual void initAsPopup(const QRect&) = 0;
virtual QRectF screenRect() const = 0;
+ virtual QRectF contentsRect() const = 0;
virtual void setKeyboardFocus() = 0;
virtual bool hasKeyboardFocus() = 0;
virtual void show() = 0;
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 8d7f298e7..e37a07960 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -90,6 +90,13 @@ QRectF RenderWidgetHostViewQtDelegateQuick::screenRect() const
return QRectF(pos.x(), pos.y(), width(), height());
}
+QRectF RenderWidgetHostViewQtDelegateQuick::contentsRect() const
+{
+ QPointF scenePoint = mapToScene(QPointF(0, 0));
+ QPointF screenPos = window()->mapToGlobal(scenePoint.toPoint());
+ return QRectF(screenPos, QPointF(width(), height()));
+}
+
void RenderWidgetHostViewQtDelegateQuick::setKeyboardFocus()
{
setFocus(true);
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 2efb2d098..1d79a101c 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -55,6 +55,7 @@ public:
virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
virtual QRectF screenRect() const Q_DECL_OVERRIDE;
+ virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
virtual void setKeyboardFocus() Q_DECL_OVERRIDE;
virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE;
virtual void show() Q_DECL_OVERRIDE;
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp
index b2e461450..2a7e98408 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp
@@ -75,6 +75,11 @@ QRectF RenderWidgetHostViewQtDelegateQuickWindow::screenRect() const
return QRectF(x(), y(), width(), height());
}
+QRectF RenderWidgetHostViewQtDelegateQuickWindow::contentsRect() const
+{
+ return geometry();
+}
+
void RenderWidgetHostViewQtDelegateQuickWindow::show()
{
QQuickWindow::show();
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
index 667bb4b3a..53203bb47 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
@@ -58,6 +58,7 @@ public:
virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
virtual QRectF screenRect() const Q_DECL_OVERRIDE;
+ virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
virtual void setKeyboardFocus() Q_DECL_OVERRIDE {}
virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE { return false; }
virtual void show() Q_DECL_OVERRIDE;
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 24c243d20..98c6265aa 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -97,6 +97,12 @@ QRectF RenderWidgetHostViewQtDelegateWidget::screenRect() const
return QRectF(x(), y(), width(), height());
}
+QRectF RenderWidgetHostViewQtDelegateWidget::contentsRect() const
+{
+ QPointF pos = mapToGlobal(QPoint(0, 0));
+ return QRectF(pos.x(), pos.y(), width(), height());
+}
+
void RenderWidgetHostViewQtDelegateWidget::setKeyboardFocus()
{
setFocus();
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 f7b83e5f5..f05ca2005 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
@@ -63,6 +63,7 @@ public:
virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
virtual QRectF screenRect() const Q_DECL_OVERRIDE;
+ virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
virtual void setKeyboardFocus() Q_DECL_OVERRIDE;
virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE;
virtual void show() Q_DECL_OVERRIDE;