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

Side by Side Diff: Source/core/animation/InvalidatableStyleInterpolation.cpp

Issue 1210353004: Rename {Animation,Interpolation}Type and {Animation,Interpolation}Value (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/InvalidatableStyleInterpolation.h" 6 #include "core/animation/InvalidatableStyleInterpolation.h"
7 7
8 #include "core/animation/StringKeyframe.h" 8 #include "core/animation/StringKeyframe.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 InvalidatableStyleInterpolation::InvalidatableStyleInterpolation( 12 InvalidatableStyleInterpolation::InvalidatableStyleInterpolation(
13 const Vector<const AnimationType*>& animationTypes, 13 const Vector<const InterpolationType*>& interpolationTypes,
14 const CSSPropertySpecificKeyframe& startKeyframe, 14 const CSSPropertySpecificKeyframe& startKeyframe,
15 const CSSPropertySpecificKeyframe& endKeyframe) 15 const CSSPropertySpecificKeyframe& endKeyframe)
16 : StyleInterpolation(nullptr, nullptr, animationTypes.first()->property()) 16 : StyleInterpolation(nullptr, nullptr, interpolationTypes.first()->property( ))
17 , m_animationTypes(animationTypes) 17 , m_interpolationTypes(interpolationTypes)
18 , m_startKeyframe(startKeyframe) 18 , m_startKeyframe(startKeyframe)
19 , m_endKeyframe(endKeyframe) 19 , m_endKeyframe(endKeyframe)
20 { 20 {
21 maybeCachePairwiseConversion(nullptr); 21 maybeCachePairwiseConversion(nullptr);
22 interpolate(0, 0); 22 interpolate(0, 0);
23 } 23 }
24 24
25 bool InvalidatableStyleInterpolation::maybeCachePairwiseConversion(const StyleRe solverState* state) const 25 bool InvalidatableStyleInterpolation::maybeCachePairwiseConversion(const StyleRe solverState* state) const
26 { 26 {
27 for (const auto& animationType : m_animationTypes) { 27 for (const auto& interpolationType : m_interpolationTypes) {
28 OwnPtrWillBeRawPtr<PairwisePrimitiveInterpolation> pairwiseConversion = animationType->maybeConvertPairwise(m_startKeyframe, m_endKeyframe, state, m_con versionCheckers); 28 OwnPtrWillBeRawPtr<PairwisePrimitiveInterpolation> pairwiseConversion = interpolationType->maybeConvertPairwise(m_startKeyframe, m_endKeyframe, state, m _conversionCheckers);
29 if (pairwiseConversion) { 29 if (pairwiseConversion) {
30 m_cachedValue = pairwiseConversion->initialValue(); 30 m_cachedValue = pairwiseConversion->initialValue();
31 m_cachedConversion = pairwiseConversion.release(); 31 m_cachedConversion = pairwiseConversion.release();
32 return true; 32 return true;
33 } 33 }
34 } 34 }
35 return false; 35 return false;
36 } 36 }
37 37
38 void InvalidatableStyleInterpolation::interpolate(int, double fraction) 38 void InvalidatableStyleInterpolation::interpolate(int, double fraction)
39 { 39 {
40 m_currentFraction = fraction; 40 m_currentFraction = fraction;
41 if (m_cachedConversion) 41 if (m_cachedConversion)
42 m_cachedConversion->interpolate(fraction, m_cachedValue); 42 m_cachedConversion->interpolate(fraction, m_cachedValue);
43 // We defer the interpolation to ensureValidInterpolation() if m_cachedConve rsion is null. 43 // We defer the interpolation to ensureValidInterpolation() if m_cachedConve rsion is null.
44 } 44 }
45 45
46 PassOwnPtrWillBeRawPtr<AnimationValue> InvalidatableStyleInterpolation::convertS ingleKeyframe(const CSSPropertySpecificKeyframe& keyframe, const StyleResolverSt ate& state) const 46 PassOwnPtrWillBeRawPtr<InterpolationValue> InvalidatableStyleInterpolation::conv ertSingleKeyframe(const CSSPropertySpecificKeyframe& keyframe, const StyleResolv erState& state) const
47 { 47 {
48 for (const auto& animationType : m_animationTypes) { 48 for (const auto& interpolationType : m_interpolationTypes) {
49 OwnPtrWillBeRawPtr<AnimationValue> result = animationType->maybeConvertS ingle(keyframe, &state, m_conversionCheckers); 49 OwnPtrWillBeRawPtr<InterpolationValue> result = interpolationType->maybe ConvertSingle(keyframe, &state, m_conversionCheckers);
50 if (result) 50 if (result)
51 return result.release(); 51 return result.release();
52 } 52 }
53 ASSERT_NOT_REACHED(); 53 ASSERT_NOT_REACHED();
54 return nullptr; 54 return nullptr;
55 } 55 }
56 56
57 bool InvalidatableStyleInterpolation::isCacheValid(const StyleResolverState& sta te) const 57 bool InvalidatableStyleInterpolation::isCacheValid(const StyleResolverState& sta te) const
58 { 58 {
59 for (const auto& checker : m_conversionCheckers) { 59 for (const auto& checker : m_conversionCheckers) {
(...skipping 16 matching lines...) Expand all
76 m_cachedConversion->interpolate(m_currentFraction, m_cachedValue); 76 m_cachedConversion->interpolate(m_currentFraction, m_cachedValue);
77 } 77 }
78 78
79 void InvalidatableStyleInterpolation::apply(StyleResolverState& state) const 79 void InvalidatableStyleInterpolation::apply(StyleResolverState& state) const
80 { 80 {
81 ensureValidInterpolation(state); 81 ensureValidInterpolation(state);
82 m_cachedValue->type().apply(m_cachedValue->interpolableValue(), m_cachedValu e->nonInterpolableValue(), state); 82 m_cachedValue->type().apply(m_cachedValue->interpolableValue(), m_cachedValu e->nonInterpolableValue(), state);
83 } 83 }
84 84
85 } // namespace blink 85 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/InvalidatableStyleInterpolation.h ('k') | Source/core/animation/PrimitiveInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698