Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolableValue.h

Issue 2487913002: Remove InterpolableBool and existing use of it in SVG path interpolation (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 private: 72 private:
73 void interpolate(const InterpolableValue& to, 73 void interpolate(const InterpolableValue& to,
74 const double progress, 74 const double progress,
75 InterpolableValue& result) const final; 75 InterpolableValue& result) const final;
76 double m_value; 76 double m_value;
77 77
78 explicit InterpolableNumber(double value) : m_value(value) {} 78 explicit InterpolableNumber(double value) : m_value(value) {}
79 }; 79 };
80 80
81 class CORE_EXPORT InterpolableBool final : public InterpolableValue {
82 public:
83 static std::unique_ptr<InterpolableBool> create(bool value) {
84 return wrapUnique(new InterpolableBool(value));
85 }
86
87 bool isBool() const final { return true; }
88 bool value() const { return m_value; }
89 bool equals(const InterpolableValue&) const final {
90 NOTREACHED();
91 return false;
92 }
93 std::unique_ptr<InterpolableValue> clone() const final {
94 return create(m_value);
95 }
96 std::unique_ptr<InterpolableValue> cloneAndZero() const final {
97 NOTREACHED();
98 return nullptr;
99 }
100 void scale(double scale) final { NOTREACHED(); }
101 void scaleAndAdd(double scale, const InterpolableValue& other) final {
102 NOTREACHED();
103 }
104
105 private:
106 void interpolate(const InterpolableValue& to,
107 const double progress,
108 InterpolableValue& result) const final;
109 bool m_value;
110
111 explicit InterpolableBool(bool value) : m_value(value) {}
112 };
113
114 class CORE_EXPORT InterpolableList : public InterpolableValue { 81 class CORE_EXPORT InterpolableList : public InterpolableValue {
115 public: 82 public:
116 // Explicitly delete operator= because MSVC automatically generate 83 // Explicitly delete operator= because MSVC automatically generate
117 // copy constructors and operator= for dll-exported classes. 84 // copy constructors and operator= for dll-exported classes.
118 // Since InterpolableList is not copyable, automatically generated 85 // Since InterpolableList is not copyable, automatically generated
119 // operator= causes MSVC compiler error. 86 // operator= causes MSVC compiler error.
120 // However, we cannot use WTF_MAKE_NONCOPYABLE because InterpolableList 87 // However, we cannot use WTF_MAKE_NONCOPYABLE because InterpolableList
121 // has its own copy constructor. So just delete operator= here. 88 // has its own copy constructor. So just delete operator= here.
122 InterpolableList& operator=(const InterpolableList&) = delete; 89 InterpolableList& operator=(const InterpolableList&) = delete;
123 90
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 164
198 InterpolableAnimatableValue(PassRefPtr<AnimatableValue> value) 165 InterpolableAnimatableValue(PassRefPtr<AnimatableValue> value)
199 : m_value(value) {} 166 : m_value(value) {}
200 }; 167 };
201 168
202 DEFINE_TYPE_CASTS(InterpolableNumber, 169 DEFINE_TYPE_CASTS(InterpolableNumber,
203 InterpolableValue, 170 InterpolableValue,
204 value, 171 value,
205 value->isNumber(), 172 value->isNumber(),
206 value.isNumber()); 173 value.isNumber());
207 DEFINE_TYPE_CASTS(InterpolableBool,
208 InterpolableValue,
209 value,
210 value->isBool(),
211 value.isBool());
212 DEFINE_TYPE_CASTS(InterpolableList, 174 DEFINE_TYPE_CASTS(InterpolableList,
213 InterpolableValue, 175 InterpolableValue,
214 value, 176 value,
215 value->isList(), 177 value->isList(),
216 value.isList()); 178 value.isList());
217 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, 179 DEFINE_TYPE_CASTS(InterpolableAnimatableValue,
218 InterpolableValue, 180 InterpolableValue,
219 value, 181 value,
220 value->isAnimatableValue(), 182 value->isAnimatableValue(),
221 value.isAnimatableValue()); 183 value.isAnimatableValue());
222 184
223 } // namespace blink 185 } // namespace blink
224 186
225 #endif 187 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698