Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
index 77ea38814b5068f6f561e17d9c9e858b5cc6243a..1d952656bf56e9222a7778e55eeb38504283123c 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -2471,8 +2471,10 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
if (!root_window) |
return; |
- gfx::Point root_window_point = |
+ gfx::Point cursor_screen_point = |
gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
+ |
+ gfx::Point root_window_point = cursor_screen_point; |
aura::client::ScreenPositionClient* screen_position_client = |
aura::client::GetScreenPositionClient(root_window); |
if (screen_position_client) { |
@@ -2483,6 +2485,23 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
if (root_window->GetEventHandlerForPoint(root_window_point) != window_) |
return; |
+#if defined(OS_WIN) |
+ // We can receive SetCursor messages from blink even when we are not the |
+ // foreground window. This can happen for e.g. when the dev tools window |
+ // is updating styles etc. We only want the cursor update to occur on |
+ // the portion of the window outside the foreground window. |
+ if (legacy_render_widget_host_HWND_) { |
scottmg
2015/11/11 05:37:52
Couldn't this happen when the legacy hwnd is disab
ananta
2015/11/11 19:35:08
The legacy window is disabled only for metro mode
|
+ HWND focus_window = ::GetFocus(); |
+ if (focus_window != GetNativeView()->GetHost()->GetAcceleratedWidget()) { |
+ RECT focus_window_screen_rect = {0}; |
+ ::GetWindowRect(focus_window, &focus_window_screen_rect); |
+ // The cursor is within the bounds of another window. Ignore. |
+ if (::PtInRect(&focus_window_screen_rect, cursor_screen_point.ToPOINT())) |
+ return; |
+ } |
+ } |
+#endif |
+ |
gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
// Do not show loading cursor when the cursor is currently hidden. |
if (is_loading_ && cursor != ui::kCursorNone) |