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

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

Issue 1305383006: Oilpan: Unship CSSValues and AnimatableValues Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/Keyframe.h" 8 #include "core/animation/Keyframe.h"
9 #include "core/css/StylePropertySet.h" 9 #include "core/css/StylePropertySet.h"
10 10
11 #include "wtf/HashMap.h" 11 #include "wtf/HashMap.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class StyleSheetContents; 15 class StyleSheetContents;
16 16
17 class StringKeyframe : public Keyframe { 17 class StringKeyframe : public Keyframe {
18 public: 18 public:
19 static PassRefPtrWillBeRawPtr<StringKeyframe> create() 19 static PassRefPtr<StringKeyframe> create()
20 { 20 {
21 return adoptRefWillBeNoop(new StringKeyframe); 21 return adoptRef(new StringKeyframe);
22 } 22 }
23 23
24 void setPropertyValue(CSSPropertyID, const String& value, Element*, StyleShe etContents*); 24 void setPropertyValue(CSSPropertyID, const String& value, Element*, StyleShe etContents*);
25 void setPropertyValue(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>); 25 void setPropertyValue(CSSPropertyID, PassRefPtr<CSSValue>);
26 void setPropertyValue(const QualifiedName&, const String& value, Element*); 26 void setPropertyValue(const QualifiedName&, const String& value, Element*);
27 CSSValue* cssPropertyValue(CSSPropertyID property) const 27 CSSValue* cssPropertyValue(CSSPropertyID property) const
28 { 28 {
29 int index = m_propertySet->findPropertyIndex(property); 29 int index = m_propertySet->findPropertyIndex(property);
30 RELEASE_ASSERT(index >= 0); 30 RELEASE_ASSERT(index >= 0);
31 return m_propertySet->propertyAt(static_cast<unsigned>(index)).value(); 31 return m_propertySet->propertyAt(static_cast<unsigned>(index)).value();
32 } 32 }
33 String svgPropertyValue(const QualifiedName& attributeName) const 33 String svgPropertyValue(const QualifiedName& attributeName) const
34 { 34 {
35 return m_svgPropertyMap.get(&attributeName); 35 return m_svgPropertyMap.get(&attributeName);
36 } 36 }
37 37
38 PropertyHandleSet properties() const override; 38 PropertyHandleSet properties() const override;
39 39
40 DECLARE_VIRTUAL_TRACE();
41
42 class CSSPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e { 40 class CSSPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e {
43 public: 41 public:
44 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, CSSValue*, EffectModel::CompositeOperation); 42 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, CSSValue*, EffectModel::CompositeOperation);
45 43
46 CSSValue* value() const { return m_value.get(); } 44 CSSValue* value() const { return m_value.get(); }
47 45
48 virtual void populateAnimatableValue(CSSPropertyID, Element&, const Comp utedStyle* baseStyle) const; 46 virtual void populateAnimatableValue(CSSPropertyID, Element&, const Comp utedStyle* baseStyle) const;
49 const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue() const final { return m_animatableValueCache.get(); } 47 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret urn m_animatableValueCache.get(); }
50 void setAnimatableValue(PassRefPtrWillBeRawPtr<AnimatableValue> value) { m_animatableValueCache = value; } 48 void setAnimatableValue(PassRefPtr<AnimatableValue> value) { m_animatabl eValueCache = value; }
51 49
52 bool isNeutral() const final { return !m_value; } 50 bool isNeutral() const final { return !m_value; }
53 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutralKeyfra me(double offset, PassRefPtr<TimingFunction> easing) const final; 51 PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of fset, PassRefPtr<TimingFunction> easing) const final;
54 PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(PropertyH andle, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* b aseStyle) const final; 52 PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(PropertyH andle, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* b aseStyle) const final;
55 53
56 DECLARE_VIRTUAL_TRACE();
57
58 private: 54 private:
59 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, CSSValue*); 55 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, CSSValue*);
60 56
61 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> clone WithOffset(double offset) const; 57 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d ouble offset) const;
62 bool isCSSPropertySpecificKeyframe() const override { return true; } 58 bool isCSSPropertySpecificKeyframe() const override { return true; }
63 59
64 PassRefPtrWillBeRawPtr<Interpolation> createLegacyStyleInterpolation(CSS PropertyID, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedSty le* baseStyle) const; 60 PassRefPtrWillBeRawPtr<Interpolation> createLegacyStyleInterpolation(CSS PropertyID, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedSty le* baseStyle) const;
65 static bool createInterpolationsFromCSSValues(CSSPropertyID, CSSValue* f romCSSValue, CSSValue* toCSSValue, Element*, OwnPtrWillBeRawPtr<WillBeHeapVector <RefPtrWillBeMember<Interpolation>>>& interpolations); 61 static bool createInterpolationsFromCSSValues(CSSPropertyID, CSSValue* f romCSSValue, CSSValue* toCSSValue, Element*, OwnPtrWillBeRawPtr<WillBeHeapVector <RefPtrWillBeMember<Interpolation>>>& interpolations);
66 62
67 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const; 63 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const;
68 64
69 RefPtrWillBeMember<CSSValue> m_value; 65 RefPtr<CSSValue> m_value;
70 mutable RefPtrWillBeMember<AnimatableValue> m_animatableValueCache; 66 mutable RefPtr<AnimatableValue> m_animatableValueCache;
71 }; 67 };
72 68
73 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e { 69 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e {
74 public: 70 public:
75 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const String&, EffectModel::CompositeOperation); 71 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const String&, EffectModel::CompositeOperation);
76 72
77 const String& value() const { return m_value; } 73 const String& value() const { return m_value; }
78 74
79 PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const final; 75 PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons t final;
80 76
81 const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue() const final { return nullptr; } 77 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret urn nullptr; }
82 78
83 PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const final; 79 PassOwnPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, Pass RefPtr<TimingFunction> easing) const final;
84 PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(PropertyH andle, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* b aseStyle) const final; 80 PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(PropertyH andle, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* b aseStyle) const final;
85 81
86 DECLARE_VIRTUAL_TRACE();
87
88 private: 82 private:
89 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const String&); 83 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const String&);
90 84
91 bool isSVGPropertySpecificKeyframe() const override { return true; } 85 bool isSVGPropertySpecificKeyframe() const override { return true; }
92 86
93 String m_value; 87 String m_value;
94 }; 88 };
95 89
96 private: 90 private:
97 StringKeyframe() 91 StringKeyframe()
98 : m_propertySet(MutableStylePropertySet::create()) 92 : m_propertySet(MutableStylePropertySet::create())
99 { } 93 { }
100 94
101 StringKeyframe(const StringKeyframe& copyFrom); 95 StringKeyframe(const StringKeyframe& copyFrom);
102 96
103 PassRefPtrWillBeRawPtr<Keyframe> clone() const override; 97 PassRefPtr<Keyframe> clone() const override;
104 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPropertySpe cificKeyframe(PropertyHandle) const override; 98 PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram e(PropertyHandle) const override;
105 99
106 bool isStringKeyframe() const override { return true; } 100 bool isStringKeyframe() const override { return true; }
107 101
108 RefPtrWillBeMember<MutableStylePropertySet> m_propertySet; 102 RefPtrWillBePersistent<MutableStylePropertySet> m_propertySet;
109 HashMap<const QualifiedName*, String> m_svgPropertyMap; 103 HashMap<const QualifiedName*, String> m_svgPropertyMap;
110 }; 104 };
111 105
112 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; 106 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe;
113 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; 107 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe;
114 108
115 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe()); 109 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe());
116 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey frame()); 110 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey frame());
117 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey frame()); 111 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey frame());
118 112
119 } 113 }
120 114
121 #endif 115 #endif
OLDNEW
« no previous file with comments | « Source/core/animation/ShadowStyleInterpolationTest.cpp ('k') | Source/core/animation/StringKeyframe.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698