Chromium Code Reviews| 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/CSSImageValue.h" | 10 #include "core/css/CSSImageValue.h" |
| 11 #include "core/css/CSSPrimitiveValue.h" | 11 #include "core/css/CSSPrimitiveValue.h" |
| 12 #include "core/css/CSSSVGDocumentValue.h" | 12 #include "core/css/CSSSVGDocumentValue.h" |
| 13 #include "core/css/CSSShadowValue.h" | 13 #include "core/css/CSSShadowValue.h" |
| 14 #include "core/css/CSSValueList.h" | 14 #include "core/css/CSSValueList.h" |
| 15 #include "core/css/Pair.h" | 15 #include "core/css/Pair.h" |
| 16 #include "core/css/Rect.h" | 16 #include "core/css/Rect.h" |
| 17 #include "core/css/resolver/StyleResolver.h" | 17 #include "core/css/resolver/StyleResolver.h" |
| 18 #include "core/css/resolver/StyleResolverState.h" | 18 #include "core/css/resolver/StyleResolverState.h" |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const | 22 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const |
| 23 { | 23 { |
| 24 if (m_outdated || !state.element()->elementAnimations() || !state.element()- >elementAnimations()->isAnimationStyleChange()) { | 24 if (m_outdated || !state.element()->elementAnimations() || !state.element()- >elementAnimations()->isAnimationStyleChange()) { |
| 25 m_innerInterpolation = LegacyStyleInterpolation::create( | 25 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue; |
| 26 StyleResolver::createAnimatableValueSnapshot(state, m_id, m_startCSS Value.get()), | 26 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue; |
| 27 StyleResolver::createAnimatableValueSnapshot(state, m_id, m_endCSSVa lue.get()), | 27 |
| 28 m_id); | 28 // Snapshot neutral values first because non-neutral values will mutate the StyleResolverState. |
|
Timothy Loh
2015/03/16 00:49:41
Snapshot underlying values?
alancutter (OOO until 2018)
2015/03/17 00:12:34
Done.
| |
| 29 if (!m_endCSSValue) { | |
| 30 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st ate, m_id, m_endCSSValue.get()); | |
| 31 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot( state, m_id, m_startCSSValue.get()); | |
| 32 } else { | |
| 33 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot( state, m_id, m_startCSSValue.get()); | |
| 34 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st ate, m_id, m_endCSSValue.get()); | |
| 35 } | |
| 36 | |
| 37 m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableV alue, endAnimatableValue, m_id); | |
| 29 m_outdated = false; | 38 m_outdated = false; |
| 30 } | 39 } |
| 31 | 40 |
| 32 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); | 41 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); |
| 33 m_innerInterpolation->apply(state); | 42 m_innerInterpolation->apply(state); |
| 34 } | 43 } |
| 35 | 44 |
| 36 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value) | 45 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value) |
| 37 { | 46 { |
| 38 // FIXME: should not require resolving styles for initial. | 47 // FIXME: should not require resolving styles for initial. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 | 150 |
| 142 DEFINE_TRACE(DeferredLegacyStyleInterpolation) | 151 DEFINE_TRACE(DeferredLegacyStyleInterpolation) |
| 143 { | 152 { |
| 144 visitor->trace(m_startCSSValue); | 153 visitor->trace(m_startCSSValue); |
| 145 visitor->trace(m_endCSSValue); | 154 visitor->trace(m_endCSSValue); |
| 146 visitor->trace(m_innerInterpolation); | 155 visitor->trace(m_innerInterpolation); |
| 147 StyleInterpolation::trace(visitor); | 156 StyleInterpolation::trace(visitor); |
| 148 } | 157 } |
| 149 | 158 |
| 150 } | 159 } |
| OLD | NEW |