| 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 28 matching lines...) Expand all Loading... |
| 39 // Implements a gesture animation (fling scroll, etc.) using a curve with a | 39 // Implements a gesture animation (fling scroll, etc.) using a curve with a |
| 40 // generic interface to define the animation parameters as a function of time, | 40 // generic interface to define the animation parameters as a function of time, |
| 41 // and applies the animation to a target, again via a generic interface. It is | 41 // and applies the animation to a target, again via a generic interface. It is |
| 42 // assumed that animate() is called on a more-or-less regular basis by the | 42 // assumed that animate() is called on a more-or-less regular basis by the |
| 43 // owner. | 43 // owner. |
| 44 class PLATFORM_EXPORT WebActiveGestureAnimation { | 44 class PLATFORM_EXPORT WebActiveGestureAnimation { |
| 45 USING_FAST_MALLOC(WebActiveGestureAnimation); | 45 USING_FAST_MALLOC(WebActiveGestureAnimation); |
| 46 WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation); | 46 WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation); |
| 47 | 47 |
| 48 public: | 48 public: |
| 49 static std::unique_ptr<WebActiveGestureAnimation> CreateAtAnimationStart( | |
| 50 std::unique_ptr<WebGestureCurve>, | |
| 51 WebGestureCurveTarget*); | |
| 52 static std::unique_ptr<WebActiveGestureAnimation> CreateWithTimeOffset( | 49 static std::unique_ptr<WebActiveGestureAnimation> CreateWithTimeOffset( |
| 53 std::unique_ptr<WebGestureCurve>, | 50 std::unique_ptr<WebGestureCurve>, |
| 54 WebGestureCurveTarget*, | 51 WebGestureCurveTarget*, |
| 55 double start_time); | 52 double start_time); |
| 56 ~WebActiveGestureAnimation(); | 53 ~WebActiveGestureAnimation(); |
| 57 | 54 |
| 58 bool Animate(double time); | 55 bool Animate(double time); |
| 59 | 56 |
| 60 private: | 57 private: |
| 61 // Assumes a valid WebGestureCurveTarget that outlives the animation. | 58 // Assumes a valid WebGestureCurveTarget that outlives the animation. |
| 62 WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve>, | 59 WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve>, |
| 63 WebGestureCurveTarget*, | 60 WebGestureCurveTarget*, |
| 64 double start_time, | 61 double start_time); |
| 65 bool waiting_for_first_tick); | |
| 66 | 62 |
| 67 double start_time_; | 63 double start_time_; |
| 68 bool waiting_for_first_tick_; | |
| 69 std::unique_ptr<WebGestureCurve> curve_; | 64 std::unique_ptr<WebGestureCurve> curve_; |
| 70 WebGestureCurveTarget* target_; | 65 WebGestureCurveTarget* target_; |
| 71 }; | 66 }; |
| 72 | 67 |
| 73 } // namespace blink | 68 } // namespace blink |
| 74 | 69 |
| 75 #endif | 70 #endif |
| OLD | NEW |