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

Side by Side 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: Replace NULL with nullptr 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/aura/test/test_screen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #include "ui/wm/public/transient_window_client.h" 92 #include "ui/wm/public/transient_window_client.h"
93 #include "ui/wm/public/window_types.h" 93 #include "ui/wm/public/window_types.h"
94 94
95 #if defined(OS_WIN) 95 #if defined(OS_WIN)
96 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 96 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
97 #include "content/browser/accessibility/browser_accessibility_win.h" 97 #include "content/browser/accessibility/browser_accessibility_win.h"
98 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" 98 #include "content/browser/renderer_host/legacy_render_widget_host_win.h"
99 #include "content/common/plugin_constants_win.h" 99 #include "content/common/plugin_constants_win.h"
100 #include "ui/base/win/hidden_window.h" 100 #include "ui/base/win/hidden_window.h"
101 #include "ui/gfx/gdi_util.h" 101 #include "ui/gfx/gdi_util.h"
102 #include "ui/gfx/screen_win.h"
102 #include "ui/gfx/win/dpi.h" 103 #include "ui/gfx/win/dpi.h"
103 #endif 104 #endif
104 105
105 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 106 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
106 #include "content/common/input_messages.h" 107 #include "content/common/input_messages.h"
107 #include "ui/events/linux/text_edit_command_auralinux.h" 108 #include "ui/events/linux/text_edit_command_auralinux.h"
108 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" 109 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h"
109 #endif 110 #endif
110 111
111 using gfx::RectToSkIRect; 112 using gfx::RectToSkIRect;
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 } 2494 }
2494 2495
2495 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 2496 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
2496 if (host_->GetProcess()->FastShutdownStarted()) 2497 if (host_->GetProcess()->FastShutdownStarted())
2497 return; 2498 return;
2498 2499
2499 aura::Window* root_window = window_->GetRootWindow(); 2500 aura::Window* root_window = window_->GetRootWindow();
2500 if (!root_window) 2501 if (!root_window)
2501 return; 2502 return;
2502 2503
2503 gfx::Point root_window_point = 2504 gfx::Screen* screen = gfx::Screen::GetScreenFor(GetNativeView());
2504 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); 2505 DCHECK(screen);
2506
2507 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint();
2508
2509 #if !defined(OS_CHROMEOS)
2510 // Ignore cursor update messages if the window under the cursor is not us.
2511 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint(
2512 cursor_screen_point);
2513 #if defined(OS_WIN)
2514 // On Windows we may fail to retrieve the aura Window at the current cursor
2515 // position. This is because the WindowFromPoint API may return the legacy
2516 // window which is not associated with an aura Window. In this case we need
2517 // to get the aura window for the parent of the legacy window.
2518 if (!window_at_screen_point && legacy_render_widget_host_HWND_) {
2519 HWND hwnd_at_point = ::WindowFromPoint(cursor_screen_point.ToPOINT());
2520
2521 if (hwnd_at_point == legacy_render_widget_host_HWND_->hwnd())
2522 hwnd_at_point = legacy_render_widget_host_HWND_->GetParent();
2523
2524 gfx::ScreenWin* screen_win = static_cast<gfx::ScreenWin*>(screen);
2525 DCHECK(screen_win);
2526 window_at_screen_point = screen_win->GetNativeWindowFromHWND(
2527 hwnd_at_point);
2528 }
2529 #endif
2530 if (!window_at_screen_point ||
2531 (window_at_screen_point->GetRootWindow() != root_window)) {
2532 return;
2533 }
2534 #endif
2535
2536 gfx::Point root_window_point = cursor_screen_point;
2505 aura::client::ScreenPositionClient* screen_position_client = 2537 aura::client::ScreenPositionClient* screen_position_client =
2506 aura::client::GetScreenPositionClient(root_window); 2538 aura::client::GetScreenPositionClient(root_window);
2507 if (screen_position_client) { 2539 if (screen_position_client) {
2508 screen_position_client->ConvertPointFromScreen( 2540 screen_position_client->ConvertPointFromScreen(
2509 root_window, &root_window_point); 2541 root_window, &root_window_point);
2510 } 2542 }
2511 2543
2512 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) 2544 if (root_window->GetEventHandlerForPoint(root_window_point) != window_)
2513 return; 2545 return;
2514 2546
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 2974
2943 //////////////////////////////////////////////////////////////////////////////// 2975 ////////////////////////////////////////////////////////////////////////////////
2944 // RenderWidgetHostViewBase, public: 2976 // RenderWidgetHostViewBase, public:
2945 2977
2946 // static 2978 // static
2947 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2979 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2948 GetScreenInfoForWindow(results, NULL); 2980 GetScreenInfoForWindow(results, NULL);
2949 } 2981 }
2950 2982
2951 } // namespace content 2983 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/aura/test/test_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698