| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool InvalidatableInterpolation::isNeutralKeyframeActive() const | 86 bool InvalidatableInterpolation::isNeutralKeyframeActive() const |
| 87 { | 87 { |
| 88 return (m_startKeyframe->isNeutral() && m_currentFraction != 1) || (m_endKey
frame->isNeutral() && m_currentFraction != 0); | 88 return (m_startKeyframe->isNeutral() && m_currentFraction != 1) || (m_endKey
frame->isNeutral() && m_currentFraction != 0); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void InvalidatableInterpolation::clearCache() const | 91 void InvalidatableInterpolation::clearCache() const |
| 92 { | 92 { |
| 93 m_isCached = false; | 93 m_isCached = false; |
| 94 m_cachedPairConversion.clear(); | 94 m_cachedPairConversion.reset(); |
| 95 m_conversionCheckers.clear(); | 95 m_conversionCheckers.clear(); |
| 96 m_cachedValue.clear(); | 96 m_cachedValue.reset(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool InvalidatableInterpolation::isCacheValid(const InterpolationEnvironment& en
vironment, const UnderlyingValueOwner& underlyingValueOwner) const | 99 bool InvalidatableInterpolation::isCacheValid(const InterpolationEnvironment& en
vironment, const UnderlyingValueOwner& underlyingValueOwner) const |
| 100 { | 100 { |
| 101 if (!m_isCached) | 101 if (!m_isCached) |
| 102 return false; | 102 return false; |
| 103 if (isNeutralKeyframeActive()) { | 103 if (isNeutralKeyframeActive()) { |
| 104 if (m_cachedPairConversion && m_cachedPairConversion->isFlip()) | 104 if (m_cachedPairConversion && m_cachedPairConversion->isFlip()) |
| 105 return false; | 105 return false; |
| 106 // Pairwise interpolation can never happen between different Interpolati
onTypes, neutral values always represent the underlying value. | 106 // Pairwise interpolation can never happen between different Interpolati
onTypes, neutral values always represent the underlying value. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |