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/CSSPathInterpolationType.h" | 5 #include "core/animation/CSSPathInterpolationType.h" |
6 | 6 |
7 #include "core/animation/PathInterpolationFunctions.h" | 7 #include "core/animation/PathInterpolationFunctions.h" |
8 #include "core/css/CSSPathValue.h" | 8 #include "core/css/CSSPathValue.h" |
9 #include "core/css/resolver/StyleResolverState.h" | 9 #include "core/css/resolver/StyleResolverState.h" |
10 #include "wtf/PtrUtil.h" | 10 #include "wtf/PtrUtil.h" |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 void CSSPathInterpolationType::apply(const InterpolableValue& interpolableValue,
const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& env
ironment) const | 15 void CSSPathInterpolationType::apply(const InterpolableValue& interpolableValue,
const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& env
ironment) const |
16 { | 16 { |
17 ASSERT(cssProperty() == CSSPropertyD); | 17 ASSERT(cssProperty() == CSSPropertyD); |
18 std::unique_ptr<SVGPathByteStream> pathByteStream = PathInterpolationFunctio
ns::appliedValue(interpolableValue, nonInterpolableValue); | 18 std::unique_ptr<SVGPathByteStream> pathByteStream = PathInterpolationFunctio
ns::appliedValue(interpolableValue, nonInterpolableValue); |
19 if (pathByteStream->isEmpty()) { | 19 if (pathByteStream->isEmpty()) { |
20 environment.state().style()->setD(nullptr); | 20 environment.style().setD(nullptr); |
21 return; | 21 return; |
22 } | 22 } |
23 environment.state().style()->setD(StylePath::create(std::move(pathByteStream
))); | 23 environment.style().setD(StylePath::create(std::move(pathByteStream))); |
24 } | 24 } |
25 | 25 |
26 void CSSPathInterpolationType::composite(UnderlyingValueOwner& underlyingValueOw
ner, double underlyingFraction, const InterpolationValue& value, double interpol
ationFraction) const | 26 void CSSPathInterpolationType::composite(UnderlyingValueOwner& underlyingValueOw
ner, double underlyingFraction, const InterpolationValue& value, double interpol
ationFraction) const |
27 { | 27 { |
28 PathInterpolationFunctions::composite(underlyingValueOwner, underlyingFracti
on, *this, value); | 28 PathInterpolationFunctions::composite(underlyingValueOwner, underlyingFracti
on, *this, value); |
29 } | 29 } |
30 | 30 |
31 InterpolationValue CSSPathInterpolationType::maybeConvertNeutral(const Interpola
tionValue& underlying, ConversionCheckers& conversionCheckers) const | 31 InterpolationValue CSSPathInterpolationType::maybeConvertNeutral(const Interpola
tionValue& underlying, ConversionCheckers& conversionCheckers) const |
32 { | 32 { |
33 return PathInterpolationFunctions::maybeConvertNeutral(underlying, conversio
nCheckers); | 33 return PathInterpolationFunctions::maybeConvertNeutral(underlying, conversio
nCheckers); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (!value.isPathValue()) { | 73 if (!value.isPathValue()) { |
74 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); | 74 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone); |
75 return nullptr; | 75 return nullptr; |
76 } | 76 } |
77 return PathInterpolationFunctions::convertValue(toCSSPathValue(value).byteSt
ream()); | 77 return PathInterpolationFunctions::convertValue(toCSSPathValue(value).byteSt
ream()); |
78 } | 78 } |
79 | 79 |
80 InterpolationValue CSSPathInterpolationType::maybeConvertUnderlyingValue(const I
nterpolationEnvironment& environment) const | 80 InterpolationValue CSSPathInterpolationType::maybeConvertUnderlyingValue(const I
nterpolationEnvironment& environment) const |
81 { | 81 { |
82 ASSERT(cssProperty() == CSSPropertyD); | 82 ASSERT(cssProperty() == CSSPropertyD); |
83 return PathInterpolationFunctions::convertValue(environment.state().style()-
>svgStyle().d()); | 83 return PathInterpolationFunctions::convertValue(environment.style().svgStyle
().d()); |
84 } | 84 } |
85 | 85 |
86 PairwiseInterpolationValue CSSPathInterpolationType::maybeMergeSingles(Interpola
tionValue&& start, InterpolationValue&& end) const | 86 PairwiseInterpolationValue CSSPathInterpolationType::maybeMergeSingles(Interpola
tionValue&& start, InterpolationValue&& end) const |
87 { | 87 { |
88 return PathInterpolationFunctions::maybeMergeSingles(std::move(start), std::
move(end)); | 88 return PathInterpolationFunctions::maybeMergeSingles(std::move(start), std::
move(end)); |
89 } | 89 } |
90 | 90 |
91 } // namespace blink | 91 } // namespace blink |
OLD | NEW |