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

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

Issue 1153943003: Add foundation for removing AnimatableValues from StyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review changes Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef InvalidatableStyleInterpolation_h
6 #define InvalidatableStyleInterpolation_h
7
8 #include "core/animation/AnimationType.h"
9 #include "core/animation/AnimationValue.h"
10 #include "core/animation/PrimitiveInterpolation.h"
11 #include "core/animation/StyleInterpolation.h"
12
13 namespace blink {
14
15 // TODO(alancutter): This class will replace *StyleInterpolation, SVGInterpolati on, Interpolation.
16 // For now it needs to distinguish itself during the refactor and temporarily ha s an ugly name.
17 // TODO(alancutter): Make this class generic for any animation environment so it can be reused for SVG animations.
18 class CORE_EXPORT InvalidatableStyleInterpolation : public StyleInterpolation {
19 public:
20 static PassRefPtrWillBeRawPtr<InvalidatableStyleInterpolation> create(
21 const Vector<const AnimationType*>& animationTypes,
22 const CSSPropertySpecificKeyframe& startKeyframe,
23 const CSSPropertySpecificKeyframe& endKeyframe)
24 {
25 return adoptRefWillBeNoop(new InvalidatableStyleInterpolation(animationT ypes, startKeyframe, endKeyframe));
26 }
27
28 virtual void interpolate(int iteration, double fraction);
29 virtual void apply(StyleResolverState&) const;
30
31 virtual bool isInvalidatableStyleInterpolation() const { return true; }
32
33 DEFINE_INLINE_VIRTUAL_TRACE()
34 {
35 StyleInterpolation::trace(visitor);
36 visitor->trace(m_cachedConversion);
37 visitor->trace(m_cachedValue);
38 }
39
40 private:
41 InvalidatableStyleInterpolation(
42 const Vector<const AnimationType*>& animationTypes,
43 const CSSPropertySpecificKeyframe& startKeyframe,
44 const CSSPropertySpecificKeyframe& endKeyframe);
45
46 void ensureValidInterpolation(const StyleResolverState&) const;
47 bool isCacheValid(const StyleResolverState&) const;
48 bool maybeCachePairwiseConversion(const StyleResolverState*) const;
49 PassOwnPtrWillBeRawPtr<FlipPrimitiveInterpolation::Side> convertSingleKeyfra me(const CSSPropertySpecificKeyframe&, const StyleResolverState&) const;
50
51 const Vector<const AnimationType*>& m_animationTypes;
52 const CSSPropertySpecificKeyframe& m_startKeyframe;
53 const CSSPropertySpecificKeyframe& m_endKeyframe;
54 double m_currentFraction;
55 mutable OwnPtrWillBeMember<PrimitiveInterpolation> m_cachedConversion;
56 mutable AnimationType::ConversionCheckers m_conversionCheckers;
57 mutable AnimationValue m_cachedValue;
58 };
59
60 DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value-> isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation());
61
62 } // namespace blink
63
64 #endif // InvalidatableStyleInterpolation_h
OLDNEW
« no previous file with comments | « Source/core/animation/Interpolation.cpp ('k') | Source/core/animation/InvalidatableStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698