Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: Source/core/animation/DeferredLegacyStyleInterpolation.cpp

Issue 851693007: Prepare for responsive CSS animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/DeferredLegacyStyleInterpolation.cpp
diff --git a/Source/core/animation/DeferredLegacyStyleInterpolation.cpp b/Source/core/animation/DeferredLegacyStyleInterpolation.cpp
index 633bde71ffc4205b506745da5baadd0ec4544dcd..7e001c356be106ec510515f7c0db3d50e6ee3c34 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,28 @@ 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;
+
+ // Call CSSAnimatableValueFactory::create before calling createAnimatableValueSnapshot because the latter modifies the
+ // style of the StyleResolverState.
+ if (!m_startCSSValue)
+ startAnimatableValue = CSSAnimatableValueFactory::create(m_id, state.styleRef());
+ if (!m_endCSSValue)
+ endAnimatableValue = CSSAnimatableValueFactory::create(m_id, state.styleRef());
+
+ 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)

Powered by Google App Engine
This is Rietveld 408576698