Commit 5e725364 authored by Kazuki Takise's avatar Kazuki Takise Committed by Commit Bot

Don't apply collision detection to non-initial PIP bounds change

We adjust PIP initial bounds in exo as Android isn't aware of some
Chrome OS System UI
We should apply this logic only to the PIP initial bounds. Otherwise,
the obsolete bounds might be applied incorrectly for display
rotation, PIP fling, etc.

Whether it's entering PIP or not can be checked by whether the snap
fraction is set or not as the snap fraction is set when the initial
bounds is actually applied to the window in ClientControlledState.

BUG=b:149889040
BUG=b:149875362
TEST=Manually confirmed PIP fling and screen rotation put PIP to
the correct position.

Change-Id: I0f988b1ed6467c6d7a005bb1b0abc6e220277c5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2081650
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746646}
parent e83e16f3
......@@ -881,7 +881,13 @@ void ClientControlledShellSurface::SetWidgetBounds(const gfx::Rect& bounds) {
if (!is_display_move_pending) {
ash::ClientControlledState::AdjustBoundsForMinimumWindowVisibility(
target_display.work_area(), &adjusted_bounds);
if (GetWindowState()->IsPip() && !GetWindowState()->is_dragged()) {
// Collision detection to the bounds set by Android should be applied only
// to initial bounds. Do not adjust new bounds as it can be obsolete or in
// transit during animation, which results in incorrect resting postiion.
// The resting position should be fully controlled by chrome afterwards
// because Android isn't aware of Chrome OS System UI.
if (GetWindowState()->IsPip() &&
!ash::PipPositioner::HasSnapFraction(GetWindowState())) {
adjusted_bounds = ash::CollisionDetectionUtils::GetRestingPosition(
target_display, adjusted_bounds,
ash::CollisionDetectionUtils::RelativePriority::kPictureInPicture);
......
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