| 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 29 matching lines...) Expand all Loading... |
| 66 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, CSSValue*); | 66 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, CSSValue*); |
| 67 | 67 |
| 68 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; | 68 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; |
| 69 bool isCSSPropertySpecificKeyframe() const override { return true; } | 69 bool isCSSPropertySpecificKeyframe() const override { return true; } |
| 70 | 70 |
| 71 PassRefPtr<Interpolation> createLegacyStyleInterpolation(CSSPropertyID,
Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseStyl
e) const; | 71 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); | 72 static bool createInterpolationsFromCSSValues(CSSPropertyID, CSSValue* f
romCSSValue, CSSValue* toCSSValue, Element*, OwnPtr<Vector<RefPtr<Interpolation>
>>& interpolations); |
| 73 | 73 |
| 74 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec
ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const; | 74 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec
ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const; |
| 75 | 75 |
| 76 RefPtrWillBePersistent<CSSValue> m_value; | 76 Persistent<CSSValue> m_value; |
| 77 mutable RefPtr<AnimatableValue> m_animatableValueCache; | 77 mutable RefPtr<AnimatableValue> m_animatableValueCache; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { | 80 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram
e { |
| 81 public: | 81 public: |
| 82 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, const String&, EffectModel::CompositeOperation); | 82 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea
sing, const String&, EffectModel::CompositeOperation); |
| 83 | 83 |
| 84 const String& value() const { return m_value; } | 84 const String& value() const { return m_value; } |
| 85 | 85 |
| 86 PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons
t final; | 86 PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons
t final; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 105 , m_presentationAttributeMap(MutableStylePropertySet::create(HTMLStandar
dMode)) | 105 , m_presentationAttributeMap(MutableStylePropertySet::create(HTMLStandar
dMode)) |
| 106 { } | 106 { } |
| 107 | 107 |
| 108 StringKeyframe(const StringKeyframe& copyFrom); | 108 StringKeyframe(const StringKeyframe& copyFrom); |
| 109 | 109 |
| 110 PassRefPtr<Keyframe> clone() const override; | 110 PassRefPtr<Keyframe> clone() const override; |
| 111 PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; | 111 PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; |
| 112 | 112 |
| 113 bool isStringKeyframe() const override { return true; } | 113 bool isStringKeyframe() const override { return true; } |
| 114 | 114 |
| 115 RefPtrWillBePersistent<MutableStylePropertySet> m_cssPropertyMap; | 115 Persistent<MutableStylePropertySet> m_cssPropertyMap; |
| 116 RefPtrWillBePersistent<MutableStylePropertySet> m_presentationAttributeMap; | 116 Persistent<MutableStylePropertySet> m_presentationAttributeMap; |
| 117 HashMap<const QualifiedName*, String> m_svgAttributeMap; | 117 HashMap<const QualifiedName*, String> m_svgAttributeMap; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; | 120 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; |
| 121 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; | 121 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; |
| 122 | 122 |
| 123 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); | 123 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()); | 124 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()); | 125 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey
frame()); |
| 126 | 126 |
| 127 } // namespace blink | 127 } // namespace blink |
| 128 | 128 |
| 129 #endif | 129 #endif |
| OLD | NEW |