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/SVGLengthInterpolationType.h" | 5 #include "core/animation/SVGLengthInterpolationType.h" |
6 | 6 |
7 #include "core/animation/InterpolationEnvironment.h" | 7 #include "core/animation/InterpolationEnvironment.h" |
8 #include "core/animation/StringKeyframe.h" | 8 #include "core/animation/StringKeyframe.h" |
9 #include "core/css/CSSHelper.h" | 9 #include "core/css/CSSHelper.h" |
10 #include "core/svg/SVGElement.h" | 10 #include "core/svg/SVGElement.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 value = entry; | 61 value = entry; |
62 unitType = CSSPrimitiveValue::lengthUnitTypeToUnitType( | 62 unitType = CSSPrimitiveValue::lengthUnitTypeToUnitType( |
63 static_cast<CSSPrimitiveValue::LengthUnitType>(i)); | 63 static_cast<CSSPrimitiveValue::LengthUnitType>(i)); |
64 } | 64 } |
65 | 65 |
66 if (unitTypeCount > 1) { | 66 if (unitTypeCount > 1) { |
67 value = 0; | 67 value = 0; |
68 unitType = CSSPrimitiveValue::UnitType::UserUnits; | 68 unitType = CSSPrimitiveValue::UnitType::UserUnits; |
69 | 69 |
70 // SVGLength does not support calc expressions, so we convert to canonical u
nits. | 70 // SVGLength does not support calc expressions, so we convert to canonical |
| 71 // units. |
71 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { | 72 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { |
72 double entry = toInterpolableNumber(listOfValues.get(i))->value(); | 73 double entry = toInterpolableNumber(listOfValues.get(i))->value(); |
73 if (entry) | 74 if (entry) |
74 value += lengthContext.convertValueToUserUnits( | 75 value += lengthContext.convertValueToUserUnits( |
75 entry, unitMode, | 76 entry, unitMode, |
76 CSSPrimitiveValue::lengthUnitTypeToUnitType( | 77 CSSPrimitiveValue::lengthUnitTypeToUnitType( |
77 static_cast<CSSPrimitiveValue::LengthUnitType>(i))); | 78 static_cast<CSSPrimitiveValue::LengthUnitType>(i))); |
78 } | 79 } |
79 } | 80 } |
80 | 81 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 InterpolationEnvironment& environment) const { | 115 InterpolationEnvironment& environment) const { |
115 SVGElement& element = environment.svgElement(); | 116 SVGElement& element = environment.svgElement(); |
116 SVGLengthContext lengthContext(&element); | 117 SVGLengthContext lengthContext(&element); |
117 element.setWebAnimatedAttribute( | 118 element.setWebAnimatedAttribute( |
118 attribute(), | 119 attribute(), |
119 resolveInterpolableSVGLength(interpolableValue, lengthContext, m_unitMode, | 120 resolveInterpolableSVGLength(interpolableValue, lengthContext, m_unitMode, |
120 m_negativeValuesForbidden)); | 121 m_negativeValuesForbidden)); |
121 } | 122 } |
122 | 123 |
123 } // namespace blink | 124 } // namespace blink |
OLD | NEW |