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, const CSSValue*); | 26 void setCSSPropertyValue(CSSPropertyID, const 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 const CSSValue* cssPropertyValue(CSSPropertyID property) const | 30 const 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 |
37 const CSSValue* presentationAttributeValue(CSSPropertyID property) const | 37 const CSSValue& presentationAttributeValue(CSSPropertyID property) const |
38 { | 38 { |
39 int index = m_presentationAttributeMap->findPropertyIndex(property); | 39 int index = m_presentationAttributeMap->findPropertyIndex(property); |
40 RELEASE_ASSERT(index >= 0); | 40 RELEASE_ASSERT(index >= 0); |
41 return m_presentationAttributeMap->propertyAt(static_cast<unsigned>(inde
x)).value(); | 41 return m_presentationAttributeMap->propertyAt(static_cast<unsigned>(inde
x)).value(); |
42 } | 42 } |
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 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; | 128 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; |
129 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; | 129 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; |
130 | 130 |
131 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); | 131 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); |
132 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey
frame()); | 132 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey
frame()); |
133 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey
frame()); | 133 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram
e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey
frame()); |
134 | 134 |
135 } // namespace blink | 135 } // namespace blink |
136 | 136 |
137 #endif | 137 #endif |
OLD | NEW |