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

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

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: and another rebase Created 4 years, 11 months 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
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 #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
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 CreateAuraWindow(); 520 CreateAuraWindow();
521 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); 521 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
522 window_->Init(ui::LAYER_SOLID_COLOR); 522 window_->Init(ui::LAYER_SOLID_COLOR);
523 window_->SetName("RenderWidgetHostViewAura"); 523 window_->SetName("RenderWidgetHostViewAura");
524 window_->layer()->SetColor(background_color_); 524 window_->layer()->SetColor(background_color_);
525 525
526 if (parent_view) 526 if (parent_view)
527 parent_view->AddChild(GetNativeView()); 527 parent_view->AddChild(GetNativeView());
528 528
529 const gfx::Display display = 529 const gfx::Display display =
530 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_); 530 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_);
531 device_scale_factor_ = display.device_scale_factor(); 531 device_scale_factor_ = display.device_scale_factor();
532 } 532 }
533 533
534 void RenderWidgetHostViewAura::InitAsPopup( 534 void RenderWidgetHostViewAura::InitAsPopup(
535 RenderWidgetHostView* parent_host_view, 535 RenderWidgetHostView* parent_host_view,
536 const gfx::Rect& bounds_in_screen) { 536 const gfx::Rect& bounds_in_screen) {
537 CreateAuraWindow(); 537 CreateAuraWindow();
538 popup_parent_host_view_ = 538 popup_parent_host_view_ =
539 static_cast<RenderWidgetHostViewAura*>(parent_host_view); 539 static_cast<RenderWidgetHostViewAura*>(parent_host_view);
540 540
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); 573 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen);
574 574
575 SetBounds(bounds_in_screen); 575 SetBounds(bounds_in_screen);
576 Show(); 576 Show();
577 if (NeedsMouseCapture()) 577 if (NeedsMouseCapture())
578 window_->SetCapture(); 578 window_->SetCapture();
579 579
580 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); 580 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this));
581 581
582 const gfx::Display display = 582 const gfx::Display display =
583 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_); 583 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_);
584 device_scale_factor_ = display.device_scale_factor(); 584 device_scale_factor_ = display.device_scale_factor();
585 } 585 }
586 586
587 void RenderWidgetHostViewAura::InitAsFullscreen( 587 void RenderWidgetHostViewAura::InitAsFullscreen(
588 RenderWidgetHostView* reference_host_view) { 588 RenderWidgetHostView* reference_host_view) {
589 CreateAuraWindow(); 589 CreateAuraWindow();
590 is_fullscreen_ = true; 590 is_fullscreen_ = true;
591 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); 591 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL);
592 window_->Init(ui::LAYER_SOLID_COLOR); 592 window_->Init(ui::LAYER_SOLID_COLOR);
593 window_->SetName("RenderWidgetHostViewAura"); 593 window_->SetName("RenderWidgetHostViewAura");
594 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 594 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
595 window_->layer()->SetColor(background_color_); 595 window_->layer()->SetColor(background_color_);
596 596
597 aura::Window* parent = NULL; 597 aura::Window* parent = NULL;
598 gfx::Rect bounds; 598 gfx::Rect bounds;
599 if (reference_host_view) { 599 if (reference_host_view) {
600 aura::Window* reference_window = 600 aura::Window* reference_window =
601 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; 601 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_;
602 if (reference_window) { 602 if (reference_window) {
603 host_tracker_.reset(new aura::WindowTracker); 603 host_tracker_.reset(new aura::WindowTracker);
604 host_tracker_->Add(reference_window); 604 host_tracker_->Add(reference_window);
605 } 605 }
606 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> 606 gfx::Display display =
607 GetDisplayNearestWindow(reference_window); 607 gfx::Screen::GetScreen()->GetDisplayNearestWindow(reference_window);
608 parent = reference_window->GetRootWindow(); 608 parent = reference_window->GetRootWindow();
609 bounds = display.bounds(); 609 bounds = display.bounds();
610 } 610 }
611 aura::client::ParentWindowWithContext(window_, parent, bounds); 611 aura::client::ParentWindowWithContext(window_, parent, bounds);
612 Show(); 612 Show();
613 Focus(); 613 Focus();
614 614
615 const gfx::Display display = 615 const gfx::Display display =
616 gfx::Screen::GetScreenFor(window_)->GetDisplayNearestWindow(window_); 616 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_);
617 device_scale_factor_ = display.device_scale_factor(); 617 device_scale_factor_ = display.device_scale_factor();
618 } 618 }
619 619
620 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { 620 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const {
621 return host_; 621 return host_;
622 } 622 }
623 623
624 void RenderWidgetHostViewAura::Show() { 624 void RenderWidgetHostViewAura::Show() {
625 window_->Show(); 625 window_->Show();
626 626
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 986
987 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { 987 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) {
988 if (insets != insets_) { 988 if (insets != insets_) {
989 insets_ = insets; 989 insets_ = insets;
990 host_->WasResized(); 990 host_->WasResized();
991 } 991 }
992 } 992 }
993 993
994 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { 994 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) {
995 current_cursor_ = cursor; 995 current_cursor_ = cursor;
996 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> 996 const gfx::Display display =
997 GetDisplayNearestWindow(window_); 997 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_);
998 current_cursor_.SetDisplayInfo(display); 998 current_cursor_.SetDisplayInfo(display);
999 UpdateCursorIfOverSelf(); 999 UpdateCursorIfOverSelf();
1000 } 1000 }
1001 1001
1002 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { 1002 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
1003 is_loading_ = is_loading; 1003 is_loading_ = is_loading;
1004 UpdateCursorIfOverSelf(); 1004 UpdateCursorIfOverSelf();
1005 } 1005 }
1006 1006
1007 void RenderWidgetHostViewAura::TextInputStateChanged( 1007 void RenderWidgetHostViewAura::TextInputStateChanged(
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 HWND parent = window_->GetHost()->GetAcceleratedWidget(); 1184 HWND parent = window_->GetHost()->GetAcceleratedWidget();
1185 CutoutRectsParams params; 1185 CutoutRectsParams params;
1186 params.widget = this; 1186 params.widget = this;
1187 params.cutout_rects = constrained_rects_; 1187 params.cutout_rects = constrained_rects_;
1188 params.geometry = &plugin_window_moves_; 1188 params.geometry = &plugin_window_moves_;
1189 LPARAM lparam = reinterpret_cast<LPARAM>(&params); 1189 LPARAM lparam = reinterpret_cast<LPARAM>(&params);
1190 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); 1190 EnumChildWindows(parent, SetCutoutRectsCallback, lparam);
1191 } 1191 }
1192 1192
1193 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { 1193 void RenderWidgetHostViewAura::UpdateMouseLockRegion() {
1194 // Clip the cursor if chrome is running on regular desktop. 1194 RECT window_rect =
1195 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { 1195 gfx::win::DIPToScreenRect(window_->GetBoundsInScreen()).ToRECT();
1196 RECT window_rect = 1196 ::ClipCursor(&window_rect);
1197 gfx::win::DIPToScreenRect(window_->GetBoundsInScreen()).ToRECT();
1198 ::ClipCursor(&window_rect);
1199 }
1200 } 1197 }
1201 1198
1202 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { 1199 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() {
1203 legacy_render_widget_host_HWND_ = NULL; 1200 legacy_render_widget_host_HWND_ = NULL;
1204 legacy_window_destroyed_ = true; 1201 legacy_window_destroyed_ = true;
1205 } 1202 }
1206 #endif 1203 #endif
1207 1204
1208 void RenderWidgetHostViewAura::OnSwapCompositorFrame( 1205 void RenderWidgetHostViewAura::OnSwapCompositorFrame(
1209 uint32_t output_surface_id, 1206 uint32_t output_surface_id,
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 const gfx::Display& new_display) { 1841 const gfx::Display& new_display) {
1845 } 1842 }
1846 1843
1847 void RenderWidgetHostViewAura::OnDisplayRemoved( 1844 void RenderWidgetHostViewAura::OnDisplayRemoved(
1848 const gfx::Display& old_display) { 1845 const gfx::Display& old_display) {
1849 } 1846 }
1850 1847
1851 void RenderWidgetHostViewAura::OnDisplayMetricsChanged( 1848 void RenderWidgetHostViewAura::OnDisplayMetricsChanged(
1852 const gfx::Display& display, uint32_t metrics) { 1849 const gfx::Display& display, uint32_t metrics) {
1853 // The screen info should be updated regardless of the metric change. 1850 // The screen info should be updated regardless of the metric change.
1854 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); 1851 gfx::Screen* screen = gfx::Screen::GetScreen();
1855 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { 1852 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) {
1856 UpdateScreenInfo(window_); 1853 UpdateScreenInfo(window_);
1857 current_cursor_.SetDisplayInfo(display); 1854 current_cursor_.SetDisplayInfo(display);
1858 UpdateCursorIfOverSelf(); 1855 UpdateCursorIfOverSelf();
1859 } 1856 }
1860 } 1857 }
1861 1858
1862 //////////////////////////////////////////////////////////////////////////////// 1859 ////////////////////////////////////////////////////////////////////////////////
1863 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: 1860 // RenderWidgetHostViewAura, aura::WindowDelegate implementation:
1864 1861
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 } 1911 }
1915 1912
1916 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( 1913 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
1917 float device_scale_factor) { 1914 float device_scale_factor) {
1918 if (!host_ || !window_->GetRootWindow()) 1915 if (!host_ || !window_->GetRootWindow())
1919 return; 1916 return;
1920 1917
1921 UpdateScreenInfo(window_); 1918 UpdateScreenInfo(window_);
1922 1919
1923 device_scale_factor_ = device_scale_factor; 1920 device_scale_factor_ = device_scale_factor;
1924 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> 1921 const gfx::Display display = gfx::Screen::GetScreen()->
1925 GetDisplayNearestWindow(window_); 1922 GetDisplayNearestWindow(window_);
1926 DCHECK_EQ(device_scale_factor, display.device_scale_factor()); 1923 DCHECK_EQ(device_scale_factor, display.device_scale_factor());
1927 current_cursor_.SetDisplayInfo(display); 1924 current_cursor_.SetDisplayInfo(display);
1928 SnapToPhysicalPixelBoundary(); 1925 SnapToPhysicalPixelBoundary();
1929 } 1926 }
1930 1927
1931 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { 1928 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) {
1932 #if defined(OS_WIN) 1929 #if defined(OS_WIN)
1933 HWND parent = NULL; 1930 HWND parent = NULL;
1934 // If the tab was hidden and it's closed, host_->is_hidden would have been 1931 // 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
2439 overscroll_controller_->Cancel(); 2436 overscroll_controller_->Cancel();
2440 2437
2441 BrowserAccessibilityManager* manager = 2438 BrowserAccessibilityManager* manager =
2442 host_->GetRootBrowserAccessibilityManager(); 2439 host_->GetRootBrowserAccessibilityManager();
2443 if (manager) 2440 if (manager)
2444 manager->OnWindowBlurred(); 2441 manager->OnWindowBlurred();
2445 2442
2446 // If we lose the focus while fullscreen, close the window; Pepper Flash 2443 // If we lose the focus while fullscreen, close the window; Pepper Flash
2447 // won't do it for us (unlike NPAPI Flash). However, we do not close the 2444 // won't do it for us (unlike NPAPI Flash). However, we do not close the
2448 // window if we lose the focus to a window on another display. 2445 // window if we lose the focus to a window on another display.
2449 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); 2446 gfx::Screen* screen = gfx::Screen::GetScreen();
2450 bool focusing_other_display = 2447 bool focusing_other_display =
2451 gained_focus && screen->GetNumDisplays() > 1 && 2448 gained_focus && screen->GetNumDisplays() > 1 &&
2452 (screen->GetDisplayNearestWindow(window_).id() != 2449 (screen->GetDisplayNearestWindow(window_).id() !=
2453 screen->GetDisplayNearestWindow(gained_focus).id()); 2450 screen->GetDisplayNearestWindow(gained_focus).id());
2454 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { 2451 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) {
2455 #if defined(OS_WIN) 2452 #if defined(OS_WIN)
2456 // On Windows, if we are switching to a non Aura Window on a different 2453 // On Windows, if we are switching to a non Aura Window on a different
2457 // screen we should not close the fullscreen window. 2454 // screen we should not close the fullscreen window.
2458 if (!gained_focus) { 2455 if (!gained_focus) {
2459 POINT point = {0}; 2456 POINT point = {0};
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner( 2498 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner(
2502 GetSurfaceIdNamespace()); 2499 GetSurfaceIdNamespace());
2503 } 2500 }
2504 delegated_frame_host_.reset(); 2501 delegated_frame_host_.reset();
2505 window_observer_.reset(); 2502 window_observer_.reset();
2506 if (window_) { 2503 if (window_) {
2507 if (window_->GetHost()) 2504 if (window_->GetHost())
2508 window_->GetHost()->RemoveObserver(this); 2505 window_->GetHost()->RemoveObserver(this);
2509 UnlockMouse(); 2506 UnlockMouse();
2510 aura::client::SetTooltipText(window_, NULL); 2507 aura::client::SetTooltipText(window_, NULL);
2511 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); 2508 gfx::Screen::GetScreen()->RemoveObserver(this);
2512 2509
2513 // This call is usually no-op since |this| object is already removed from 2510 // This call is usually no-op since |this| object is already removed from
2514 // the Aura root window and we don't have a way to get an input method 2511 // the Aura root window and we don't have a way to get an input method
2515 // object associated with the window, but just in case. 2512 // object associated with the window, but just in case.
2516 DetachFromInputMethod(); 2513 DetachFromInputMethod();
2517 } 2514 }
2518 if (popup_parent_host_view_) { 2515 if (popup_parent_host_view_) {
2519 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || 2516 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL ||
2520 popup_parent_host_view_->popup_child_host_view_ == this); 2517 popup_parent_host_view_->popup_child_host_view_ == this);
2521 popup_parent_host_view_->popup_child_host_view_ = NULL; 2518 popup_parent_host_view_->popup_child_host_view_ = NULL;
(...skipping 15 matching lines...) Expand all
2537 2534
2538 void RenderWidgetHostViewAura::CreateAuraWindow() { 2535 void RenderWidgetHostViewAura::CreateAuraWindow() {
2539 DCHECK(!window_); 2536 DCHECK(!window_);
2540 window_ = new aura::Window(this); 2537 window_ = new aura::Window(this);
2541 window_observer_.reset(new WindowObserver(this)); 2538 window_observer_.reset(new WindowObserver(this));
2542 2539
2543 aura::client::SetTooltipText(window_, &tooltip_); 2540 aura::client::SetTooltipText(window_, &tooltip_);
2544 aura::client::SetActivationDelegate(window_, this); 2541 aura::client::SetActivationDelegate(window_, this);
2545 aura::client::SetFocusChangeObserver(window_, this); 2542 aura::client::SetFocusChangeObserver(window_, this);
2546 window_->set_layer_owner_delegate(delegated_frame_host_.get()); 2543 window_->set_layer_owner_delegate(delegated_frame_host_.get());
2547 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 2544 gfx::Screen::GetScreen()->AddObserver(this);
2548 } 2545 }
2549 2546
2550 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 2547 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
2551 if (host_->GetProcess()->FastShutdownStarted()) 2548 if (host_->GetProcess()->FastShutdownStarted())
2552 return; 2549 return;
2553 2550
2554 aura::Window* root_window = window_->GetRootWindow(); 2551 aura::Window* root_window = window_->GetRootWindow();
2555 if (!root_window) 2552 if (!root_window)
2556 return; 2553 return;
2557 2554
2558 gfx::Screen* screen = gfx::Screen::GetScreenFor(GetNativeView()); 2555 gfx::Screen* screen = gfx::Screen::GetScreen();
2559 DCHECK(screen); 2556 DCHECK(screen);
2560 2557
2561 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); 2558 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint();
2562 2559
2563 #if !defined(OS_CHROMEOS) 2560 #if !defined(OS_CHROMEOS)
2564 // Ignore cursor update messages if the window under the cursor is not us. 2561 // Ignore cursor update messages if the window under the cursor is not us.
2565 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( 2562 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint(
2566 cursor_screen_point); 2563 cursor_screen_point);
2567 #if defined(OS_WIN) 2564 #if defined(OS_WIN)
2568 // On Windows we may fail to retrieve the aura Window at the current cursor 2565 // 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
2696 else if (!overscroll_controller_) 2693 else if (!overscroll_controller_)
2697 overscroll_controller_.reset(new OverscrollController()); 2694 overscroll_controller_.reset(new OverscrollController());
2698 } 2695 }
2699 2696
2700 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { 2697 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() {
2701 // The top left corner of our view in window coordinates might not land on a 2698 // The top left corner of our view in window coordinates might not land on a
2702 // device pixel boundary if we have a non-integer device scale. In that case, 2699 // device pixel boundary if we have a non-integer device scale. In that case,
2703 // to avoid the web contents area looking blurry we translate the web contents 2700 // to avoid the web contents area looking blurry we translate the web contents
2704 // in the +x, +y direction to land on the nearest pixel boundary. This may 2701 // in the +x, +y direction to land on the nearest pixel boundary. This may
2705 // cause the bottom and right edges to be clipped slightly, but that's ok. 2702 // cause the bottom and right edges to be clipped slightly, but that's ok.
2706 aura::Window* snapped = NULL; 2703 aura::Window* snapped = window_->GetRootWindow();
2707 // On desktop, use the root window. On alternative environment (ash),
2708 // use the toplevel window which must be already snapped.
2709 if (gfx::Screen::GetScreenFor(window_) !=
2710 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE)) {
2711 snapped = window_->GetRootWindow();
2712 } else {
2713 snapped = window_->GetToplevelWindow();
2714 }
2715 if (snapped && snapped != window_) 2704 if (snapped && snapped != window_)
2716 ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer()); 2705 ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer());
2717 2706
2718 has_snapped_to_boundary_ = true; 2707 has_snapped_to_boundary_ = true;
2719 } 2708 }
2720 2709
2721 bool RenderWidgetHostViewAura::OnShowContextMenu( 2710 bool RenderWidgetHostViewAura::OnShowContextMenu(
2722 const ContextMenuParams& params) { 2711 const ContextMenuParams& params) {
2723 #if defined(OS_WIN) 2712 #if defined(OS_WIN)
2724 last_context_menu_params_.reset(); 2713 last_context_menu_params_.reset();
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 3067
3079 //////////////////////////////////////////////////////////////////////////////// 3068 ////////////////////////////////////////////////////////////////////////////////
3080 // RenderWidgetHostViewBase, public: 3069 // RenderWidgetHostViewBase, public:
3081 3070
3082 // static 3071 // static
3083 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3072 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3084 GetScreenInfoForWindow(results, NULL); 3073 GetScreenInfoForWindow(results, NULL);
3085 } 3074 }
3086 3075
3087 } // namespace content 3076 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698