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

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

Issue 223443002: [Reland] Web Animations: Introduce String based KeyframeEffectModel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@anotherKEMApproach
Patch Set: Created 6 years, 8 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
« no previous file with comments | « Source/core/animation/Interpolation.cpp ('k') | Source/core/animation/KeyframeEffectModel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef Keyframe_h
6 #define Keyframe_h
7
8 #include "CSSPropertyNames.h"
9 #include "core/animation/AnimationEffect.h"
10 #include "core/animation/TimedItem.h"
11
12 namespace WebCore {
13
14 typedef HashSet<CSSPropertyID> PropertySet;
15
16 // FIXME: Make Keyframe immutable
17 class Keyframe : public RefCountedWillBeGarbageCollectedFinalized<Keyframe> {
18 public:
19 virtual ~Keyframe() { }
20
21 void setOffset(double offset) { m_offset = offset; }
22 double offset() const { return m_offset; }
23
24 void setComposite(AnimationEffect::CompositeOperation composite) { m_composi te = composite; }
25 AnimationEffect::CompositeOperation composite() const { return m_composite; }
26
27 void setEasing(PassRefPtr<TimingFunction> easing) { m_easing = easing; }
28 TimingFunction* easing() const { return m_easing.get(); }
29
30 static bool compareOffsets(const RefPtrWillBeMember<Keyframe>&, const RefPtr WillBeMember<Keyframe>&);
31 virtual PropertySet properties() const = 0;
32
33 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const = 0;
34 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const
35 {
36 RefPtrWillBeRawPtr<Keyframe> theClone = clone();
37 theClone->setOffset(offset);
38 return theClone.release();
39 }
40
41 virtual bool isAnimatableValueKeyframe() const { return false; }
42 virtual bool isStringKeyframe() const { return false; }
43
44 virtual void trace(Visitor*) { }
45
46 class PropertySpecificKeyframe : public NoBaseWillBeGarbageCollectedFinalize d<PropertySpecificKeyframe> {
47 public:
48 virtual ~PropertySpecificKeyframe() { }
49 double offset() const { return m_offset; }
50 TimingFunction* easing() const { return m_easing.get(); }
51 AnimationEffect::CompositeOperation composite() const { return m_composi te; }
52 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> cloneWithOffset (double offset) const = 0;
53
54 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return false; }
55 virtual bool isStringPropertySpecificKeyframe() const { return false; }
56
57 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> neutralKeyframe (double offset, PassRefPtr<TimingFunction> easing) const = 0;
58 virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPro pertyID, WebCore::Keyframe::PropertySpecificKeyframe* end) const = 0;
59
60 virtual void trace(Visitor*) = 0;
61
62 protected:
63 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, AnimationEffect::CompositeOperation);
64
65 double m_offset;
66 RefPtr<TimingFunction> m_easing;
67 AnimationEffect::CompositeOperation m_composite;
68 };
69
70 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> createPropertySpeci ficKeyframe(CSSPropertyID) const = 0;
71
72 protected:
73 Keyframe()
74 : m_offset(nullValue())
75 , m_composite(AnimationEffect::CompositeReplace)
76 , m_easing(LinearTimingFunction::preset())
77 {
78 }
79 Keyframe(double offset, AnimationEffect::CompositeOperation composite, PassR efPtr<TimingFunction> easing)
80 : m_offset(offset)
81 , m_composite(composite)
82 , m_easing(easing)
83 {
84 }
85
86 double m_offset;
87 AnimationEffect::CompositeOperation m_composite;
88 RefPtr<TimingFunction> m_easing;
89 };
90
91 }
92
93 #endif
OLDNEW
« no previous file with comments | « Source/core/animation/Interpolation.cpp ('k') | Source/core/animation/KeyframeEffectModel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698