OLD | NEW |
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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 String svgPropertyValue(const QualifiedName& attributeName) const | 44 String svgPropertyValue(const QualifiedName& attributeName) const |
45 { | 45 { |
46 return m_svgAttributeMap.get(&attributeName); | 46 return m_svgAttributeMap.get(&attributeName); |
47 } | 47 } |
48 | 48 |
49 PropertyHandleSet properties() const override; | 49 PropertyHandleSet properties() const override; |
50 | 50 |
51 class CSSPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { | 51 class CSSPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { |
52 public: | 52 public: |
53 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, CSSValue*, EffectModel::CompositeOperation); | 53 static PassRefPtr<CSSPropertySpecificKeyframe> create(double offset, Pas
sRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::CompositeOperation
composite) |
| 54 { |
| 55 return adoptRef(new CSSPropertySpecificKeyframe(offset, easing, valu
e, composite)); |
| 56 } |
54 | 57 |
55 CSSValue* value() const { return m_value.get(); } | 58 CSSValue* value() const { return m_value.get(); } |
56 | 59 |
57 virtual bool populateAnimatableValue(CSSPropertyID, Element&, const Comp
utedStyle* baseStyle, bool force) const; | 60 virtual bool populateAnimatableValue(CSSPropertyID, Element&, const Comp
utedStyle* baseStyle, bool force) const; |
58 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn m_animatableValueCache.get(); } | 61 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn m_animatableValueCache.get(); } |
59 void setAnimatableValue(PassRefPtr<AnimatableValue> value) { m_animatabl
eValueCache = value; } | 62 void setAnimatableValue(PassRefPtr<AnimatableValue> value) { m_animatabl
eValueCache = value; } |
60 | 63 |
61 bool isNeutral() const final { return !m_value; } | 64 bool isNeutral() const final { return !m_value; } |
62 PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of
fset, PassRefPtr<TimingFunction> easing) const final; | 65 PassRefPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of
fset, PassRefPtr<TimingFunction> easing) const final; |
63 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyle) co
nst final; | 66 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyle) co
nst final; |
64 | 67 |
65 private: | 68 private: |
66 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, CSSValue*); | 69 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, CSSValue* value, EffectModel::CompositeOperation composite) |
| 70 : Keyframe::PropertySpecificKeyframe(offset, easing, composite) |
| 71 , m_value(value) |
| 72 { } |
67 | 73 |
68 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; | 74 virtual PassRefPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; |
69 bool isCSSPropertySpecificKeyframe() const override { return true; } | 75 bool isCSSPropertySpecificKeyframe() const override { return true; } |
70 | 76 |
71 PassRefPtr<Interpolation> createLegacyStyleInterpolation(CSSPropertyID,
Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyl
e) const; | 77 PassRefPtr<Interpolation> createLegacyStyleInterpolation(CSSPropertyID,
Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyl
e) const; |
72 static bool createInterpolationsFromCSSValues(CSSPropertyID, CSSValue* f
romCSSValue, CSSValue* toCSSValue, Element*, OwnPtr<Vector<RefPtr<Interpolation>
>>& interpolations); | 78 static bool createInterpolationsFromCSSValues(CSSPropertyID, CSSValue* f
romCSSValue, CSSValue* toCSSValue, Element*, OwnPtr<Vector<RefPtr<Interpolation>
>>& interpolations); |
73 | 79 |
74 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec
ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const; | 80 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec
ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const; |
75 | 81 |
76 RefPtrWillBePersistent<CSSValue> m_value; | 82 RefPtrWillBePersistent<CSSValue> m_value; |
77 mutable RefPtr<AnimatableValue> m_animatableValueCache; | 83 mutable RefPtr<AnimatableValue> m_animatableValueCache; |
78 }; | 84 }; |
79 | 85 |
80 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { | 86 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { |
81 public: | 87 public: |
82 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, const String&, EffectModel::CompositeOperation); | 88 static PassRefPtr<SVGPropertySpecificKeyframe> create(double offset, Pas
sRefPtr<TimingFunction> easing, const String& value, EffectModel::CompositeOpera
tion composite) |
| 89 { |
| 90 return adoptRef(new SVGPropertySpecificKeyframe(offset, easing, valu
e, composite)); |
| 91 } |
83 | 92 |
84 const String& value() const { return m_value; } | 93 const String& value() const { return m_value; } |
85 | 94 |
86 PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons
t final; | 95 PassRefPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons
t final; |
87 | 96 |
88 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn nullptr; } | 97 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn nullptr; } |
89 | 98 |
90 bool isNeutral() const final { return m_value.isNull(); } | 99 bool isNeutral() const final { return m_value.isNull(); } |
91 PassOwnPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, Pass
RefPtr<TimingFunction> easing) const final; | 100 PassRefPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, Pass
RefPtr<TimingFunction> easing) const final; |
92 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyle) co
nst final; | 101 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyle) co
nst final; |
93 | 102 |
94 private: | 103 private: |
95 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, const String&); | 104 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, const String& value, EffectModel::CompositeOperation composite) |
| 105 : Keyframe::PropertySpecificKeyframe(offset, easing, composite) |
| 106 , m_value(value) |
| 107 { } |
96 | 108 |
97 bool isSVGPropertySpecificKeyframe() const override { return true; } | 109 bool isSVGPropertySpecificKeyframe() const override { return true; } |
98 | 110 |
99 String m_value; | 111 String m_value; |
100 }; | 112 }; |
101 | 113 |
102 private: | 114 private: |
103 StringKeyframe() | 115 StringKeyframe() |
104 : m_cssPropertyMap(MutableStylePropertySet::create(HTMLStandardMode)) | 116 : m_cssPropertyMap(MutableStylePropertySet::create(HTMLStandardMode)) |
105 , m_presentationAttributeMap(MutableStylePropertySet::create(HTMLStandar
dMode)) | 117 , m_presentationAttributeMap(MutableStylePropertySet::create(HTMLStandar
dMode)) |
106 { } | 118 { } |
107 | 119 |
108 StringKeyframe(const StringKeyframe& copyFrom); | 120 StringKeyframe(const StringKeyframe& copyFrom); |
109 | 121 |
110 PassRefPtr<Keyframe> clone() const override; | 122 PassRefPtr<Keyframe> clone() const override; |
111 PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; | 123 PassRefPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; |
112 | 124 |
113 bool isStringKeyframe() const override { return true; } | 125 bool isStringKeyframe() const override { return true; } |
114 | 126 |
115 RefPtrWillBePersistent<MutableStylePropertySet> m_cssPropertyMap; | 127 RefPtrWillBePersistent<MutableStylePropertySet> m_cssPropertyMap; |
116 RefPtrWillBePersistent<MutableStylePropertySet> m_presentationAttributeMap; | 128 RefPtrWillBePersistent<MutableStylePropertySet> m_presentationAttributeMap; |
117 HashMap<const QualifiedName*, String> m_svgAttributeMap; | 129 HashMap<const QualifiedName*, String> m_svgAttributeMap; |
118 }; | 130 }; |
119 | 131 |
120 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; | 132 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; |
121 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; | 133 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; |
122 | 134 |
123 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); | 135 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); |
124 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey
frame()); | 136 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey
frame()); |
125 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey
frame()); | 137 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey
frame()); |
126 | 138 |
127 } // namespace blink | 139 } // namespace blink |
128 | 140 |
129 #endif | 141 #endif |
OLD | NEW |