| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 6 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
| 7 | 7 |
| 8 #include "core/animation/ElementAnimations.h" | 8 #include "core/animation/ElementAnimations.h" |
| 9 #include "core/animation/css/CSSAnimatableValueFactory.h" | 9 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 10 #include "core/css/CSSBasicShapes.h" | 10 #include "core/css/CSSBasicShapes.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| 23 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const | 23 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const |
| 24 { | 24 { |
| 25 if (m_outdated || !state.element()->elementAnimations() || !state.element()-
>elementAnimations()->isAnimationStyleChange()) { | 25 if (m_outdated || !state.element()->elementAnimations() || !state.element()-
>elementAnimations()->isAnimationStyleChange()) { |
| 26 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue; | 26 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue; |
| 27 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue; | 27 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue; |
| 28 | 28 |
| 29 // Snapshot underlying values for neutral keyframes first because non-ne
utral keyframes will mutate the StyleResolverState. | 29 // Snapshot underlying values for neutral keyframes first because non-ne
utral keyframes will mutate the StyleResolverState. |
| 30 if (!m_endCSSValue) { | 30 if (!m_endCSSValue) { |
| 31 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st
ate, m_id, m_endCSSValue.get()); | 31 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st
ate, m_id, m_endCSSValue); |
| 32 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot(
state, m_id, m_startCSSValue.get()); | 32 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot(
state, m_id, m_startCSSValue); |
| 33 } else { | 33 } else { |
| 34 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot(
state, m_id, m_startCSSValue.get()); | 34 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot(
state, m_id, m_startCSSValue); |
| 35 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st
ate, m_id, m_endCSSValue.get()); | 35 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st
ate, m_id, m_endCSSValue); |
| 36 } | 36 } |
| 37 | 37 |
| 38 m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableV
alue, endAnimatableValue, m_id); | 38 m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableV
alue, endAnimatableValue, m_id); |
| 39 m_outdated = false; | 39 m_outdated = false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); | 42 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); |
| 43 m_innerInterpolation->apply(state); | 43 m_innerInterpolation->apply(state); |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSSVGDocumentValue& documentValue) | 131 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSSVGDocumentValue& documentValue) |
| 132 { | 132 { |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSValueList& valueList) | 136 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSValueList& valueList) |
| 137 { | 137 { |
| 138 size_t length = valueList.length(); | 138 size_t length = valueList.length(); |
| 139 for (size_t index = 0; index < length; ++index) { | 139 for (size_t index = 0; index < length; ++index) { |
| 140 if (interpolationRequiresStyleResolve(*valueList.item(index))) | 140 if (interpolationRequiresStyleResolve(valueList.item(index))) |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 return false; | 143 return false; |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSBasicShape& shape) | 146 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSBasicShape& shape) |
| 147 { | 147 { |
| 148 // FIXME: Should determine the specific shape, and inspect the members. | 148 // FIXME: Should determine the specific shape, and inspect the members. |
| 149 return false; | 149 return false; |
| 150 } | 150 } |
| 151 | 151 |
| 152 DEFINE_TRACE(DeferredLegacyStyleInterpolation) | 152 DEFINE_TRACE(DeferredLegacyStyleInterpolation) |
| 153 { | 153 { |
| 154 visitor->trace(m_startCSSValue); | 154 visitor->trace(m_startCSSValue); |
| 155 visitor->trace(m_endCSSValue); | 155 visitor->trace(m_endCSSValue); |
| 156 visitor->trace(m_innerInterpolation); | 156 visitor->trace(m_innerInterpolation); |
| 157 StyleInterpolation::trace(visitor); | 157 StyleInterpolation::trace(visitor); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } | 160 } |
| OLD | NEW |