| 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 |
| 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 // A specialization of Keyframe that associates user specified keyframe properti
es with either CSS properties or SVG attributes. | 17 // A specialization of Keyframe that associates user specified keyframe properti
es with either CSS properties or SVG attributes. |
| 18 class StringKeyframe : public Keyframe { | 18 class StringKeyframe : public Keyframe { |
| 19 public: | 19 public: |
| 20 static PassRefPtr<StringKeyframe> create() | 20 static PassRefPtr<StringKeyframe> create() |
| 21 { | 21 { |
| 22 return adoptRef(new StringKeyframe); | 22 return adoptRef(new StringKeyframe); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void setCSSPropertyValue(CSSPropertyID, const String& value, Element*, Style
SheetContents*); | 25 void setCSSPropertyValue(CSSPropertyID, const String& value, Element*, Style
SheetContents*); |
| 26 void setCSSPropertyValue(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>); | 26 void setCSSPropertyValue(CSSPropertyID, RawPtr<CSSValue>); |
| 27 void setPresentationAttributeValue(CSSPropertyID, const String& value, Eleme
nt*, StyleSheetContents*); | 27 void setPresentationAttributeValue(CSSPropertyID, const String& value, Eleme
nt*, StyleSheetContents*); |
| 28 void setSVGAttributeValue(const QualifiedName&, const String& value); | 28 void setSVGAttributeValue(const QualifiedName&, const String& value); |
| 29 | 29 |
| 30 CSSValue* cssPropertyValue(CSSPropertyID property) const | 30 CSSValue* cssPropertyValue(CSSPropertyID property) const |
| 31 { | 31 { |
| 32 int index = m_cssPropertyMap->findPropertyIndex(property); | 32 int index = m_cssPropertyMap->findPropertyIndex(property); |
| 33 RELEASE_ASSERT(index >= 0); | 33 RELEASE_ASSERT(index >= 0); |
| 34 return m_cssPropertyMap->propertyAt(static_cast<unsigned>(index)).value(
); | 34 return m_cssPropertyMap->propertyAt(static_cast<unsigned>(index)).value(
); |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 { } | 72 { } |
| 73 | 73 |
| 74 virtual PassRefPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; | 74 virtual PassRefPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; |
| 75 bool isCSSPropertySpecificKeyframe() const override { return true; } | 75 bool isCSSPropertySpecificKeyframe() const override { return true; } |
| 76 | 76 |
| 77 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; |
| 78 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); |
| 79 | 79 |
| 80 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; |
| 81 | 81 |
| 82 RefPtrWillBePersistent<CSSValue> m_value; | 82 Persistent<CSSValue> m_value; |
| 83 mutable RefPtr<AnimatableValue> m_animatableValueCache; | 83 mutable RefPtr<AnimatableValue> m_animatableValueCache; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { | 86 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { |
| 87 public: | 87 public: |
| 88 static PassRefPtr<SVGPropertySpecificKeyframe> create(double offset, Pas
sRefPtr<TimingFunction> easing, const String& value, EffectModel::CompositeOpera
tion composite) | 88 static PassRefPtr<SVGPropertySpecificKeyframe> create(double offset, Pas
sRefPtr<TimingFunction> easing, const String& value, EffectModel::CompositeOpera
tion composite) |
| 89 { | 89 { |
| 90 return adoptRef(new SVGPropertySpecificKeyframe(offset, easing, valu
e, composite)); | 90 return adoptRef(new SVGPropertySpecificKeyframe(offset, easing, valu
e, composite)); |
| 91 } | 91 } |
| 92 | 92 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 117 , m_presentationAttributeMap(MutableStylePropertySet::create(HTMLStandar
dMode)) | 117 , m_presentationAttributeMap(MutableStylePropertySet::create(HTMLStandar
dMode)) |
| 118 { } | 118 { } |
| 119 | 119 |
| 120 StringKeyframe(const StringKeyframe& copyFrom); | 120 StringKeyframe(const StringKeyframe& copyFrom); |
| 121 | 121 |
| 122 PassRefPtr<Keyframe> clone() const override; | 122 PassRefPtr<Keyframe> clone() const override; |
| 123 PassRefPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; | 123 PassRefPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; |
| 124 | 124 |
| 125 bool isStringKeyframe() const override { return true; } | 125 bool isStringKeyframe() const override { return true; } |
| 126 | 126 |
| 127 RefPtrWillBePersistent<MutableStylePropertySet> m_cssPropertyMap; | 127 Persistent<MutableStylePropertySet> m_cssPropertyMap; |
| 128 RefPtrWillBePersistent<MutableStylePropertySet> m_presentationAttributeMap; | 128 Persistent<MutableStylePropertySet> m_presentationAttributeMap; |
| 129 HashMap<const QualifiedName*, String> m_svgAttributeMap; | 129 HashMap<const QualifiedName*, String> m_svgAttributeMap; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; | 132 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; |
| 133 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; | 133 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; |
| 134 | 134 |
| 135 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); | 135 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); |
| 136 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()); |
| 137 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()); |
| 138 | 138 |
| 139 } // namespace blink | 139 } // namespace blink |
| 140 | 140 |
| 141 #endif | 141 #endif |
| OLD | NEW |