summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-18 14:11:06 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-20 17:13:51 +0200
commit7717f941a349140497d5e689530a2bf31e8397da (patch)
tree10a59c8fdc08bbaabc4c3b21500b56c259021f1a /src/core/render_widget_host_view_qt.cpp
parent7ea45766f6c49de9a81a387013fb1b98ab82766d (diff)
Propagate the page's screen coordinates when the top-level window moved
This fixes a regression after the 37 upgrade where the select popups would have the wrong position. Adjust to the new behavior and also avoid doing a mapToGlobal of the position received in InitAsPopup. RWHV::SetBounds has been giving us screen coordinates since the Chromium 33 update, but popup locations somehow managed to work properly through some side-effect sorcery. This also fixes the value of window.screen[XY] in JavaScript which wasn't updated when the window was moved. Change-Id: I544499bafedccfb7d389b4abc48f1386c398473f Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 9365020a0..d0c8f1482 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -216,9 +216,7 @@ void RenderWidgetHostViewQt::InitAsChild(gfx::NativeView)
void RenderWidgetHostViewQt::InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect& rect)
{
- QRect screenRect = toQt(rect);
- screenRect.moveTo(m_adapterClient->mapToGlobal(screenRect.topLeft()));
- m_delegate->initAsPopup(screenRect);
+ m_delegate->initAsPopup(toQt(rect));
}
void RenderWidgetHostViewQt::InitAsFullscreen(content::RenderWidgetHostView*)
@@ -238,12 +236,12 @@ void RenderWidgetHostViewQt::SetSize(const gfx::Size& size)
m_delegate->resize(width,height);
}
-void RenderWidgetHostViewQt::SetBounds(const gfx::Rect& rect)
+void RenderWidgetHostViewQt::SetBounds(const gfx::Rect& screenRect)
{
// This is called when webkit has sent us a Move message.
- if (IsPopup())
- m_delegate->move(m_adapterClient->mapToGlobal(toQt(rect.origin())));
- SetSize(rect.size());
+ if (IsPopup())
+ m_delegate->move(toQt(screenRect.origin()));
+ SetSize(screenRect.size());
}
gfx::Size RenderWidgetHostViewQt::GetPhysicalBackingSize() const
@@ -659,7 +657,18 @@ QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode)
void RenderWidgetHostViewQt::notifyResize()
{
- GetRenderWidgetHost()->WasResized();
+ m_host->WasResized();
+}
+
+void RenderWidgetHostViewQt::windowBoundsChanged()
+{
+ m_host->SendScreenRects();
+}
+
+void RenderWidgetHostViewQt::windowChanged()
+{
+ if (m_delegate->window())
+ m_host->NotifyScreenInfoChanged();
}
bool RenderWidgetHostViewQt::forwardEvent(QEvent *event)
@@ -729,12 +738,6 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) co
}
}
-void RenderWidgetHostViewQt::windowChanged()
-{
- if (m_delegate->window())
- m_host->NotifyScreenInfoChanged();
-}
-
void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) {
Q_UNUSED(touch);
const bool eventConsumed = ack_result == content::INPUT_EVENT_ACK_STATE_CONSUMED;