Commit 5decbd7f authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Fix animation issue when activating second app window from shelf

Changes:
When an active window exists, clicking on shelf item to activate another
window should not run slide down animation.

Bug: 896908
Change-Id: Ifd037b139da44bac3d05c3c88dd5c7f044f7d898
Reviewed-on: https://chromium-review.googlesource.com/c/1292050
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601287}
parent 111df5ad
......@@ -593,12 +593,21 @@ bool HomeLauncherGestureHandler::SetUpWindows(Mode mode, aura::Window* window) {
const bool overview_active =
Shell::Get()->window_selector_controller()->IsSelecting();
const bool split_view_active = split_view_controller->IsSplitViewModeActive();
auto windows = Shell::Get()->mru_window_tracker()->BuildWindowForCycleList();
if (window && (mode != Mode::kSlideDownToHide || overview_active ||
split_view_active)) {
window_ = nullptr;
return false;
}
if (window && !windows.empty() && windows[0] != window &&
windows[0]->IsVisible()) {
// Do not run slide down animation for the |window| if another active window
// in mru list exists.
window_ = nullptr;
return false;
}
if (Shell::Get()
->app_list_controller()
->IsHomeLauncherEnabledInTabletMode() &&
......@@ -611,7 +620,6 @@ bool HomeLauncherGestureHandler::SetUpWindows(Mode mode, aura::Window* window) {
// Always hide split view windows if they exist. Otherwise, hide the specified
// window if it is not null. If non of above is true, we want the first window
// in the mru list, if it exists and is usable.
auto windows = Shell::Get()->mru_window_tracker()->BuildWindowForCycleList();
window_ = split_view_active
? split_view_controller->GetDefaultSnappedWindow()
: (window ? window : (windows.empty() ? nullptr : windows[0]));
......
......@@ -231,7 +231,7 @@ void AnimateHideWindow_BrightnessGrayscale(aura::Window* window) {
AnimateShowHideWindowCommon_BrightnessGrayscale(window, false);
}
void AnimateShowWindow_SlideDown(aura::Window* window) {
bool AnimateShowWindow_SlideDown(aura::Window* window) {
AppListControllerImpl* app_list_controller =
Shell::Get()->app_list_controller();
......@@ -249,18 +249,18 @@ void AnimateShowWindow_SlideDown(aura::Window* window) {
// style to default so that normal animation applies.
::wm::SetWindowVisibilityAnimationType(
window, ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT);
return;
return true;
}
}
// Fallback to use minimize animation.
AnimateShowWindow_Minimize(window);
// Fallback to no animation.
return false;
}
void AnimateHideWindow_SlideDown(aura::Window* window) {
bool AnimateHideWindow_SlideDown(aura::Window* window) {
// The hide animation should be handled in HomeLauncherGestureHandler, so
// fallback to use minimize animation here.
AnimateHideWindow_Minimize(window);
// fallback to no animation.
return false;
}
bool AnimateShowWindow(aura::Window* window) {
......@@ -277,8 +277,7 @@ bool AnimateShowWindow(aura::Window* window) {
AnimateShowWindow_BrightnessGrayscale(window);
return true;
case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_SLIDE_DOWN:
AnimateShowWindow_SlideDown(window);
return true;
return AnimateShowWindow_SlideDown(window);
default:
NOTREACHED();
return false;
......@@ -299,8 +298,7 @@ bool AnimateHideWindow(aura::Window* window) {
AnimateHideWindow_BrightnessGrayscale(window);
return true;
case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_SLIDE_DOWN:
AnimateHideWindow_SlideDown(window);
return true;
return AnimateHideWindow_SlideDown(window);
default:
NOTREACHED();
return false;
......
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