OLD | NEW |
| (Empty) |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef TouchpadFlingPlatformGestureCurve_h | |
6 #define TouchpadFlingPlatformGestureCurve_h | |
7 | |
8 #include "FloatPoint.h" | |
9 #include "PlatformGestureCurve.h" | |
10 #include <wtf/OwnPtr.h> | |
11 #include <wtf/PassOwnPtr.h> | |
12 | |
13 namespace WebCore { | |
14 | |
15 class PlatformGestureCurveTarget; | |
16 | |
17 // Implementation of PlatformGestureCurve suitable for touch pad/screen-based | |
18 // fling scroll. Starts with a flat velocity profile based on 'velocity', which | |
19 // tails off to zero. Time is scaled to that duration of the fling is proportion
al | |
20 // the initial velocity. | |
21 class TouchpadFlingPlatformGestureCurve : public PlatformGestureCurve { | |
22 public: | |
23 static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, I
ntPoint cumulativeScroll = IntPoint()); | |
24 static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, f
loat p0, float p1, float p2, float p3, float p4, float curveDuration, IntPoint c
umulativeScroll = IntPoint()); | |
25 virtual ~TouchpadFlingPlatformGestureCurve(); | |
26 | |
27 virtual const char* debugName() const OVERRIDE; | |
28 virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*) OVERRI
DE; | |
29 | |
30 private: | |
31 TouchpadFlingPlatformGestureCurve(const FloatPoint& velocity, float p0, floa
t p1, float p2, float p3, float p4, float curveDuration, const IntPoint& cumulat
iveScroll); | |
32 | |
33 FloatPoint m_displacementRatio; | |
34 IntPoint m_cumulativeScroll; | |
35 float m_coeffs[5]; | |
36 float m_timeOffset; | |
37 float m_curveDuration; | |
38 float m_positionOffset; | |
39 | |
40 static const int m_maxSearchIterations; | |
41 }; | |
42 | |
43 } // namespace WebCore | |
44 | |
45 #endif | |
OLD | NEW |