Commit 172d2393 authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

Do not do bounds change animation for a to-be-snapped window if ...

... the window has an un-identity transform in place.

This is to fix the animation when snapping an overview window in clamshell mode.

Bug: 890029
TEST: Manually
Change-Id: I5d05eee296b16a5b84da10bfbad848c78969c8a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1731697
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: default avatarMitsuru Oshima (OOO 8/12,13) <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686477}
parent 94c26596
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/presentation_time_recorder.h" #include "ash/public/cpp/presentation_time_recorder.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/scoped_animation_disabler.h"
#include "ash/screen_util.h" #include "ash/screen_util.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -406,6 +407,14 @@ void SplitViewController::SnapWindow(aura::Window* window, ...@@ -406,6 +407,14 @@ void SplitViewController::SnapWindow(aura::Window* window,
} }
} }
// Disable the bounds change animation for a to-be-snapped window if the
// window has an un-identity transform. We'll do transform animation for the
// window in OnWindowSnapped() function.
std::unique_ptr<ScopedAnimationDisabler> animation_disabler;
auto iter = snapping_window_transformed_bounds_map_.find(window);
if (iter != snapping_window_transformed_bounds_map_.end())
animation_disabler = std::make_unique<ScopedAnimationDisabler>(window);
if (WindowState::Get(window)->GetStateType() == if (WindowState::Get(window)->GetStateType() ==
GetStateTypeFromSnapPosition(snap_position)) { GetStateTypeFromSnapPosition(snap_position)) {
// Update its snapped bounds as its bounds may not be the expected snapped // Update its snapped bounds as its bounds may not be the expected snapped
...@@ -1207,6 +1216,13 @@ void SplitViewController::StopObserving(SnapPosition snap_position) { ...@@ -1207,6 +1216,13 @@ void SplitViewController::StopObserving(SnapPosition snap_position) {
if (split_view_divider_) if (split_view_divider_)
split_view_divider_->RemoveObservedWindow(window); split_view_divider_->RemoveObservedWindow(window);
Shell::Get()->shadow_controller()->UpdateShadowForWindow(window); Shell::Get()->shadow_controller()->UpdateShadowForWindow(window);
// It's possible that when we try to snap an ARC app window, while we are
// waiting for its state/bounds to the expected state/bounds, another window
// snap request comes in and causing the previous to-be-snapped window to
// be un-observed, in this case we should restore the previous to-be-snapped
// window's transform if it's unidentity.
RestoreTransformIfApplicable(window);
} }
} }
...@@ -1685,8 +1701,6 @@ gfx::Point SplitViewController::GetEndDragLocationInScreen( ...@@ -1685,8 +1701,6 @@ gfx::Point SplitViewController::GetEndDragLocationInScreen(
} }
void SplitViewController::RestoreTransformIfApplicable(aura::Window* window) { void SplitViewController::RestoreTransformIfApplicable(aura::Window* window) {
DCHECK(IsWindowInSplitView(window));
// If the transform of the window has been changed, calculate a good starting // If the transform of the window has been changed, calculate a good starting
// transform based on its transformed bounds before to be snapped. // transform based on its transformed bounds before to be snapped.
auto iter = snapping_window_transformed_bounds_map_.find(window); auto iter = snapping_window_transformed_bounds_map_.find(window);
......
...@@ -498,8 +498,6 @@ void TabletModeWindowState::UpdateBounds(WindowState* window_state, ...@@ -498,8 +498,6 @@ void TabletModeWindowState::UpdateBounds(WindowState* window_state,
// avoid flashing. // avoid flashing.
if (window_state->IsMaximized()) if (window_state->IsMaximized())
window_state->SetBoundsDirectCrossFade(bounds_in_parent); window_state->SetBoundsDirectCrossFade(bounds_in_parent);
else if (window_state->IsSnapped())
window_state->SetBoundsDirect(bounds_in_parent);
else else
window_state->SetBoundsDirectAnimated(bounds_in_parent); window_state->SetBoundsDirectAnimated(bounds_in_parent);
} }
......
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