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

Unified Diff: ash/wm/session_state_animator.cc

Issue 11419225: Decouple workspace animation from other actions on windows (e.g. hide/show), so that animations can… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge with ToT Created 8 years, 1 month 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 | « no previous file | ash/wm/workspace/workspace_animations.h » ('j') | ash/wm/workspace/workspace_animations.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/session_state_animator.cc
diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc
index b082c986f6e0d847dfd8fc39c5718999b06bb683..373e4c971f1e1691ef14012d8437ffe438d90201 100644
--- a/ash/wm/session_state_animator.cc
+++ b/ash/wm/session_state_animator.cc
@@ -12,6 +12,7 @@
#include "ui/aura/root_window.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/layer_animation_sequence.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/widget/widget.h"
namespace ash {
@@ -155,13 +156,30 @@ void HideWindow(aura::Window* window,
base::TimeDelta duration,
WorkspaceAnimationDirection direction,
ui::LayerAnimationObserver* observer) {
+ ui::LayerAnimator* animator = window->layer()->GetAnimator();
+
WorkspaceAnimationDetails details;
details.direction = direction;
details.animate = true;
details.animate_scale = true;
details.animate_opacity = true;
details.duration = duration;
- HideWorkspace(window, details);
+
+ const bool noforce = false;
+ const bool hide = false;
+
+ ui::ScopedLayerAnimationSettings settings(animator);
+ settings.SetTransitionDuration(duration);
+
+ SetWorkspaceAnimationTargetParameters(window, details, hide, noforce);
+
+ // After the animation completes snap the transform back to the identity,
+ // otherwise any one that asks for screen bounds gets a slightly scaled
+ // version.
+ settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
+ settings.SetTransitionDuration(base::TimeDelta());
+ window->layer()->SetTransform(gfx::Transform());
+
// A bit of a dirty trick: we need to catch the end of the animation we don't
// control. So we use two facts we know: which animator will be used and the
// target opacity to add "Do nothing" animation sequence.
@@ -172,20 +190,30 @@ void HideWindow(aura::Window* window,
0.0, base::TimeDelta()));
if (observer)
sequence->AddObserver(observer);
- window->layer()->GetAnimator()->ScheduleAnimation(sequence);
+ animator->ScheduleAnimation(sequence);
}
void ShowWindow(aura::Window* window,
- base::TimeDelta length,
+ base::TimeDelta duration,
WorkspaceAnimationDirection direction,
ui::LayerAnimationObserver* observer) {
+ ui::LayerAnimator* animator = window->layer()->GetAnimator();
+
WorkspaceAnimationDetails details;
details.direction = direction;
details.animate = true;
details.animate_scale = true;
details.animate_opacity = true;
- details.duration = length;
- ShowWorkspace(window, details);
+ details.duration = duration;
+
+ const bool noforce = false;
+ const bool show = true;
+
+ ui::ScopedLayerAnimationSettings settings(animator);
+ settings.SetTransitionDuration(duration);
+
+ SetWorkspaceAnimationTargetParameters(window, details, show, noforce);
+
// A bit of a dirty trick: we need to catch the end of the animation we don't
// control. So we use two facts we know: which animator will be used and the
// target opacity to add "Do nothing" animation sequence.
@@ -196,7 +224,7 @@ void ShowWindow(aura::Window* window,
1.0, base::TimeDelta()));
if (observer)
sequence->AddObserver(observer);
- window->layer()->GetAnimator()->ScheduleAnimation(sequence);
+ animator->ScheduleAnimation(sequence);
}
// Starts grayscale/brightness animation for |window| over |duration|. Target
« no previous file with comments | « no previous file | ash/wm/workspace/workspace_animations.h » ('j') | ash/wm/workspace/workspace_animations.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698