| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 friend class InterpolableNumber; | 46 friend class InterpolableNumber; |
| 47 friend class InterpolableBool; | 47 friend class InterpolableBool; |
| 48 friend class InterpolableList; | 48 friend class InterpolableList; |
| 49 | 49 |
| 50 friend class AnimationInterpolableValueTest; | 50 friend class AnimationInterpolableValueTest; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class CORE_EXPORT InterpolableNumber final : public InterpolableValue { | 53 class CORE_EXPORT InterpolableNumber final : public InterpolableValue { |
| 54 public: | 54 public: |
| 55 static std::unique_ptr<InterpolableNumber> create(double value) { | 55 static std::unique_ptr<InterpolableNumber> create(double value) { |
| 56 return wrapUnique(new InterpolableNumber(value)); | 56 return WTF::wrapUnique(new InterpolableNumber(value)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool isNumber() const final { return true; } | 59 bool isNumber() const final { return true; } |
| 60 double value() const { return m_value; } | 60 double value() const { return m_value; } |
| 61 bool equals(const InterpolableValue& other) const final; | 61 bool equals(const InterpolableValue& other) const final; |
| 62 std::unique_ptr<InterpolableValue> clone() const final { | 62 std::unique_ptr<InterpolableValue> clone() const final { |
| 63 return create(m_value); | 63 return create(m_value); |
| 64 } | 64 } |
| 65 std::unique_ptr<InterpolableValue> cloneAndZero() const final { | 65 std::unique_ptr<InterpolableValue> cloneAndZero() const final { |
| 66 return create(0); | 66 return create(0); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 83 // Explicitly delete operator= because MSVC automatically generate | 83 // Explicitly delete operator= because MSVC automatically generate |
| 84 // copy constructors and operator= for dll-exported classes. | 84 // copy constructors and operator= for dll-exported classes. |
| 85 // Since InterpolableList is not copyable, automatically generated | 85 // Since InterpolableList is not copyable, automatically generated |
| 86 // operator= causes MSVC compiler error. | 86 // operator= causes MSVC compiler error. |
| 87 // However, we cannot use WTF_MAKE_NONCOPYABLE because InterpolableList | 87 // However, we cannot use WTF_MAKE_NONCOPYABLE because InterpolableList |
| 88 // has its own copy constructor. So just delete operator= here. | 88 // has its own copy constructor. So just delete operator= here. |
| 89 InterpolableList& operator=(const InterpolableList&) = delete; | 89 InterpolableList& operator=(const InterpolableList&) = delete; |
| 90 | 90 |
| 91 static std::unique_ptr<InterpolableList> create( | 91 static std::unique_ptr<InterpolableList> create( |
| 92 const InterpolableList& other) { | 92 const InterpolableList& other) { |
| 93 return wrapUnique(new InterpolableList(other)); | 93 return WTF::wrapUnique(new InterpolableList(other)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 static std::unique_ptr<InterpolableList> create(size_t size) { | 96 static std::unique_ptr<InterpolableList> create(size_t size) { |
| 97 return wrapUnique(new InterpolableList(size)); | 97 return WTF::wrapUnique(new InterpolableList(size)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool isList() const final { return true; } | 100 bool isList() const final { return true; } |
| 101 void set(size_t position, std::unique_ptr<InterpolableValue> value) { | 101 void set(size_t position, std::unique_ptr<InterpolableValue> value) { |
| 102 m_values[position] = std::move(value); | 102 m_values[position] = std::move(value); |
| 103 } | 103 } |
| 104 const InterpolableValue* get(size_t position) const { | 104 const InterpolableValue* get(size_t position) const { |
| 105 return m_values[position].get(); | 105 return m_values[position].get(); |
| 106 } | 106 } |
| 107 std::unique_ptr<InterpolableValue>& getMutable(size_t position) { | 107 std::unique_ptr<InterpolableValue>& getMutable(size_t position) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 Vector<std::unique_ptr<InterpolableValue>> m_values; | 130 Vector<std::unique_ptr<InterpolableValue>> m_values; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 // FIXME: Remove this when we can. | 133 // FIXME: Remove this when we can. |
| 134 class InterpolableAnimatableValue : public InterpolableValue { | 134 class InterpolableAnimatableValue : public InterpolableValue { |
| 135 public: | 135 public: |
| 136 static std::unique_ptr<InterpolableAnimatableValue> create( | 136 static std::unique_ptr<InterpolableAnimatableValue> create( |
| 137 PassRefPtr<AnimatableValue> value) { | 137 PassRefPtr<AnimatableValue> value) { |
| 138 return wrapUnique(new InterpolableAnimatableValue(std::move(value))); | 138 return WTF::wrapUnique(new InterpolableAnimatableValue(std::move(value))); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool isAnimatableValue() const final { return true; } | 141 bool isAnimatableValue() const final { return true; } |
| 142 AnimatableValue* value() const { return m_value.get(); } | 142 AnimatableValue* value() const { return m_value.get(); } |
| 143 bool equals(const InterpolableValue&) const final { | 143 bool equals(const InterpolableValue&) const final { |
| 144 NOTREACHED(); | 144 NOTREACHED(); |
| 145 return false; | 145 return false; |
| 146 } | 146 } |
| 147 std::unique_ptr<InterpolableValue> clone() const final { | 147 std::unique_ptr<InterpolableValue> clone() const final { |
| 148 return create(m_value); | 148 return create(m_value); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 178 value.isList()); | 178 value.isList()); |
| 179 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, | 179 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, |
| 180 InterpolableValue, | 180 InterpolableValue, |
| 181 value, | 181 value, |
| 182 value->isAnimatableValue(), | 182 value->isAnimatableValue(), |
| 183 value.isAnimatableValue()); | 183 value.isAnimatableValue()); |
| 184 | 184 |
| 185 } // namespace blink | 185 } // namespace blink |
| 186 | 186 |
| 187 #endif | 187 #endif |
| OLD | NEW |