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 <memory> |
| 8 #include "core/animation/SVGInterpolationEnvironment.h" |
8 #include "core/animation/StringKeyframe.h" | 9 #include "core/animation/StringKeyframe.h" |
9 #include "core/css/CSSHelper.h" | 10 #include "core/css/CSSHelper.h" |
10 #include "core/svg/SVGElement.h" | 11 #include "core/svg/SVGElement.h" |
11 #include "core/svg/SVGLength.h" | 12 #include "core/svg/SVGLength.h" |
12 #include "core/svg/SVGLengthContext.h" | 13 #include "core/svg/SVGLengthContext.h" |
13 #include <memory> | |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 std::unique_ptr<InterpolableValue> | 17 std::unique_ptr<InterpolableValue> |
18 SVGLengthInterpolationType::NeutralInterpolableValue() { | 18 SVGLengthInterpolationType::NeutralInterpolableValue() { |
19 std::unique_ptr<InterpolableList> list_of_values = | 19 std::unique_ptr<InterpolableList> list_of_values = |
20 InterpolableList::Create(CSSPrimitiveValue::kLengthUnitTypeCount); | 20 InterpolableList::Create(CSSPrimitiveValue::kLengthUnitTypeCount); |
21 for (size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; ++i) | 21 for (size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; ++i) |
22 list_of_values->Set(i, InterpolableNumber::Create(0)); | 22 list_of_values->Set(i, InterpolableNumber::Create(0)); |
23 | 23 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const NonInterpolableValue*) const { | 108 const NonInterpolableValue*) const { |
109 NOTREACHED(); | 109 NOTREACHED(); |
110 // This function is no longer called, because apply has been overridden. | 110 // This function is no longer called, because apply has been overridden. |
111 return nullptr; | 111 return nullptr; |
112 } | 112 } |
113 | 113 |
114 void SVGLengthInterpolationType::Apply( | 114 void SVGLengthInterpolationType::Apply( |
115 const InterpolableValue& interpolable_value, | 115 const InterpolableValue& interpolable_value, |
116 const NonInterpolableValue* non_interpolable_value, | 116 const NonInterpolableValue* non_interpolable_value, |
117 InterpolationEnvironment& environment) const { | 117 InterpolationEnvironment& environment) const { |
118 SVGElement& element = environment.SvgElement(); | 118 SVGElement& element = ToSVGInterpolationEnvironment(environment).SvgElement(); |
119 SVGLengthContext length_context(&element); | 119 SVGLengthContext length_context(&element); |
120 element.SetWebAnimatedAttribute( | 120 element.SetWebAnimatedAttribute( |
121 Attribute(), | 121 Attribute(), |
122 ResolveInterpolableSVGLength(interpolable_value, length_context, | 122 ResolveInterpolableSVGLength(interpolable_value, length_context, |
123 unit_mode_, negative_values_forbidden_)); | 123 unit_mode_, negative_values_forbidden_)); |
124 } | 124 } |
125 | 125 |
126 } // namespace blink | 126 } // namespace blink |
OLD | NEW |