diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-09 22:45:53 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-09 22:45:53 +0000 |
commit | 3e4be6ef5735176638fdbd0bf00581f5679de795 (patch) | |
tree | f39733ee892c3f188cd60f9a917c57b1a19c13d8 /ui | |
parent | 2faab8ff8380484de5f46f00bebd6bf657535856 (diff) | |
download | chromium_src-3e4be6ef5735176638fdbd0bf00581f5679de795.zip chromium_src-3e4be6ef5735176638fdbd0bf00581f5679de795.tar.gz chromium_src-3e4be6ef5735176638fdbd0bf00581f5679de795.tar.bz2 |
Remove SetHostSize/Bounds from RootWindow in favor of just calling SetBounds() on host()
R=sky@chromium.org
http://crbug.com/308846
Review URL: https://codereview.chromium.org/128753002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/root_window.cc | 35 | ||||
-rw-r--r-- | ui/aura/root_window.h | 6 | ||||
-rw-r--r-- | ui/aura/test/aura_test_helper.cc | 2 | ||||
-rw-r--r-- | ui/views/corewm/capture_controller_unittest.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_screen_position_client.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura_unittest.cc | 3 |
7 files changed, 13 insertions, 39 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 01f62c7..7e95d75 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -194,33 +194,6 @@ WindowTreeHostDelegate* RootWindow::AsWindowTreeHostDelegate() { return this; } -void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) { - DispatchDetails details = DispatchHeldEvents(); - if (details.dispatcher_destroyed) - return; - gfx::Rect bounds = host_->GetBounds(); - bounds.set_size(size_in_pixel); - host_->SetBounds(bounds); - - // Requery the location to constrain it within the new root window size. - gfx::Point point; - if (host_->QueryMouseLocation(&point)) { - SetLastMouseLocation(window(), - ui::ConvertPointToDIP(window()->layer(), point)); - } - - synthesize_mouse_move_ = false; -} - -void RootWindow::SetHostBounds(const gfx::Rect& bounds_in_pixel) { - DCHECK(!bounds_in_pixel.IsEmpty()); - DispatchDetails details = DispatchHeldEvents(); - if (details.dispatcher_destroyed) - return; - host_->SetBounds(bounds_in_pixel); - synthesize_mouse_move_ = false; -} - void RootWindow::SetCursor(gfx::NativeCursor cursor) { last_cursor_ = cursor; // A lot of code seems to depend on NULL cursors actually showing an arrow, @@ -740,6 +713,14 @@ void RootWindow::OnHostResized(const gfx::Size& size) { return; FOR_EACH_OBSERVER(RootWindowObserver, observers_, OnWindowTreeHostResized(this)); + + // Constrain the mouse position within the new root Window size. + gfx::Point point; + if (host_->QueryMouseLocation(&point)) { + SetLastMouseLocation(window(), + ui::ConvertPointToDIP(window()->layer(), point)); + } + synthesize_mouse_move_ = false; } RootWindow* RootWindow::AsRootWindow() { diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h index 1b8068e..0493a26 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -103,12 +103,6 @@ class AURA_EXPORT RootWindow : public ui::EventProcessor, WindowTreeHostDelegate* AsWindowTreeHostDelegate(); - // Gets/sets the size of the host window. - void SetHostSize(const gfx::Size& size_in_pixel); - - // Sets the bounds of the host window. - void SetHostBounds(const gfx::Rect& size_in_pizel); - // Sets the currently-displayed cursor. If the cursor was previously hidden // via ShowCursor(false), it will remain hidden until ShowCursor(true) is // called, at which point the cursor that was last set via SetCursor() will be diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc index 001c56f..dc03ded 100644 --- a/ui/aura/test/aura_test_helper.cc +++ b/ui/aura/test/aura_test_helper.cc @@ -93,7 +93,7 @@ void AuraTestHelper::SetUp(bool allow_test_contexts) { root_window()->Show(); // Ensure width != height so tests won't confuse them. - dispatcher()->SetHostSize(gfx::Size(800, 600)); + dispatcher()->host()->SetBounds(gfx::Rect(800, 600)); } void AuraTestHelper::TearDown() { diff --git a/ui/views/corewm/capture_controller_unittest.cc b/ui/views/corewm/capture_controller_unittest.cc index 2479ee9..5f375aa 100644 --- a/ui/views/corewm/capture_controller_unittest.cc +++ b/ui/views/corewm/capture_controller_unittest.cc @@ -38,7 +38,7 @@ class CaptureControllerTest : public aura::test::AuraTestBase { aura::RootWindow::CreateParams(gfx::Rect(0, 0, 800, 600)))); second_root_->Init(); second_root_->window()->Show(); - second_root_->SetHostSize(gfx::Size(800, 600)); + second_root_->host()->SetBounds(gfx::Rect(800, 600)); second_capture_controller_.reset( new corewm::ScopedCaptureClient(second_root_->window())); diff --git a/ui/views/widget/desktop_aura/desktop_screen_position_client.cc b/ui/views/widget/desktop_aura/desktop_screen_position_client.cc index 9041799..ccbfb06 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_position_client.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_position_client.cc @@ -89,7 +89,7 @@ void DesktopScreenPositionClient::SetBounds( DesktopNativeWidgetAura* desktop_native_widget = DesktopNativeWidgetAura::ForWindow(window); if (desktop_native_widget) { - root->GetDispatcher()->SetHostBounds(bounds); + root->GetDispatcher()->host()->SetBounds(bounds); // Setting bounds of root resizes |window|. } else { window->SetBounds(bounds); diff --git a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc index 0e81528..27b8962 100644 --- a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc +++ b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc @@ -93,7 +93,7 @@ void X11DesktopWindowMoveClient::EndMoveLoop() { // DesktopWindowTreeHostLinux, private: void X11DesktopWindowMoveClient::SetHostBounds(const gfx::Rect& rect) { - root_window_->SetHostBounds(rect); + root_window_->host()->SetBounds(rect); } } // namespace views diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc index 0962361..9c32403 100644 --- a/ui/views/widget/native_widget_aura_unittest.cc +++ b/ui/views/widget/native_widget_aura_unittest.cc @@ -40,8 +40,7 @@ class NativeWidgetAuraTest : public ViewsTestBase { // testing::Test overrides: virtual void SetUp() OVERRIDE { ViewsTestBase::SetUp(); - root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); - dispatcher()->SetHostSize(gfx::Size(640, 480)); + dispatcher()->host()->SetBounds(gfx::Rect(640, 480)); } protected: |