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/CSSBasicShapeInterpolationType.h" | 5 #include "core/animation/CSSBasicShapeInterpolationType.h" |
6 | 6 |
7 #include "core/animation/BasicShapeInterpolationFunctions.h" | 7 #include "core/animation/BasicShapeInterpolationFunctions.h" |
8 #include "core/animation/BasicShapePropertyFunctions.h" | 8 #include "core/animation/BasicShapePropertyFunctions.h" |
9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
10 #include "core/css/resolver/StyleResolverState.h" | 10 #include "core/css/resolver/StyleResolverState.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 PairwiseInterpolationValue CSSBasicShapeInterpolationType::maybeMergeSingles(Int
erpolationValue&& start, InterpolationValue&& end) const | 97 PairwiseInterpolationValue CSSBasicShapeInterpolationType::maybeMergeSingles(Int
erpolationValue&& start, InterpolationValue&& end) const |
98 { | 98 { |
99 if (!BasicShapeInterpolationFunctions::shapesAreCompatible(*start.nonInterpo
lableValue, *end.nonInterpolableValue)) | 99 if (!BasicShapeInterpolationFunctions::shapesAreCompatible(*start.nonInterpo
lableValue, *end.nonInterpolableValue)) |
100 return nullptr; | 100 return nullptr; |
101 return PairwiseInterpolationValue(std::move(start.interpolableValue), std::m
ove(end.interpolableValue), start.nonInterpolableValue.release()); | 101 return PairwiseInterpolationValue(std::move(start.interpolableValue), std::m
ove(end.interpolableValue), start.nonInterpolableValue.release()); |
102 } | 102 } |
103 | 103 |
104 InterpolationValue CSSBasicShapeInterpolationType::maybeConvertUnderlyingValue(c
onst InterpolationEnvironment& environment) const | 104 InterpolationValue CSSBasicShapeInterpolationType::maybeConvertUnderlyingValue(c
onst InterpolationEnvironment& environment) const |
105 { | 105 { |
106 const ComputedStyle& style = *environment.state().style(); | 106 const ComputedStyle& style = environment.style(); |
107 return BasicShapeInterpolationFunctions::maybeConvertBasicShape( | 107 return BasicShapeInterpolationFunctions::maybeConvertBasicShape( |
108 BasicShapePropertyFunctions::getBasicShape(cssProperty(), style), style.
effectiveZoom()); | 108 BasicShapePropertyFunctions::getBasicShape(cssProperty(), style), style.
effectiveZoom()); |
109 } | 109 } |
110 | 110 |
111 void CSSBasicShapeInterpolationType::composite(UnderlyingValueOwner& underlyingV
alueOwner, double underlyingFraction, const InterpolationValue& value, double in
terpolationFraction) const | 111 void CSSBasicShapeInterpolationType::composite(UnderlyingValueOwner& underlyingV
alueOwner, double underlyingFraction, const InterpolationValue& value, double in
terpolationFraction) const |
112 { | 112 { |
113 if (!BasicShapeInterpolationFunctions::shapesAreCompatible(*underlyingValueO
wner.value().nonInterpolableValue, *value.nonInterpolableValue)) { | 113 if (!BasicShapeInterpolationFunctions::shapesAreCompatible(*underlyingValueO
wner.value().nonInterpolableValue, *value.nonInterpolableValue)) { |
114 underlyingValueOwner.set(*this, value); | 114 underlyingValueOwner.set(*this, value); |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(underlyin
gFraction, *value.interpolableValue); | 118 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(underlyin
gFraction, *value.interpolableValue); |
119 } | 119 } |
120 | 120 |
121 void CSSBasicShapeInterpolationType::apply(const InterpolableValue& interpolable
Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen
t& environment) const | 121 void CSSBasicShapeInterpolationType::apply(const InterpolableValue& interpolable
Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen
t& environment) const |
122 { | 122 { |
123 BasicShapePropertyFunctions::setBasicShape(cssProperty(), *environment.state
().style(), | 123 BasicShapePropertyFunctions::setBasicShape(cssProperty(), environment.style(
), |
124 BasicShapeInterpolationFunctions::createBasicShape(interpolableValue, *n
onInterpolableValue, environment.state().cssToLengthConversionData())); | 124 BasicShapeInterpolationFunctions::createBasicShape(interpolableValue, *n
onInterpolableValue, environment.state().cssToLengthConversionData())); |
125 } | 125 } |
126 | 126 |
127 } // namespace blink | 127 } // namespace blink |
OLD | NEW |