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 StringKeyframe_h | |
6 #define StringKeyframe_h | |
7 | |
8 #include "core/animation/AnimatableValue.h" | |
9 #include "core/animation/Keyframe.h" | |
10 | |
11 namespace WebCore { | |
12 | |
13 class StringKeyframe : public Keyframe { | |
14 public: | |
15 static PassRefPtr<StringKeyframe> create() { return adoptRef(new StringKeyfr
ame); } | |
16 void setPropertyValue(CSSPropertyID property, const String& value) | |
17 { | |
18 m_propertyValues.add(property, value); | |
19 } | |
20 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr
operty); } | |
21 String 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 String& value, AnimationEffect::CompositeOperation); | |
31 | |
32 const String& value() const { return m_value; } | |
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 private: | |
37 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const String& value); | |
38 | |
39 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; | |
40 virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return
true; } | |
41 | |
42 String m_value; | |
43 }; | |
44 | |
45 private: | |
46 StringKeyframe() { } | |
47 | |
48 StringKeyframe(const StringKeyframe& copyFrom); | |
49 | |
50 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE; | |
51 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecifi
cKeyframe(CSSPropertyID) const OVERRIDE; | |
52 | |
53 virtual bool isStringKeyframe() const OVERRIDE { return true; } | |
54 | |
55 typedef HashMap<CSSPropertyID, String> PropertyValueMap; | |
56 PropertyValueMap m_propertyValues; | |
57 }; | |
58 | |
59 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe; | |
60 | |
61 } | |
62 | |
63 #endif | |
OLD | NEW |