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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 switch (event->native_event().message) { | 254 switch (event->native_event().message) { |
255 case WM_XBUTTONUP: | 255 case WM_XBUTTONUP: |
256 case WM_NCXBUTTONUP: | 256 case WM_NCXBUTTONUP: |
257 return true; | 257 return true; |
258 } | 258 } |
259 #endif | 259 #endif |
260 return false; | 260 return false; |
261 } | 261 } |
262 | 262 |
263 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { | 263 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { |
264 const gfx::Display display = window ? | 264 gfx::Screen* screen = gfx::Screen::GetScreen(); |
265 gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window) : | 265 const gfx::Display display = window ? screen->GetDisplayNearestWindow(window) |
266 gfx::Screen::GetScreenFor(window)->GetPrimaryDisplay(); | 266 : screen->GetPrimaryDisplay(); |
267 results->rect = display.bounds(); | 267 results->rect = display.bounds(); |
268 results->availableRect = display.work_area(); | 268 results->availableRect = display.work_area(); |
269 // TODO(derat|oshima): Don't hardcode this. Get this from display object. | 269 // TODO(derat|oshima): Don't hardcode this. Get this from display object. |
270 results->depth = 24; | 270 results->depth = 24; |
271 results->depthPerComponent = 8; | 271 results->depthPerComponent = 8; |
272 results->deviceScaleFactor = display.device_scale_factor(); | 272 results->deviceScaleFactor = display.device_scale_factor(); |
273 | 273 |
274 // The Display rotation and the WebScreenInfo orientation are not the same | 274 // The Display rotation and the WebScreenInfo orientation are not the same |
275 // angle. The former is the physical display rotation while the later is the | 275 // angle. The former is the physical display rotation while the later is the |
276 // rotation required by the content to be shown properly on the screen, in | 276 // rotation required by the content to be shown properly on the screen, in |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 CreateAuraWindow(); | 521 CreateAuraWindow(); |
522 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 522 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
523 window_->Init(ui::LAYER_SOLID_COLOR); | 523 window_->Init(ui::LAYER_SOLID_COLOR); |
524 window_->SetName("RenderWidgetHostViewAura"); | 524 window_->SetName("RenderWidgetHostViewAura"); |
525 window_->layer()->SetColor(background_color_); | 525 window_->layer()->SetColor(background_color_); |
526 | 526 |
527 if (parent_view) | 527 if (parent_view) |
528 parent_view->AddChild(GetNativeView()); | 528 parent_view->AddChild(GetNativeView()); |
529 | 529 |
530 const gfx::Display display = | 530 const gfx::Display display = |
531 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_); | 531 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
532 device_scale_factor_ = display.device_scale_factor(); | 532 device_scale_factor_ = display.device_scale_factor(); |
533 } | 533 } |
534 | 534 |
535 void RenderWidgetHostViewAura::InitAsPopup( | 535 void RenderWidgetHostViewAura::InitAsPopup( |
536 RenderWidgetHostView* parent_host_view, | 536 RenderWidgetHostView* parent_host_view, |
537 const gfx::Rect& bounds_in_screen) { | 537 const gfx::Rect& bounds_in_screen) { |
538 CreateAuraWindow(); | 538 CreateAuraWindow(); |
539 popup_parent_host_view_ = | 539 popup_parent_host_view_ = |
540 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 540 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
541 | 541 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); | 574 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); |
575 | 575 |
576 SetBounds(bounds_in_screen); | 576 SetBounds(bounds_in_screen); |
577 Show(); | 577 Show(); |
578 if (NeedsMouseCapture()) | 578 if (NeedsMouseCapture()) |
579 window_->SetCapture(); | 579 window_->SetCapture(); |
580 | 580 |
581 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); | 581 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); |
582 | 582 |
583 const gfx::Display display = | 583 const gfx::Display display = |
584 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_); | 584 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
585 device_scale_factor_ = display.device_scale_factor(); | 585 device_scale_factor_ = display.device_scale_factor(); |
586 } | 586 } |
587 | 587 |
588 void RenderWidgetHostViewAura::InitAsFullscreen( | 588 void RenderWidgetHostViewAura::InitAsFullscreen( |
589 RenderWidgetHostView* reference_host_view) { | 589 RenderWidgetHostView* reference_host_view) { |
590 CreateAuraWindow(); | 590 CreateAuraWindow(); |
591 is_fullscreen_ = true; | 591 is_fullscreen_ = true; |
592 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 592 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
593 window_->Init(ui::LAYER_SOLID_COLOR); | 593 window_->Init(ui::LAYER_SOLID_COLOR); |
594 window_->SetName("RenderWidgetHostViewAura"); | 594 window_->SetName("RenderWidgetHostViewAura"); |
595 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 595 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
596 window_->layer()->SetColor(background_color_); | 596 window_->layer()->SetColor(background_color_); |
597 | 597 |
598 aura::Window* parent = NULL; | 598 aura::Window* parent = NULL; |
599 gfx::Rect bounds; | 599 gfx::Rect bounds; |
600 if (reference_host_view) { | 600 if (reference_host_view) { |
601 aura::Window* reference_window = | 601 aura::Window* reference_window = |
602 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 602 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
603 if (reference_window) { | 603 if (reference_window) { |
604 host_tracker_.reset(new aura::WindowTracker); | 604 host_tracker_.reset(new aura::WindowTracker); |
605 host_tracker_->Add(reference_window); | 605 host_tracker_->Add(reference_window); |
606 } | 606 } |
607 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 607 gfx::Display display = |
608 GetDisplayNearestWindow(reference_window); | 608 gfx::Screen::GetScreen()->GetDisplayNearestWindow(reference_window); |
609 parent = reference_window->GetRootWindow(); | 609 parent = reference_window->GetRootWindow(); |
610 bounds = display.bounds(); | 610 bounds = display.bounds(); |
611 } | 611 } |
612 aura::client::ParentWindowWithContext(window_, parent, bounds); | 612 aura::client::ParentWindowWithContext(window_, parent, bounds); |
613 Show(); | 613 Show(); |
614 Focus(); | 614 Focus(); |
615 | 615 |
616 const gfx::Display display = | 616 const gfx::Display display = |
617 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_); | 617 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
618 device_scale_factor_ = display.device_scale_factor(); | 618 device_scale_factor_ = display.device_scale_factor(); |
619 } | 619 } |
620 | 620 |
621 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 621 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
622 return host_; | 622 return host_; |
623 } | 623 } |
624 | 624 |
625 void RenderWidgetHostViewAura::Show() { | 625 void RenderWidgetHostViewAura::Show() { |
626 window_->Show(); | 626 window_->Show(); |
627 | 627 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 | 987 |
988 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { | 988 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { |
989 if (insets != insets_) { | 989 if (insets != insets_) { |
990 insets_ = insets; | 990 insets_ = insets; |
991 host_->WasResized(); | 991 host_->WasResized(); |
992 } | 992 } |
993 } | 993 } |
994 | 994 |
995 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 995 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
996 current_cursor_ = cursor; | 996 current_cursor_ = cursor; |
997 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 997 const gfx::Display display = |
998 GetDisplayNearestWindow(window_); | 998 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); |
999 current_cursor_.SetDisplayInfo(display); | 999 current_cursor_.SetDisplayInfo(display); |
1000 UpdateCursorIfOverSelf(); | 1000 UpdateCursorIfOverSelf(); |
1001 } | 1001 } |
1002 | 1002 |
1003 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 1003 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
1004 is_loading_ = is_loading; | 1004 is_loading_ = is_loading; |
1005 UpdateCursorIfOverSelf(); | 1005 UpdateCursorIfOverSelf(); |
1006 } | 1006 } |
1007 | 1007 |
1008 void RenderWidgetHostViewAura::TextInputStateChanged( | 1008 void RenderWidgetHostViewAura::TextInputStateChanged( |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 HWND parent = window_->GetHost()->GetAcceleratedWidget(); | 1185 HWND parent = window_->GetHost()->GetAcceleratedWidget(); |
1186 CutoutRectsParams params; | 1186 CutoutRectsParams params; |
1187 params.widget = this; | 1187 params.widget = this; |
1188 params.cutout_rects = constrained_rects_; | 1188 params.cutout_rects = constrained_rects_; |
1189 params.geometry = &plugin_window_moves_; | 1189 params.geometry = &plugin_window_moves_; |
1190 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); | 1190 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); |
1191 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 1191 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
1192 } | 1192 } |
1193 | 1193 |
1194 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 1194 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
1195 // Clip the cursor if chrome is running on regular desktop. | 1195 RECT window_rect = |
1196 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 1196 gfx::win::DIPToScreenRect(window_->GetBoundsInScreen()).ToRECT(); |
1197 RECT window_rect = | 1197 ::ClipCursor(&window_rect); |
1198 gfx::win::DIPToScreenRect(window_->GetBoundsInScreen()).ToRECT(); | |
1199 ::ClipCursor(&window_rect); | |
1200 } | |
1201 } | 1198 } |
1202 | 1199 |
1203 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 1200 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
1204 legacy_render_widget_host_HWND_ = NULL; | 1201 legacy_render_widget_host_HWND_ = NULL; |
1205 legacy_window_destroyed_ = true; | 1202 legacy_window_destroyed_ = true; |
1206 } | 1203 } |
1207 #endif | 1204 #endif |
1208 | 1205 |
1209 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 1206 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
1210 uint32_t output_surface_id, | 1207 uint32_t output_surface_id, |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 const gfx::Display& new_display) { | 1842 const gfx::Display& new_display) { |
1846 } | 1843 } |
1847 | 1844 |
1848 void RenderWidgetHostViewAura::OnDisplayRemoved( | 1845 void RenderWidgetHostViewAura::OnDisplayRemoved( |
1849 const gfx::Display& old_display) { | 1846 const gfx::Display& old_display) { |
1850 } | 1847 } |
1851 | 1848 |
1852 void RenderWidgetHostViewAura::OnDisplayMetricsChanged( | 1849 void RenderWidgetHostViewAura::OnDisplayMetricsChanged( |
1853 const gfx::Display& display, uint32_t metrics) { | 1850 const gfx::Display& display, uint32_t metrics) { |
1854 // The screen info should be updated regardless of the metric change. | 1851 // The screen info should be updated regardless of the metric change. |
1855 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); | 1852 gfx::Screen* screen = gfx::Screen::GetScreen(); |
1856 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { | 1853 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { |
1857 UpdateScreenInfo(window_); | 1854 UpdateScreenInfo(window_); |
1858 current_cursor_.SetDisplayInfo(display); | 1855 current_cursor_.SetDisplayInfo(display); |
1859 UpdateCursorIfOverSelf(); | 1856 UpdateCursorIfOverSelf(); |
1860 } | 1857 } |
1861 } | 1858 } |
1862 | 1859 |
1863 //////////////////////////////////////////////////////////////////////////////// | 1860 //////////////////////////////////////////////////////////////////////////////// |
1864 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: | 1861 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: |
1865 | 1862 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 } | 1912 } |
1916 | 1913 |
1917 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1914 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
1918 float device_scale_factor) { | 1915 float device_scale_factor) { |
1919 if (!host_ || !window_->GetRootWindow()) | 1916 if (!host_ || !window_->GetRootWindow()) |
1920 return; | 1917 return; |
1921 | 1918 |
1922 UpdateScreenInfo(window_); | 1919 UpdateScreenInfo(window_); |
1923 | 1920 |
1924 device_scale_factor_ = device_scale_factor; | 1921 device_scale_factor_ = device_scale_factor; |
1925 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 1922 const gfx::Display display = gfx::Screen::GetScreen()-> |
1926 GetDisplayNearestWindow(window_); | 1923 GetDisplayNearestWindow(window_); |
1927 DCHECK_EQ(device_scale_factor, display.device_scale_factor()); | 1924 DCHECK_EQ(device_scale_factor, display.device_scale_factor()); |
1928 current_cursor_.SetDisplayInfo(display); | 1925 current_cursor_.SetDisplayInfo(display); |
1929 SnapToPhysicalPixelBoundary(); | 1926 SnapToPhysicalPixelBoundary(); |
1930 } | 1927 } |
1931 | 1928 |
1932 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { | 1929 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { |
1933 #if defined(OS_WIN) | 1930 #if defined(OS_WIN) |
1934 HWND parent = NULL; | 1931 HWND parent = NULL; |
1935 // If the tab was hidden and it's closed, host_->is_hidden would have been | 1932 // If the tab was hidden and it's closed, host_->is_hidden would have been |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 overscroll_controller_->Cancel(); | 2437 overscroll_controller_->Cancel(); |
2441 | 2438 |
2442 BrowserAccessibilityManager* manager = | 2439 BrowserAccessibilityManager* manager = |
2443 host_->GetRootBrowserAccessibilityManager(); | 2440 host_->GetRootBrowserAccessibilityManager(); |
2444 if (manager) | 2441 if (manager) |
2445 manager->OnWindowBlurred(); | 2442 manager->OnWindowBlurred(); |
2446 | 2443 |
2447 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2444 // If we lose the focus while fullscreen, close the window; Pepper Flash |
2448 // won't do it for us (unlike NPAPI Flash). However, we do not close the | 2445 // won't do it for us (unlike NPAPI Flash). However, we do not close the |
2449 // window if we lose the focus to a window on another display. | 2446 // window if we lose the focus to a window on another display. |
2450 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); | 2447 gfx::Screen* screen = gfx::Screen::GetScreen(); |
2451 bool focusing_other_display = | 2448 bool focusing_other_display = |
2452 gained_focus && screen->GetNumDisplays() > 1 && | 2449 gained_focus && screen->GetNumDisplays() > 1 && |
2453 (screen->GetDisplayNearestWindow(window_).id() != | 2450 (screen->GetDisplayNearestWindow(window_).id() != |
2454 screen->GetDisplayNearestWindow(gained_focus).id()); | 2451 screen->GetDisplayNearestWindow(gained_focus).id()); |
2455 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { | 2452 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { |
2456 #if defined(OS_WIN) | 2453 #if defined(OS_WIN) |
2457 // On Windows, if we are switching to a non Aura Window on a different | 2454 // On Windows, if we are switching to a non Aura Window on a different |
2458 // screen we should not close the fullscreen window. | 2455 // screen we should not close the fullscreen window. |
2459 if (!gained_focus) { | 2456 if (!gained_focus) { |
2460 POINT point = {0}; | 2457 POINT point = {0}; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2503 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner( | 2500 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner( |
2504 GetSurfaceIdNamespace()); | 2501 GetSurfaceIdNamespace()); |
2505 } | 2502 } |
2506 delegated_frame_host_.reset(); | 2503 delegated_frame_host_.reset(); |
2507 window_observer_.reset(); | 2504 window_observer_.reset(); |
2508 if (window_) { | 2505 if (window_) { |
2509 if (window_->GetHost()) | 2506 if (window_->GetHost()) |
2510 window_->GetHost()->RemoveObserver(this); | 2507 window_->GetHost()->RemoveObserver(this); |
2511 UnlockMouse(); | 2508 UnlockMouse(); |
2512 aura::client::SetTooltipText(window_, NULL); | 2509 aura::client::SetTooltipText(window_, NULL); |
2513 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); | 2510 gfx::Screen::GetScreen()->RemoveObserver(this); |
2514 | 2511 |
2515 // This call is usually no-op since |this| object is already removed from | 2512 // This call is usually no-op since |this| object is already removed from |
2516 // the Aura root window and we don't have a way to get an input method | 2513 // the Aura root window and we don't have a way to get an input method |
2517 // object associated with the window, but just in case. | 2514 // object associated with the window, but just in case. |
2518 DetachFromInputMethod(); | 2515 DetachFromInputMethod(); |
2519 } | 2516 } |
2520 if (popup_parent_host_view_) { | 2517 if (popup_parent_host_view_) { |
2521 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2518 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
2522 popup_parent_host_view_->popup_child_host_view_ == this); | 2519 popup_parent_host_view_->popup_child_host_view_ == this); |
2523 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2520 popup_parent_host_view_->popup_child_host_view_ = NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
2539 | 2536 |
2540 void RenderWidgetHostViewAura::CreateAuraWindow() { | 2537 void RenderWidgetHostViewAura::CreateAuraWindow() { |
2541 DCHECK(!window_); | 2538 DCHECK(!window_); |
2542 window_ = new aura::Window(this); | 2539 window_ = new aura::Window(this); |
2543 window_observer_.reset(new WindowObserver(this)); | 2540 window_observer_.reset(new WindowObserver(this)); |
2544 | 2541 |
2545 aura::client::SetTooltipText(window_, &tooltip_); | 2542 aura::client::SetTooltipText(window_, &tooltip_); |
2546 aura::client::SetActivationDelegate(window_, this); | 2543 aura::client::SetActivationDelegate(window_, this); |
2547 aura::client::SetFocusChangeObserver(window_, this); | 2544 aura::client::SetFocusChangeObserver(window_, this); |
2548 window_->set_layer_owner_delegate(delegated_frame_host_.get()); | 2545 window_->set_layer_owner_delegate(delegated_frame_host_.get()); |
2549 gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 2546 gfx::Screen::GetScreen()->AddObserver(this); |
2550 } | 2547 } |
2551 | 2548 |
2552 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2549 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
2553 if (host_->GetProcess()->FastShutdownStarted()) | 2550 if (host_->GetProcess()->FastShutdownStarted()) |
2554 return; | 2551 return; |
2555 | 2552 |
2556 aura::Window* root_window = window_->GetRootWindow(); | 2553 aura::Window* root_window = window_->GetRootWindow(); |
2557 if (!root_window) | 2554 if (!root_window) |
2558 return; | 2555 return; |
2559 | 2556 |
2560 gfx::Screen* screen = gfx::Screen::GetScreenFor(GetNativeView()); | 2557 gfx::Screen* screen = gfx::Screen::GetScreen(); |
2561 DCHECK(screen); | 2558 DCHECK(screen); |
2562 | 2559 |
2563 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); | 2560 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); |
2564 | 2561 |
2565 #if !defined(OS_CHROMEOS) | 2562 #if !defined(OS_CHROMEOS) |
2566 // Ignore cursor update messages if the window under the cursor is not us. | 2563 // Ignore cursor update messages if the window under the cursor is not us. |
2567 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( | 2564 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( |
2568 cursor_screen_point); | 2565 cursor_screen_point); |
2569 #if defined(OS_WIN) | 2566 #if defined(OS_WIN) |
2570 // On Windows we may fail to retrieve the aura Window at the current cursor | 2567 // On Windows we may fail to retrieve the aura Window at the current cursor |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 else if (!overscroll_controller_) | 2695 else if (!overscroll_controller_) |
2699 overscroll_controller_.reset(new OverscrollController()); | 2696 overscroll_controller_.reset(new OverscrollController()); |
2700 } | 2697 } |
2701 | 2698 |
2702 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { | 2699 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
2703 // The top left corner of our view in window coordinates might not land on a | 2700 // The top left corner of our view in window coordinates might not land on a |
2704 // device pixel boundary if we have a non-integer device scale. In that case, | 2701 // device pixel boundary if we have a non-integer device scale. In that case, |
2705 // to avoid the web contents area looking blurry we translate the web contents | 2702 // to avoid the web contents area looking blurry we translate the web contents |
2706 // in the +x, +y direction to land on the nearest pixel boundary. This may | 2703 // in the +x, +y direction to land on the nearest pixel boundary. This may |
2707 // cause the bottom and right edges to be clipped slightly, but that's ok. | 2704 // cause the bottom and right edges to be clipped slightly, but that's ok. |
2708 aura::Window* snapped = NULL; | 2705 aura::Window* snapped = window_->GetRootWindow(); |
2709 // On desktop, use the root window. On alternative environment (ash), | |
2710 // use the toplevel window which must be already snapped. | |
2711 if (gfx::Screen::GetScreenFor(window_) != | |
2712 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE)) { | |
2713 snapped = window_->GetRootWindow(); | |
2714 } else { | |
2715 snapped = window_->GetToplevelWindow(); | |
2716 } | |
2717 if (snapped && snapped != window_) | 2706 if (snapped && snapped != window_) |
2718 ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer()); | 2707 ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer()); |
2719 | 2708 |
2720 has_snapped_to_boundary_ = true; | 2709 has_snapped_to_boundary_ = true; |
2721 } | 2710 } |
2722 | 2711 |
2723 void RenderWidgetHostViewAura::OnShowContextMenu() { | 2712 void RenderWidgetHostViewAura::OnShowContextMenu() { |
2724 #if defined(OS_WIN) | 2713 #if defined(OS_WIN) |
2725 showing_context_menu_ = true; | 2714 showing_context_menu_ = true; |
2726 #endif | 2715 #endif |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3029 | 3018 |
3030 //////////////////////////////////////////////////////////////////////////////// | 3019 //////////////////////////////////////////////////////////////////////////////// |
3031 // RenderWidgetHostViewBase, public: | 3020 // RenderWidgetHostViewBase, public: |
3032 | 3021 |
3033 // static | 3022 // static |
3034 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3023 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
3035 GetScreenInfoForWindow(results, NULL); | 3024 GetScreenInfoForWindow(results, NULL); |
3036 } | 3025 } |
3037 | 3026 |
3038 } // namespace content | 3027 } // namespace content |
OLD | NEW |