Commit d0f0f9fe authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

overview gesture: No drag above the shelf.

Do not allow the drag if the drag position starts above the shelf.

Bug: 997885
Change-Id: Ifd5619cd28d96de889c28cd2c51fe67586224783
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880079Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709618}
parent f9978366
...@@ -2352,6 +2352,12 @@ void ShelfLayoutManager::MaybeStartDragWindowFromShelf( ...@@ -2352,6 +2352,12 @@ void ShelfLayoutManager::MaybeStartDragWindowFromShelf(
return; return;
} }
// If the start location is above the shelf (e.g., on the extended hotseat),
// do not allow the drag.
const gfx::Rect shelf_bounds = GetVisibleShelfBounds();
if (event_in_screen.location().y() < shelf_bounds.y())
return;
aura::Window* window = aura::Window* window =
GetWindowForDragToHomeOrOverview(event_in_screen.location()); GetWindowForDragToHomeOrOverview(event_in_screen.location());
if (!window) if (!window)
......
...@@ -3905,6 +3905,24 @@ TEST_F(ShelfLayoutManagerWindowDraggingTest, NoOpForHiddenShelf) { ...@@ -3905,6 +3905,24 @@ TEST_F(ShelfLayoutManagerWindowDraggingTest, NoOpForHiddenShelf) {
EndScroll(/*is_fling=*/false, 0.f); EndScroll(/*is_fling=*/false, 0.f);
} }
TEST_F(ShelfLayoutManagerWindowDraggingTest, NoOpIfDragStartsAboveShelf) {
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
Shelf* shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
SwipeUpOnShelf();
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
gfx::Rect hotseat_bounds =
GetShelfWidget()->hotseat_widget()->GetWindowBoundsInScreen();
StartScroll(hotseat_bounds.CenterPoint());
EXPECT_FALSE(GetShelfLayoutManager()->window_drag_controller_for_testing());
EndScroll(/*is_fling=*/false, 0.f);
}
class ShelfLayoutManagerKeyboardTest : public AshTestBase { class ShelfLayoutManagerKeyboardTest : public AshTestBase {
public: public:
ShelfLayoutManagerKeyboardTest() = default; ShelfLayoutManagerKeyboardTest() = default;
......
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