Commit e7e6db61 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

wm: cleanup: Merge wm_window_animations into window_animations.

Test: none
Bug: none
Change-Id: Ibc087b3fb0579ea3980ecb03a92b1e2133aa8d7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2258856
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781583}
parent 6d2490cf
......@@ -1464,8 +1464,6 @@ component("ash") {
"wm/wm_highlight_item_border.h",
"wm/wm_shadow_controller_delegate.cc",
"wm/wm_shadow_controller_delegate.h",
"wm/wm_window_animations.cc",
"wm/wm_window_animations.h",
"wm/work_area_insets.cc",
"wm/work_area_insets.h",
"wm/workspace/backdrop_controller.cc",
......
......@@ -10,7 +10,7 @@
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "ash/wm/wm_window_animations.h"
#include "ash/wm/window_animations.h"
#include "base/barrier_closure.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window_event_dispatcher.h"
......
......@@ -382,6 +382,22 @@ void CrossFadeAnimationInternal(
} // namespace
void SetTransformForScaleAnimation(ui::Layer* layer,
LayerScaleAnimationDirection type) {
// Scales for windows above and below the current workspace.
constexpr float kLayerScaleAboveSize = 1.1f;
constexpr float kLayerScaleBelowSize = .9f;
const float scale = type == LAYER_SCALE_ANIMATION_ABOVE
? kLayerScaleAboveSize
: kLayerScaleBelowSize;
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);
}
void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
// Recalculate the transform at restore time since the launcher item may have
// moved while the window was minimized.
......
......@@ -20,9 +20,21 @@ class LayerTreeOwner;
}
// This is only for animations specific to Ash. For window animations shared
// with desktop Chrome, see ui/views/corewm/window_animations.h.
// with desktop Chrome, see ui/wm/core/window_animations.h.
namespace ash {
// Direction for ash-specific window animations used in workspaces and
// lock/unlock animations.
enum LayerScaleAnimationDirection {
LAYER_SCALE_ANIMATION_ABOVE,
LAYER_SCALE_ANIMATION_BELOW,
};
// Applies scale related to the specified LayerScaleAnimationDirection.
ASH_EXPORT void SetTransformForScaleAnimation(
ui::Layer* layer,
LayerScaleAnimationDirection type);
// Implementation of cross fading. Window is the window being cross faded. It
// should be at the target bounds. |old_layer_owner| contains the previous layer
// from |window|.
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/wm_window_animations.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/transform.h"
namespace ash {
void SetTransformForScaleAnimation(ui::Layer* layer,
LayerScaleAnimationDirection type) {
// Scales for windows above and below the current workspace.
const float kLayerScaleAboveSize = 1.1f;
const float kLayerScaleBelowSize = .9f;
const float scale = type == LAYER_SCALE_ANIMATION_ABOVE
? kLayerScaleAboveSize
: kLayerScaleBelowSize;
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);
}
} // namespace ash
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_WM_WINDOW_ANIMATIONS_H_
#define ASH_WM_WM_WINDOW_ANIMATIONS_H_
#include "ash/ash_export.h"
namespace ui {
class Layer;
}
// This is only for animations specific to Ash. For window animations shared
// with desktop Chrome, see ui/views/corewm/window_animations.h.
namespace ash {
// Direction for ash-specific window animations used in workspaces and
// lock/unlock animations.
enum LayerScaleAnimationDirection {
LAYER_SCALE_ANIMATION_ABOVE,
LAYER_SCALE_ANIMATION_BELOW,
};
// Applies scale related to the specified AshWindowScaleType.
ASH_EXPORT void SetTransformForScaleAnimation(
ui::Layer* layer,
LayerScaleAnimationDirection type);
} // namespace ash
#endif // ASH_WM_WM_WINDOW_ANIMATIONS_H_
......@@ -14,8 +14,8 @@
#include "ash/wm/fullscreen_window_finder.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_state.h"
#include "ash/wm/wm_window_animations.h"
#include "ash/wm/workspace/backdrop_controller.h"
#include "ash/wm/workspace/workspace_event_handler.h"
#include "ash/wm/workspace/workspace_layout_manager.h"
......
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