#include "ui/wm/core/window_animations.h"
#include <math.h>
#include <memory>
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
#include "ui/base/class_property.h"
#include "ui/compositor/animation_throughput_reporter.h"
#include "ui/compositor/compositor_observer.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/layer_tree_owner.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/animation/animation.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/transform_util.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/geometry/vector3d_f.h"
#include "ui/gfx/interpolated_transform.h"
#include "ui/wm/core/window_properties.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/core/wm_core_switches.h"
#include "ui/wm/public/animation_host.h"
namespace wm {
namespace {
class HidingWindowAnimationObserverBase : public aura::WindowObserver { … };
SmoothnessCallback;
ui::AnimationThroughputReporter::ReportCallback ForSmoothness(
SmoothnessCallback callback) { … }
void ReportHideSmoothness(int smoothness) { … }
}
class ImplicitHidingWindowAnimationObserver
: public HidingWindowAnimationObserverBase,
public ui::ImplicitAnimationObserver { … };
namespace {
const int kDefaultAnimationDurationForMenuMS = …;
const float kWindowAnimation_HideOpacity = …;
const float kWindowAnimation_ShowOpacity = …;
const float kWindowAnimation_TranslateFactor = …;
const float kWindowAnimation_ScaleFactor = …;
const int kWindowAnimation_Rotate_DurationMS = …;
const int kWindowAnimation_Rotate_OpacityDurationPercent = …;
const float kWindowAnimation_Rotate_TranslateY = …;
const float kWindowAnimation_Rotate_PerspectiveDepth = …;
const float kWindowAnimation_Rotate_DegreesX = …;
const float kWindowAnimation_Rotate_ScaleFactor = …;
const float kWindowAnimation_Bounce_Scale = …;
const int kWindowAnimation_Bounce_DurationMS = …;
const int kWindowAnimation_Bounce_GrowShrinkDurationPercent = …;
base::TimeDelta GetWindowVisibilityAnimationDuration(
const aura::Window& window) { … }
int GetWindowVisibilityAnimationType(aura::Window* window) { … }
void GetTransformRelativeToRoot(ui::Layer* layer, gfx::Transform* transform) { … }
gfx::Rect GetLayerWorldBoundsAfterTransform(ui::Layer* layer,
const gfx::Transform& transform) { … }
void AugmentWindowSize(aura::Window* window,
const gfx::Transform& end_transform) { … }
void AnimateShowWindowCommon(aura::Window* window,
const gfx::Transform& start_transform,
const gfx::Transform& end_transform) { … }
void AnimateHideWindowCommon(aura::Window* window,
const gfx::Transform& end_transform) { … }
static gfx::Transform GetScaleForWindow(aura::Window* window) { … }
void AnimateShowWindow_Drop(aura::Window* window) { … }
void AnimateHideWindow_Drop(aura::Window* window) { … }
void AnimateShowWindow_Vertical(aura::Window* window) { … }
void AnimateHideWindow_Vertical(aura::Window* window) { … }
void AnimateShowWindow_Fade(aura::Window* window) { … }
void AnimateHideWindow_Fade(aura::Window* window) { … }
std::unique_ptr<ui::LayerAnimationElement> CreateGrowShrinkElement(
aura::Window* window,
bool grow) { … }
void AnimateBounce(aura::Window* window) { … }
class RotateHidingWindowAnimationObserver
: public HidingWindowAnimationObserverBase,
public ui::LayerAnimationObserver { … };
void AddLayerAnimationsForRotate(aura::Window* window, bool show) { … }
void AnimateShowWindow_Rotate(aura::Window* window) { … }
void AnimateHideWindow_Rotate(aura::Window* window) { … }
bool AnimateShowWindow(aura::Window* window) { … }
bool AnimateHideWindow(aura::Window* window) { … }
}
ImplicitHidingWindowAnimationObserver::ImplicitHidingWindowAnimationObserver(
aura::Window* window,
ui::ScopedLayerAnimationSettings* settings)
: … { … }
void ImplicitHidingWindowAnimationObserver::OnImplicitAnimationsCompleted() { … }
ScopedHidingAnimationSettings::ScopedHidingAnimationSettings(
aura::Window* window)
: … { … }
ScopedHidingAnimationSettings::~ScopedHidingAnimationSettings() { … }
void SetWindowVisibilityAnimationType(aura::Window* window, int type) { … }
int GetWindowVisibilityAnimationType(aura::Window* window) { … }
void SetWindowVisibilityAnimationTransition(
aura::Window* window,
WindowVisibilityAnimationTransition transition) { … }
bool HasWindowVisibilityAnimationTransition(
aura::Window* window,
WindowVisibilityAnimationTransition transition) { … }
void SetWindowVisibilityAnimationDuration(aura::Window* window,
const base::TimeDelta& duration) { … }
base::TimeDelta GetWindowVisibilityAnimationDuration(
const aura::Window& window) { … }
void SetWindowVisibilityAnimationVerticalPosition(aura::Window* window,
float position) { … }
bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) { … }
bool AnimateWindow(aura::Window* window, WindowAnimationType type) { … }
bool WindowAnimationsDisabled(aura::Window* window) { … }
}