Skip to content

Commit

Permalink
Fix the broken page flip zone in app list
Browse files Browse the repository at this point in the history
Background:
Recently, apps grid view's bounds changed. Also the shelf can be set
auto-hidden so that the display work area is always full screen even
when the shelf is visible. Thus, incorrect bounds are checked for
page flip during dragging.

Change:
Change the page flip zone to make the page flip only happen when drag
point is between the bottom of apps grid view and the top of bottom
shelf.

BUG=840021

Change-Id: Ia7f1be3ff6a2ae04bc41d43391ab9f525efd1b90
Reviewed-on: https://chromium-review.googlesource.com/1045611
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556485}
  • Loading branch information
Weidong Guo authored and Commit Bot committed May 7, 2018
1 parent d7e9702 commit 788685a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ui/app_list/views/app_list_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ class APP_LIST_EXPORT AppListView : public views::WidgetDelegateView,

bool is_tablet_mode() const { return is_tablet_mode_; }

bool is_side_shelf() const { return is_side_shelf_; }

bool is_in_drag() const { return is_in_drag_; }

int app_list_y_position_in_screen() const {
Expand Down
11 changes: 8 additions & 3 deletions ui/app_list/views/apps_grid_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2204,9 +2204,14 @@ bool AppsGridView::IsPointWithinBottomDragBuffer(
display::Screen::GetScreen()->GetDisplayNearestView(
GetWidget()->GetNativeView());

return point_in_screen.y() >
GetBoundsInScreen().height() - kPageFlipZoneSize &&
point_in_screen.y() < display.work_area().height();
const int kBottomDragBufferMin =
GetBoundsInScreen().bottom() - kPageFlipZoneSize;
const int kBottomDragBufferMax =
display.bounds().bottom() -
(contents_view_->app_list_view()->is_side_shelf() ? 0 : kShelfSize);

return point_in_screen.y() > kBottomDragBufferMin &&
point_in_screen.y() < kBottomDragBufferMax;
}

void AppsGridView::ButtonPressed(views::Button* sender,
Expand Down

0 comments on commit 788685a

Please sign in to comment.