| OLD | NEW |
| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebActiveGestureAnimation_h | 26 #ifndef WebActiveGestureAnimation_h |
| 27 #define WebActiveGestureAnimation_h | 27 #define WebActiveGestureAnimation_h |
| 28 | 28 |
| 29 #include "platform/PlatformExport.h" | 29 #include "platform/PlatformExport.h" |
| 30 #include "wtf/Allocator.h" | 30 #include "wtf/Allocator.h" |
| 31 #include "wtf/Noncopyable.h" | 31 #include "wtf/Noncopyable.h" |
| 32 #include <memory> | 32 #include "wtf/OwnPtr.h" |
| 33 #include "wtf/PassOwnPtr.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 class WebGestureCurve; | 37 class WebGestureCurve; |
| 37 class WebGestureCurveTarget; | 38 class WebGestureCurveTarget; |
| 38 | 39 |
| 39 // Implements a gesture animation (fling scroll, etc.) using a curve with a gene
ric interface | 40 // Implements a gesture animation (fling scroll, etc.) using a curve with a gene
ric interface |
| 40 // to define the animation parameters as a function of time, and applies the ani
mation | 41 // to define the animation parameters as a function of time, and applies the ani
mation |
| 41 // to a target, again via a generic interface. It is assumed that animate() is c
alled | 42 // to a target, again via a generic interface. It is assumed that animate() is c
alled |
| 42 // on a more-or-less regular basis by the owner. | 43 // on a more-or-less regular basis by the owner. |
| 43 class PLATFORM_EXPORT WebActiveGestureAnimation { | 44 class PLATFORM_EXPORT WebActiveGestureAnimation { |
| 44 USING_FAST_MALLOC(WebActiveGestureAnimation); | 45 USING_FAST_MALLOC(WebActiveGestureAnimation); |
| 45 WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation); | 46 WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation); |
| 46 public: | 47 public: |
| 47 static std::unique_ptr<WebActiveGestureAnimation> createAtAnimationStart(std
::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*); | 48 static PassOwnPtr<WebActiveGestureAnimation> createAtAnimationStart(PassOwnP
tr<WebGestureCurve>, WebGestureCurveTarget*); |
| 48 static std::unique_ptr<WebActiveGestureAnimation> createWithTimeOffset(std::
unique_ptr<WebGestureCurve>, WebGestureCurveTarget*, double startTime); | 49 static PassOwnPtr<WebActiveGestureAnimation> createWithTimeOffset(PassOwnPtr
<WebGestureCurve>, WebGestureCurveTarget*, double startTime); |
| 49 ~WebActiveGestureAnimation(); | 50 ~WebActiveGestureAnimation(); |
| 50 | 51 |
| 51 bool animate(double time); | 52 bool animate(double time); |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 // Assumes a valid WebGestureCurveTarget that outlives the animation. | 55 // Assumes a valid WebGestureCurveTarget that outlives the animation. |
| 55 WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve>, WebGestureCurveT
arget*, double startTime, bool waitingForFirstTick); | 56 WebActiveGestureAnimation(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget
*, double startTime, bool waitingForFirstTick); |
| 56 | 57 |
| 57 double m_startTime; | 58 double m_startTime; |
| 58 bool m_waitingForFirstTick; | 59 bool m_waitingForFirstTick; |
| 59 std::unique_ptr<WebGestureCurve> m_curve; | 60 OwnPtr<WebGestureCurve> m_curve; |
| 60 WebGestureCurveTarget* m_target; | 61 WebGestureCurveTarget* m_target; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace blink | 64 } // namespace blink |
| 64 | 65 |
| 65 #endif | 66 #endif |
| OLD | NEW |