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

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

Issue 1276183004: Oilpan: Unship oilpan from temporary animation objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 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 #ifndef Keyframe_h 5 #ifndef Keyframe_h
6 #define Keyframe_h 6 #define Keyframe_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/animation/AnimationEffect.h" 9 #include "core/animation/AnimationEffect.h"
10 #include "core/animation/EffectModel.h" 10 #include "core/animation/EffectModel.h"
11 #include "core/animation/PropertyHandle.h" 11 #include "core/animation/PropertyHandle.h"
12 #include "core/animation/animatable/AnimatableValue.h" 12 #include "core/animation/animatable/AnimatableValue.h"
13 #include "wtf/Allocator.h" 13 #include "wtf/Allocator.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 using PropertyHandleSet = HashSet<PropertyHandle>; 17 using PropertyHandleSet = HashSet<PropertyHandle>;
18 18
19 class Element; 19 class Element;
20 class ComputedStyle; 20 class ComputedStyle;
21 21
22 // FIXME: Make Keyframe immutable 22 // FIXME: Make Keyframe immutable
23 class CORE_EXPORT Keyframe : public RefCountedWillBeGarbageCollectedFinalized<Ke yframe> { 23 class CORE_EXPORT Keyframe : public RefCounted<Keyframe> {
24 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(Keyframe); 24 WTF_MAKE_FAST_ALLOCATED(Keyframe);
25 WTF_MAKE_NONCOPYABLE(Keyframe); 25 WTF_MAKE_NONCOPYABLE(Keyframe);
26 public: 26 public:
27 virtual ~Keyframe() { } 27 virtual ~Keyframe() { }
28 28
29 void setOffset(double offset) { m_offset = offset; } 29 void setOffset(double offset) { m_offset = offset; }
30 double offset() const { return m_offset; } 30 double offset() const { return m_offset; }
31 31
32 void setComposite(EffectModel::CompositeOperation composite) { m_composite = composite; } 32 void setComposite(EffectModel::CompositeOperation composite) { m_composite = composite; }
33 EffectModel::CompositeOperation composite() const { return m_composite; } 33 EffectModel::CompositeOperation composite() const { return m_composite; }
34 34
35 void setEasing(PassRefPtr<TimingFunction> easing) { m_easing = easing; } 35 void setEasing(PassRefPtr<TimingFunction> easing) { m_easing = easing; }
36 TimingFunction& easing() const { return *m_easing; } 36 TimingFunction& easing() const { return *m_easing; }
37 37
38 static bool compareOffsets(const RefPtrWillBeMember<Keyframe>& a, const RefP trWillBeMember<Keyframe>& b) 38 static bool compareOffsets(const RefPtr<Keyframe>& a, const RefPtr<Keyframe> & b)
39 { 39 {
40 return a->offset() < b->offset(); 40 return a->offset() < b->offset();
41 } 41 }
42 42
43 virtual PropertyHandleSet properties() const = 0; 43 virtual PropertyHandleSet properties() const = 0;
44 44
45 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const = 0; 45 virtual PassRefPtr<Keyframe> clone() const = 0;
46 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const 46 PassRefPtr<Keyframe> cloneWithOffset(double offset) const
47 { 47 {
48 RefPtrWillBeRawPtr<Keyframe> theClone = clone(); 48 RefPtr<Keyframe> theClone = clone();
49 theClone->setOffset(offset); 49 theClone->setOffset(offset);
50 return theClone.release(); 50 return theClone.release();
51 } 51 }
52 52
53 virtual bool isAnimatableValueKeyframe() const { return false; } 53 virtual bool isAnimatableValueKeyframe() const { return false; }
54 virtual bool isStringKeyframe() const { return false; } 54 virtual bool isStringKeyframe() const { return false; }
55 55
56 DEFINE_INLINE_VIRTUAL_TRACE() { } 56 class PropertySpecificKeyframe {
57 57 WTF_MAKE_FAST_ALLOCATED(PropertySpecificKeyframe);
58 class PropertySpecificKeyframe : public NoBaseWillBeGarbageCollectedFinalize d<PropertySpecificKeyframe> {
59 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PropertySpecificKeyframe);
60 WTF_MAKE_NONCOPYABLE(PropertySpecificKeyframe); 58 WTF_MAKE_NONCOPYABLE(PropertySpecificKeyframe);
61 public: 59 public:
62 virtual ~PropertySpecificKeyframe() { } 60 virtual ~PropertySpecificKeyframe() { }
63 double offset() const { return m_offset; } 61 double offset() const { return m_offset; }
64 TimingFunction& easing() const { return *m_easing; } 62 TimingFunction& easing() const { return *m_easing; }
65 EffectModel::CompositeOperation composite() const { return m_composite; } 63 EffectModel::CompositeOperation composite() const { return m_composite; }
66 double underlyingFraction() const { return m_composite == EffectModel::C ompositeReplace ? 0 : 1; } 64 double underlyingFraction() const { return m_composite == EffectModel::C ompositeReplace ? 0 : 1; }
67 virtual bool isNeutral() const { ASSERT_NOT_REACHED(); return false; } 65 virtual bool isNeutral() const { ASSERT_NOT_REACHED(); return false; }
68 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> cloneWithOffset (double offset) const = 0; 66 virtual PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offs et) const = 0;
69 67
70 // FIXME: Remove this once CompositorAnimations no longer depends on Ani matableValues 68 // FIXME: Remove this once CompositorAnimations no longer depends on Ani matableValues
71 virtual void populateAnimatableValue(CSSPropertyID, Element&, const Comp utedStyle* baseStyle) const { } 69 virtual void populateAnimatableValue(CSSPropertyID, Element&, const Comp utedStyle* baseStyle) const { }
72 virtual const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue () const = 0; 70 virtual const PassRefPtr<AnimatableValue> getAnimatableValue() const = 0 ;
73 71
74 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return false; } 72 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return false; }
75 virtual bool isCSSPropertySpecificKeyframe() const { return false; } 73 virtual bool isCSSPropertySpecificKeyframe() const { return false; }
76 virtual bool isSVGPropertySpecificKeyframe() const { return false; } 74 virtual bool isSVGPropertySpecificKeyframe() const { return false; }
77 75
78 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> neutralKeyframe (double offset, PassRefPtr<TimingFunction> easing) const = 0; 76 virtual PassOwnPtr<PropertySpecificKeyframe> neutralKeyframe(double offs et, PassRefPtr<TimingFunction> easing) const = 0;
79 virtual PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(P ropertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*, const Computed Style* baseStyle) const = 0; 77 virtual PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandl e, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseS tyle) const = 0;
80
81 DEFINE_INLINE_VIRTUAL_TRACE() { }
82 78
83 protected: 79 protected:
84 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, EffectModel::CompositeOperation); 80 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, EffectModel::CompositeOperation);
85 81
86 double m_offset; 82 double m_offset;
87 RefPtr<TimingFunction> m_easing; 83 RefPtr<TimingFunction> m_easing;
88 EffectModel::CompositeOperation m_composite; 84 EffectModel::CompositeOperation m_composite;
89 }; 85 };
90 86
91 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> createPropertySpeci ficKeyframe(PropertyHandle) const = 0; 87 virtual PassOwnPtr<PropertySpecificKeyframe> createPropertySpecificKeyframe( PropertyHandle) const = 0;
92 88
93 protected: 89 protected:
94 Keyframe() 90 Keyframe()
95 : m_offset(nullValue()) 91 : m_offset(nullValue())
96 , m_composite(EffectModel::CompositeReplace) 92 , m_composite(EffectModel::CompositeReplace)
97 , m_easing(LinearTimingFunction::shared()) 93 , m_easing(LinearTimingFunction::shared())
98 { 94 {
99 } 95 }
100 Keyframe(double offset, EffectModel::CompositeOperation composite, PassRefPt r<TimingFunction> easing) 96 Keyframe(double offset, EffectModel::CompositeOperation composite, PassRefPt r<TimingFunction> easing)
101 : m_offset(offset) 97 : m_offset(offset)
102 , m_composite(composite) 98 , m_composite(composite)
103 , m_easing(easing) 99 , m_easing(easing)
104 { 100 {
105 } 101 }
106 102
107 double m_offset; 103 double m_offset;
108 EffectModel::CompositeOperation m_composite; 104 EffectModel::CompositeOperation m_composite;
109 RefPtr<TimingFunction> m_easing; 105 RefPtr<TimingFunction> m_easing;
110 }; 106 };
111 107
112 } // namespace blink 108 } // namespace blink
113 109
114 #endif // Keyframe_h 110 #endif // Keyframe_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698