Commit 610520d0 authored by calamity's avatar calamity Committed by Commit bot

Fix janky experimental app list animation.

This CL fixes an issue where the experimental app list animation from
the start page to the custom launcher page was janky because the bounds
were being calculated incorrectly. This CL fixes the animation to use
the size of the view being animated rather than the entire contents
bounds.

BUG=None

Review URL: https://codereview.chromium.org/901133003

Cr-Commit-Position: refs/heads/master@{#314980}
parent 3d7ea50b
......@@ -27,21 +27,23 @@ ContentsAnimator::~ContentsAnimator() {
}
gfx::Rect ContentsAnimator::GetOnscreenPageBounds(int page_index) const {
return contents_view_->IsStateActive(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)
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(contents_view_->GetContentsBounds());
gfx::Rect bounds(GetOnscreenPageBounds(page_index));
// The start page and search page origins are above; all other pages' origins
// are below.
int page_height = bounds.height();
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 ? -page_height : page_height);
bounds.set_y(origin_above
? -bounds.height()
: contents_view_->GetContentsBounds().height() + bounds.y());
return bounds;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment