Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1433153002: Ignore update cursor messages from blink when the cursor position lies outside our root window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698