OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 InvalidatableStyleInterpolation_h | 5 #ifndef InvalidatableInterpolation_h |
6 #define InvalidatableStyleInterpolation_h | 6 #define InvalidatableInterpolation_h |
7 | 7 |
8 #include "core/animation/InterpolationType.h" | 8 #include "core/animation/InterpolationType.h" |
9 #include "core/animation/InterpolationValue.h" | 9 #include "core/animation/InterpolationValue.h" |
10 #include "core/animation/PrimitiveInterpolation.h" | 10 #include "core/animation/PrimitiveInterpolation.h" |
11 #include "core/animation/StyleInterpolation.h" | 11 #include "core/animation/StyleInterpolation.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // TODO(alancutter): This class will replace *StyleInterpolation, SVGInterpolati
on, Interpolation. | 15 // TODO(alancutter): This class will replace *StyleInterpolation, SVGInterpolati
on, Interpolation. |
16 // For now it needs to distinguish itself during the refactor and temporarily ha
s an ugly name. | 16 // For now it needs to distinguish itself during the refactor and temporarily ha
s an ugly name. |
17 class CORE_EXPORT InvalidatableStyleInterpolation : public Interpolation { | 17 class CORE_EXPORT InvalidatableInterpolation : public Interpolation { |
18 public: | 18 public: |
19 static PassRefPtr<InvalidatableStyleInterpolation> create( | 19 static PassRefPtr<InvalidatableInterpolation> create( |
20 const Vector<const InterpolationType*>& InterpolationTypes, | 20 const Vector<const InterpolationType*>& InterpolationTypes, |
21 const PropertySpecificKeyframe& startKeyframe, | 21 const PropertySpecificKeyframe& startKeyframe, |
22 const PropertySpecificKeyframe& endKeyframe) | 22 const PropertySpecificKeyframe& endKeyframe) |
23 { | 23 { |
24 return adoptRef(new InvalidatableStyleInterpolation(InterpolationTypes,
startKeyframe, endKeyframe)); | 24 return adoptRef(new InvalidatableInterpolation(InterpolationTypes, start
Keyframe, endKeyframe)); |
25 } | 25 } |
26 | 26 |
27 PropertyHandle property() const final { return m_interpolationTypes.first()-
>property(); } | 27 PropertyHandle property() const final { return m_interpolationTypes.first()-
>property(); } |
28 virtual void interpolate(int iteration, double fraction); | 28 virtual void interpolate(int iteration, double fraction); |
29 bool dependsOnUnderlyingValue() const; | 29 bool dependsOnUnderlyingValue() const; |
30 virtual void apply(InterpolationEnvironment&) const { ASSERT_NOT_REACHED();
} | 30 virtual void apply(InterpolationEnvironment&) const { ASSERT_NOT_REACHED();
} |
31 static void applyStack(const ActiveInterpolations&, InterpolationEnvironment
&); | 31 static void applyStack(const ActiveInterpolations&, InterpolationEnvironment
&); |
32 | 32 |
33 virtual bool isInvalidatableStyleInterpolation() const { return true; } | 33 virtual bool isInvalidatableInterpolation() const { return true; } |
34 | 34 |
35 private: | 35 private: |
36 InvalidatableStyleInterpolation( | 36 InvalidatableInterpolation( |
37 const Vector<const InterpolationType*>& interpolationTypes, | 37 const Vector<const InterpolationType*>& interpolationTypes, |
38 const PropertySpecificKeyframe& startKeyframe, | 38 const PropertySpecificKeyframe& startKeyframe, |
39 const PropertySpecificKeyframe& endKeyframe) | 39 const PropertySpecificKeyframe& endKeyframe) |
40 : Interpolation(nullptr, nullptr) | 40 : Interpolation(nullptr, nullptr) |
41 , m_interpolationTypes(interpolationTypes) | 41 , m_interpolationTypes(interpolationTypes) |
42 , m_startKeyframe(&startKeyframe) | 42 , m_startKeyframe(&startKeyframe) |
43 , m_endKeyframe(&endKeyframe) | 43 , m_endKeyframe(&endKeyframe) |
44 , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) | 44 , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) |
45 , m_isCached(false) | 45 , m_isCached(false) |
46 { } | 46 { } |
(...skipping 11 matching lines...) Expand all Loading... |
58 const Vector<const InterpolationType*>& m_interpolationTypes; | 58 const Vector<const InterpolationType*>& m_interpolationTypes; |
59 const PropertySpecificKeyframe* m_startKeyframe; | 59 const PropertySpecificKeyframe* m_startKeyframe; |
60 const PropertySpecificKeyframe* m_endKeyframe; | 60 const PropertySpecificKeyframe* m_endKeyframe; |
61 double m_currentFraction; | 61 double m_currentFraction; |
62 mutable bool m_isCached; | 62 mutable bool m_isCached; |
63 mutable OwnPtr<PrimitiveInterpolation> m_cachedPairConversion; | 63 mutable OwnPtr<PrimitiveInterpolation> m_cachedPairConversion; |
64 mutable InterpolationType::ConversionCheckers m_conversionCheckers; | 64 mutable InterpolationType::ConversionCheckers m_conversionCheckers; |
65 mutable OwnPtr<InterpolationValue> m_cachedValue; | 65 mutable OwnPtr<InterpolationValue> m_cachedValue; |
66 }; | 66 }; |
67 | 67 |
68 DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value->
isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation()); | 68 DEFINE_TYPE_CASTS(InvalidatableInterpolation, Interpolation, value, value->isInv
alidatableInterpolation(), value.isInvalidatableInterpolation()); |
69 | 69 |
70 } // namespace blink | 70 } // namespace blink |
71 | 71 |
72 #endif // InvalidatableStyleInterpolation_h | 72 #endif // InvalidatableInterpolation_h |
OLD | NEW |