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

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

Issue 194733002: Web Animations: Use StringKeyframes for element.animate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef StringKeyframe_h 5 #ifndef StringKeyframe_h
6 #define StringKeyframe_h 6 #define StringKeyframe_h
7 7
8 #include "core/animation/AnimatableValue.h"
9 #include "core/animation/Keyframe.h" 8 #include "core/animation/Keyframe.h"
10 9
11 namespace WebCore { 10 namespace WebCore {
12 11
12 class StyleSheetContents;
13
13 class StringKeyframe : public Keyframe { 14 class StringKeyframe : public Keyframe {
14 public: 15 public:
15 static PassRefPtrWillBeRawPtr<StringKeyframe> create() 16 static PassRefPtrWillBeRawPtr<StringKeyframe> create()
16 { 17 {
17 return adoptRefWillBeNoop(new StringKeyframe); 18 return adoptRefWillBeNoop(new StringKeyframe);
18 } 19 }
19 void setPropertyValue(CSSPropertyID property, const String& value) 20 void setPropertyValue(CSSPropertyID, const String& value, StyleSheetContents *);
20 {
21 m_propertyValues.add(property, value);
22 }
23 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr operty); } 21 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr operty); }
24 String propertyValue(CSSPropertyID property) const 22 CSSValue* propertyValue(CSSPropertyID property) const
25 { 23 {
26 ASSERT(m_propertyValues.contains(property)); 24 ASSERT(m_propertyValues.contains(property));
27 return m_propertyValues.get(property); 25 return m_propertyValues.get(property);
28 } 26 }
29 virtual PropertySet properties() const OVERRIDE; 27 virtual PropertySet properties() const OVERRIDE;
30 28
31 virtual void trace(Visitor*) OVERRIDE; 29 virtual void trace(Visitor*) OVERRIDE;
32 30
33 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { 31 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe {
34 public: 32 public:
35 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const String& value, AnimationEffect::CompositeOperation); 33 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, CSSValue*, AnimationEffect::CompositeOperation);
36 34
37 const String& value() const { return m_value; } 35 CSSValue* value() const { return m_value.get(); }
38 36
39 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutr alKeyframe(double offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINA L; 37 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutr alKeyframe(double offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINA L;
40 virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPro pertyID, WebCore::Keyframe::PropertySpecificKeyframe* end) const OVERRIDE FINAL; 38 virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPro pertyID, WebCore::Keyframe::PropertySpecificKeyframe* end, Element*) const OVERR IDE FINAL;
41 39
42 virtual void trace(Visitor*) OVERRIDE; 40 virtual void trace(Visitor*) OVERRIDE;
43 41
44 private: 42 private:
45 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const String& value); 43 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, CSSValue*);
46 44
47 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> clone WithOffset(double offset) const; 45 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> clone WithOffset(double offset) const;
48 virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return true; } 46 virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return true; }
49 47
50 String m_value; 48 RefPtr<CSSValue> m_value;
51 }; 49 };
52 50
53 private: 51 private:
54 StringKeyframe() { } 52 StringKeyframe() { }
55 53
56 StringKeyframe(const StringKeyframe& copyFrom); 54 StringKeyframe(const StringKeyframe& copyFrom);
57 55
56 void setPropertyCSSValue(CSSPropertyID, CSSValue*);
58 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE; 57 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE;
59 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPro pertySpecificKeyframe(CSSPropertyID) const OVERRIDE; 58 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPro pertySpecificKeyframe(CSSPropertyID) const OVERRIDE;
60 59
61 virtual bool isStringKeyframe() const OVERRIDE { return true; } 60 virtual bool isStringKeyframe() const OVERRIDE { return true; }
62 61
63 typedef HashMap<CSSPropertyID, String> PropertyValueMap; 62 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PropertyValueMap;
64 PropertyValueMap m_propertyValues; 63 PropertyValueMap m_propertyValues;
65 }; 64 };
66 65
67 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe; 66 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe;
68 67
68 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe());
69 DEFINE_TYPE_CASTS(StringPropertySpecificKeyframe, Keyframe::PropertySpecificKeyf rame, value, value->isStringPropertySpecificKeyframe(), value.isStringPropertySp ecificKeyframe());
70
69 } 71 }
70 72
71 #endif 73 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698