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 18 matching lines...) Expand all Loading... |
29 #include "public/platform/WebGestureCurveTarget.h" | 29 #include "public/platform/WebGestureCurveTarget.h" |
30 #include "wtf/PtrUtil.h" | 30 #include "wtf/PtrUtil.h" |
31 #include <memory> | 31 #include <memory> |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 std::unique_ptr<WebActiveGestureAnimation> | 35 std::unique_ptr<WebActiveGestureAnimation> |
36 WebActiveGestureAnimation::createAtAnimationStart( | 36 WebActiveGestureAnimation::createAtAnimationStart( |
37 std::unique_ptr<WebGestureCurve> curve, | 37 std::unique_ptr<WebGestureCurve> curve, |
38 WebGestureCurveTarget* target) { | 38 WebGestureCurveTarget* target) { |
39 return wrapUnique( | 39 return WTF::wrapUnique( |
40 new WebActiveGestureAnimation(std::move(curve), target, 0, true)); | 40 new WebActiveGestureAnimation(std::move(curve), target, 0, true)); |
41 } | 41 } |
42 | 42 |
43 std::unique_ptr<WebActiveGestureAnimation> | 43 std::unique_ptr<WebActiveGestureAnimation> |
44 WebActiveGestureAnimation::createWithTimeOffset( | 44 WebActiveGestureAnimation::createWithTimeOffset( |
45 std::unique_ptr<WebGestureCurve> curve, | 45 std::unique_ptr<WebGestureCurve> curve, |
46 WebGestureCurveTarget* target, | 46 WebGestureCurveTarget* target, |
47 double startTime) { | 47 double startTime) { |
48 return wrapUnique(new WebActiveGestureAnimation(std::move(curve), target, | 48 return WTF::wrapUnique(new WebActiveGestureAnimation(std::move(curve), target, |
49 startTime, false)); | 49 startTime, false)); |
50 } | 50 } |
51 | 51 |
52 WebActiveGestureAnimation::~WebActiveGestureAnimation() {} | 52 WebActiveGestureAnimation::~WebActiveGestureAnimation() {} |
53 | 53 |
54 WebActiveGestureAnimation::WebActiveGestureAnimation( | 54 WebActiveGestureAnimation::WebActiveGestureAnimation( |
55 std::unique_ptr<WebGestureCurve> curve, | 55 std::unique_ptr<WebGestureCurve> curve, |
56 WebGestureCurveTarget* target, | 56 WebGestureCurveTarget* target, |
57 double startTime, | 57 double startTime, |
58 bool waitingForFirstTick) | 58 bool waitingForFirstTick) |
59 : m_startTime(startTime), | 59 : m_startTime(startTime), |
60 m_waitingForFirstTick(waitingForFirstTick), | 60 m_waitingForFirstTick(waitingForFirstTick), |
61 m_curve(std::move(curve)), | 61 m_curve(std::move(curve)), |
62 m_target(target) {} | 62 m_target(target) {} |
63 | 63 |
64 bool WebActiveGestureAnimation::animate(double time) { | 64 bool WebActiveGestureAnimation::animate(double time) { |
65 if (m_waitingForFirstTick) { | 65 if (m_waitingForFirstTick) { |
66 m_startTime = time; | 66 m_startTime = time; |
67 m_waitingForFirstTick = false; | 67 m_waitingForFirstTick = false; |
68 } | 68 } |
69 // All WebGestureCurves assume zero-based time, so we subtract | 69 // All WebGestureCurves assume zero-based time, so we subtract |
70 // the animation start time before passing to the curve. | 70 // the animation start time before passing to the curve. |
71 return m_curve->apply(time - m_startTime, m_target); | 71 return m_curve->apply(time - m_startTime, m_target); |
72 } | 72 } |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
OLD | NEW |