diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-08 19:16:59 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-08 19:16:59 +0000 |
commit | cd9a61c70012ba2d7062f861d9ae3fe4b831f277 (patch) | |
tree | 36ec4f771194c94f290fb433e462fce602ffcb8d /ash | |
parent | 9bdadea89eed1e2b85b0b89df4b5a744ee933920 (diff) | |
download | chromium_src-cd9a61c70012ba2d7062f861d9ae3fe4b831f277.zip chromium_src-cd9a61c70012ba2d7062f861d9ae3fe4b831f277.tar.gz chromium_src-cd9a61c70012ba2d7062f861d9ae3fe4b831f277.tar.bz2 |
Move DIP translation from ui/aura to ui/compositor.
Layer's coordinate system is now in DIP.
Added support of dynamic density switching.
Removed ENABLE_DIP gyp/macro and added runtime flag "--ui-enable-dip"
BUG=105165, 114666
TEST=enabled monitor test. added new tests to compositor_unittests
Review URL: https://chromiumcodereview.appspot.com/10221028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 7 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 5 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 5 | ||||
-rw-r--r-- | ash/dip_unittest.cc | 65 | ||||
-rw-r--r-- | ash/monitor/multi_monitor_manager.cc | 22 | ||||
-rw-r--r-- | ash/monitor/multi_monitor_manager.h | 2 | ||||
-rw-r--r-- | ash/wm/image_grid.cc | 35 | ||||
-rw-r--r-- | ash/wm/image_grid.h | 11 | ||||
-rw-r--r-- | ash/wm/image_grid_unittest.cc | 12 | ||||
-rw-r--r-- | ash/wm/resize_shadow.cc | 2 | ||||
-rw-r--r-- | ash/wm/shadow.cc | 4 | ||||
-rw-r--r-- | ash/wm/shadow.h | 10 | ||||
-rw-r--r-- | ash/wm/shadow_controller.cc | 3 | ||||
-rw-r--r-- | ash/wm/shelf_layout_manager.cc | 11 | ||||
-rw-r--r-- | ash/wm/window_animations.cc | 14 |
15 files changed, 87 insertions, 121 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index f8782ea..b6ce065 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -513,12 +513,15 @@ bool AcceleratorController::AcceleratorPressed( return HandlePrintLayerHierarchy(); case PRINT_WINDOW_HIERARCHY: return HandlePrintWindowHierarchy(); - case ADD_REMOVE_MONITOR: + case MONITOR_ADD_REMOVE: internal::MultiMonitorManager::AddRemoveMonitor(); return true; - case CYCLE_MONITOR: + case MONITOR_CYCLE: internal::MultiMonitorManager::CycleMonitor(); return true; + case MONITOR_TOGGLE_SCALE: + internal::MultiMonitorManager::ToggleMonitorScale(); + return true; #endif default: NOTREACHED() << "Unhandled action " << it->second; diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index 0b7093a..08d47f2 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -104,8 +104,9 @@ const AcceleratorData kAcceleratorData[] = { // For testing on systems where Alt-Tab is already mapped. { true, ui::VKEY_W, false, false, true, CYCLE_FORWARD_MRU }, { true, ui::VKEY_W, true, false, true, CYCLE_BACKWARD_MRU }, - { true, ui::VKEY_F4, false, true, false, ADD_REMOVE_MONITOR }, - { true, ui::VKEY_F4, true, true, false, CYCLE_MONITOR }, + { true, ui::VKEY_F4, false, true, false, MONITOR_ADD_REMOVE }, + { true, ui::VKEY_F4, true, true, false, MONITOR_CYCLE }, + { true, ui::VKEY_HOME, true, true, false, MONITOR_TOGGLE_SCALE }, #endif // trigger_on_press, KeyboardCode, shift, control, alt, AcceleratorAction }; diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 12d94c1..08ef43a 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -59,8 +59,9 @@ enum AcceleratorAction { OPEN_FILE_MANAGER, #endif #if !defined(NDEBUG) - ADD_REMOVE_MONITOR, - CYCLE_MONITOR, + MONITOR_ADD_REMOVE, + MONITOR_CYCLE, + MONITOR_TOGGLE_SCALE, PRINT_LAYER_HIERARCHY, PRINT_WINDOW_HIERARCHY, ROTATE_SCREEN, diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index 7d57a0e..16335b3 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -17,80 +17,55 @@ #include "ui/aura/client/activation_client.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/compositor/dip_util.h" #include "ui/compositor/layer.h" #include "ui/gfx/insets.h" #include "ui/gfx/monitor.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" -#if defined(ENABLE_DIP) -#define MAYBE_Shadow FAILS_Shadow -#define MAYBE_WorkArea FAILS_WorkArea -#else -#define MAYBE_Shadow DISABLED_Shadow -#define MAYBE_WorkArea DISABLED_WorkArea -#endif - namespace ash { typedef ash::test::AshTestBase DIPTest; -// Test if the shadow works correctly under different density -TEST_F(DIPTest, MAYBE_Shadow) { - const gfx::Rect kBoundsInDIP(20, 30, 400, 300); - - scoped_ptr<aura::Window> window(new aura::Window(NULL)); - window->SetType(aura::client::WINDOW_TYPE_NORMAL); - window->Init(ui::LAYER_TEXTURED); - window->SetParent(NULL); - window->SetBounds(kBoundsInDIP); - - internal::ShadowController::TestApi api( - Shell::GetInstance()->shadow_controller()); - const internal::Shadow* shadow = api.GetShadowForWindow(window.get()); - window->Show(); - - const gfx::Rect layer_bounds_copy = shadow->layer()->bounds(); - window.reset(); - - ChangeMonitorConfig(2.0f, gfx::Rect(0, 0, 1000, 1000)); - - window.reset(new aura::Window(NULL)); - window->SetType(aura::client::WINDOW_TYPE_NORMAL); - window->Init(ui::LAYER_TEXTURED); - window->SetParent(NULL); - window->SetBounds(kBoundsInDIP); - shadow = api.GetShadowForWindow(window.get()); - window->Show(); - EXPECT_EQ("40,60 800x600", window->GetBoundsInPixel().ToString()); - EXPECT_EQ(layer_bounds_copy.Scale(2.0f).ToString(), - shadow->layer()->bounds().ToString()); -} +#if defined(OS_WIN) +// Windows/Aura doesn't have DIP support in monitor yet. +#define MAYBE_WorkArea DISABLED_WorkArea +#else +#define MAYBE_WorkArea WorkArea +#endif // Test if the WM sets correct work area under different density. TEST_F(DIPTest, MAYBE_WorkArea) { + ui::test::ScopedDIPEnablerForTest enable; ChangeMonitorConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); aura::RootWindow* root = Shell::GetRootWindow(); const gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow(root); EXPECT_EQ("0,0 1000x900", monitor.bounds().ToString()); - const gfx::Rect work_area = monitor.work_area(); - const gfx::Insets insets = monitor.bounds().InsetsFrom(work_area); - EXPECT_EQ("0,0,48,0", insets.ToString()); + gfx::Rect work_area = monitor.work_area(); + EXPECT_EQ("0,0 1000x852", work_area.ToString()); + EXPECT_EQ("0,0,48,0", monitor.bounds().InsetsFrom(work_area).ToString()); ChangeMonitorConfig(2.0f, gfx::Rect(0, 0, 2000, 1800)); const gfx::Monitor monitor_2x = gfx::Screen::GetMonitorNearestWindow(root); + // The |bounds_in_pixel()| should report bounds in pixel coordinate. EXPECT_EQ("0,0 2000x1800", monitor_2x.bounds_in_pixel().ToString()); - EXPECT_EQ("0,0 1000x900", monitor_2x.bounds().ToString()); - EXPECT_EQ(work_area.ToString(), monitor_2x.work_area().ToString()); + // Aura and views coordinates are in DIP, so they their bounds do not change. + EXPECT_EQ("0,0 1000x900", monitor_2x.bounds().ToString()); + work_area = monitor_2x.work_area(); + EXPECT_EQ("0,0 1000x852", work_area.ToString()); + EXPECT_EQ("0,0,48,0", monitor_2x.bounds().InsetsFrom(work_area).ToString()); + // Sanity check if the workarea's inset hight is same as + // the launcher's height. Launcher* launcher = Shell::GetInstance()->launcher(); EXPECT_EQ( - monitor_2x.bounds().InsetsFrom(work_area).height() * 2, + monitor_2x.bounds().InsetsFrom(work_area).height(), launcher->widget()->GetNativeView()->layer()->bounds().height()); } diff --git a/ash/monitor/multi_monitor_manager.cc b/ash/monitor/multi_monitor_manager.cc index 874f224..e7ace37 100644 --- a/ash/monitor/multi_monitor_manager.cc +++ b/ash/monitor/multi_monitor_manager.cc @@ -57,6 +57,12 @@ void MultiMonitorManager::CycleMonitor() { manager->CycleMonitorImpl(); } + void MultiMonitorManager::ToggleMonitorScale() { + MultiMonitorManager* manager = static_cast<MultiMonitorManager*>( + aura::Env::GetInstance()->monitor_manager()); + manager->ScaleMonitorImpl(); +} + void MultiMonitorManager::OnNativeMonitorsChanged( const std::vector<Monitor>& new_monitors) { size_t min = std::min(monitors_.size(), new_monitors.size()); @@ -204,6 +210,22 @@ void MultiMonitorManager::CycleMonitorImpl() { } } +void MultiMonitorManager::ScaleMonitorImpl() { + if (monitors_.size() > 0) { + std::vector<Monitor> new_monitors; + for (Monitors::const_iterator iter = monitors_.begin(); + iter != monitors_.end(); ++iter) { + gfx::Monitor monitor = *iter; + float factor = monitor.device_scale_factor() == 1.0f ? 2.0f : 1.0f; + monitor.SetScaleAndBounds( + factor, gfx::Rect(monitor.bounds_in_pixel().origin(), + monitor.size().Scale(factor))); + new_monitors.push_back(monitor); + } + OnNativeMonitorsChanged(new_monitors); + } +} + gfx::Monitor& MultiMonitorManager::FindMonitorById(int id) { for (Monitors::iterator iter = monitors_.begin(); iter != monitors_.end(); ++iter) { diff --git a/ash/monitor/multi_monitor_manager.h b/ash/monitor/multi_monitor_manager.h index 6ecd8a7..3d8a76b 100644 --- a/ash/monitor/multi_monitor_manager.h +++ b/ash/monitor/multi_monitor_manager.h @@ -37,6 +37,7 @@ class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager, // of on a device. static void AddRemoveMonitor(); static void CycleMonitor(); + static void ToggleMonitorScale(); bool UpdateWorkAreaOfMonitorNearestWindow(const aura::Window* window, const gfx::Insets& insets); @@ -64,6 +65,7 @@ class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager, void Init(); void AddRemoveMonitorImpl(); void CycleMonitorImpl(); + void ScaleMonitorImpl(); gfx::Monitor& FindMonitorById(int id); Monitors monitors_; diff --git a/ash/wm/image_grid.cc b/ash/wm/image_grid.cc index 2edb3f5..c9c982f 100644 --- a/ash/wm/image_grid.cc +++ b/ash/wm/image_grid.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "ui/aura/dip_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image.h" #include "ui/gfx/rect.h" @@ -27,9 +26,8 @@ gfx::Rect ImageGrid::TestAPI::GetTransformedLayerBounds( return bounds; } -ImageGrid::ImageGrid(aura::Window* window) - : window_(window), - layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), +ImageGrid::ImageGrid() + : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), top_image_height_(0), bottom_image_height_(0), left_image_width_(0), @@ -130,7 +128,7 @@ void ImageGrid::SetSize(const gfx::Size& size) { if (center_height > 0) { ui::Transform transform; transform.SetScaleY( - static_cast<float>(center_height) / left_layer_->bounds().height()); + (static_cast<float>(center_height) / left_layer_->bounds().height())); transform.ConcatTranslate(0, top); left_layer_->SetTransform(transform); } @@ -206,21 +204,16 @@ void ImageGrid::SetSize(const gfx::Size& size) { } } -void ImageGrid::SetContentBounds(const gfx::Rect& content_bounds_in_dip) { -#if defined(ENABLE_DIP) - // TODO(oshma): Scale the size of the shadow. - const gfx::Rect content_bounds = - aura::ConvertRectToPixel(window_, content_bounds_in_dip); -#else - const gfx::Rect& content_bounds = content_bounds_in_dip; -#endif +void ImageGrid::SetContentBounds(const gfx::Rect& content_bounds) { SetSize(gfx::Size( content_bounds.width() + left_image_width_ + right_image_width_, - content_bounds.height() + top_image_height_ + bottom_image_height_)); - layer_->SetBounds(gfx::Rect(content_bounds.x() - left_image_width_, - content_bounds.y() - top_image_height_, - layer_->bounds().width(), - layer_->bounds().height())); + content_bounds.height() + top_image_height_ + + bottom_image_height_)); + layer_->SetBounds( + gfx::Rect(content_bounds.x() - left_image_width_, + content_bounds.y() - top_image_height_, + layer_->bounds().width(), + layer_->bounds().height())); } void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, @@ -267,13 +260,7 @@ void ImageGrid::SetImage(const gfx::Image* image, // Set up the new layer and painter. layer_ptr->reset(new ui::Layer(ui::LAYER_TEXTURED)); -#if defined(ENABLE_DIP) - const gfx::Size size = - aura::ConvertSizeToPixel(window_, GetImageSize(image)); -#else const gfx::Size size = GetImageSize(image); -#endif - layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); painter_ptr->reset(new ImagePainter(image)); diff --git a/ash/wm/image_grid.h b/ash/wm/image_grid.h index 7b53f88..37fc37c 100644 --- a/ash/wm/image_grid.h +++ b/ash/wm/image_grid.h @@ -15,10 +15,6 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -namespace aura { -class Window; -} // namespace aura - namespace gfx { class Image; } // namespace gfx @@ -91,7 +87,7 @@ class ASH_EXPORT ImageGrid { DISALLOW_COPY_AND_ASSIGN(TestAPI); }; - explicit ImageGrid(aura::Window* window); + ImageGrid(); ~ImageGrid(); ui::Layer* layer() { return layer_.get(); } @@ -167,11 +163,6 @@ class ASH_EXPORT ImageGrid { scoped_ptr<ui::Layer>* layer_ptr, scoped_ptr<ImagePainter>* painter_ptr); - // A possibly-arbitrary window that is drawn at the same DPI - // (i.e. on the same monitor) as this grid. - // TODO(oshima): move scale factor to ui/compositor/ and remove this. - aura::Window* window_; - // Layer that contains all of the image layers. scoped_ptr<ui::Layer> layer_; diff --git a/ash/wm/image_grid_unittest.cc b/ash/wm/image_grid_unittest.cc index bb31c31..715ddb9 100644 --- a/ash/wm/image_grid_unittest.cc +++ b/ash/wm/image_grid_unittest.cc @@ -37,7 +37,7 @@ TEST_F(ImageGridTest, Basic) { scoped_ptr<gfx::Image> image_Bx1(CreateImage(gfx::Size(kBorder, 1))); scoped_ptr<gfx::Image> image_BxB(CreateImage(gfx::Size(kBorder, kBorder))); - ImageGrid grid(NULL); + ImageGrid grid; grid.SetImages(image_BxB.get(), image_1xB.get(), image_BxB.get(), image_Bx1.get(), image_1x1.get(), image_Bx1.get(), image_BxB.get(), image_1xB.get(), image_BxB.get()); @@ -129,7 +129,7 @@ TEST_F(ImageGridTest, SetContentBounds) { scoped_ptr<gfx::Image> image_Bx1(CreateImage(gfx::Size(kBorder, 1))); scoped_ptr<gfx::Image> image_BxB(CreateImage(gfx::Size(kBorder, kBorder))); - ImageGrid grid(NULL); + ImageGrid grid; grid.SetImages(image_BxB.get(), image_1xB.get(), image_BxB.get(), image_Bx1.get(), image_1x1.get(), image_Bx1.get(), image_BxB.get(), image_1xB.get(), image_BxB.get()); @@ -154,7 +154,7 @@ TEST_F(ImageGridTest, SingleImage) { const int kBorder = 1; scoped_ptr<gfx::Image> image(CreateImage(gfx::Size(kBorder, kBorder))); - ImageGrid grid(NULL); + ImageGrid grid; grid.SetImages(NULL, image.get(), NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -186,7 +186,7 @@ TEST_F(ImageGridTest, ResetImages) { const int kBorder = 1; scoped_ptr<gfx::Image> image(CreateImage(gfx::Size(kBorder, kBorder))); - ImageGrid grid(NULL); + ImageGrid grid; grid.SetImages(NULL, image.get(), NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -234,7 +234,7 @@ TEST_F(ImageGridTest, SmallerSides) { scoped_ptr<gfx::Image> left_image(CreateImage(gfx::Size(kEdge, kEdge))); scoped_ptr<gfx::Image> right_image(CreateImage(gfx::Size(kEdge, kEdge))); - ImageGrid grid(NULL); + ImageGrid grid; grid.SetImages(top_left_image.get(), top_image.get(), top_right_image.get(), left_image.get(), NULL, right_image.get(), NULL, NULL, NULL); @@ -287,7 +287,7 @@ TEST_F(ImageGridTest, TooSmall) { scoped_ptr<gfx::Image> bottom_right_image( CreateImage(gfx::Size(kCorner, kCorner))); - ImageGrid grid(NULL); + ImageGrid grid; grid.SetImages( top_left_image.get(), top_image.get(), top_right_image.get(), left_image.get(), center_image.get(), right_image.get(), diff --git a/ash/wm/resize_shadow.cc b/ash/wm/resize_shadow.cc index a9e0298..805783f 100644 --- a/ash/wm/resize_shadow.cc +++ b/ash/wm/resize_shadow.cc @@ -49,7 +49,7 @@ ResizeShadow::~ResizeShadow() {} void ResizeShadow::Init(aura::Window* window) { // Set up our image grid and images. ResourceBundle& res = ResourceBundle::GetSharedInstance(); - image_grid_.reset(new ImageGrid(window)); + image_grid_.reset(new ImageGrid); image_grid_->SetImages( &res.GetImageNamed(IDR_AURA_RESIZE_SHADOW_TOP_LEFT), &res.GetImageNamed(IDR_AURA_RESIZE_SHADOW_TOP), diff --git a/ash/wm/shadow.cc b/ash/wm/shadow.cc index 49e9788..7cd2fea 100644 --- a/ash/wm/shadow.cc +++ b/ash/wm/shadow.cc @@ -44,9 +44,9 @@ Shadow::Shadow() : style_(STYLE_ACTIVE) { Shadow::~Shadow() { } -void Shadow::Init(aura::Window* window, Style style) { +void Shadow::Init(Style style) { style_ = style; - image_grid_.reset(new ImageGrid(window)); + image_grid_.reset(new ImageGrid); UpdateImagesForStyle(); image_grid_->layer()->set_name("Shadow"); image_grid_->layer()->SetOpacity(GetOpacityForStyle(style_)); diff --git a/ash/wm/shadow.h b/ash/wm/shadow.h index a137085..11ac6f3 100644 --- a/ash/wm/shadow.h +++ b/ash/wm/shadow.h @@ -12,10 +12,6 @@ #include "ui/compositor/layer_animation_observer.h" #include "ui/gfx/rect.h" -namespace aura { -class Window; -} // namespace aura - namespace ui { class Layer; } // namespace ui @@ -44,11 +40,7 @@ class ASH_EXPORT Shadow : public ui::ImplicitAnimationObserver { Shadow(); virtual ~Shadow(); - // |window| is a possibly-arbitrary window that is drawn at the same DPI - // (i.e. on the same monitor) as this shadow. The actual bounds for the - // shadow still has to be provided through |SetContentBounds()|. - // TODO(oshima): move scale factor to ui/compositor/ and remove this. - void Init(aura::Window* window, Style style); + void Init(Style style); // Returns |image_grid_|'s ui::Layer. This is exposed so it can be added to // the same layer as the content and stacked below it. SetContentBounds() diff --git a/ash/wm/shadow_controller.cc b/ash/wm/shadow_controller.cc index 04aa99f..2538630 100644 --- a/ash/wm/shadow_controller.cc +++ b/ash/wm/shadow_controller.cc @@ -162,8 +162,7 @@ void ShadowController::CreateShadowForWindow(aura::Window* window) { linked_ptr<Shadow> shadow(new Shadow()); window_shadows_.insert(make_pair(window, shadow)); - shadow->Init(window, - ShouldUseSmallShadowForWindow(window) ? + shadow->Init(ShouldUseSmallShadowForWindow(window) ? Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); shadow->SetContentBounds(gfx::Rect(window->bounds().size())); shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc index 188449a..0d344fe 100644 --- a/ash/wm/shelf_layout_manager.cc +++ b/ash/wm/shelf_layout_manager.cc @@ -14,7 +14,6 @@ #include "base/auto_reset.h" #include "base/i18n/rtl.h" #include "ui/aura/client/activation_client.h" -#include "ui/aura/dip_util.h" #include "ui/aura/event.h" #include "ui/aura/event_filter.h" #include "ui/aura/root_window.h" @@ -37,11 +36,6 @@ ui::Layer* GetLayer(views::Widget* widget) { return widget->GetNativeView()->layer(); } -void SetLayerBounds(views::Widget* widget, const gfx::Rect& bounds) { - aura::Window* window = widget->GetNativeView(); - window->layer()->SetBounds(aura::ConvertRectToPixel(window, bounds)); -} - } // namespace // static @@ -195,6 +189,7 @@ void ShelfLayoutManager::LayoutShelf() { CalculateTargetBounds(state_, &target_bounds); if (launcher_widget()) { GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); + launcher_widget()->SetBounds(target_bounds.launcher_bounds); launcher_->SetStatusWidth( target_bounds.status_bounds.width()); @@ -334,7 +329,7 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) { launcher_animation_setter.SetTransitionDuration( base::TimeDelta::FromMilliseconds(130)); launcher_animation_setter.SetTweenType(ui::Tween::EASE_OUT); - SetLayerBounds(launcher_widget(), target_bounds.launcher_bounds); + GetLayer(launcher_widget())->SetBounds(target_bounds.launcher_bounds); GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); } ui::ScopedLayerAnimationSettings status_animation_setter( @@ -342,7 +337,7 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) { status_animation_setter.SetTransitionDuration( base::TimeDelta::FromMilliseconds(130)); status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); - SetLayerBounds(status_, target_bounds.status_bounds); + GetLayer(status_)->SetBounds(target_bounds.status_bounds); GetLayer(status_)->SetOpacity(target_bounds.opacity); Shell::GetInstance()->SetMonitorWorkAreaInsets( Shell::GetRootWindow(), diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index 15394ff..692af31 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -14,7 +14,6 @@ #include "base/stl_util.h" #include "base/time.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/dip_util.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" #include "ui/aura/window_property.h" @@ -236,7 +235,7 @@ void AnimateShowWindow_Drop(aura::Window* window) { ui::Transform transform; transform.ConcatScale(kWindowAnimation_ScaleFactor, kWindowAnimation_ScaleFactor); - gfx::Rect bounds = window->GetBoundsInPixel(); + gfx::Rect bounds = window->bounds(); transform.ConcatTranslate( kWindowAnimation_TranslateFactor * bounds.width(), kWindowAnimation_TranslateFactor * bounds.height()); @@ -247,7 +246,7 @@ void AnimateHideWindow_Drop(aura::Window* window) { ui::Transform transform; transform.ConcatScale(kWindowAnimation_ScaleFactor, kWindowAnimation_ScaleFactor); - gfx::Rect bounds = window->GetBoundsInPixel(); + gfx::Rect bounds = window->bounds(); transform.ConcatTranslate( kWindowAnimation_TranslateFactor * bounds.width(), kWindowAnimation_TranslateFactor * bounds.height()); @@ -281,8 +280,8 @@ void AnimateHideWindow_Fade(aura::Window* window) { ui::Transform BuildWorkspaceSwitchTransform(aura::Window* window) { // Animations for transitioning workspaces scale all windows. To give the // effect of scaling from the center of the screen the windows are translated. - gfx::Rect bounds = window->GetBoundsInPixel(); - gfx::Rect parent_bounds(window->parent()->GetBoundsInPixel()); + gfx::Rect bounds = window->bounds(); + gfx::Rect parent_bounds(window->parent()->bounds()); float mid_x = static_cast<float>(parent_bounds.width()) / 2.0f; float initial_x = @@ -366,9 +365,8 @@ gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { void AddLayerAnimationsForMinimize(aura::Window* window, bool show) { // Recalculate the transform at restore time since the launcher item may have // moved while the window was minimized. - gfx::Rect bounds = window->GetBoundsInPixel(); - gfx::Rect target_bounds = - aura::ConvertRectToPixel(window, GetMinimizeRectForWindow(window)); + gfx::Rect bounds = window->bounds(); + gfx::Rect target_bounds = GetMinimizeRectForWindow(window); float scale_x = static_cast<float>(target_bounds.height()) / bounds.width(); float scale_y = static_cast<float>(target_bounds.width()) / bounds.height(); |