| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/LengthSVGInterpolation.h" | 6 #include "core/animation/LengthSVGInterpolation.h" |
| 7 | 7 |
| 8 #include "core/css/CSSHelper.h" | 8 #include "core/css/CSSHelper.h" |
| 9 #include "core/svg/SVGAnimatedLength.h" | 9 #include "core/svg/SVGAnimatedLength.h" |
| 10 #include "core/svg/SVGAnimatedLengthList.h" | 10 #include "core/svg/SVGAnimatedLengthList.h" |
| 11 #include "core/svg/SVGElement.h" | 11 #include "core/svg/SVGElement.h" |
| 12 #include "core/svg/SVGLengthContext.h" | 12 #include "core/svg/SVGLengthContext.h" |
| 13 #include "wtf/StdLibExtras.h" | 13 #include "wtf/StdLibExtras.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 PassRefPtrWillBeRawPtr<SVGLengthList> LengthSVGInterpolation::createList(const S
VGAnimatedPropertyBase& attribute) | 17 PassRefPtrWillBeRawPtr<SVGLengthList> LengthSVGInterpolation::createList(const S
VGAnimatedPropertyBase& attribute) |
| 18 { | 18 { |
| 19 ASSERT(attribute.type() == AnimatedLengthList); | 19 ASSERT(attribute.type() == AnimatedLengthList); |
| 20 const SVGAnimatedLengthList& animatedLengthList = static_cast<const SVGAnima
tedLengthList&>(attribute); | 20 const SVGAnimatedLengthList& animatedLengthList = static_cast<const SVGAnima
tedLengthList&>(attribute); |
| 21 return SVGLengthList::create(animatedLengthList.currentValue()->unitMode()); | 21 return SVGLengthList::create(animatedLengthList.currentValue()->unitMode()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 PassRefPtr<LengthSVGInterpolation> LengthSVGInterpolation::create(SVGPropertyBas
e* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase>
attribute) | 24 PassRefPtr<LengthSVGInterpolation> LengthSVGInterpolation::create(SVGPropertyBas
e* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase>
attribute) |
| 25 { | 25 { |
| 26 NonInterpolableType modeData; | 26 NonInterpolableType modeData; |
| 27 OwnPtr<InterpolableValue> startValue = toInterpolableValue(toSVGLength(start
).get(), attribute.get(), &modeData); | 27 OwnPtr<InterpolableValue> startValue = toInterpolableValue(toSVGLength(start
), attribute.get(), &modeData); |
| 28 OwnPtr<InterpolableValue> endValue = toInterpolableValue(toSVGLength(end).ge
t(), attribute.get(), nullptr); | 28 OwnPtr<InterpolableValue> endValue = toInterpolableValue(toSVGLength(end), a
ttribute.get(), nullptr); |
| 29 return adoptRef(new LengthSVGInterpolation(startValue.release(), endValue.re
lease(), attribute, modeData)); | 29 return adoptRef(new LengthSVGInterpolation(startValue.release(), endValue.re
lease(), attribute, modeData)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 void populateModeData(const SVGAnimatedPropertyBase* attribute, LengthSVGInterpo
lation::NonInterpolableType* ptrModeData) | 34 void populateModeData(const SVGAnimatedPropertyBase* attribute, LengthSVGInterpo
lation::NonInterpolableType* ptrModeData) |
| 35 { | 35 { |
| 36 switch (attribute->type()) { | 36 switch (attribute->type()) { |
| 37 case AnimatedLength: { | 37 case AnimatedLength: { |
| 38 const SVGAnimatedLength& animatedLength = static_cast<const SVGAnimatedL
ength&>(*attribute); | 38 const SVGAnimatedLength& animatedLength = static_cast<const SVGAnimatedL
ength&>(*attribute); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 result->setValueInSpecifiedUnits(value); | 162 result->setValueInSpecifiedUnits(value); |
| 163 return result.release(); | 163 return result.release(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 PassRefPtrWillBeRawPtr<SVGPropertyBase> LengthSVGInterpolation::interpolatedValu
e(SVGElement& targetElement) const | 166 PassRefPtrWillBeRawPtr<SVGPropertyBase> LengthSVGInterpolation::interpolatedValu
e(SVGElement& targetElement) const |
| 167 { | 167 { |
| 168 return fromInterpolableValue(*m_cachedValue, m_modeData, &targetElement); | 168 return fromInterpolableValue(*m_cachedValue, m_modeData, &targetElement); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } | 171 } |
| OLD | NEW |