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

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: Address comments 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 // 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.
28 innerInterpolation->apply(state); 29 // style of the StyleResolverState.
30 if (!m_startCSSValue)
31 startAnimatableValue = CSSAnimatableValueFactory::create(m_id, *stat e.style());
32 if (!m_endCSSValue)
33 endAnimatableValue = CSSAnimatableValueFactory::create(m_id, *state. style());
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
42 m_outdated = false;
43 }
44
45 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction);
46 m_innerInterpolation->apply(state);
29 } 47 }
30 48
31 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value) 49 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C SSValue& value)
32 { 50 {
33 // FIXME: should not require resolving styles for initial. 51 // FIXME: should not require resolving styles for initial.
34 if (value.isInitialValue() || value.isInheritedValue() || value.isUnsetValue ()) 52 if (value.isInitialValue() || value.isInheritedValue() || value.isUnsetValue ())
35 return true; 53 return true;
36 if (value.isPrimitiveValue()) 54 if (value.isPrimitiveValue())
37 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); 55 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value));
38 if (value.isValueList()) 56 if (value.isValueList())
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 153 }
136 154
137 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor) 155 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor)
138 { 156 {
139 visitor->trace(m_startCSSValue); 157 visitor->trace(m_startCSSValue);
140 visitor->trace(m_endCSSValue); 158 visitor->trace(m_endCSSValue);
141 StyleInterpolation::trace(visitor); 159 StyleInterpolation::trace(visitor);
142 } 160 }
143 161
144 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698