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

Side by Side Diff: Source/core/animation/StringKeyframe.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 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 op)
31 : Keyframe::PropertySpecificKeyframe(offset, easing, op)
32 , m_value(value)
33 {
34 }
35
36 const String& value() const { return m_value; }
37
38 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(d ouble offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINAL;
39 virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, Web Core::Keyframe::PropertySpecificKeyframe* end) const OVERRIDE FINAL;
40 private:
41 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const String& value)
42 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect ::CompositeReplace)
43 , m_value(value)
44 {
45 ASSERT(!isNull(m_offset));
46 }
47
48 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d ouble offset) const;
49 virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return true; }
50
51 String m_value;
52 };
53
54 private:
55 StringKeyframe()
56 : Keyframe()
57 {
58 }
59 StringKeyframe(const StringKeyframe& copyFrom);
60
61 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE
62 {
63 return adoptRefWillBeNoop(new StringKeyframe(*this));
64 }
65 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecifi cKeyframe(CSSPropertyID property) const
66 {
67 return adoptPtr(new PropertySpecificKeyframe(offset(), easing(), propert yValue(property), composite()));
68 }
69 virtual bool isStringKeyframe() const OVERRIDE { return true; }
70
71 typedef HashMap<CSSPropertyID, String> PropertyValueMap;
72 PropertyValueMap m_propertyValues;
73 };
74
75 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe;
76
77 }
78
79 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698