Commit 414a2324 authored by Kazuki Takise's avatar Kazuki Takise Committed by Commit Bot

Show the auto-hide shelf if there is a single PIP window

This CL reverts https://crrev.com/c/1529500.

The reason why we hid the auto-hide shelf at the time is that we
didn't apply the collision detection logic to the PIP initial
bounds and the auto-hide shelf could overlap with PIP. Now that we
apply collision detection to the initial bounds, we can now revert
this CL.

Currently there are a few issues with PIP if the auto-hide shelf
gets hidden when there's a single PIP window.
- When you trigger PIP via minimize, the original window gets
  minimized first and the auto-hide shelf becomes shown, but soon
  after PIP shows up and the shelf becomes hidden again, which
  looks a bit weird.
- When PIP gets shown, the auto-hide shelf is still visible and
  then it gets hidden, but the PIP window doesn't move to the
  bottom as at this point the gravity is "to the right".

BUG=b:149889866
TEST=Manually confirmed the PIP interacts well with the auto-hide
TEST=shelf.

Change-Id: I643487b53b23931bdabd816a30c6337741d15fc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2065256Reviewed-by: default avatarEliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarStefan Kuhne <skuhne@chromium.org>
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743391}
parent a5ce0391
...@@ -846,10 +846,7 @@ bool ShelfLayoutManager::HasVisibleWindow() const { ...@@ -846,10 +846,7 @@ bool ShelfLayoutManager::HasVisibleWindow() const {
return true; return true;
} }
} }
auto* pip_container = Shell::GetContainer(root, kShellWindowId_PipContainer); return false;
// The PIP window is not activatable and is not in the MRU list, but count
// it as a visible window for shelf auto-hide purposes. See crbug.com/942991.
return !pip_container->children().empty();
} }
void ShelfLayoutManager::CancelDragOnShelfIfInProgress() { void ShelfLayoutManager::CancelDragOnShelfIfInProgress() {
......
...@@ -2374,8 +2374,8 @@ TEST_P(ShelfLayoutManagerTest, A11yAlertOnWorkspaceState) { ...@@ -2374,8 +2374,8 @@ TEST_P(ShelfLayoutManagerTest, A11yAlertOnWorkspaceState) {
client.last_a11y_alert()); client.last_a11y_alert());
} }
// Verifies the auto-hide shelf is hidden if there is only a single PIP window. // Verifies the auto-hide shelf is shown if there is only a single PIP window.
TEST_P(ShelfLayoutManagerTest, AutoHideShelfHiddenForSinglePipWindow) { TEST_P(ShelfLayoutManagerTest, AutoHideShelfShownForSinglePipWindow) {
Shelf* shelf = GetPrimaryShelf(); Shelf* shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
...@@ -2394,7 +2394,7 @@ TEST_P(ShelfLayoutManagerTest, AutoHideShelfHiddenForSinglePipWindow) { ...@@ -2394,7 +2394,7 @@ TEST_P(ShelfLayoutManagerTest, AutoHideShelfHiddenForSinglePipWindow) {
// Expect the shelf to be hidden. // Expect the shelf to be hidden.
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
} }
// Verifies that shelf components are placed properly in right-to-left UI. // Verifies that shelf components are placed properly in right-to-left UI.
......
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