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

Side by Side Diff: ui/app_list/apps_grid_view.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 | « ui/app_list/apps_grid_view.h ('k') | ui/app_list/pagination_model.h » ('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 "ui/app_list/apps_grid_view.h" 5 #include "ui/app_list/apps_grid_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/app_list/app_list_item_view.h" 9 #include "ui/app_list/app_list_item_view.h"
10 #include "ui/app_list/pagination_model.h" 10 #include "ui/app_list/pagination_model.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 void AppsGridView::EnsureItemVisible(const AppListItemView* item) { 87 void AppsGridView::EnsureItemVisible(const AppListItemView* item) {
88 int index = GetIndexOf(item); 88 int index = GetIndexOf(item);
89 if (index >= 0 && tiles_per_page()) { 89 if (index >= 0 && tiles_per_page()) {
90 pagination_model_->SelectPage(index / tiles_per_page(), 90 pagination_model_->SelectPage(index / tiles_per_page(),
91 false /* animate */); 91 false /* animate */);
92 } 92 }
93 } 93 }
94 94
95 bool AppsGridView::HasPageTransition() const {
96 return pagination_model_->has_transition();
97 }
98
95 gfx::Size AppsGridView::GetPreferredSize() { 99 gfx::Size AppsGridView::GetPreferredSize() {
96 gfx::Insets insets(GetInsets()); 100 gfx::Insets insets(GetInsets());
97 gfx::Size tile_size = gfx::Size(kPreferredTileWidth, kPreferredTileHeight); 101 gfx::Size tile_size = gfx::Size(kPreferredTileWidth, kPreferredTileHeight);
98 return gfx::Size(tile_size.width() * cols_ + insets.width(), 102 return gfx::Size(tile_size.width() * cols_ + insets.width(),
99 tile_size.height() * rows_per_page_ + insets.height()); 103 tile_size.height() * rows_per_page_ + insets.height());
100 } 104 }
101 105
102 void AppsGridView::Layout() { 106 void AppsGridView::Layout() {
103 gfx::Rect rect(GetContentsBounds()); 107 gfx::Rect rect(GetContentsBounds());
104 if (rect.IsEmpty() || child_count() == 0 || !tiles_per_page()) 108 if (rect.IsEmpty() || child_count() == 0 || !tiles_per_page())
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 void AppsGridView::TransitionChanged() { 337 void AppsGridView::TransitionChanged() {
334 // Update layout for valid page transition only since over-scroll no longer 338 // Update layout for valid page transition only since over-scroll no longer
335 // animates app icons. 339 // animates app icons.
336 const PaginationModel::Transition& transition = 340 const PaginationModel::Transition& transition =
337 pagination_model_->transition(); 341 pagination_model_->transition();
338 if (pagination_model_->is_valid_page(transition.target_page)) 342 if (pagination_model_->is_valid_page(transition.target_page))
339 Layout(); 343 Layout();
340 } 344 }
341 345
342 } // namespace app_list 346 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/apps_grid_view.h ('k') | ui/app_list/pagination_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698