diff options
author | noamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 01:08:50 +0000 |
---|---|---|
committer | noamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 01:08:50 +0000 |
commit | 3aba491456ae97849f98dfb1d32beacad20fe9c5 (patch) | |
tree | 0c1462b869b46d720c7a38ce933729d97e900fb5 | |
parent | cfa5b2f45d470115ffe397f70ee4a47019949ae3 (diff) | |
download | chromium_src-3aba491456ae97849f98dfb1d32beacad20fe9c5.zip chromium_src-3aba491456ae97849f98dfb1d32beacad20fe9c5.tar.gz chromium_src-3aba491456ae97849f98dfb1d32beacad20fe9c5.tar.bz2 |
Revert 244005 "Remove SetHostSize/Bounds from RootWindow in favo..."
> 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
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/133003002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244033 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/display/display_controller.cc | 4 | ||||
-rw-r--r-- | ash/display/mirror_window_controller.cc | 2 | ||||
-rw-r--r-- | ash/display/virtual_keyboard_window_controller.cc | 2 | ||||
-rw-r--r-- | ash/wm/screen_dimmer_unittest.cc | 6 | ||||
-rw-r--r-- | content/browser/web_contents/touch_editable_impl_aura_browsertest.cc | 2 | ||||
-rw-r--r-- | content/shell/browser/shell_aura.cc | 2 | ||||
-rw-r--r-- | content/shell/browser/shell_views.cc | 3 | ||||
-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 |
14 files changed, 50 insertions, 23 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index a6cff54..e7bef65 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -616,7 +616,7 @@ void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { DCHECK(!display_info.bounds_in_native().IsEmpty()); aura::WindowEventDispatcher* dispatcher = root_windows_[display.id()]->GetDispatcher(); - dispatcher->host()->SetBounds(display_info.bounds_in_native()); + dispatcher->SetHostBounds(display_info.bounds_in_native()); SetDisplayPropertiesOnHostWindow(dispatcher, display); } @@ -632,7 +632,7 @@ void DisplayController::OnDisplayAdded(const gfx::Display& display) { GetDisplayManager()->GetDisplayInfo(display.id()); aura::WindowEventDispatcher* dispatcher = root_windows_[display.id()]->GetDispatcher(); - dispatcher->host()->SetBounds(display_info.bounds_in_native()); + dispatcher->SetHostBounds(display_info.bounds_in_native()); SetDisplayPropertiesOnHostWindow(dispatcher, display); } else { if (primary_display_id == gfx::Display::kInvalidDisplayID) diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index 54d6764..226b99d 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc @@ -204,7 +204,7 @@ void MirrorWindowController::UpdateWindow(const DisplayInfo& display_info) { } else { GetRootWindowSettings(root_window_->window())->display_id = display_info.id(); - root_window_->host()->SetBounds(display_info.bounds_in_native()); + root_window_->SetHostBounds(display_info.bounds_in_native()); } DisplayManager* display_manager = Shell::GetInstance()->display_manager(); diff --git a/ash/display/virtual_keyboard_window_controller.cc b/ash/display/virtual_keyboard_window_controller.cc index f1ac8aa..0c3058f 100644 --- a/ash/display/virtual_keyboard_window_controller.cc +++ b/ash/display/virtual_keyboard_window_controller.cc @@ -68,7 +68,7 @@ void VirtualKeyboardWindowController::UpdateWindow( aura::RootWindow* root_window = root_window_controller_->dispatcher(); GetRootWindowSettings(root_window->window())->display_id = display_info.id(); - root_window->host()->SetBounds(display_info.bounds_in_native()); + root_window->SetHostBounds(display_info.bounds_in_native()); } } diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc index b386b01..a87c71b 100644 --- a/ash/wm/screen_dimmer_unittest.cc +++ b/ash/wm/screen_dimmer_unittest.cc @@ -70,9 +70,9 @@ TEST_F(ScreenDimmerTest, ResizeLayer) { // When we resize the root window, the dimming layer should be resized to // match. - gfx::Rect kNewBounds(400, 300); - Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->SetBounds(kNewBounds); - EXPECT_EQ(kNewBounds.ToString(), dimming_layer->bounds().ToString()); + gfx::Size kNewSize(400, 300); + Shell::GetPrimaryRootWindow()->GetDispatcher()->SetHostSize(kNewSize); + EXPECT_EQ(kNewSize.ToString(), dimming_layer->bounds().size().ToString()); } } // namespace test diff --git a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc index 2b1a5cb..b4f6bb3 100644 --- a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc +++ b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc @@ -137,7 +137,7 @@ class TouchEditableImplAuraTest : public ContentBrowserTest { NavigateToURL(shell(), test_url); aura::Window* content = shell()->web_contents()->GetView()->GetContentNativeView(); - content->GetDispatcher()->host()->SetBounds(gfx::Rect(800, 600)); + content->GetDispatcher()->SetHostSize(gfx::Size(800, 600)); } void TestTouchSelectionOriginatingFromWebpage() { diff --git a/content/shell/browser/shell_aura.cc b/content/shell/browser/shell_aura.cc index 6493824..0b72f9c 100644 --- a/content/shell/browser/shell_aura.cc +++ b/content/shell/browser/shell_aura.cc @@ -147,7 +147,7 @@ ShellAuraPlatformData::~ShellAuraPlatformData() { } void ShellAuraPlatformData::ResizeWindow(int width, int height) { - root_window_->host()->SetBounds(gfx::Rect(width, height)); + root_window_->SetHostSize(gfx::Size(width, height)); } // static diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc index 47f61ee..741c6ba 100644 --- a/content/shell/browser/shell_views.cc +++ b/content/shell/browser/shell_views.cc @@ -101,7 +101,8 @@ class ShellWindowDelegateView : public views::WidgetDelegateView, // Resizing a widget on chromeos doesn't automatically resize the root, need // to explicitly do that. #if defined(OS_CHROMEOS) - GetWidget()->GetNativeWindow()->GetDispatcher()->host()->SetBounds(bounds); + GetWidget()->GetNativeWindow()->GetDispatcher()->SetHostSize( + bounds.size()); #endif } diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 7e95d75..01f62c7 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -194,6 +194,33 @@ 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, @@ -713,14 +740,6 @@ 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 0493a26..1b8068e 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -103,6 +103,12 @@ 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 f4351f5..6cef5d9 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()->host()->SetBounds(gfx::Rect(800, 600)); + dispatcher()->SetHostSize(gfx::Size(800, 600)); } void AuraTestHelper::TearDown() { diff --git a/ui/views/corewm/capture_controller_unittest.cc b/ui/views/corewm/capture_controller_unittest.cc index 5f375aa..2479ee9 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_->host()->SetBounds(gfx::Rect(800, 600)); + second_root_->SetHostSize(gfx::Size(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 ccbfb06..9041799 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()->host()->SetBounds(bounds); + root->GetDispatcher()->SetHostBounds(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 27b8962..0e81528 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_->host()->SetBounds(rect); + root_window_->SetHostBounds(rect); } } // namespace views diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc index 9c32403..0962361 100644 --- a/ui/views/widget/native_widget_aura_unittest.cc +++ b/ui/views/widget/native_widget_aura_unittest.cc @@ -40,7 +40,8 @@ class NativeWidgetAuraTest : public ViewsTestBase { // testing::Test overrides: virtual void SetUp() OVERRIDE { ViewsTestBase::SetUp(); - dispatcher()->host()->SetBounds(gfx::Rect(640, 480)); + root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); + dispatcher()->SetHostSize(gfx::Size(640, 480)); } protected: |