| 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 InterpolationValue_h | 5 #ifndef InterpolationValue_h |
| 6 #define InterpolationValue_h | 6 #define InterpolationValue_h |
| 7 | 7 |
| 8 #include "core/animation/InterpolableValue.h" | 8 #include "core/animation/InterpolableValue.h" |
| 9 #include "core/animation/NonInterpolableValue.h" | 9 #include "core/animation/NonInterpolableValue.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class InterpolationType; | 14 class InterpolationType; |
| 15 | 15 |
| 16 struct InterpolationComponentValue { | 16 struct InterpolationComponentValue { |
| 17 ALLOW_ONLY_INLINE_ALLOCATION(); | 17 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 18 | 18 |
| 19 InterpolationComponentValue(PassOwnPtr<InterpolableValue> interpolableValue
= nullptr, PassRefPtrWillBeRawPtr<NonInterpolableValue> nonInterpolableValue = n
ullptr) | 19 InterpolationComponentValue(PassOwnPtr<InterpolableValue> interpolableValue
= nullptr, PassRefPtrWillBeRawPtr<NonInterpolableValue> nonInterpolableValue = n
ullptr) |
| 20 : interpolableValue(interpolableValue) | 20 : interpolableValue(interpolableValue) |
| 21 , nonInterpolableValue(nonInterpolableValue) | 21 , nonInterpolableValue(nonInterpolableValue) |
| 22 { } | 22 { } |
| 23 | 23 |
| 24 OwnPtr<InterpolableValue> interpolableValue; | 24 OwnPtr<InterpolableValue> interpolableValue; |
| 25 RefPtrWillBePersistent<NonInterpolableValue> nonInterpolableValue; | 25 RefPtrWillBePersistent<NonInterpolableValue> nonInterpolableValue; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class InterpolationValue { | 28 class InterpolationValue { |
| 29 public: | 29 public: |
| 30 static PassOwnPtr<InterpolationValue> create(const InterpolationType& type,
PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue
> nonInterpolableValue = nullptr) | 30 static PassOwnPtr<InterpolationValue> create(const InterpolationType& type,
PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtrWillBeRawPtr<NonInter
polableValue> nonInterpolableValue = nullptr) |
| 31 { | 31 { |
| 32 return adoptPtr(new InterpolationValue(type, interpolableValue, nonInter
polableValue)); | 32 return adoptPtr(new InterpolationValue(type, interpolableValue, nonInter
polableValue)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 PassOwnPtr<InterpolationValue> clone() const | 35 PassOwnPtr<InterpolationValue> clone() const |
| 36 { | 36 { |
| 37 return create(m_type, m_component.interpolableValue->clone(), m_componen
t.nonInterpolableValue); | 37 return create(m_type, m_component.interpolableValue->clone(), m_componen
t.nonInterpolableValue); |
| 38 } | 38 } |
| 39 | 39 |
| 40 const InterpolationType& type() const { return m_type; } | 40 const InterpolationType& type() const { return m_type; } |
| 41 const InterpolableValue& interpolableValue() const { return *m_component.int
erpolableValue; } | 41 const InterpolableValue& interpolableValue() const { return *m_component.int
erpolableValue; } |
| 42 const NonInterpolableValue* nonInterpolableValue() const { return m_componen
t.nonInterpolableValue.get(); } | 42 const NonInterpolableValue* nonInterpolableValue() const { return m_componen
t.nonInterpolableValue.get(); } |
| 43 | 43 |
| 44 InterpolationComponentValue& mutableComponent() { return m_component; } | 44 InterpolationComponentValue& mutableComponent() { return m_component; } |
| 45 | 45 |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 InterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableVal
ue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue) | 48 InterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableVal
ue> interpolableValue, PassRefPtrWillBeRawPtr<NonInterpolableValue> nonInterpola
bleValue) |
| 49 : m_type(type) | 49 : m_type(type) |
| 50 , m_component(interpolableValue, nonInterpolableValue) | 50 , m_component(interpolableValue, nonInterpolableValue) |
| 51 { | 51 { |
| 52 ASSERT(m_component.interpolableValue); | 52 ASSERT(m_component.interpolableValue); |
| 53 } | 53 } |
| 54 | 54 |
| 55 const InterpolationType& m_type; | 55 const InterpolationType& m_type; |
| 56 InterpolationComponentValue m_component; | 56 InterpolationComponentValue m_component; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif // InterpolationValue_h | 61 #endif // InterpolationValue_h |
| OLD | NEW |