Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h

Issue 9969140: Merge 113095 - [chromium] Switch touchpad fling curve physics to absolute (not scaled) curve. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #ifndef TouchpadFlingPlatformGestureCurve_h 25 #ifndef TouchpadFlingPlatformGestureCurve_h
26 #define TouchpadFlingPlatformGestureCurve_h 26 #define TouchpadFlingPlatformGestureCurve_h
27 27
28 #include "FloatPoint.h" 28 #include "FloatPoint.h"
29 #include "PlatformGestureCurve.h" 29 #include "PlatformGestureCurve.h"
30 #include "UnitBezier.h"
31 #include <wtf/OwnPtr.h> 30 #include <wtf/OwnPtr.h>
32 #include <wtf/PassOwnPtr.h> 31 #include <wtf/PassOwnPtr.h>
33 32
34 namespace WebCore { 33 namespace WebCore {
35 34
36 class PlatformGestureCurveTarget; 35 class PlatformGestureCurveTarget;
37 36
38 // Implementation of PlatformGestureCurve suitable for touch pad/screen-based 37 // Implementation of PlatformGestureCurve suitable for touch pad/screen-based
39 // fling scroll. Starts with a flat velocity profile based on 'velocity', which 38 // fling scroll. Starts with a flat velocity profile based on 'velocity', which
40 // tails off to zero. Time is scaled to that duration of the fling is proportion al 39 // tails off to zero. Time is scaled to that duration of the fling is proportion al
41 // the initial velocity. 40 // the initial velocity.
42 class TouchpadFlingPlatformGestureCurve : public PlatformGestureCurve { 41 class TouchpadFlingPlatformGestureCurve : public PlatformGestureCurve {
43 public: 42 public:
44 static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, I ntPoint cumulativeScroll = IntPoint()); 43 static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, I ntPoint cumulativeScroll = IntPoint());
45 static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, c onst float unitTimeScaleLog10, const FloatPoint& bezierP1, const FloatPoint& bez ierP2, IntPoint cumulativeScroll = IntPoint()); 44 static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, f loat p0, float p1, float p2, float p3, float p4, float curveDuration, IntPoint c umulativeScroll = IntPoint());
46 virtual ~TouchpadFlingPlatformGestureCurve(); 45 virtual ~TouchpadFlingPlatformGestureCurve();
47 46
48 virtual const char* debugName() const { return "TouchpadFling"; } 47 virtual const char* debugName() const { return "TouchpadFling"; }
49 virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*); 48 virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*);
50 49
51 private: 50 private:
52 TouchpadFlingPlatformGestureCurve(const FloatPoint& velocity, const float un itTimeScaleLog10, const FloatPoint& bezierP1, const FloatPoint& bezierP2, const IntPoint& cumulativeScroll); 51 TouchpadFlingPlatformGestureCurve(const FloatPoint& velocity, float p0, floa t p1, float p2, float p3, float p4, float curveDuration, const IntPoint& cumulat iveScroll);
53 52
54 FloatPoint m_velocity; 53 FloatPoint m_displacementRatio;
55 float m_timeScaleFactor;
56 IntPoint m_cumulativeScroll; 54 IntPoint m_cumulativeScroll;
57 UnitBezier m_flingBezier; 55 float m_coeffs[5];
56 float m_timeOffset;
57 float m_curveDuration;
58 float m_positionOffset;
59
60 static const int m_maxSearchIterations;
58 }; 61 };
59 62
60 } // namespace WebCore 63 } // namespace WebCore
61 64
62 #endif 65 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698