summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 14:43:09 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 14:43:09 +0000
commit7152c349d7b4704d951e97af42d33cab1753ea7e (patch)
tree4cd2d6f6f59705e06e905cd6f81f23048d77592c
parenta3d95cd30b2674806833df52e6033f2108c5eaf4 (diff)
downloadchromium_src-7152c349d7b4704d951e97af42d33cab1753ea7e.zip
chromium_src-7152c349d7b4704d951e97af42d33cab1753ea7e.tar.gz
chromium_src-7152c349d7b4704d951e97af42d33cab1753ea7e.tar.bz2
Fix client coordinates when forwarding mouse events to RenderWidgetHostView parents.
A commit on behalf of tangjie: (already reviewed) http://codereview.chromium.org/113671 BUG=http://code.google.com/p/chromium/issues/detail?id=11901 TEST=click anywhere in the extension bar and note whether this also gets counted as a click on the tab that's directly above it veritcally. Review URL: http://codereview.chromium.org/119065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17478 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index f8e50c7..f6fa297 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -1025,7 +1025,18 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam,
// Give the TabContents first crack at the message. It may want to
// prevent forwarding to the renderer if some higher level browser
// functionality is invoked.
- if (SendMessage(GetParent(), message, wparam, lparam) != 0)
+ LPARAM parent_msg_lparam = lparam;
+ if (message != WM_MOUSELEAVE) {
+ // For the messages except WM_MOUSELEAVE, before forwarding them to
+ // parent window, we should adjust cursor position from client
+ // coordinates in current window to client coordinates in its parent
+ // window.
+ CPoint cursor_pos(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
+ ClientToScreen(&cursor_pos);
+ GetParent().ScreenToClient(&cursor_pos);
+ parent_msg_lparam = MAKELPARAM(cursor_pos.x, cursor_pos.y);
+ }
+ if (SendMessage(GetParent(), message, wparam, parent_msg_lparam) != 0)
return 1;
}
}