#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/events/mobile_scroller.h"
#include <cmath>
#include <ostream>
#include "base/check_op.h"
#include "base/lazy_instance.h"
#include "base/notreached.h"
#include "base/numerics/math_constants.h"
namespace ui {
namespace {
const int kDefaultDurationMs = …;
const float kDefaultFriction = …;
const float kDecelerationRate = …;
const float kInflexion = …;
const float kEpsilon = …;
const float kThresholdForFlingEnd = …;
bool ApproxEquals(float a, float b) { … }
struct ViscosityConstants { … };
struct SplineConstants { … };
float ComputeDeceleration(float friction) { … }
template <typename T>
int Signum(T t) { … }
template <typename T>
T Clamped(T t, T a, T b) { … }
base::LazyInstance<ViscosityConstants>::Leaky g_viscosity_constants = …;
base::LazyInstance<SplineConstants>::Leaky g_spline_constants = …;
}
MobileScroller::Config::Config()
: … { … }
MobileScroller::MobileScroller(const Config& config)
: … { … }
MobileScroller::~MobileScroller() { … }
bool MobileScroller::ComputeScrollOffset(base::TimeTicks time,
gfx::Vector2dF* offset,
gfx::Vector2dF* velocity) { … }
void MobileScroller::StartScroll(float start_x,
float start_y,
float dx,
float dy,
base::TimeTicks start_time) { … }
void MobileScroller::StartScroll(float start_x,
float start_y,
float dx,
float dy,
base::TimeTicks start_time,
base::TimeDelta duration) { … }
void MobileScroller::Fling(float start_x,
float start_y,
float velocity_x,
float velocity_y,
float min_x,
float max_x,
float min_y,
float max_y,
base::TimeTicks start_time) { … }
void MobileScroller::ExtendDuration(base::TimeDelta extend) { … }
void MobileScroller::SetFinalX(float new_x) { … }
void MobileScroller::SetFinalY(float new_y) { … }
void MobileScroller::AbortAnimation() { … }
void MobileScroller::ForceFinished(bool finished) { … }
bool MobileScroller::IsFinished() const { … }
base::TimeDelta MobileScroller::GetTimePassed() const { … }
base::TimeDelta MobileScroller::GetDuration() const { … }
float MobileScroller::GetCurrX() const { … }
float MobileScroller::GetCurrY() const { … }
float MobileScroller::GetCurrVelocity() const { … }
float MobileScroller::GetCurrVelocityX() const { … }
float MobileScroller::GetCurrVelocityY() const { … }
float MobileScroller::GetStartX() const { … }
float MobileScroller::GetStartY() const { … }
float MobileScroller::GetFinalX() const { … }
float MobileScroller::GetFinalY() const { … }
bool MobileScroller::IsScrollingInDirection(float xvel, float yvel) const { … }
bool MobileScroller::ComputeScrollOffsetInternal(base::TimeTicks time) { … }
void MobileScroller::RecomputeDeltas() { … }
double MobileScroller::GetSplineDeceleration(float velocity) const { … }
base::TimeDelta MobileScroller::GetSplineFlingDuration(float velocity) const { … }
double MobileScroller::GetSplineFlingDistance(float velocity) const { … }
}