OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/SVGLengthListInterpolationType.h" | 5 #include "core/animation/SVGLengthListInterpolationType.h" |
6 | 6 |
7 #include "core/animation/InterpolationEnvironment.h" | 7 #include <memory> |
| 8 #include "core/animation/SVGInterpolationEnvironment.h" |
8 #include "core/animation/SVGLengthInterpolationType.h" | 9 #include "core/animation/SVGLengthInterpolationType.h" |
9 #include "core/animation/UnderlyingLengthChecker.h" | 10 #include "core/animation/UnderlyingLengthChecker.h" |
10 #include "core/svg/SVGLengthList.h" | 11 #include "core/svg/SVGLengthList.h" |
11 #include <memory> | |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 InterpolationValue SVGLengthListInterpolationType::MaybeConvertNeutral( | 15 InterpolationValue SVGLengthListInterpolationType::MaybeConvertNeutral( |
16 const InterpolationValue& underlying, | 16 const InterpolationValue& underlying, |
17 ConversionCheckers& conversion_checkers) const { | 17 ConversionCheckers& conversion_checkers) const { |
18 size_t underlying_length = | 18 size_t underlying_length = |
19 UnderlyingLengthChecker::GetUnderlyingLength(underlying); | 19 UnderlyingLengthChecker::GetUnderlyingLength(underlying); |
20 conversion_checkers.push_back( | 20 conversion_checkers.push_back( |
21 UnderlyingLengthChecker::Create(underlying_length)); | 21 UnderlyingLengthChecker::Create(underlying_length)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const NonInterpolableValue*) const { | 78 const NonInterpolableValue*) const { |
79 NOTREACHED(); | 79 NOTREACHED(); |
80 // This function is no longer called, because apply has been overridden. | 80 // This function is no longer called, because apply has been overridden. |
81 return nullptr; | 81 return nullptr; |
82 } | 82 } |
83 | 83 |
84 void SVGLengthListInterpolationType::Apply( | 84 void SVGLengthListInterpolationType::Apply( |
85 const InterpolableValue& interpolable_value, | 85 const InterpolableValue& interpolable_value, |
86 const NonInterpolableValue* non_interpolable_value, | 86 const NonInterpolableValue* non_interpolable_value, |
87 InterpolationEnvironment& environment) const { | 87 InterpolationEnvironment& environment) const { |
88 SVGElement& element = environment.SvgElement(); | 88 SVGElement& element = ToSVGInterpolationEnvironment(environment).SvgElement(); |
89 SVGLengthContext length_context(&element); | 89 SVGLengthContext length_context(&element); |
90 | 90 |
91 SVGLengthList* result = SVGLengthList::Create(unit_mode_); | 91 SVGLengthList* result = SVGLengthList::Create(unit_mode_); |
92 const InterpolableList& list = ToInterpolableList(interpolable_value); | 92 const InterpolableList& list = ToInterpolableList(interpolable_value); |
93 for (size_t i = 0; i < list.length(); i++) { | 93 for (size_t i = 0; i < list.length(); i++) { |
94 result->Append(SVGLengthInterpolationType::ResolveInterpolableSVGLength( | 94 result->Append(SVGLengthInterpolationType::ResolveInterpolableSVGLength( |
95 *list.Get(i), length_context, unit_mode_, negative_values_forbidden_)); | 95 *list.Get(i), length_context, unit_mode_, negative_values_forbidden_)); |
96 } | 96 } |
97 | 97 |
98 element.SetWebAnimatedAttribute(Attribute(), result); | 98 element.SetWebAnimatedAttribute(Attribute(), result); |
99 } | 99 } |
100 | 100 |
101 } // namespace blink | 101 } // namespace blink |
OLD | NEW |