Chromium Code Reviews| 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 { | |
| 17 ALLOW_ONLY_INLINE_ALLOCATION(); | |
| 18 | |
| 19 InterpolationComponentValue(PassOwnPtr<InterpolableValue> interpolableValue = nullptr, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) | |
| 20 : interpolableValue(interpolableValue) | |
| 21 , nonInterpolableValue(nonInterpolableValue) | |
| 22 { } | |
| 23 | |
| 24 OwnPtr<InterpolableValue> interpolableValue; | |
| 25 RefPtr<NonInterpolableValue> nonInterpolableValue; | |
| 26 }; | |
| 27 | |
| 16 class InterpolationValue { | 28 class InterpolationValue { |
| 17 public: | 29 public: |
| 18 static PassOwnPtr<InterpolationValue> create(const InterpolationType& type, PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtrWillBeRawPtr<NonInter polableValue> nonInterpolableValue = nullptr) | 30 static PassOwnPtr<InterpolationValue> create(const InterpolationType& type, PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtrWillBeRawPtr<NonInter polableValue> nonInterpolableValue = nullptr) |
| 19 { | 31 { |
| 20 return adoptPtr(new InterpolationValue(type, interpolableValue, nonInter polableValue)); | 32 return adoptPtr(new InterpolationValue(type, interpolableValue, nonInter polableValue)); |
| 21 } | 33 } |
| 22 | 34 |
| 23 PassOwnPtr<InterpolationValue> clone() const | 35 PassOwnPtr<InterpolationValue> clone() const |
| 24 { | 36 { |
| 25 return create(m_type, m_interpolableValue->clone(), m_nonInterpolableVal ue); | 37 return create(m_type, m_component.interpolableValue->clone(), m_componen t.nonInterpolableValue); |
| 26 } | 38 } |
| 27 | 39 |
| 28 const InterpolationType& type() const { return m_type; } | 40 const InterpolationType& type() const { return m_type; } |
| 29 const InterpolableValue& interpolableValue() const { return *m_interpolableV alue; } | 41 const InterpolableValue& interpolableValue() const { return *m_component.int erpolableValue; } |
| 30 InterpolableValue& interpolableValue() { return *m_interpolableValue; } | 42 const NonInterpolableValue* nonInterpolableValue() const { return m_componen t.nonInterpolableValue.get(); } |
| 31 const NonInterpolableValue* nonInterpolableValue() const { return m_nonInter polableValue.get(); } | 43 |
| 44 InterpolationComponentValue& mutableComponent() { return m_component; } | |
|
dstockwell
2015/09/14 00:24:36
The component naming doesn't help here, this sound
alancutter (OOO until 2018)
2015/09/14 00:37:39
This description is an accurate interpretation of
| |
| 32 | 45 |
| 33 private: | 46 private: |
| 34 InterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableVal ue> interpolableValue, PassRefPtrWillBeRawPtr<NonInterpolableValue> nonInterpola bleValue = nullptr) | 47 InterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableVal ue> interpolableValue, PassRefPtrWillBeRawPtr<NonInterpolableValue> nonInterpola bleValue = nullptr) |
| 35 : m_type(type) | 48 : m_type(type) |
| 36 , m_interpolableValue(interpolableValue) | 49 , m_component(interpolableValue, nonInterpolableValue) |
| 37 , m_nonInterpolableValue(nonInterpolableValue) | |
| 38 { | 50 { |
| 39 ASSERT(this->m_interpolableValue); | 51 ASSERT(m_component.interpolableValue); |
| 40 } | 52 } |
| 41 | 53 |
| 42 const InterpolationType& m_type; | 54 const InterpolationType& m_type; |
| 43 OwnPtr<InterpolableValue> m_interpolableValue; | 55 InterpolationComponentValue m_component; |
| 44 RefPtrWillBePersistent<NonInterpolableValue> m_nonInterpolableValue; | |
| 45 | |
| 46 friend class InterpolationType; | |
| 47 }; | 56 }; |
| 48 | 57 |
| 49 } // namespace blink | 58 } // namespace blink |
| 50 | 59 |
| 51 #endif // InterpolationValue_h | 60 #endif // InterpolationValue_h |
| OLD | NEW |