Chromium Code Reviews| Index: Source/core/animation/DeferredLegacyStyleInterpolation.cpp |
| diff --git a/Source/core/animation/DeferredLegacyStyleInterpolation.cpp b/Source/core/animation/DeferredLegacyStyleInterpolation.cpp |
| index 633bde71ffc4205b506745da5baadd0ec4544dcd..da327595e8ce6716700ffa26ef70495f8fc666fe 100644 |
| --- a/Source/core/animation/DeferredLegacyStyleInterpolation.cpp |
| +++ b/Source/core/animation/DeferredLegacyStyleInterpolation.cpp |
| @@ -5,7 +5,8 @@ |
| #include "config.h" |
| #include "core/animation/DeferredLegacyStyleInterpolation.h" |
| -#include "core/animation/LegacyStyleInterpolation.h" |
| +#include "core/animation/ActiveAnimations.h" |
| +#include "core/animation/css/CSSAnimatableValueFactory.h" |
| #include "core/css/CSSImageValue.h" |
| #include "core/css/CSSPrimitiveValue.h" |
| #include "core/css/CSSSVGDocumentValue.h" |
| @@ -20,12 +21,29 @@ namespace blink { |
| void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const |
| { |
| - RefPtrWillBeRawPtr<LegacyStyleInterpolation> innerInterpolation = LegacyStyleInterpolation::create( |
| - StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_startCSSValue), |
| - StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_endCSSValue), |
| - m_id); |
| - innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); |
| - innerInterpolation->apply(state); |
| + if (m_outdated || !state.element()->activeAnimations() || !state.element()->activeAnimations()->isAnimationStyleChange()) { |
| + RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue = nullptr; |
| + RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue = nullptr; |
| + |
| + // Do checks in this order because calling createAnimatableValueSnapshot modifies the |
|
dstockwell
2015/02/05 23:04:52
In which order?
dstockwell
2015/02/05 23:04:52
In which order?
shend
2015/02/06 03:16:25
Made it clearer in the comment.
|
| + // style of the StyleResolverState. |
| + if (!m_startCSSValue) |
| + startAnimatableValue = CSSAnimatableValueFactory::create(m_id, *state.style()); |
| + if (!m_endCSSValue) |
| + endAnimatableValue = CSSAnimatableValueFactory::create(m_id, *state.style()); |
| + |
| + if (m_startCSSValue) |
| + startAnimatableValue = StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_startCSSValue); |
| + if (m_endCSSValue) |
| + endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_endCSSValue); |
| + |
| + m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableValue, endAnimatableValue, m_id); |
| + |
| + m_outdated = false; |
| + } |
| + |
| + m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); |
| + m_innerInterpolation->apply(state); |
| } |
| bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const CSSValue& value) |