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

Unified Diff: ash/wm/workspace/workspace_animations.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: Fixed Daniel's comments 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 | « ash/wm/window_animations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_animations.cc
diff --git a/ash/wm/workspace/workspace_animations.cc b/ash/wm/workspace/workspace_animations.cc
index 2abed13b3fa578e430bfd6ef2f4ccacb54163fe9..9a523ffaf32f7adecb4d3b122617b298c5d5d712 100644
--- a/ash/wm/workspace/workspace_animations.cc
+++ b/ash/wm/workspace/workspace_animations.cc
@@ -4,6 +4,7 @@
#include "ash/wm/workspace/workspace_animations.h"
+#include "ash/wm/window_animations.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
@@ -19,26 +20,6 @@ namespace {
// Tween type used when showing/hiding workspaces.
const ui::Tween::Type kWorkspaceTweenType = ui::Tween::EASE_OUT;
-// Scales for workspaces above/below current workspace.
-const float kWorkspaceScaleAbove = 1.1f;
-const float kWorkspaceScaleBelow = .9f;
-
-enum WorkspaceScaleType {
- WORKSPACE_SCALE_ABOVE,
- WORKSPACE_SCALE_BELOW,
-};
-
-// Applies the specified WorkspaceScaleType.
-void ApplyWorkspaceScale(ui::Layer* layer, WorkspaceScaleType type) {
- const float scale = type == WORKSPACE_SCALE_ABOVE ? kWorkspaceScaleAbove :
- kWorkspaceScaleBelow;
- gfx::Transform transform;
- transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2,
- -layer->bounds().height() * (scale - 1.0f) / 2);
- transform.Scale(scale, scale);
- layer->SetTransform(transform);
-}
-
// If |details.duration| is not-empty it is returned, otherwise
// |kWorkspaceSwitchTimeMS| is returned.
base::TimeDelta DurationForWorkspaceShowOrHide(
@@ -73,9 +54,9 @@ void ShowWorkspace(aura::Window* window,
window->layer()->SetOpacity(details.animate_opacity ? 0.0f : 1.0f);
if (details.animate_scale) {
- ApplyWorkspaceScale(window->layer(),
- details.direction == WORKSPACE_ANIMATE_UP ?
- WORKSPACE_SCALE_BELOW : WORKSPACE_SCALE_ABOVE);
+ SetTransformForScaleAnimation(window->layer(),
+ details.direction == WORKSPACE_ANIMATE_UP ?
+ LAYER_SCALE_ANIMATION_BELOW : LAYER_SCALE_ANIMATION_BELOW);
} else {
window->layer()->SetTransform(gfx::Transform());
}
@@ -130,9 +111,9 @@ void HideWorkspace(aura::Window* window,
settings.SetTransitionDuration(DurationForWorkspaceShowOrHide(details));
settings.SetTweenType(kWorkspaceTweenType);
if (details.animate_scale) {
- ApplyWorkspaceScale(window->layer(),
- details.direction == WORKSPACE_ANIMATE_UP ?
- WORKSPACE_SCALE_ABOVE : WORKSPACE_SCALE_BELOW);
+ SetTransformForScaleAnimation(window->layer(),
+ details.direction == WORKSPACE_ANIMATE_UP ?
+ LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
} else {
window->layer()->SetTransform(gfx::Transform());
}
« no previous file with comments | « ash/wm/window_animations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698