Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: ash/wm/base_layout_manager.cc

Issue 10454107: Revert 139494 - ash: Improved window maximize/restore animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/base_layout_manager.h ('k') | ash/wm/window_animations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/base_layout_manager.cc
===================================================================
--- ash/wm/base_layout_manager.cc (revision 139956)
+++ ash/wm/base_layout_manager.cc (working copy)
@@ -4,14 +4,12 @@
#include "ash/wm/base_layout_manager.h"
-#include "ash/ash_switches.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
-#include "base/command_line.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -77,7 +75,7 @@
// Only update the bounds if the window has a show state that depends on the
// workspace area.
if (wm::IsWindowMaximized(child) || wm::IsWindowFullscreen(child))
- UpdateBoundsFromShowState(child, false);
+ UpdateBoundsFromShowState(child);
}
void BaseLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
@@ -100,9 +98,14 @@
void BaseLayoutManager::SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) {
- // Just set the bounds immediately. We fix up maximized and fullscreen
- // bounds in OnWindowAddedToLayout() above.
- SetChildBoundsDirect(child, requested_bounds);
+ gfx::Rect child_bounds(requested_bounds);
+ // Avoid a janky resize on startup by ensuring the initial bounds fill the
+ // screen.
+ if (wm::IsWindowMaximized(child))
+ child_bounds = ScreenAsh::GetMaximizedWindowBounds(child);
+ else if (wm::IsWindowFullscreen(child))
+ child_bounds = gfx::Screen::GetMonitorNearestWindow(child).bounds();
+ SetChildBoundsDirect(child, child_bounds);
}
/////////////////////////////////////////////////////////////////////////////
@@ -127,7 +130,7 @@
const void* key,
intptr_t old) {
if (key == aura::client::kShowStateKey) {
- UpdateBoundsFromShowState(window, true);
+ UpdateBoundsFromShowState(window);
ShowStateChanged(window, static_cast<ui::WindowShowState>(old));
}
}
@@ -164,15 +167,13 @@
}
}
-void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window,
- bool animate) {
+void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window) {
switch (window->GetProperty(aura::client::kShowStateKey)) {
case ui::SHOW_STATE_DEFAULT:
case ui::SHOW_STATE_NORMAL: {
const gfx::Rect* restore = GetRestoreBounds(window);
if (restore) {
- MaybeAnimateToBounds(window,
- animate,
+ SetChildBoundsDirect(window,
BoundsWithScreenEdgeVisible(window, *restore));
}
window->ClearProperty(aura::client::kRestoreBoundsKey);
@@ -181,17 +182,13 @@
case ui::SHOW_STATE_MAXIMIZED:
SetRestoreBoundsIfNotSet(window);
- MaybeAnimateToBounds(window,
- animate,
- ScreenAsh::GetMaximizedWindowBounds(window));
+ SetChildBoundsDirect(window, ScreenAsh::GetMaximizedWindowBounds(window));
break;
case ui::SHOW_STATE_FULLSCREEN:
SetRestoreBoundsIfNotSet(window);
- MaybeAnimateToBounds(
- window,
- animate,
- gfx::Screen::GetMonitorNearestWindow(window).bounds());
+ SetChildBoundsDirect(
+ window, gfx::Screen::GetMonitorNearestWindow(window).bounds());
break;
default:
@@ -199,20 +196,6 @@
}
}
-void BaseLayoutManager::MaybeAnimateToBounds(aura::Window* window,
- bool animate,
- const gfx::Rect& new_bounds) {
- // Only animate visible windows.
- if (animate &&
- window->TargetVisibility() &&
- !CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAshWindowAnimationsDisabled)) {
- CrossFadeToBounds(window, new_bounds);
- return;
- }
- SetChildBoundsDirect(window, new_bounds);
-}
-
void BaseLayoutManager::AdjustWindowSizesForScreenChange() {
// If a user plugs an external monitor into a laptop running Aura the
// monitor size will change. Maximized windows need to resize to match.
« no previous file with comments | « ash/wm/base_layout_manager.h ('k') | ash/wm/window_animations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698