#include "ui/views/layout/animating_layout_manager.h"
#include <algorithm>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "base/auto_reset.h"
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/animation/animation.h"
#include "ui/gfx/animation/animation_container.h"
#include "ui/gfx/animation/multi_animation.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/views/animation/animation_delegate_views.h"
#include "ui/views/layout/normalized_geometry.h"
#include "ui/views/layout/proposed_layout.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
namespace views {
namespace {
const ChildLayout* FindChildViewInLayout(const ProposedLayout& layout,
const View* view) { … }
ChildLayout* FindChildViewInLayout(ProposedLayout* layout, const View* view) { … }
enum class LayoutFadeType { … };
ProposedLayout WithOnlyVisibleViews(const ProposedLayout layout) { … }
bool HaveSameVisibleViews(const ProposedLayout& l1, const ProposedLayout& l2) { … }
}
struct AnimatingLayoutManager::LayoutFadeInfo { … };
class AnimatingLayoutManager::AnimationDelegate
: public AnimationDelegateViews { … };
AnimatingLayoutManager::AnimationDelegate::AnimationDelegate(
AnimatingLayoutManager* layout_manager)
: … { … }
void AnimatingLayoutManager::AnimationDelegate::UpdateAnimationParameters() { … }
void AnimatingLayoutManager::AnimationDelegate::Animate() { … }
void AnimatingLayoutManager::AnimationDelegate::Reset() { … }
void AnimatingLayoutManager::AnimationDelegate::MakeReadyForAnimation() { … }
void AnimatingLayoutManager::AnimationDelegate::AnimationProgressed(
const gfx::Animation* animation) { … }
void AnimatingLayoutManager::AnimationDelegate::AnimationCanceled(
const gfx::Animation* animation) { … }
void AnimatingLayoutManager::AnimationDelegate::AnimationEnded(
const gfx::Animation* animation) { … }
AnimatingLayoutManager::AnimatingLayoutManager() = default;
AnimatingLayoutManager::~AnimatingLayoutManager() = default;
AnimatingLayoutManager& AnimatingLayoutManager::SetBoundsAnimationMode(
BoundsAnimationMode bounds_animation_mode) { … }
AnimatingLayoutManager& AnimatingLayoutManager::SetAnimationDuration(
base::TimeDelta animation_duration) { … }
AnimatingLayoutManager& AnimatingLayoutManager::SetTweenType(
gfx::Tween::Type tween_type) { … }
AnimatingLayoutManager& AnimatingLayoutManager::SetOpacityAnimationDuration(
base::TimeDelta animation_duration) { … }
AnimatingLayoutManager& AnimatingLayoutManager::SetOpacityTweenType(
gfx::Tween::Type tween_type) { … }
AnimatingLayoutManager& AnimatingLayoutManager::SetOrientation(
LayoutOrientation orientation) { … }
AnimatingLayoutManager& AnimatingLayoutManager::SetDefaultFadeMode(
FadeInOutMode default_fade_mode) { … }
void AnimatingLayoutManager::ResetLayout() { … }
void AnimatingLayoutManager::FadeOut(View* child_view) { … }
void AnimatingLayoutManager::FadeIn(View* child_view) { … }
void AnimatingLayoutManager::AddObserver(Observer* observer) { … }
void AnimatingLayoutManager::RemoveObserver(Observer* observer) { … }
bool AnimatingLayoutManager::HasObserver(Observer* observer) const { … }
gfx::Size AnimatingLayoutManager::GetPreferredSize(const View* host) const { … }
gfx::Size AnimatingLayoutManager::GetPreferredSize(
const View* host,
const SizeBounds& available_size) const { … }
gfx::Size AnimatingLayoutManager::GetMinimumSize(const View* host) const { … }
int AnimatingLayoutManager::GetPreferredHeightForWidth(const View* host,
int width) const { … }
std::vector<raw_ptr<View, VectorExperimental>>
AnimatingLayoutManager::GetChildViewsInPaintOrder(const View* host) const { … }
bool AnimatingLayoutManager::OnViewRemoved(View* host, View* view) { … }
void AnimatingLayoutManager::PostOrQueueAction(base::OnceClosure action) { … }
FlexRule AnimatingLayoutManager::GetDefaultFlexRule() const { … }
gfx::AnimationContainer*
AnimatingLayoutManager::GetAnimationContainerForTesting() { … }
void AnimatingLayoutManager::EnableAnimationForTesting() { … }
ProposedLayout AnimatingLayoutManager::CalculateProposedLayout(
const SizeBounds& size_bounds) const { … }
void AnimatingLayoutManager::OnInstalled(View* host) { … }
bool AnimatingLayoutManager::OnViewAdded(View* host, View* view) { … }
void AnimatingLayoutManager::OnLayoutChanged() { … }
void AnimatingLayoutManager::LayoutImpl() { … }
void AnimatingLayoutManager::EndAnimation() { … }
void AnimatingLayoutManager::ResetLayoutToTargetSize() { … }
void AnimatingLayoutManager::ResetLayoutToSize(const gfx::Size& target_size) { … }
bool AnimatingLayoutManager::RecalculateTarget() { … }
void AnimatingLayoutManager::AnimateTo(double value,
double fade_in_opacity,
double fade_out_opacity) { … }
void AnimatingLayoutManager::NotifyIsAnimatingChanged() { … }
void AnimatingLayoutManager::RunQueuedActions() { … }
void AnimatingLayoutManager::PostQueuedActions() { … }
void AnimatingLayoutManager::UpdateCurrentLayout(double percent,
double fade_in_opacity,
double fade_out_opacity) { … }
void AnimatingLayoutManager::CalculateFadeInfos() { … }
void AnimatingLayoutManager::ResolveFades() { … }
ChildLayout AnimatingLayoutManager::CalculateScaleFade(
const LayoutFadeInfo& fade_info,
double scale_percent,
bool scale_from_zero) const { … }
ChildLayout AnimatingLayoutManager::CalculateSlideFade(
const LayoutFadeInfo& fade_info,
double scale_percent,
bool slide_from_leading) const { … }
ChildLayout AnimatingLayoutManager::CalculateFadeAndSlideFade(
const LayoutFadeInfo& fade_info,
double scale_percent,
double opacity_value,
bool slide_from_leading) const { … }
gfx::Size AnimatingLayoutManager::GetAvailableTargetLayoutSize() { … }
gfx::Size AnimatingLayoutManager::DefaultFlexRuleImpl(
const AnimatingLayoutManager* animating_layout,
const View* view,
const SizeBounds& size_bounds) { … }
}