Index: ui/app_list/views/contents_animator.cc |
diff --git a/ui/app_list/views/contents_animator.cc b/ui/app_list/views/contents_animator.cc |
index e6519808bfe3c697114ad23f1d51dc4d8d5cadc4..cc38108175a3657b0025b22f64fe0a214ab22b2b 100644 |
--- a/ui/app_list/views/contents_animator.cc |
+++ b/ui/app_list/views/contents_animator.cc |
@@ -36,27 +36,6 @@ ContentsAnimator::ContentsAnimator(ContentsView* contents_view) |
ContentsAnimator::~ContentsAnimator() { |
} |
-gfx::Rect ContentsAnimator::GetOnscreenPageBounds(int page_index) const { |
- return contents_view_->GetPageIndexForState( |
- AppListModel::STATE_CUSTOM_LAUNCHER_PAGE) == page_index |
- ? contents_view_->GetContentsBounds() |
- : contents_view_->GetDefaultContentsBounds(); |
-} |
- |
-gfx::Rect ContentsAnimator::GetOffscreenPageBounds(int page_index) const { |
- gfx::Rect bounds(GetOnscreenPageBounds(page_index)); |
- // The start page and search page origins are above; all other pages' origins |
- // are below. |
- bool origin_above = contents_view_->GetPageIndexForState( |
- AppListModel::STATE_START) == page_index || |
- contents_view_->GetPageIndexForState( |
- AppListModel::STATE_SEARCH_RESULTS) == page_index; |
- bounds.set_y(origin_above |
- ? -bounds.height() |
- : contents_view_->GetContentsBounds().height() + bounds.y()); |
- return bounds; |
-} |
- |
void ContentsAnimator::UpdateCustomPageForDefaultAnimation(double progress, |
int from_page, |
int to_page) const { |
@@ -73,7 +52,8 @@ void ContentsAnimator::UpdateCustomPageForDefaultAnimation(double progress, |
views::View* custom_page = contents_view()->GetPageView(custom_page_index); |
gfx::Rect custom_page_collapsed( |
contents_view()->GetCustomPageCollapsedBounds()); |
- gfx::Rect custom_page_origin(GetOffscreenPageBounds(custom_page_index)); |
+ gfx::Rect custom_page_origin( |
+ contents_view()->GetOffscreenPageBounds(custom_page_index)); |
gfx::Rect custom_page_rect; |
if (from_page == start_page_index) { |
@@ -157,10 +137,12 @@ std::string DefaultAnimator::NameForTests() const { |
void DefaultAnimator::Update(double progress, int from_page, int to_page) { |
// Move the from page from 0 to its origin. Move the to page from its origin |
// to 0. |
- gfx::Rect from_page_onscreen(GetOnscreenPageBounds(from_page)); |
- gfx::Rect to_page_onscreen(GetOnscreenPageBounds(to_page)); |
- gfx::Rect from_page_origin(GetOffscreenPageBounds(from_page)); |
- gfx::Rect to_page_origin(GetOffscreenPageBounds(to_page)); |
+ gfx::Rect from_page_onscreen( |
+ contents_view()->GetOnscreenPageBounds(from_page)); |
+ gfx::Rect to_page_onscreen(contents_view()->GetOnscreenPageBounds(to_page)); |
+ gfx::Rect from_page_origin( |
+ contents_view()->GetOffscreenPageBounds(from_page)); |
+ gfx::Rect to_page_origin(contents_view()->GetOffscreenPageBounds(to_page)); |
gfx::Rect from_page_rect(gfx::Tween::RectValueBetween( |
progress, from_page_onscreen, from_page_origin)); |
gfx::Rect to_page_rect( |
@@ -193,13 +175,16 @@ void StartToAppsAnimator::Update(double progress, |
int apps_page) { |
// TODO(mgiuca): This is just a clone of DefaultAnimator's animation. Write a |
// custom animation for the All Apps button on the Start page. |
- gfx::Rect on_screen(contents_view()->GetDefaultContentsBounds()); |
- gfx::Rect from_page_origin(GetOffscreenPageBounds(start_page)); |
- gfx::Rect to_page_origin(GetOffscreenPageBounds(apps_page)); |
- gfx::Rect from_page_rect( |
- gfx::Tween::RectValueBetween(progress, on_screen, from_page_origin)); |
+ gfx::Rect from_page_onscreen( |
+ contents_view()->GetOnscreenPageBounds(start_page)); |
+ gfx::Rect to_page_onscreen(contents_view()->GetOnscreenPageBounds(apps_page)); |
+ gfx::Rect from_page_origin( |
+ contents_view()->GetOffscreenPageBounds(start_page)); |
+ gfx::Rect to_page_origin(contents_view()->GetOffscreenPageBounds(apps_page)); |
+ gfx::Rect from_page_rect(gfx::Tween::RectValueBetween( |
+ progress, from_page_onscreen, from_page_origin)); |
gfx::Rect to_page_rect( |
- gfx::Tween::RectValueBetween(progress, to_page_origin, on_screen)); |
+ gfx::Tween::RectValueBetween(progress, to_page_origin, to_page_onscreen)); |
contents_view()->GetPageView(start_page)->SetBoundsRect(from_page_rect); |
contents_view()->GetPageView(apps_page)->SetBoundsRect(to_page_rect); |
@@ -221,9 +206,12 @@ std::string StartToCustomAnimator::NameForTests() const { |
void StartToCustomAnimator::Update(double progress, |
int start_page, |
int custom_page) { |
- gfx::Rect start_page_on_screen(GetOnscreenPageBounds(start_page)); |
- gfx::Rect custom_page_on_screen(GetOnscreenPageBounds(custom_page)); |
- gfx::Rect start_page_origin(GetOffscreenPageBounds(start_page)); |
+ gfx::Rect start_page_on_screen( |
+ contents_view()->GetOnscreenPageBounds(start_page)); |
+ gfx::Rect custom_page_on_screen( |
+ contents_view()->GetOnscreenPageBounds(custom_page)); |
+ gfx::Rect start_page_origin( |
+ contents_view()->GetOffscreenPageBounds(start_page)); |
gfx::Rect custom_page_origin(contents_view()->GetCustomPageCollapsedBounds()); |
gfx::Rect start_page_rect(gfx::Tween::RectValueBetween( |
progress, start_page_on_screen, start_page_origin)); |