Commit 2ffd13b5 authored by Kevin Strohbehn's avatar Kevin Strohbehn Committed by Commit Bot

Scrolling Homecher on first/last page will no longer ignore events

Bug: 874202
Change-Id: I19db72345f8646ffa1100d2b51672990e12041e2
Reviewed-on: https://chromium-review.googlesource.com/1228998
Commit-Queue: Kevin Strohbehn <ginko@google.com>
Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592256}
parent 47241df2
...@@ -68,13 +68,8 @@ bool PaginationController::OnGestureEvent(const ui::GestureEvent& event, ...@@ -68,13 +68,8 @@ bool PaginationController::OnGestureEvent(const ui::GestureEvent& event,
float scroll = scroll_axis_ == SCROLL_AXIS_HORIZONTAL float scroll = scroll_axis_ == SCROLL_AXIS_HORIZONTAL
? details.scroll_x_hint() ? details.scroll_x_hint()
: details.scroll_y_hint(); : details.scroll_y_hint();
if (scroll == 0 || if (scroll == 0)
!pagination_model_->IsValidPageRelative(scroll < 0 ? 1 : -1)) {
// scroll > 0 means moving contents right or down. That is,
// transitioning to the previous page. If scrolling to an invalid page,
// do not handle this event.
return false; return false;
}
pagination_model_->StartScroll(); pagination_model_->StartScroll();
return true; return true;
} }
...@@ -82,6 +77,13 @@ bool PaginationController::OnGestureEvent(const ui::GestureEvent& event, ...@@ -82,6 +77,13 @@ bool PaginationController::OnGestureEvent(const ui::GestureEvent& event,
float scroll = scroll_axis_ == SCROLL_AXIS_HORIZONTAL float scroll = scroll_axis_ == SCROLL_AXIS_HORIZONTAL
? details.scroll_x() ? details.scroll_x()
: details.scroll_y(); : details.scroll_y();
if (!pagination_model_->IsValidPageRelative(scroll < 0 ? 1 : -1) &&
!pagination_model_->has_transition()) {
// scroll > 0 means moving contents right or down. That is,
// transitioning to the previous page. If scrolling to an invalid page,
// ignore the event until movement continues in a valid direction.
return true;
}
int width = scroll_axis_ == SCROLL_AXIS_HORIZONTAL ? bounds.width() int width = scroll_axis_ == SCROLL_AXIS_HORIZONTAL ? bounds.width()
: bounds.height(); : bounds.height();
pagination_model_->UpdateScroll(scroll / width); pagination_model_->UpdateScroll(scroll / width);
......
...@@ -1002,6 +1002,15 @@ void AppsGridView::OnGestureEvent(ui::GestureEvent* event) { ...@@ -1002,6 +1002,15 @@ void AppsGridView::OnGestureEvent(ui::GestureEvent* event) {
return; return;
} }
// If the event is a scroll down in clamshell mode on the first page, don't
// let |pagination_controller_| handle it. Unless it occurs in a folder.
if (!folder_delegate_ && event->type() == ui::ET_GESTURE_SCROLL_BEGIN &&
!contents_view_->app_list_view()->IsHomeLauncherEnabledInTabletMode() &&
pagination_model_.selected_page() == 0 &&
event->details().scroll_y_hint() > 0) {
return;
}
// Scroll begin events should not be passed to ancestor views if it occurs // Scroll begin events should not be passed to ancestor views if it occurs
// inside the folder bounds even it is not handled. This prevents user from // inside the folder bounds even it is not handled. This prevents user from
// closing the folder when scrolling inside it. // closing the folder when scrolling inside it.
......
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