#include "cc/animation/scroll_offset_animation_curve.h"
#include <algorithm>
#include <cmath>
#include <ostream>
#include <utility>
#include "base/check_op.h"
#include "base/memory/ptr_util.h"
#include "ui/gfx/animation/keyframe/timing_function.h"
#include "ui/gfx/animation/tween.h"
const double kConstantDuration = …;
const double kDurationDivisor = …;
const double kDeltaBasedMaxDuration = …;
const double kInverseDeltaRampStartPx = …;
const double kInverseDeltaRampEndPx = …;
const double kInverseDeltaMinDuration = …;
const double kInverseDeltaMaxDuration = …;
const double kInverseDeltaSlope = …;
const double kInverseDeltaOffset = …;
CubicBezierTimingFunction;
LinearTimingFunction;
TimingFunction;
namespace cc {
namespace {
constexpr double kImpulseCurveX1 = …;
constexpr double kImpulseCurveX2 = …;
constexpr double kImpulseCurveY2 = …;
constexpr double kImpulseMinDurationMs = …;
constexpr double kImpulseMaxDurationMs = …;
constexpr double kImpulseMillisecondsPerPixel = …;
const double kEpsilon = …;
static float MaximumDimension(const gfx::Vector2dF& delta) { … }
static std::unique_ptr<TimingFunction> EaseInOutWithInitialSlope(double slope) { … }
std::unique_ptr<TimingFunction> ImpulseCurveWithInitialSlope(double slope) { … }
bool IsNewTargetInOppositeDirection(const gfx::PointF& current_position,
const gfx::PointF& old_target,
const gfx::PointF& new_target) { … }
base::TimeDelta VelocityBasedDurationBound(gfx::Vector2dF old_delta,
double velocity,
gfx::Vector2dF new_delta) { … }
}
std::optional<double>
ScrollOffsetAnimationCurve::animation_duration_for_testing_;
ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
const gfx::PointF& target_value,
AnimationType animation_type,
std::optional<DurationBehavior> duration_behavior)
: … { … }
ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
const gfx::PointF& target_value,
std::unique_ptr<TimingFunction> timing_function,
AnimationType animation_type,
std::optional<DurationBehavior> duration_behavior)
: … { … }
ScrollOffsetAnimationCurve::~ScrollOffsetAnimationCurve() = default;
base::TimeDelta ScrollOffsetAnimationCurve::EaseInOutSegmentDuration(
const gfx::Vector2dF& delta,
DurationBehavior duration_behavior,
base::TimeDelta delayed_by) { … }
base::TimeDelta ScrollOffsetAnimationCurve::EaseInOutBoundedSegmentDuration(
const gfx::Vector2dF& new_delta,
base::TimeDelta t,
base::TimeDelta delayed_by) { … }
base::TimeDelta ScrollOffsetAnimationCurve::SegmentDuration(
const gfx::Vector2dF& delta,
base::TimeDelta delayed_by,
std::optional<double> velocity) { … }
base::TimeDelta ScrollOffsetAnimationCurve::LinearSegmentDuration(
const gfx::Vector2dF& delta,
base::TimeDelta delayed_by,
float velocity) { … }
base::TimeDelta ScrollOffsetAnimationCurve::ImpulseSegmentDuration(
const gfx::Vector2dF& delta,
base::TimeDelta delayed_by) { … }
void ScrollOffsetAnimationCurve::SetInitialValue(
const gfx::PointF& initial_value,
base::TimeDelta delayed_by,
float velocity) { … }
bool ScrollOffsetAnimationCurve::HasSetInitialValue() const { … }
void ScrollOffsetAnimationCurve::ApplyAdjustment(
const gfx::Vector2dF& adjustment) { … }
gfx::PointF ScrollOffsetAnimationCurve::GetValue(base::TimeDelta t) const { … }
base::TimeDelta ScrollOffsetAnimationCurve::Duration() const { … }
int ScrollOffsetAnimationCurve::Type() const { … }
const char* ScrollOffsetAnimationCurve::TypeName() const { … }
std::unique_ptr<gfx::AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { … }
void ScrollOffsetAnimationCurve::Tick(
base::TimeDelta t,
int property_id,
gfx::KeyframeModel* keyframe_model,
gfx::TimingFunction::LimitDirection unused) const { … }
std::unique_ptr<ScrollOffsetAnimationCurve>
ScrollOffsetAnimationCurve::CloneToScrollOffsetAnimationCurve() const { … }
void ScrollOffsetAnimationCurve::SetAnimationDurationForTesting(
base::TimeDelta duration) { … }
double ScrollOffsetAnimationCurve::CalculateVelocity(base::TimeDelta t) { … }
void ScrollOffsetAnimationCurve::UpdateTarget(base::TimeDelta t,
const gfx::PointF& new_target) { … }
const ScrollOffsetAnimationCurve*
ScrollOffsetAnimationCurve::ToScrollOffsetAnimationCurve(
const AnimationCurve* c) { … }
ScrollOffsetAnimationCurve*
ScrollOffsetAnimationCurve::ToScrollOffsetAnimationCurve(AnimationCurve* c) { … }
}