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

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

Issue 215883005: Web Animations: Introduce String based KeyframeEffectModel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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 class Keyframe : public RefCountedWillBeGarbageCollectedFinalized<Keyframe> {
17 public:
18 virtual ~Keyframe() { }
dstockwell 2014/04/01 06:38:12 nit: whitespace and grouping would make this a bit
shans 2014/04/01 12:05:32 Done.
19 void setOffset(double offset) { m_offset = offset; }
20 double offset() const { return m_offset; }
21 void setComposite(AnimationEffect::CompositeOperation composite) { m_composi te = composite; }
22 AnimationEffect::CompositeOperation composite() const { return m_composite; }
23 void setEasing(PassRefPtr<TimingFunction> easing) { m_easing = easing; }
24 TimingFunction* easing() const { return m_easing.get(); }
25 static bool compareOffsets(const RefPtrWillBeRawPtr<Keyframe>&, const RefPtr WillBeRawPtr<Keyframe>&);
26 virtual PropertySet properties() const = 0;
27 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const = 0;
28 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const
29 {
30 RefPtrWillBeRawPtr<Keyframe> theClone = clone();
31 theClone->setOffset(offset);
32 return theClone.release();
33 }
34
35 virtual bool isAnimatableValueKeyframe() const { return false; }
36 virtual bool isStringKeyframe() const { return false; }
37
38 void trace(Visitor*) { }
39
40 class PropertySpecificKeyframe : public NoBaseWillBeGarbageCollectedFinalize d<PropertySpecificKeyframe> {
41 public:
42 virtual ~PropertySpecificKeyframe() { }
43 double offset() const { return m_offset; }
44 TimingFunction* easing() const { return m_easing.get(); }
45 AnimationEffect::CompositeOperation composite() const { return m_composi te; }
46 virtual PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offs et) const = 0;
47
48 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return false; }
49 virtual bool isStringPropertySpecificKeyframe() const { return false; }
50
51 virtual PassOwnPtr<PropertySpecificKeyframe> neutralKeyframe(double offs et, PassRefPtr<TimingFunction> easing) const = 0;
52 virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, Web Core::Keyframe::PropertySpecificKeyframe *end) const = 0;
53
54 protected:
55 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, AnimationEffect::CompositeOperation);
56
57 double m_offset;
58 RefPtr<TimingFunction> m_easing;
59 AnimationEffect::CompositeOperation m_composite;
60 };
61
62 virtual PassOwnPtr<PropertySpecificKeyframe> createPropertySpecificKeyframe( CSSPropertyID) const = 0;
63
64
65 protected:
66 Keyframe()
dstockwell 2014/04/01 06:38:12 Would it make things much harder if we made Keyfra
shans 2014/04/01 12:05:32 PropertySpecificKeyframe is already. I *think* we
67 : m_offset(nullValue())
68 , m_composite(AnimationEffect::CompositeReplace)
69 , m_easing(LinearTimingFunction::preset())
70 {
71 }
72 Keyframe(double offset, AnimationEffect::CompositeOperation composite, PassR efPtr<TimingFunction> easing)
73 : m_offset(offset)
74 , m_composite(composite)
75 , m_easing(easing)
76 {
77 }
78
79 double m_offset;
80 AnimationEffect::CompositeOperation m_composite;
81 RefPtr<TimingFunction> m_easing;
82 };
83
84 typedef Keyframe::PropertySpecificKeyframe PropertySpecificKeyframe;
85
86 }
87
88 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698