diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-03 00:05:55 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-03 00:05:55 +0000 |
commit | dc851a4e5e36ccb3fe5445912888c1eb9527be20 (patch) | |
tree | 5feed945411b2360c6c96a078025dd1a4cffab01 /ash/wm/app_list_controller.cc | |
parent | fec861d1b04e93f3a9e57ea3e93771c16bbd2120 (diff) | |
download | chromium_src-dc851a4e5e36ccb3fe5445912888c1eb9527be20.zip chromium_src-dc851a4e5e36ccb3fe5445912888c1eb9527be20.tar.gz chromium_src-dc851a4e5e36ccb3fe5445912888c1eb9527be20.tar.bz2 |
cros: Use screen coordinates for app list animation.
BUG=150656
TEST=Verify app list bubble is at the right location on all desktops.
R=oshima@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10996066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/app_list_controller.cc')
-rw-r--r-- | ash/wm/app_list_controller.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index 438bef0a..c3d1840 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -184,15 +184,16 @@ void AppListController::ScheduleAnimation() { // Stop observing previous animation. StopObservingImplicitAnimations(); - ui::Layer* layer = GetLayer(view_->GetWidget()); + views::Widget* widget = view_->GetWidget(); + ui::Layer* layer = GetLayer(widget); layer->GetAnimator()->StopAnimating(); gfx::Rect target_bounds; if (is_visible_) { - target_bounds = layer->bounds(); - layer->SetBounds(OffsetTowardsShelf(layer->bounds())); + target_bounds = widget->GetWindowBoundsInScreen(); + widget->SetBounds(OffsetTowardsShelf(target_bounds)); } else { - target_bounds = OffsetTowardsShelf(layer->bounds()); + target_bounds = OffsetTowardsShelf(widget->GetWindowBoundsInScreen()); } ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); @@ -201,7 +202,7 @@ void AppListController::ScheduleAnimation() { animation.AddObserver(this); layer->SetOpacity(is_visible_ ? 1.0 : 0.0); - layer->SetBounds(target_bounds); + widget->SetBounds(target_bounds); } void AppListController::ProcessLocatedEvent(aura::Window* target, @@ -335,10 +336,11 @@ void AppListController::TransitionChanged() { if (pagination_model_->is_valid_page(transition.target_page)) return; + views::Widget* widget = view_->GetWidget(); if (!pagination_model_->IsRevertingCurrentTransition()) { // Update cached |view_bounds_| before the first over-scroll move. if (!should_snap_back_) - view_bounds_ = view_->GetWidget()->GetNativeView()->bounds(); + view_bounds_ = widget->GetWindowBoundsInScreen(); const int current_page = pagination_model_->selected_page(); const int dir = transition.target_page > current_page ? -1 : 1; @@ -348,15 +350,14 @@ void AppListController::TransitionChanged() { gfx::Rect shifted(view_bounds_); shifted.set_x(shifted.x() + shift); - view_->GetWidget()->SetBounds(shifted); + widget->SetBounds(shifted); should_snap_back_ = true; } else if (should_snap_back_) { should_snap_back_ = false; - ui::Layer* layer = GetLayer(view_->GetWidget()); - ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); + ui::ScopedLayerAnimationSettings animation(GetLayer(widget)->GetAnimator()); animation.SetTransitionDuration( base::TimeDelta::FromMilliseconds(kSnapBackAnimationDurationMs)); - layer->SetBounds(view_bounds_); + widget->SetBounds(view_bounds_); } } |