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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 } | 585 } |
586 #endif | 586 #endif |
587 } | 587 } |
588 | 588 |
589 #if defined(OS_WIN) | 589 #if defined(OS_WIN) |
590 if (legacy_render_widget_host_HWND_) | 590 if (legacy_render_widget_host_HWND_) |
591 legacy_render_widget_host_HWND_->Hide(); | 591 legacy_render_widget_host_HWND_->Hide(); |
592 #endif | 592 #endif |
593 } | 593 } |
594 | 594 |
595 aura::Window* RenderWidgetHostViewAura::GetToplevelWindow() { | |
596 base::debug::StackTrace().Print(); | |
597 #if defined(OS_CHROMEOS) | |
598 return window_->GetToplevelWindow(); | |
sadrul
2016/12/16 20:15:44
On non-chromeos, I assume this returns the |Deskto
| |
599 #else | |
600 return window_->GetRootWindow(); | |
601 #endif | |
602 } | |
603 | |
595 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 604 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
596 // For a SetSize operation, we don't care what coordinate system the origin | 605 // For a SetSize operation, we don't care what coordinate system the origin |
597 // of the window is in, it's only important to make sure that the origin | 606 // of the window is in, it's only important to make sure that the origin |
598 // remains constant after the operation. | 607 // remains constant after the operation. |
599 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 608 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
600 } | 609 } |
601 | 610 |
602 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { | 611 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { |
603 gfx::Point relative_origin(rect.origin()); | 612 display::Display display = |
604 | 613 popup_parent_host_view_ |
605 // RenderWidgetHostViewAura::SetBounds() takes screen coordinates, but | 614 ? display::Screen::GetScreen()->GetDisplayNearestWindow( |
606 // Window::SetBounds() takes parent coordinates, so do the conversion here. | 615 popup_parent_host_view_->window_) |
607 aura::Window* root = window_->GetRootWindow(); | 616 : display::Screen::GetScreen()->GetDisplayMatching(rect); |
608 if (root) { | 617 GetToplevelWindow()->SetBoundsInScreen(rect, display); |
609 aura::client::ScreenPositionClient* screen_position_client = | |
610 aura::client::GetScreenPositionClient(root); | |
611 if (screen_position_client) { | |
612 screen_position_client->ConvertPointFromScreen( | |
613 window_->parent(), &relative_origin); | |
614 } | |
615 } | |
616 | |
617 InternalSetBounds(gfx::Rect(relative_origin, rect.size())); | |
618 } | 618 } |
619 | 619 |
620 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { | 620 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { |
621 return last_scroll_offset_; | 621 return last_scroll_offset_; |
622 } | 622 } |
623 | 623 |
624 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 624 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
625 return window_; | 625 return window_; |
626 } | 626 } |
627 | 627 |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2387 | 2387 |
2388 void RenderWidgetHostViewAura::SetPopupChild( | 2388 void RenderWidgetHostViewAura::SetPopupChild( |
2389 RenderWidgetHostViewAura* popup_child_host_view) { | 2389 RenderWidgetHostViewAura* popup_child_host_view) { |
2390 popup_child_host_view_ = popup_child_host_view; | 2390 popup_child_host_view_ = popup_child_host_view; |
2391 event_handler_->SetPopupChild( | 2391 event_handler_->SetPopupChild( |
2392 popup_child_host_view, | 2392 popup_child_host_view, |
2393 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2393 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
2394 } | 2394 } |
2395 | 2395 |
2396 } // namespace content | 2396 } // namespace content |
OLD | NEW |