OLD | NEW |
---|---|
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 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2464 } | 2464 } |
2465 | 2465 |
2466 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2466 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
2467 if (host_->GetProcess()->FastShutdownStarted()) | 2467 if (host_->GetProcess()->FastShutdownStarted()) |
2468 return; | 2468 return; |
2469 | 2469 |
2470 aura::Window* root_window = window_->GetRootWindow(); | 2470 aura::Window* root_window = window_->GetRootWindow(); |
2471 if (!root_window) | 2471 if (!root_window) |
2472 return; | 2472 return; |
2473 | 2473 |
2474 gfx::Point root_window_point = | 2474 gfx::Point cursor_screen_point = |
2475 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 2475 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
2476 | |
2477 gfx::Point root_window_point = cursor_screen_point; | |
2476 aura::client::ScreenPositionClient* screen_position_client = | 2478 aura::client::ScreenPositionClient* screen_position_client = |
2477 aura::client::GetScreenPositionClient(root_window); | 2479 aura::client::GetScreenPositionClient(root_window); |
2478 if (screen_position_client) { | 2480 if (screen_position_client) { |
2479 screen_position_client->ConvertPointFromScreen( | 2481 screen_position_client->ConvertPointFromScreen( |
2480 root_window, &root_window_point); | 2482 root_window, &root_window_point); |
2481 } | 2483 } |
2482 | 2484 |
2483 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) | 2485 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) |
2484 return; | 2486 return; |
2485 | 2487 |
2488 #if defined(OS_WIN) | |
2489 // We can receive SetCursor messages from blink even when we are not the | |
2490 // foreground window. This can happen for e.g. when the dev tools window | |
2491 // is updating styles etc. We only want the cursor update to occur on | |
2492 // the portion of the window outside the foreground window. | |
2493 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
| |
2494 HWND focus_window = ::GetFocus(); | |
2495 if (focus_window != GetNativeView()->GetHost()->GetAcceleratedWidget()) { | |
2496 RECT focus_window_screen_rect = {0}; | |
2497 ::GetWindowRect(focus_window, &focus_window_screen_rect); | |
2498 // The cursor is within the bounds of another window. Ignore. | |
2499 if (::PtInRect(&focus_window_screen_rect, cursor_screen_point.ToPOINT())) | |
2500 return; | |
2501 } | |
2502 } | |
2503 #endif | |
2504 | |
2486 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 2505 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
2487 // Do not show loading cursor when the cursor is currently hidden. | 2506 // Do not show loading cursor when the cursor is currently hidden. |
2488 if (is_loading_ && cursor != ui::kCursorNone) | 2507 if (is_loading_ && cursor != ui::kCursorNone) |
2489 cursor = ui::kCursorPointer; | 2508 cursor = ui::kCursorPointer; |
2490 | 2509 |
2491 aura::client::CursorClient* cursor_client = | 2510 aura::client::CursorClient* cursor_client = |
2492 aura::client::GetCursorClient(root_window); | 2511 aura::client::GetCursorClient(root_window); |
2493 if (cursor_client) { | 2512 if (cursor_client) { |
2494 cursor_client->SetCursor(cursor); | 2513 cursor_client->SetCursor(cursor); |
2495 } | 2514 } |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2913 | 2932 |
2914 //////////////////////////////////////////////////////////////////////////////// | 2933 //////////////////////////////////////////////////////////////////////////////// |
2915 // RenderWidgetHostViewBase, public: | 2934 // RenderWidgetHostViewBase, public: |
2916 | 2935 |
2917 // static | 2936 // static |
2918 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2937 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2919 GetScreenInfoForWindow(results, NULL); | 2938 GetScreenInfoForWindow(results, NULL); |
2920 } | 2939 } |
2921 | 2940 |
2922 } // namespace content | 2941 } // namespace content |
OLD | NEW |