Commit 550f6764 authored by Alexander Guettler's avatar Alexander Guettler Committed by Commit Bot

Fix incorrectly dropping WM_MOUSELEAVE after a call to SetCapture

After fixing the bounds check in r623087 it could happen that the window
below the mouse is still the render_widget_host after a tooltip was
created and called SetCapture to not forward mouse events to us.
This makes sure that we only do the bounds check if there is not a
capture currently active.

R=kenrb@chromium.org, lanwei@chromium.org

Bug: 944772
Change-Id: Id6f5ab4ca1f643a8830ad22b36a6975b1da5bc95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1554356Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649615}
parent 3f6b4c3c
...@@ -352,7 +352,8 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseLeave(UINT message, ...@@ -352,7 +352,8 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseLeave(UINT message,
LPARAM l_param) { LPARAM l_param) {
mouse_tracking_enabled_ = false; mouse_tracking_enabled_ = false;
LRESULT ret = 0; LRESULT ret = 0;
if ((::GetCapture() != GetParent()) && GetWindowEventTarget(GetParent())) { HWND capture_window = ::GetCapture();
if ((capture_window != GetParent()) && GetWindowEventTarget(GetParent())) {
// We should send a WM_MOUSELEAVE to the parent window only if the mouse // We should send a WM_MOUSELEAVE to the parent window only if the mouse
// has moved outside the bounds of the parent. // has moved outside the bounds of the parent.
POINT cursor_pos; POINT cursor_pos;
...@@ -362,7 +363,8 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseLeave(UINT message, ...@@ -362,7 +363,8 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseLeave(UINT message,
// respond with HTTRANSPARENT to a WM_NCHITTEST message, // respond with HTTRANSPARENT to a WM_NCHITTEST message,
// it may be returned. // it may be returned.
HWND window_from_point = ::WindowFromPoint(cursor_pos); HWND window_from_point = ::WindowFromPoint(cursor_pos);
if (window_from_point != hwnd() && window_from_point != GetParent()) { if (window_from_point != GetParent() &&
(capture_window || window_from_point != hwnd())) {
bool msg_handled = false; bool msg_handled = false;
ret = GetWindowEventTarget(GetParent())->HandleMouseMessage( ret = GetWindowEventTarget(GetParent())->HandleMouseMessage(
message, w_param, l_param, &msg_handled); message, w_param, l_param, &msg_handled);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment