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

Side by Side 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 and tidy up 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 unified diff | Download patch
OLDNEW
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/LegacyStyleInterpolation.h" 8 #include "core/animation/ActiveAnimations.h"
9 #include "core/animation/css/CSSAnimatableValueFactory.h"
9 #include "core/css/CSSImageValue.h" 10 #include "core/css/CSSImageValue.h"
10 #include "core/css/CSSPrimitiveValue.h" 11 #include "core/css/CSSPrimitiveValue.h"
11 #include "core/css/CSSSVGDocumentValue.h" 12 #include "core/css/CSSSVGDocumentValue.h"
12 #include "core/css/CSSShadowValue.h" 13 #include "core/css/CSSShadowValue.h"
13 #include "core/css/CSSValueList.h" 14 #include "core/css/CSSValueList.h"
14 #include "core/css/Pair.h" 15 #include "core/css/Pair.h"
15 #include "core/css/Rect.h" 16 #include "core/css/Rect.h"
16 #include "core/css/resolver/StyleResolver.h" 17 #include "core/css/resolver/StyleResolver.h"
17 #include "core/css/resolver/StyleResolverState.h" 18 #include "core/css/resolver/StyleResolverState.h"
18 19
19 namespace blink { 20 namespace blink {
20 21
21 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const 22 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const
22 { 23 {
23 RefPtrWillBeRawPtr<LegacyStyleInterpolation> innerInterpolation = LegacyStyl eInterpolation::create( 24 if (m_outdated || !state.element()->activeAnimations() || !state.element()-> activeAnimations()->isAnimationStyleChange()) {
24 StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_startCSSVal ue), 25 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue = nullptr;
25 StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_endCSSValue ), 26 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue = nullptr;
26 m_id); 27
27 innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); 28 // Call CSSAnimatableValueFactory::create before calling createAnimatabl eValueSnapshot because the latter modifies the
28 innerInterpolation->apply(state); 29 // style of the StyleResolverState.
30 if (!m_startCSSValue)
31 startAnimatableValue = CSSAnimatableValueFactory::create(m_id, *stat e.style());
Timothy Loh 2015/02/11 03:54:36 styleRef()
shend 2015/02/12 01:01:42 Done.
32 if (!m_endCSSValue)
33 endAnimatableValue = CSSAnimatableValueFactory::create(m_id, *state. style());
Timothy Loh 2015/02/11 03:54:36 styleRef()
shend 2015/02/12 01:01:42 Done.
34
35 if (m_startCSSValue)
36 startAnimatableValue = StyleResolver::createAnimatableValueSnapshot( state, m_id, *m_startCSSValue);
37 if (m_endCSSValue)
38 endAnimatableValue = StyleResolver::createAnimatableValueSnapshot(st ate, m_id, *m_endCSSValue);
39
40 m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableV alue, endAnimatableValue, m_id);
41 m_outdated = false;
42 }
43
44 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction);
45 m_innerInterpolation->apply(state);
29 } 46 }
30 47
31 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value) 48 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value)
32 { 49 {
33 // FIXME: should not require resolving styles for initial. 50 // FIXME: should not require resolving styles for initial.
34 if (value.isInitialValue() || value.isInheritedValue() || value.isUnsetValue ()) 51 if (value.isInitialValue() || value.isInheritedValue() || value.isUnsetValue ())
35 return true; 52 return true;
36 if (value.isPrimitiveValue()) 53 if (value.isPrimitiveValue())
37 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); 54 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value));
38 if (value.isValueList()) 55 if (value.isValueList())
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 152 }
136 153
137 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor) 154 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor)
138 { 155 {
139 visitor->trace(m_startCSSValue); 156 visitor->trace(m_startCSSValue);
140 visitor->trace(m_endCSSValue); 157 visitor->trace(m_endCSSValue);
141 StyleInterpolation::trace(visitor); 158 StyleInterpolation::trace(visitor);
142 } 159 }
143 160
144 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698