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 #include "core/animation/SVGTransformListInterpolationType.h" | 5 #include "core/animation/SVGTransformListInterpolationType.h" |
6 | 6 |
7 #include "core/animation/InterpolableValue.h" | 7 #include "core/animation/InterpolableValue.h" |
8 #include "core/animation/InterpolationEnvironment.h" | 8 #include "core/animation/InterpolationEnvironment.h" |
9 #include "core/animation/NonInterpolableValue.h" | 9 #include "core/animation/NonInterpolableValue.h" |
10 #include "core/animation/StringKeyframe.h" | 10 #include "core/animation/StringKeyframe.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 class SVGTransformListChecker : public InterpolationType::ConversionChecker { | 173 class SVGTransformListChecker : public InterpolationType::ConversionChecker { |
174 public: | 174 public: |
175 static std::unique_ptr<SVGTransformListChecker> create( | 175 static std::unique_ptr<SVGTransformListChecker> create( |
176 const InterpolationValue& underlying) { | 176 const InterpolationValue& underlying) { |
177 return wrapUnique(new SVGTransformListChecker(underlying)); | 177 return wrapUnique(new SVGTransformListChecker(underlying)); |
178 } | 178 } |
179 | 179 |
180 bool isValid(const InterpolationEnvironment&, | 180 bool isValid(const InterpolationEnvironment&, |
181 const InterpolationValue& underlying) const final { | 181 const InterpolationValue& underlying) const final { |
182 // TODO(suzyh): change maybeConvertSingle so we don't have to recalculate fo
r changes to the interpolable values | 182 // TODO(suzyh): change maybeConvertSingle so we don't have to recalculate |
| 183 // for changes to the interpolable values |
183 if (!underlying && !m_underlying) | 184 if (!underlying && !m_underlying) |
184 return true; | 185 return true; |
185 if (!underlying || !m_underlying) | 186 if (!underlying || !m_underlying) |
186 return false; | 187 return false; |
187 return m_underlying.interpolableValue->equals( | 188 return m_underlying.interpolableValue->equals( |
188 *underlying.interpolableValue) && | 189 *underlying.interpolableValue) && |
189 getTransformTypes(m_underlying) == getTransformTypes(underlying); | 190 getTransformTypes(m_underlying) == getTransformTypes(underlying); |
190 } | 191 } |
191 | 192 |
192 private: | 193 private: |
193 SVGTransformListChecker(const InterpolationValue& underlying) | 194 SVGTransformListChecker(const InterpolationValue& underlying) |
194 : m_underlying(underlying.clone()) {} | 195 : m_underlying(underlying.clone()) {} |
195 | 196 |
196 const InterpolationValue m_underlying; | 197 const InterpolationValue m_underlying; |
197 }; | 198 }; |
198 | 199 |
199 } // namespace | 200 } // namespace |
200 | 201 |
201 InterpolationValue SVGTransformListInterpolationType::maybeConvertNeutral( | 202 InterpolationValue SVGTransformListInterpolationType::maybeConvertNeutral( |
202 const InterpolationValue&, | 203 const InterpolationValue&, |
203 ConversionCheckers&) const { | 204 ConversionCheckers&) const { |
204 NOTREACHED(); | 205 NOTREACHED(); |
205 // This function is no longer called, because maybeConvertSingle has been over
ridden. | 206 // This function is no longer called, because maybeConvertSingle has been |
| 207 // overridden. |
206 return nullptr; | 208 return nullptr; |
207 } | 209 } |
208 | 210 |
209 InterpolationValue SVGTransformListInterpolationType::maybeConvertSVGValue( | 211 InterpolationValue SVGTransformListInterpolationType::maybeConvertSVGValue( |
210 const SVGPropertyBase& svgValue) const { | 212 const SVGPropertyBase& svgValue) const { |
211 if (svgValue.type() != AnimatedTransformList) | 213 if (svgValue.type() != AnimatedTransformList) |
212 return nullptr; | 214 return nullptr; |
213 | 215 |
214 const SVGTransformList& svgList = toSVGTransformList(svgValue); | 216 const SVGTransformList& svgList = toSVGTransformList(svgValue); |
215 std::unique_ptr<InterpolableList> result = | 217 std::unique_ptr<InterpolableList> result = |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 303 |
302 void SVGTransformListInterpolationType::composite( | 304 void SVGTransformListInterpolationType::composite( |
303 UnderlyingValueOwner& underlyingValueOwner, | 305 UnderlyingValueOwner& underlyingValueOwner, |
304 double underlyingFraction, | 306 double underlyingFraction, |
305 const InterpolationValue& value, | 307 const InterpolationValue& value, |
306 double interpolationFraction) const { | 308 double interpolationFraction) const { |
307 underlyingValueOwner.set(*this, value); | 309 underlyingValueOwner.set(*this, value); |
308 } | 310 } |
309 | 311 |
310 } // namespace blink | 312 } // namespace blink |
OLD | NEW |