| Index: ui/app_list/pagination_model.cc
|
| diff --git a/ui/app_list/pagination_model.cc b/ui/app_list/pagination_model.cc
|
| index 5e8d655a37580f5458b6b924b8fe09221412927d..f0b9bddc300718370e002dc79a3dc3ee422678a9 100644
|
| --- a/ui/app_list/pagination_model.cc
|
| +++ b/ui/app_list/pagination_model.cc
|
| @@ -177,6 +177,20 @@ void PaginationModel::RemoveObserver(PaginationModelObserver* observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| +int PaginationModel::SelectedTargetPage() const {
|
| + // If no animation, or animation is in reverse, just the selected page.
|
| + if (!transition_animation_ || !transition_animation_->IsShowing())
|
| + return selected_page_;
|
| +
|
| + // If, at the end of the current animation, we will animate to another page,
|
| + // return that eventual page.
|
| + if (pending_selected_page_ >= 0)
|
| + return pending_selected_page_;
|
| +
|
| + // Just the target of the current animation.
|
| + return transition_.target_page;
|
| +}
|
| +
|
| void PaginationModel::NotifySelectedPageChanged(int old_selected,
|
| int new_selected) {
|
| FOR_EACH_OBSERVER(PaginationModelObserver,
|
| @@ -194,14 +208,7 @@ void PaginationModel::NotifyTransitionChanged() {
|
|
|
| int PaginationModel::CalculateTargetPage(int delta) const {
|
| DCHECK_GT(total_pages_, 0);
|
| -
|
| - int current_page = selected_page_;
|
| - if (transition_animation_ && transition_animation_->IsShowing()) {
|
| - current_page = pending_selected_page_ >= 0 ?
|
| - pending_selected_page_ : transition_.target_page;
|
| - }
|
| -
|
| - const int target_page = current_page + delta;
|
| + const int target_page = SelectedTargetPage() + delta;
|
|
|
| int start_page = 0;
|
| int end_page = total_pages_ - 1;
|
|
|