Commit 47d568d4 authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

Let client PIP windows be positioned off-screen.

didn't get stuck on the edge.

Bug: b/112572556
Test: exo_unittests and tried swipe-to-dismiss on a PIP window and it
Change-Id: I02626a004c6e2dfc7c64f077d77bea8edaa150c1
Reviewed-on: https://chromium-review.googlesource.com/1175748Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584275}
parent e882388d
......@@ -726,9 +726,15 @@ void ClientControlledShellSurface::CompositorLockTimedOut() {
// ShellSurfaceBase overrides:
void ClientControlledShellSurface::SetWidgetBounds(const gfx::Rect& bounds) {
// Android PIP windows can be dismissed by swiping off the screen. Let them be
// positioned off-screen. Apart from swipe to dismiss, the PIP window will
// be kept on screen.
// TODO(edcourtney): This should be done as a client controlled move, not
// a special case.
if (((!client_controlled_move_resize_ && !GetWindowState()->is_dragged()) ||
client_controlled_move_resize_) &&
!client_controlled_state_->set_bounds_locally()) {
!client_controlled_state_->set_bounds_locally() &&
!GetWindowState()->IsPip()) {
{
// Calculate a minimum window visibility required bounds.
aura::Window* window = widget_->GetNativeWindow();
......
......@@ -1686,4 +1686,29 @@ TEST_F(ClientControlledShellSurfaceTest, PipWindowCannotBeActivated) {
EXPECT_TRUE(shell_surface->GetWidget()->CanActivate());
}
TEST_F(ClientControlledShellSurfaceTest, MovingPipWindowOffDisplayIsAllowed) {
UpdateDisplay("500x500");
gfx::Size buffer_size(256, 256);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
std::unique_ptr<Surface> surface(new Surface);
auto shell_surface(
exo_test_helper()->CreateClientControlledShellSurface(surface.get()));
surface->Attach(buffer.get());
surface->Commit();
// Use the PIP window state type.
shell_surface->SetPip();
shell_surface->GetWidget()->Show();
// Set an off-screen geometry.
gfx::Rect bounds(-200, 0, 100, 100);
shell_surface->SetGeometry(bounds);
surface->Commit();
EXPECT_EQ(gfx::Rect(-200, 0, 100, 100),
shell_surface->GetWidget()->GetWindowBoundsInScreen());
}
} // namespace exo
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