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

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

Issue 555753002: Experimental app list: Change transition animations of top-level pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved reverts out into separate CLs. Created 6 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 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/contents_view.cc
diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc
index 19c9dd93836895343e2c8637f186e69053dbf31e..3c35593015f523e05b5268d59994bd749a20bcb3 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -203,20 +203,24 @@ void ContentsView::UpdatePageBounds() {
}
}
- gfx::Rect incoming_target(rect);
- gfx::Rect outgoing_target(rect);
- int dir = target_page > current_page ? -1 : 1;
-
- // Pages transition vertically.
+ // A page's origin is its off-screen resting place (top). The start page's
+ // origin is above; all other pages' origins are below.
+ int start_page = GetPageIndexForNamedPage(NAMED_PAGE_START);
int page_height = rect.height();
- int transition_offset = progress * page_height * dir;
-
- outgoing_target.set_y(transition_offset);
- incoming_target.set_y(dir < 0 ? transition_offset + page_height
- : transition_offset - page_height);
-
- view_model_->view_at(current_page)->SetBoundsRect(outgoing_target);
- view_model_->view_at(target_page)->SetBoundsRect(incoming_target);
+ int current_page_origin =
+ current_page == start_page ? -page_height : page_height;
+ int target_page_origin =
+ target_page == start_page ? -page_height : page_height;
+
+ // Move |current_page| from 0 to its origin. Move |target_page| from its
+ // origin to 0.
+ gfx::Rect current_page_rect(rect);
+ gfx::Rect target_page_rect(rect);
+ current_page_rect.set_y(progress * current_page_origin);
+ target_page_rect.set_y((1 - progress) * target_page_origin);
+
+ view_model_->view_at(current_page)->SetBoundsRect(current_page_rect);
+ view_model_->view_at(target_page)->SetBoundsRect(target_page_rect);
calamity 2014/09/09 09:13:21 I think you need to do an IsExperimentalAppListEna
Matt Giuca 2014/09/10 01:45:36 Done. Whoops.
}
PaginationModel* ContentsView::GetAppsPaginationModel() {
« 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