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/InvalidatableInterpolation.h" | 5 #include "core/animation/InvalidatableInterpolation.h" |
6 | 6 |
7 #include "core/animation/InterpolationEnvironment.h" | 7 #include "core/animation/InterpolationEnvironment.h" |
8 #include "core/animation/StringKeyframe.h" | 8 #include "core/animation/StringKeyframe.h" |
9 #include "core/css/resolver/StyleResolverState.h" | 9 #include "core/css/resolver/StyleResolverState.h" |
10 | 10 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 UnderlyingValueOwner underlyingValueOwner; | 172 UnderlyingValueOwner underlyingValueOwner; |
173 const InvalidatableInterpolation& firstInterpolation = toInvalidatableInterp
olation(*interpolations.at(startingIndex)); | 173 const InvalidatableInterpolation& firstInterpolation = toInvalidatableInterp
olation(*interpolations.at(startingIndex)); |
174 if (firstInterpolation.dependsOnUnderlyingValue()) { | 174 if (firstInterpolation.dependsOnUnderlyingValue()) { |
175 underlyingValueOwner.set(firstInterpolation.maybeConvertUnderlyingValue(
environment)); | 175 underlyingValueOwner.set(firstInterpolation.maybeConvertUnderlyingValue(
environment)); |
176 } else { | 176 } else { |
177 const TypedInterpolationValue* firstValue = firstInterpolation.ensureVal
idInterpolation(environment, underlyingValueOwner); | 177 const TypedInterpolationValue* firstValue = firstInterpolation.ensureVal
idInterpolation(environment, underlyingValueOwner); |
178 // Fast path for replace interpolations that are the only one to apply. | 178 // Fast path for replace interpolations that are the only one to apply. |
179 if (interpolations.size() == 1) { | 179 if (interpolations.size() == 1) { |
180 if (firstValue) { | 180 if (firstValue) { |
181 firstInterpolation.setFlagIfInheritUsed(environment); | 181 firstInterpolation.setFlagIfInheritUsed(environment); |
182 firstValue->type().apply(firstValue->interpolableValue(), firstV
alue->nonInterpolableValue(), environment); | 182 firstValue->type().apply(firstValue->interpolableValue(), firstV
alue->getNonInterpolableValue(), environment); |
183 } | 183 } |
184 return; | 184 return; |
185 } | 185 } |
186 underlyingValueOwner.set(firstValue); | 186 underlyingValueOwner.set(firstValue); |
187 startingIndex++; | 187 startingIndex++; |
188 } | 188 } |
189 | 189 |
190 // Composite interpolations onto the underlying value. | 190 // Composite interpolations onto the underlying value. |
191 bool shouldApply = false; | 191 bool shouldApply = false; |
192 for (size_t i = startingIndex; i < interpolations.size(); i++) { | 192 for (size_t i = startingIndex; i < interpolations.size(); i++) { |
193 const InvalidatableInterpolation& currentInterpolation = toInvalidatable
Interpolation(*interpolations.at(i)); | 193 const InvalidatableInterpolation& currentInterpolation = toInvalidatable
Interpolation(*interpolations.at(i)); |
194 ASSERT(currentInterpolation.dependsOnUnderlyingValue()); | 194 ASSERT(currentInterpolation.dependsOnUnderlyingValue()); |
195 const TypedInterpolationValue* currentValue = currentInterpolation.ensur
eValidInterpolation(environment, underlyingValueOwner); | 195 const TypedInterpolationValue* currentValue = currentInterpolation.ensur
eValidInterpolation(environment, underlyingValueOwner); |
196 if (!currentValue) | 196 if (!currentValue) |
197 continue; | 197 continue; |
198 shouldApply = true; | 198 shouldApply = true; |
199 currentInterpolation.setFlagIfInheritUsed(environment); | 199 currentInterpolation.setFlagIfInheritUsed(environment); |
200 double underlyingFraction = currentInterpolation.underlyingFraction(); | 200 double underlyingFraction = currentInterpolation.underlyingFraction(); |
201 if (underlyingFraction == 0 || !underlyingValueOwner || underlyingValueO
wner.type() != currentValue->type()) | 201 if (underlyingFraction == 0 || !underlyingValueOwner || underlyingValueO
wner.type() != currentValue->type()) |
202 underlyingValueOwner.set(currentValue); | 202 underlyingValueOwner.set(currentValue); |
203 else | 203 else |
204 currentValue->type().composite(underlyingValueOwner, underlyingFract
ion, currentValue->value(), currentInterpolation.m_currentFraction); | 204 currentValue->type().composite(underlyingValueOwner, underlyingFract
ion, currentValue->value(), currentInterpolation.m_currentFraction); |
205 } | 205 } |
206 | 206 |
207 if (shouldApply && underlyingValueOwner) | 207 if (shouldApply && underlyingValueOwner) |
208 underlyingValueOwner.type().apply(*underlyingValueOwner.value().interpol
ableValue, underlyingValueOwner.value().nonInterpolableValue.get(), environment)
; | 208 underlyingValueOwner.type().apply(*underlyingValueOwner.value().interpol
ableValue, underlyingValueOwner.value().nonInterpolableValue.get(), environment)
; |
209 } | 209 } |
210 | 210 |
211 } // namespace blink | 211 } // namespace blink |
OLD | NEW |