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/CSSLengthListInterpolationType.h" | 5 #include "core/animation/CSSLengthListInterpolationType.h" |
6 | 6 |
7 #include "core/animation/CSSLengthInterpolationType.h" | 7 #include "core/animation/CSSLengthInterpolationType.h" |
8 #include "core/animation/LengthListPropertyFunctions.h" | 8 #include "core/animation/LengthListPropertyFunctions.h" |
9 #include "core/animation/ListInterpolationFunctions.h" | 9 #include "core/animation/ListInterpolationFunctions.h" |
10 #include "core/animation/UnderlyingLengthChecker.h" | 10 #include "core/animation/UnderlyingLengthChecker.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 PairwiseInterpolationValue CSSLengthListInterpolationType::maybeMergeSingles(Int
erpolationValue&& start, InterpolationValue&& end) const | 103 PairwiseInterpolationValue CSSLengthListInterpolationType::maybeMergeSingles(Int
erpolationValue&& start, InterpolationValue&& end) const |
104 { | 104 { |
105 return ListInterpolationFunctions::maybeMergeSingles(std::move(start), std::
move(end), CSSLengthInterpolationType::staticMergeSingleConversions); | 105 return ListInterpolationFunctions::maybeMergeSingles(std::move(start), std::
move(end), CSSLengthInterpolationType::staticMergeSingleConversions); |
106 } | 106 } |
107 | 107 |
108 InterpolationValue CSSLengthListInterpolationType::maybeConvertUnderlyingValue(c
onst InterpolationEnvironment& environment) const | 108 InterpolationValue CSSLengthListInterpolationType::maybeConvertUnderlyingValue(c
onst InterpolationEnvironment& environment) const |
109 { | 109 { |
110 Vector<Length> underlyingLengthList; | 110 Vector<Length> underlyingLengthList; |
111 if (!LengthListPropertyFunctions::getLengthList(cssProperty(), *environment.
state().style(), underlyingLengthList)) | 111 if (!LengthListPropertyFunctions::getLengthList(cssProperty(), environment.s
tyle(), underlyingLengthList)) |
112 return nullptr; | 112 return nullptr; |
113 return maybeConvertLengthList(underlyingLengthList, environment.state().styl
e()->effectiveZoom()); | 113 return maybeConvertLengthList(underlyingLengthList, environment.style().effe
ctiveZoom()); |
114 } | 114 } |
115 | 115 |
116 void CSSLengthListInterpolationType::composite(UnderlyingValueOwner& underlyingV
alueOwner, double underlyingFraction, const InterpolationValue& value, double in
terpolationFraction) const | 116 void CSSLengthListInterpolationType::composite(UnderlyingValueOwner& underlyingV
alueOwner, double underlyingFraction, const InterpolationValue& value, double in
terpolationFraction) const |
117 { | 117 { |
118 ListInterpolationFunctions::composite(underlyingValueOwner, underlyingFracti
on, *this, value, | 118 ListInterpolationFunctions::composite(underlyingValueOwner, underlyingFracti
on, *this, value, |
119 CSSLengthInterpolationType::nonInterpolableValuesAreCompatible, | 119 CSSLengthInterpolationType::nonInterpolableValuesAreCompatible, |
120 CSSLengthInterpolationType::composite); | 120 CSSLengthInterpolationType::composite); |
121 } | 121 } |
122 | 122 |
123 void CSSLengthListInterpolationType::apply(const InterpolableValue& interpolable
Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen
t& environment) const | 123 void CSSLengthListInterpolationType::apply(const InterpolableValue& interpolable
Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen
t& environment) const |
124 { | 124 { |
125 const InterpolableList& interpolableList = toInterpolableList(interpolableVa
lue); | 125 const InterpolableList& interpolableList = toInterpolableList(interpolableVa
lue); |
126 const size_t length = interpolableList.length(); | 126 const size_t length = interpolableList.length(); |
127 ASSERT(length > 0); | 127 ASSERT(length > 0); |
128 const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonI
nterpolableValue); | 128 const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonI
nterpolableValue); |
129 ASSERT(nonInterpolableList.length() == length); | 129 ASSERT(nonInterpolableList.length() == length); |
130 Vector<Length> result(length); | 130 Vector<Length> result(length); |
131 for (size_t i = 0; i < length; i++) { | 131 for (size_t i = 0; i < length; i++) { |
132 result[i] = CSSLengthInterpolationType::resolveInterpolableLength( | 132 result[i] = CSSLengthInterpolationType::resolveInterpolableLength( |
133 *interpolableList.get(i), | 133 *interpolableList.get(i), |
134 nonInterpolableList.get(i), | 134 nonInterpolableList.get(i), |
135 environment.state().cssToLengthConversionData(), | 135 environment.state().cssToLengthConversionData(), |
136 m_valueRange); | 136 m_valueRange); |
137 } | 137 } |
138 LengthListPropertyFunctions::setLengthList(cssProperty(), *environment.state
().style(), std::move(result)); | 138 LengthListPropertyFunctions::setLengthList(cssProperty(), environment.style(
), std::move(result)); |
139 } | 139 } |
140 | 140 |
141 } // namespace blink | 141 } // namespace blink |
OLD | NEW |