Commit 30048681 authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

Cros splitscreen: Ignore the window bounds change transition transform if the...

Cros splitscreen: Ignore the window bounds change transition transform if the window is in overview mode.

Bug: 817557
Change-Id: Ibb1a048261a97fb9265e9b4330b3bbf9f21a65c8
Reviewed-on: https://chromium-review.googlesource.com/942090
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540386}
parent b96abb85
...@@ -164,9 +164,9 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) { ...@@ -164,9 +164,9 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
base::TimeDelta::FromSeconds(1)); base::TimeDelta::FromSeconds(1));
} }
// Tests that when crossfading from a window which has a transform that the // Tests that when crossfading from a window which has a transform, the cross
// crossfade starts from this transformed size rather than snapping the window // fading animation should be ignored and the window should set to its desired
// to an identity transform and crossfading from there. // bounds directly.
TEST_F(WindowAnimationsTest, CrossFadeToBoundsFromTransform) { TEST_F(WindowAnimationsTest, CrossFadeToBoundsFromTransform) {
ui::ScopedAnimationDurationScaleMode test_duration_mode( ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
...@@ -185,23 +185,13 @@ TEST_F(WindowAnimationsTest, CrossFadeToBoundsFromTransform) { ...@@ -185,23 +185,13 @@ TEST_F(WindowAnimationsTest, CrossFadeToBoundsFromTransform) {
// Cross fade to a larger size, as in a maximize animation. // Cross fade to a larger size, as in a maximize animation.
GetWindowState(window.get()) GetWindowState(window.get())
->SetBoundsDirectCrossFade(gfx::Rect(0, 0, 640, 480)); ->SetBoundsDirectCrossFade(gfx::Rect(0, 0, 640, 480));
// Window's layer has been replaced. // Window's layer has not been replaced.
EXPECT_NE(old_layer, window->layer()); EXPECT_EQ(old_layer, window->layer());
// Original layer stays opaque and stretches to new size. // Original layer stays opaque and set to new size directly.
EXPECT_EQ(1.0f, old_layer->GetTargetOpacity()); EXPECT_EQ(1.0f, old_layer->GetTargetOpacity());
EXPECT_EQ("10,10 320x240", old_layer->bounds().ToString()); EXPECT_EQ("0,0 640x480", old_layer->bounds().ToString());
// Window still has its old transform before crossfading animation.
EXPECT_EQ(half_size, old_layer->transform()); EXPECT_EQ(half_size, old_layer->transform());
// New layer animates in from the old window's transformed size to the
// identity transform.
EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
// Set up the transform necessary to start at the old windows transformed
// position.
gfx::Transform quarter_size_shifted;
quarter_size_shifted.Translate(20, 20);
quarter_size_shifted.Scale(0.25f, 0.25f);
EXPECT_EQ(quarter_size_shifted, window->layer()->transform());
EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform());
} }
} // namespace wm } // namespace wm
......
...@@ -619,6 +619,13 @@ void WindowState::SetBoundsDirectCrossFade(const gfx::Rect& new_bounds) { ...@@ -619,6 +619,13 @@ void WindowState::SetBoundsDirectCrossFade(const gfx::Rect& new_bounds) {
return; return;
} }
// If the window already has a transform in place, do not use the cross fade
// animation, set the bounds directly instead.
if (!window_->layer()->GetTargetTransform().IsIdentity()) {
SetBoundsDirect(new_bounds);
return;
}
// Create fresh layers for the window and all its children to paint into. // Create fresh layers for the window and all its children to paint into.
// Takes ownership of the old layer and all its children, which will be // Takes ownership of the old layer and all its children, which will be
// cleaned up after the animation completes. // cleaned up after the animation completes.
......
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