Commit aa8d4214 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Shelf: Fix an issue where the hotseat couldn't be dragged up in split view

Also add a test.

Bug: 1018363
Change-Id: I99b2a24b7cd292ac1ec3963d0ebdb343591a5a00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881231
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Auto-Submit: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709966}
parent 2c96e49c
......@@ -1050,11 +1050,6 @@ HotseatState ShelfLayoutManager::CalculateHotseatState(
in_split_view =
split_view_controller && split_view_controller->InSplitViewMode();
}
// If we're in split view, we never show the hotseat no matter what.
if (in_split_view)
return HotseatState::kHidden;
switch (drag_status_) {
case kDragNone: {
switch (app_list_controller->home_launcher_animation_state()) {
......@@ -1065,6 +1060,8 @@ HotseatState ShelfLayoutManager::CalculateHotseatState(
case AppListControllerImpl::HomeLauncherAnimationState::kFinished:
if (app_list_controller->IsVisible())
return HotseatState::kShown;
if (in_split_view)
return HotseatState::kHidden;
if (in_overview)
return HotseatState::kExtended;
if (visibility_state == SHELF_AUTO_HIDE) {
......@@ -1601,26 +1598,21 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
}
int hotseat_y = 0;
if (!Shell::Get()->overview_controller() ||
!Shell::Get()->overview_controller()->InOverviewSession() ||
window_drag_controller_) {
const int hotseat_extended_y =
Shell::Get()->shelf_config()->hotseat_size() +
Shell::Get()->shelf_config()->hotseat_bottom_padding();
const int hotseat_baseline =
(state_.hotseat_state == HotseatState::kExtended)
? -hotseat_extended_y
: shelf_size;
bool use_hotseat_baseline =
(state_.hotseat_state == HotseatState::kExtended &&
visibility_state() == SHELF_AUTO_HIDE) ||
(state_.hotseat_state == HotseatState::kHidden &&
visibility_state() != SHELF_AUTO_HIDE);
hotseat_y = std::max(
-hotseat_extended_y,
static_cast<int>((use_hotseat_baseline ? hotseat_baseline : 0) +
translate));
}
const int hotseat_extended_y =
Shell::Get()->shelf_config()->hotseat_size() +
Shell::Get()->shelf_config()->hotseat_bottom_padding();
const int hotseat_baseline =
(state_.hotseat_state == HotseatState::kExtended) ? -hotseat_extended_y
: shelf_size;
bool use_hotseat_baseline =
(state_.hotseat_state == HotseatState::kExtended &&
visibility_state() == SHELF_AUTO_HIDE) ||
(state_.hotseat_state == HotseatState::kHidden &&
visibility_state() != SHELF_AUTO_HIDE);
hotseat_y = std::max(
-hotseat_extended_y,
static_cast<int>((use_hotseat_baseline ? hotseat_baseline : 0) +
translate));
target_bounds->hotseat_bounds_in_shelf.set_y(hotseat_y);
return;
}
......
......@@ -3525,6 +3525,27 @@ TEST_P(HotseatShelfLayoutManagerTest, GestureDraggingActiveWindowHidesHotseat) {
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
}
// Tests that a swipe up on the shelf shows the hotseat while in split view.
TEST_F(HotseatShelfLayoutManagerTest, SwipeUpOnShelfShowsHotseatInSplitView) {
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// Go into split view mode by first going into overview, and then snapping
// the open window on one side.
OverviewController* overview_controller = Shell::Get()->overview_controller();
overview_controller->StartOverview();
SplitViewController* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow());
split_view_controller->SnapWindow(window.get(), SplitViewController::LEFT);
EXPECT_TRUE(split_view_controller->InSplitViewMode());
// We should still be able to drag up the hotseat.
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
}
// Tests that releasing the hotseat gesture below the threshold results in a
// kHidden hotseat when the shelf is shown.
TEST_F(HotseatShelfLayoutManagerTest, ReleasingSlowDragBelowThreshold) {
......
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