| Index: content/browser/renderer_host/input/fling/fling_curve_impl.h
|
| diff --git a/content/browser/renderer_host/input/fling/fling_curve_impl.h b/content/browser/renderer_host/input/fling/fling_curve_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0d3ada6e15884000f9610d937819e136598dda25
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/input/fling/fling_curve_impl.h
|
| @@ -0,0 +1,53 @@
|
| +// Copyright (c) 2013 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_H_
|
| +#define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "content/browser/renderer_host/input/fling/fling_curve.h"
|
| +#include "content/common/content_export.h"
|
| +#include "ui/gfx/point.h"
|
| +#include "ui/gfx/point_f.h"
|
| +
|
| +namespace content {
|
| +
|
| +// Implementation of FlingCurve suitable for touch pad/screen-based
|
| +// fling scroll. Starts with a flat velocity profile based on 'velocity', which
|
| +// tails off to zero. Time is scaled to that duration of the fling is
|
| +// proportional to the initial velocity.
|
| +class FlingCurveImpl : public FlingCurve {
|
| + public:
|
| +
|
| + CONTENT_EXPORT static FlingCurve* Create(
|
| + const gfx::PointF& initial_velocity,
|
| + float p0,
|
| + float p1,
|
| + float p2,
|
| + const gfx::Point& cumulative_scroll);
|
| +
|
| + // Overridden from FlingCurve.
|
| + virtual bool Apply(double time_in_secs, FlingCurveTarget* target) OVERRIDE;
|
| +
|
| + private:
|
| + FlingCurveImpl(const gfx::PointF& initial_velocity,
|
| + float p0,
|
| + float p1,
|
| + float p2,
|
| + const gfx::Point& cumulative_scroll);
|
| + virtual ~FlingCurveImpl();
|
| +
|
| + gfx::PointF displacement_ratio_;
|
| + gfx::PointF cumulative_scroll_;
|
| + float coefficients_[3];
|
| + float time_offset_;
|
| + float curve_duration_;
|
| + float position_offset_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FlingCurveImpl);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_H_
|
|
|