Commit 83634882 authored by Ana Salazar's avatar Ana Salazar Committed by Commit Bot

Cros: Change bounds of expand arrow tap target

Changed to match the app list spec.

Bug: 1002139
Change-Id: I2a9c4814bf3f54f53f1f4e286d9680b130f917ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880075
Commit-Queue: Ana Salazar <anasalazar@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709612}
parent 34df39f3
......@@ -405,16 +405,24 @@ TEST_F(AppListControllerImplTest, CloseNotificationWithAppListShown) {
// expand view arrow. (see https://crbug.com/906858)
TEST_F(AppListControllerImplTest,
EnterFullScreenModeAfterTappingNearExpandArrow) {
// The bounds for the tap target of the expand arrow button, taken from
// expand_arrow_view.cc |kTapTargetWidth| and |kTapTargetHeight|.
constexpr int tapping_width = 156;
constexpr int tapping_height = 72;
ShowAppListNow();
ASSERT_EQ(ash::AppListViewState::kPeeking,
GetAppListView()->app_list_state());
// Get in screen bounds of arrow
const gfx::Rect expand_arrow = GetAppListView()
->app_list_main_view()
->contents_view()
->expand_arrow_view()
->GetBoundsInScreen();
gfx::Rect expand_arrow = GetAppListView()
->app_list_main_view()
->contents_view()
->expand_arrow_view()
->GetBoundsInScreen();
const int horizontal_padding = (tapping_width - expand_arrow.width()) / 2;
const int vertical_padding = (tapping_height - expand_arrow.height()) / 2;
expand_arrow.Inset(-horizontal_padding, -vertical_padding);
// Tap expand arrow icon and check that full screen apps view is entered.
ui::test::EventGenerator* event_generator = GetEventGenerator();
......@@ -426,14 +434,15 @@ TEST_F(AppListControllerImplTest,
DismissAppListNow();
base::RunLoop().RunUntilIdle();
// Re-enter peeking mode and test that tapping near (but not directly on)
// the expand arrow icon still brings up full app list view.
// Re-enter peeking mode and test that tapping on one of the bounds of the
// tap target for the expand arrow icon still brings up full app list
// view.
ShowAppListNow();
ASSERT_EQ(ash::AppListViewState::kPeeking,
GetAppListView()->app_list_state());
event_generator->GestureTapAt(
gfx::Point(expand_arrow.top_right().x(), expand_arrow.top_right().y()));
event_generator->GestureTapAt(gfx::Point(expand_arrow.top_right().x() - 1,
expand_arrow.top_right().y() + 1));
ASSERT_EQ(ash::AppListViewState::kFullscreenAllApps,
GetAppListView()->app_list_state());
......
......@@ -81,6 +81,10 @@ constexpr SkColor kInkDropRippleColor = SkColorSetARGB(0x14, 0xFF, 0xFF, 0xFF);
constexpr SkColor kFocusRingColor = gfx::kGoogleBlue300;
constexpr int kFocusRingWidth = 2;
// THe bounds for the tap target of the expand arrow button.
constexpr int kTapTargetWidth = 156;
constexpr int kTapTargetHeight = 72;
} // namespace
ExpandArrowView::ExpandArrowView(ContentsView* contents_view,
......@@ -392,10 +396,10 @@ bool ExpandArrowView::DoesIntersectRect(const views::View* target,
gfx::Rect button_bounds = GetLocalBounds();
// Increase clickable area for the button from
// (kTileWidth x height) to
// (3 * height - width).
int horizontal_padding =
button_bounds.width() - (button_bounds.height() * 1.5);
button_bounds.Inset(gfx::Insets(0, horizontal_padding));
// (kTapTargetWidth x kTapTargetHeight).
const int horizontal_padding = (kTapTargetWidth - button_bounds.width()) / 2;
const int vertical_padding = (kTapTargetHeight - button_bounds.height()) / 2;
button_bounds.Inset(-horizontal_padding, -vertical_padding);
return button_bounds.Intersects(rect);
}
......
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