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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 25336003: Use root window's coordinates when updating cursor in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win-specific hack removed Created 7 years 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 | Annotate | Revision Log
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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 #endif 3261 #endif
3262 } 3262 }
3263 3263
3264 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 3264 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
3265 const gfx::Point screen_point = 3265 const gfx::Point screen_point =
3266 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); 3266 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
3267 aura::Window* root_window = window_->GetRootWindow(); 3267 aura::Window* root_window = window_->GetRootWindow();
3268 if (!root_window) 3268 if (!root_window)
3269 return; 3269 return;
3270 3270
3271 gfx::Rect screen_rect = GetViewBounds(); 3271 gfx::Point root_window_point = screen_point;
3272 gfx::Point local_point = screen_point; 3272 aura::client::ScreenPositionClient* screen_position_client =
3273 local_point.Offset(-screen_rect.x(), -screen_rect.y()); 3273 aura::client::GetScreenPositionClient(root_window);
3274 if (screen_position_client) {
3275 screen_position_client->ConvertPointFromScreen(
3276 root_window, &root_window_point);
3277 }
3274 3278
3275 #if defined(OS_WIN) 3279 if (root_window->GetEventHandlerForPoint(root_window_point) != window_)
3276 // If there's another toplevel window above us at this point (for example a
3277 // menu), we don't want to update the cursor.
3278 POINT windows_point = { screen_point.x(), screen_point.y() };
3279 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher();
3280 if (dispatcher->host()->GetAcceleratedWidget() !=
3281 ::WindowFromPoint(windows_point))
3282 return;
3283 #endif
3284 if (root_window->GetEventHandlerForPoint(local_point) != window_)
3285 return; 3280 return;
3286 3281
3287 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); 3282 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor();
3288 // Do not show loading cursor when the cursor is currently hidden. 3283 // Do not show loading cursor when the cursor is currently hidden.
3289 if (is_loading_ && cursor != ui::kCursorNone) 3284 if (is_loading_ && cursor != ui::kCursorNone)
3290 cursor = ui::kCursorPointer; 3285 cursor = ui::kCursorPointer;
3291 3286
3292 aura::client::CursorClient* cursor_client = 3287 aura::client::CursorClient* cursor_client =
3293 aura::client::GetCursorClient(root_window); 3288 aura::client::GetCursorClient(root_window);
3294 if (cursor_client) { 3289 if (cursor_client) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3475 RenderWidgetHost* widget) { 3470 RenderWidgetHost* widget) {
3476 return new RenderWidgetHostViewAura(widget); 3471 return new RenderWidgetHostViewAura(widget);
3477 } 3472 }
3478 3473
3479 // static 3474 // static
3480 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3475 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3481 GetScreenInfoForWindow(results, NULL); 3476 GetScreenInfoForWindow(results, NULL);
3482 } 3477 }
3483 3478
3484 } // namespace content 3479 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698