OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LegacyStyleInterpolation_h | 5 #ifndef LegacyStyleInterpolation_h |
6 #define LegacyStyleInterpolation_h | 6 #define LegacyStyleInterpolation_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/animation/Interpolation.h" | 10 #include "core/animation/Interpolation.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 bool isLegacyStyleInterpolation() const final { return true; } | 41 bool isLegacyStyleInterpolation() const final { return true; } |
42 | 42 |
43 PassRefPtr<AnimatableValue> currentValue() const { | 43 PassRefPtr<AnimatableValue> currentValue() const { |
44 return toInterpolableAnimatableValue(m_cachedValue.get())->value(); | 44 return toInterpolableAnimatableValue(m_cachedValue.get())->value(); |
45 } | 45 } |
46 | 46 |
47 CSSPropertyID id() const { return m_id; } | 47 CSSPropertyID id() const { return m_id; } |
48 | 48 |
49 PropertyHandle getProperty() const final { return PropertyHandle(id()); } | 49 PropertyHandle getProperty() const final { return PropertyHandle(id()); } |
50 | 50 |
| 51 void interpolate(int iteration, double fraction) final; |
| 52 |
| 53 protected: |
| 54 LegacyStyleInterpolation(std::unique_ptr<InterpolableValue> start, |
| 55 std::unique_ptr<InterpolableValue> end, |
| 56 CSSPropertyID); |
| 57 |
51 private: | 58 private: |
| 59 const std::unique_ptr<InterpolableValue> m_start; |
| 60 const std::unique_ptr<InterpolableValue> m_end; |
52 CSSPropertyID m_id; | 61 CSSPropertyID m_id; |
53 | 62 |
54 LegacyStyleInterpolation(std::unique_ptr<InterpolableValue> start, | 63 mutable double m_cachedFraction; |
55 std::unique_ptr<InterpolableValue> end, | 64 mutable int m_cachedIteration; |
56 CSSPropertyID id) | 65 mutable std::unique_ptr<InterpolableValue> m_cachedValue; |
57 : Interpolation(std::move(start), std::move(end)), m_id(id) {} | 66 |
| 67 InterpolableValue* getCachedValueForTesting() const final { |
| 68 return m_cachedValue.get(); |
| 69 } |
58 }; | 70 }; |
59 | 71 |
60 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, | 72 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, |
61 Interpolation, | 73 Interpolation, |
62 value, | 74 value, |
63 value->isLegacyStyleInterpolation(), | 75 value->isLegacyStyleInterpolation(), |
64 value.isLegacyStyleInterpolation()); | 76 value.isLegacyStyleInterpolation()); |
65 | 77 |
66 } // namespace blink | 78 } // namespace blink |
67 | 79 |
68 #endif | 80 #endif |
OLD | NEW |