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

Unified Diff: ui/app_list/views/apps_grid_view.cc

Issue 491973004: Make apps grid view scroll vertically in experimental app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@calamity-ares-vertical-scroll
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/apps_grid_view.cc
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc
index f150eb6b6802d80162520ddfe390c0bbcac19581..b9ac18432d88b2adafd7b06ccf2cecd6d7c4fda0 100644
--- a/ui/app_list/views/apps_grid_view.cc
+++ b/ui/app_list/views/apps_grid_view.cc
@@ -1133,9 +1133,10 @@ void AppsGridView::CalculateIdealBounds() {
tile_size.height() * rows_per_page_));
grid_rect.Intersect(rect);
- // Page width including padding pixels. A tile.x + page_width means the same
- // tile slot in the next page.
+ // Page size including padding pixels. A tile.x + page_width means the same
+ // tile slot in the next page; similarly for tile.y + page_height.
const int page_width = grid_rect.width() + kPagePadding;
+ const int page_height = grid_rect.height() + kPagePadding;
calamity 2014/09/01 00:58:12 You can move these down closer to where they're us
Matt Giuca 2014/09/01 01:28:29 Nah, this shouldn't be moved inside the for loop s
// If there is a transition, calculates offset for current and target page.
const int current_page = pagination_model_.selected_page();
@@ -1143,10 +1144,8 @@ void AppsGridView::CalculateIdealBounds() {
pagination_model_.transition();
const bool is_valid = pagination_model_.is_valid_page(transition.target_page);
- // Transition to right means negative offset.
+ // Transition to previous page means negative offset.
const int dir = transition.target_page > current_page ? -1 : 1;
- const int transition_offset = is_valid ?
- transition.progress * page_width * dir : 0;
const int total_views =
view_model_.view_size() + pulsing_blocks_model_.view_size();
@@ -1170,17 +1169,35 @@ void AppsGridView::CalculateIdealBounds() {
}
}
- // Decides an x_offset for current item.
+ // Decide the x or y offset for current item.
int x_offset = 0;
- if (view_index.page < current_page)
- x_offset = -page_width;
- else if (view_index.page > current_page)
- x_offset = page_width;
-
- if (is_valid) {
- if (view_index.page == current_page ||
- view_index.page == transition.target_page) {
- x_offset += transition_offset;
+ int y_offset = 0;
+
+ if (app_list::switches::IsExperimentalAppListEnabled()) {
+ // The experimental app list transitions vertically.
+ if (view_index.page < current_page)
+ y_offset = -page_height;
+ else if (view_index.page > current_page)
+ y_offset = page_height;
+
+ if (is_valid) {
+ if (view_index.page == current_page ||
+ view_index.page == transition.target_page) {
+ y_offset += transition.progress * page_height * dir;
+ }
+ }
+ } else {
+ // The normal app list transitions horizontally.
+ if (view_index.page < current_page)
+ x_offset = -page_width;
+ else if (view_index.page > current_page)
+ x_offset = page_width;
+
+ if (is_valid) {
+ if (view_index.page == current_page ||
+ view_index.page == transition.target_page) {
+ x_offset += transition.progress * page_width * dir;
+ }
}
}
@@ -1188,7 +1205,7 @@ void AppsGridView::CalculateIdealBounds() {
const int col = view_index.slot % cols_;
gfx::Rect tile_slot(
gfx::Point(grid_rect.x() + col * tile_size.width() + x_offset,
- grid_rect.y() + row * tile_size.height()),
+ grid_rect.y() + row * tile_size.height() + y_offset),
tile_size);
if (i < view_model_.view_size()) {
view_model_.set_ideal_bounds(i, tile_slot);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698