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 InterpolableValue_h | 5 #ifndef InterpolableValue_h |
6 #define InterpolableValue_h | 6 #define InterpolableValue_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/animatable/AnimatableValue.h" | 9 #include "core/animation/animatable/AnimatableValue.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "wtf/OwnPtr.h" | 11 #include "wtf/OwnPtr.h" |
12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
13 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class CORE_EXPORT InterpolableValue { | 17 class CORE_EXPORT InterpolableValue { |
18 WTF_MAKE_FAST_ALLOCATED(InterpolableValue); | 18 WTF_MAKE_FAST_ALLOCATED(InterpolableValue); |
19 public: | 19 public: |
20 virtual ~InterpolableValue() { } | 20 virtual ~InterpolableValue() { } |
21 | 21 |
22 virtual bool isNumber() const { return false; } | 22 virtual bool isNumber() const { return false; } |
23 virtual bool isBool() const { return false; } | 23 virtual bool isBool() const { return false; } |
24 virtual bool isList() const { return false; } | 24 virtual bool isList() const { return false; } |
25 virtual bool isAnimatableValue() const { return false; } | 25 virtual bool isAnimatableValue() const { return false; } |
26 | 26 |
27 virtual PassOwnPtr<InterpolableValue> clone() const = 0; | 27 virtual PassOwnPtr<InterpolableValue> clone() const = 0; |
| 28 virtual void scaleAndAdd(double scale, const InterpolableValue& other) = 0; |
28 | 29 |
29 private: | 30 private: |
30 virtual void interpolate(const InterpolableValue& to, const double progress,
InterpolableValue& result) const = 0; | 31 virtual void interpolate(const InterpolableValue& to, const double progress,
InterpolableValue& result) const = 0; |
31 virtual void scaleAndAdd(double scale, const InterpolableValue& other) = 0; | |
32 | 32 |
33 friend class Interpolation; | 33 friend class Interpolation; |
34 friend class PairwisePrimitiveInterpolation; | 34 friend class PairwisePrimitiveInterpolation; |
35 friend class InvalidatableStyleInterpolation; | |
36 | 35 |
37 // Keep interpolate private, but allow calls within the hierarchy without | 36 // Keep interpolate private, but allow calls within the hierarchy without |
38 // knowledge of type. | 37 // knowledge of type. |
39 friend class DeferredLegacyStyleInterpolation; | 38 friend class DeferredLegacyStyleInterpolation; |
40 friend class InterpolableNumber; | 39 friend class InterpolableNumber; |
41 friend class InterpolableBool; | 40 friend class InterpolableBool; |
42 friend class InterpolableList; | 41 friend class InterpolableList; |
43 | 42 |
44 friend class AnimationInterpolableValueTest; | 43 friend class AnimationInterpolableValueTest; |
45 }; | 44 }; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 }; | 173 }; |
175 | 174 |
176 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); | 175 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); |
177 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); | 176 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); |
178 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); | 177 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); |
179 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); | 178 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); |
180 | 179 |
181 } | 180 } |
182 | 181 |
183 #endif | 182 #endif |
OLD | NEW |