Chromium Code Reviews| Index: content/browser/renderer_host/legacy_render_widget_host_win.cc |
| =================================================================== |
| --- content/browser/renderer_host/legacy_render_widget_host_win.cc (revision 250790) |
| +++ content/browser/renderer_host/legacy_render_widget_host_win.cc (working copy) |
| @@ -7,6 +7,7 @@ |
| #include "base/command_line.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/win/windows_version.h" |
| +#include "base/win/win_util.h" |
| #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| #include "content/browser/accessibility/browser_accessibility_win.h" |
| #include "content/public/common/content_switches.h" |
| @@ -22,13 +23,15 @@ |
| // static |
| scoped_ptr<LegacyRenderWidgetHostHWND> LegacyRenderWidgetHostHWND::Create( |
| HWND parent) { |
| + if (CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kDisableLegacyIntermediateWindow)) |
| + return scoped_ptr<LegacyRenderWidgetHostHWND>(); |
| + |
| scoped_ptr<LegacyRenderWidgetHostHWND> legacy_window_instance; |
| legacy_window_instance.reset(new LegacyRenderWidgetHostHWND(parent)); |
| // If we failed to create the child, or if the switch to disable the legacy |
| // window is passed in, then return NULL. |
| - if (!::IsWindow(legacy_window_instance->hwnd()) || |
| - CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kDisableLegacyIntermediateWindow)) |
| + if (!::IsWindow(legacy_window_instance->hwnd())) |
| return scoped_ptr<LegacyRenderWidgetHostHWND>(); |
| legacy_window_instance->Init(); |
| @@ -130,12 +133,26 @@ |
| WPARAM w_param, |
| LPARAM l_param, |
| BOOL& handled) { |
| - POINT mouse_coords; |
| - mouse_coords.x = GET_X_LPARAM(l_param); |
| - mouse_coords.y = GET_Y_LPARAM(l_param); |
| - ::MapWindowPoints(hwnd(), GetParent(), &mouse_coords, 1); |
| - return ::SendMessage(GetParent(), message, w_param, |
| - MAKELPARAM(mouse_coords.x, mouse_coords.y)); |
| + // Mark the WM_MOUSEMOVE message with a special flag 0xbeef in the high word |
|
sky
2014/02/12 22:51:29
nit nuke 0xbeef, since you really mean SPECIAL_MOU
ananta
2014/02/12 23:17:08
Done.
|
| + // of the WPARAM. |
| + // The parent window has code to track mouse events, i.e to detect if the |
| + // cursor left the bounds of the parent window. Technically entering a child |
| + // window indicates that the cursor left the parent window. |
| + // To ensure that the parent does not turn on tracking for the WM_MOUSEMOVE |
| + // messages sent from us, we flag this in the WPARAM. |
| + if (message == WM_MOUSEMOVE) |
| + w_param = MAKEWPARAM(LOWORD(w_param), SPECIAL_MOUSEMOVE_NOT_TO_BE_TRACKED); |
| + |
| + // The offsets in mouse wheel messages are in screen coordinates. We should |
| + // not be converting them to parent coordinates. |
| + if (message != WM_MOUSEWHEEL && message != WM_MOUSEHWHEEL) { |
| + POINT mouse_coords; |
| + mouse_coords.x = GET_X_LPARAM(l_param); |
| + mouse_coords.y = GET_Y_LPARAM(l_param); |
| + ::MapWindowPoints(hwnd(), GetParent(), &mouse_coords, 1); |
| + l_param = MAKELPARAM(mouse_coords.x, mouse_coords.y); |
| + } |
| + return ::SendMessage(GetParent(), message, w_param, l_param); |
| } |
| LRESULT LegacyRenderWidgetHostHWND::OnMouseActivate(UINT message, |