Commit df6e1cbc authored by Kazuki Takise's avatar Kazuki Takise Committed by Commit Bot

Don't apply bounds change animation to the first bounds change of PIP resize

The current scenario is as follows:
1. Just before PIP resize, the next animation type is set
   kAnimationAnimated.
2. If the bounds doesn't change, the next animation type remains
   kAnimationAnimated.
3. PIP resize is started and window geometry and viewport are sent
   from Android before the first commit of PIP resize.
4. On the first commit, as the next animation type is set
   kAnimationAnimated, window geometry is applied with animation
   enabled, but viewport is applied immediately, so we observe a
   glitch for one frame.

This CL changes it so that we make sure to set kAnimationNone once
PIP resize has started.

at the start of resize.

Bug: b/142105182
Test: Resized PIP window and confirmed I didn't observe a glitch
Change-Id: Ie61db4fe86891d5d10654d3c44b6dfe6cb7b1730
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1850684
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Reviewed-by: default avatarEliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706746}
parent 591e7d92
......@@ -973,10 +973,10 @@ bool ClientControlledShellSurface::OnPreWidgetCommit() {
state_changed_ = window_state->GetStateType() != pending_window_state_;
if (!state_changed_) {
// Animate PIP window movement unless it is being dragged.
if (window_state->IsPip() && !window_state->is_dragged()) {
client_controlled_state_->set_next_bounds_change_animation_type(
ash::ClientControlledState::kAnimationAnimated);
}
client_controlled_state_->set_next_bounds_change_animation_type(
window_state->IsPip() && !window_state->is_dragged()
? ash::ClientControlledState::kAnimationAnimated
: ash::ClientControlledState::kAnimationNone);
return true;
}
......
......@@ -2012,6 +2012,39 @@ TEST_F(ClientControlledShellSurfaceTest, PipWindowDragDoesNotAnimate) {
resizer->CompleteDrag();
}
TEST_F(ClientControlledShellSurfaceTest,
PipWindowDragDoesNotAnimateWithExtraCommit) {
const 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());
shell_surface->SetGeometry(gfx::Rect(buffer_size));
surface->Attach(buffer.get());
surface->Commit();
shell_surface->SetPip();
surface->Commit();
shell_surface->GetWidget()->Show();
// Making an extra commit may set the next bounds change animation type
// wrongly.
surface->Commit();
aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
EXPECT_EQ(gfx::Rect(0, 0, 256, 256), window->layer()->GetTargetBounds());
EXPECT_EQ(gfx::Rect(0, 0, 256, 256), window->layer()->bounds());
ui::ScopedAnimationDurationScaleMode animation_scale_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
std::unique_ptr<ash::WindowResizer> resizer(ash::CreateWindowResizer(
window, gfx::Point(), HTCAPTION, ::wm::WINDOW_MOVE_SOURCE_MOUSE));
resizer->Drag(gfx::Point(10, 10), 0);
EXPECT_EQ(gfx::Rect(10, 10, 256, 256), window->layer()->GetTargetBounds());
EXPECT_EQ(gfx::Rect(10, 10, 256, 256), window->layer()->bounds());
EXPECT_FALSE(window->layer()->GetAnimator()->is_animating());
resizer->CompleteDrag();
}
TEST_F(ClientControlledShellSurfaceTest,
ExpandingPipInTabletModeEndsSplitView) {
EnableTabletMode(true);
......
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