Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: ash/wm/app_list_controller.cc

Issue 10961020: cros: Fix mouse over-scroll animation not happening. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix jumping around when mouse is hovering on an item Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/app_list/app_list_item_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/wm/app_list_controller.h" 5 #include "ash/wm/app_list_controller.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 void AppListController::TransitionChanged() { 331 void AppListController::TransitionChanged() {
332 // |view_| could be NULL when app list is closed with a running transition. 332 // |view_| could be NULL when app list is closed with a running transition.
333 if (!view_) 333 if (!view_)
334 return; 334 return;
335 335
336 const app_list::PaginationModel::Transition& transition = 336 const app_list::PaginationModel::Transition& transition =
337 pagination_model_->transition(); 337 pagination_model_->transition();
338 if (pagination_model_->is_valid_page(transition.target_page)) 338 if (pagination_model_->is_valid_page(transition.target_page))
339 return; 339 return;
340 340
341 if (pagination_model_->scrolling()) { 341 if (!pagination_model_->IsRevertingCurrentTransition()) {
342 const int current_page = pagination_model_->selected_page(); 342 const int current_page = pagination_model_->selected_page();
343 const int dir = transition.target_page > current_page ? -1 : 1; 343 const int dir = transition.target_page > current_page ? -1 : 1;
344 344
345 const double progress = 1.0 - pow(1.0 - transition.progress, 4); 345 const double progress = 1.0 - pow(1.0 - transition.progress, 4);
346 const int shift = kMaxOverScrollShift * progress * dir; 346 const int shift = kMaxOverScrollShift * progress * dir;
347 347
348 gfx::Rect shifted(view_bounds_); 348 gfx::Rect shifted(view_bounds_);
349 shifted.set_x(shifted.x() + shift); 349 shifted.set_x(shifted.x() + shift);
350 view_->GetWidget()->SetBounds(shifted); 350 view_->GetWidget()->SetBounds(shifted);
351 should_snap_back_ = true; 351 should_snap_back_ = true;
352 } else if (should_snap_back_) { 352 } else if (should_snap_back_) {
353 should_snap_back_ = false; 353 should_snap_back_ = false;
354 ui::Layer* layer = GetLayer(view_->GetWidget()); 354 ui::Layer* layer = GetLayer(view_->GetWidget());
355 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); 355 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator());
356 animation.SetTransitionDuration( 356 animation.SetTransitionDuration(
357 base::TimeDelta::FromMilliseconds(kSnapBackAnimationDurationMs)); 357 base::TimeDelta::FromMilliseconds(kSnapBackAnimationDurationMs));
358 layer->SetBounds(view_bounds_); 358 layer->SetBounds(view_bounds_);
359 } 359 }
360 } 360 }
361 361
362 } // namespace internal 362 } // namespace internal
363 } // namespace ash 363 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/app_list_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698