OLD | NEW |
| (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 AnimatableValueKeyframe_h | |
6 #define AnimatableValueKeyframe_h | |
7 | |
8 #include "core/animation/AnimatableValue.h" | |
9 #include "core/animation/Keyframe.h" | |
10 | |
11 namespace WebCore { | |
12 | |
13 class AnimatableValueKeyframe : public Keyframe { | |
14 public: | |
15 static PassRefPtr<AnimatableValueKeyframe> create() { return adoptRef(new An
imatableValueKeyframe); } | |
16 void setPropertyValue(CSSPropertyID property, PassRefPtr<AnimatableValue> va
lue) | |
17 { | |
18 m_propertyValues.add(property, value); | |
19 } | |
20 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr
operty); } | |
21 AnimatableValue* propertyValue(CSSPropertyID property) const | |
22 { | |
23 ASSERT(m_propertyValues.contains(property)); | |
24 return m_propertyValues.get(property); | |
25 } | |
26 virtual PropertySet properties() const OVERRIDE; | |
27 | |
28 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | |
29 public: | |
30 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, AnimationEffect::CompositeOperation); | |
31 | |
32 AnimatableValue* value() const { return m_value.get(); } | |
33 | |
34 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(d
ouble offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINAL; | |
35 virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, Web
Core::Keyframe::PropertySpecificKeyframe* end) const OVERRIDE FINAL; | |
36 | |
37 private: | |
38 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtr<AnimatableValue>); | |
39 | |
40 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const OVERRIDE; | |
41 virtual bool isAnimatableValuePropertySpecificKeyframe() const OVERRIDE
{ return true; } | |
42 | |
43 RefPtr<AnimatableValue> m_value; | |
44 }; | |
45 | |
46 private: | |
47 AnimatableValueKeyframe() | |
48 { } | |
49 | |
50 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); | |
51 | |
52 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE; | |
53 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecifi
cKeyframe(CSSPropertyID) const OVERRIDE; | |
54 | |
55 virtual bool isAnimatableValueKeyframe() const OVERRIDE { return true; } | |
56 | |
57 typedef HashMap<CSSPropertyID, RefPtr<AnimatableValue> > PropertyValueMap; | |
58 PropertyValueMap m_propertyValues; | |
59 }; | |
60 | |
61 typedef AnimatableValueKeyframe::PropertySpecificKeyframe AnimatableValuePropert
ySpecificKeyframe; | |
62 | |
63 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); | |
64 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, PropertySpecificKeyfr
ame, value, value->isAnimatableValuePropertySpecificKeyframe(), value.isAnimatab
leValuePropertySpecificKeyframe()); | |
65 | |
66 } | |
67 | |
68 #endif | |
OLD | NEW |