OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 { | 63 { |
64 } | 64 } |
65 | 65 |
66 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet
adata().m_propertyID); } | 66 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet
adata().m_propertyID); } |
67 CSSPropertyID shorthandID() const { return propertyMetadata().shorthandI
D(); } | 67 CSSPropertyID shorthandID() const { return propertyMetadata().shorthandI
D(); } |
68 | 68 |
69 bool isImportant() const { return propertyMetadata().m_important; } | 69 bool isImportant() const { return propertyMetadata().m_important; } |
70 bool isInherited() const { return propertyMetadata().m_inherited; } | 70 bool isInherited() const { return propertyMetadata().m_inherited; } |
71 bool isImplicit() const { return propertyMetadata().m_implicit; } | 71 bool isImplicit() const { return propertyMetadata().m_implicit; } |
72 | 72 |
73 const CSSValue value() const { return propertyValue(); } | |
74 // FIXME: We should try to remove this mutable overload. | 73 // FIXME: We should try to remove this mutable overload. |
75 CSSValue value() { return propertyValue(); } | 74 const CSSValue& value() { return propertyValue(); } |
76 | 75 |
77 // FIXME: Remove this. | 76 // FIXME: Remove this. |
78 CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(
), propertyValue()); } | 77 CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(
), propertyValue()); } |
79 | 78 |
80 const StylePropertyMetadata& propertyMetadata() const; | 79 const StylePropertyMetadata& propertyMetadata() const; |
81 | 80 |
82 private: | 81 private: |
83 const CSSValue propertyValue() const; | 82 const CSSValue& propertyValue() const; |
84 | 83 |
85 const StylePropertySet& m_propertySet; | 84 const StylePropertySet& m_propertySet; |
86 unsigned m_index; | 85 unsigned m_index; |
87 }; | 86 }; |
88 | 87 |
89 unsigned propertyCount() const; | 88 unsigned propertyCount() const; |
90 bool isEmpty() const; | 89 bool isEmpty() const; |
91 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } | 90 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } |
92 int findPropertyIndex(CSSPropertyID) const; | 91 int findPropertyIndex(CSSPropertyID) const; |
93 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr
operty) != -1; } | 92 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr
operty) != -1; } |
94 | 93 |
95 NullableCSSValue getPropertyCSSValue(CSSPropertyID) const; | 94 const NullableCSSValue getPropertyCSSValue(CSSPropertyID) const; |
96 String getPropertyValue(CSSPropertyID) const; | 95 String getPropertyValue(CSSPropertyID) const; |
97 | 96 |
98 bool propertyIsImportant(CSSPropertyID) const; | 97 bool propertyIsImportant(CSSPropertyID) const; |
99 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; | 98 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; |
100 bool isPropertyImplicit(CSSPropertyID) const; | 99 bool isPropertyImplicit(CSSPropertyID) const; |
101 | 100 |
102 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs
sParserMode); } | 101 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs
sParserMode); } |
103 | 102 |
104 PassRefPtrWillBeRawPtr<MutableStylePropertySet> mutableCopy() const; | 103 PassRefPtrWillBeRawPtr<MutableStylePropertySet> mutableCopy() const; |
105 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co
nst; | 104 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co
nst; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 : m_cssParserMode(cssParserMode) | 136 : m_cssParserMode(cssParserMode) |
138 , m_isMutable(false) | 137 , m_isMutable(false) |
139 , m_arraySize(std::min(immutableArraySize, unsigned(MaxArraySize))) | 138 , m_arraySize(std::min(immutableArraySize, unsigned(MaxArraySize))) |
140 { } | 139 { } |
141 | 140 |
142 unsigned m_cssParserMode : 3; | 141 unsigned m_cssParserMode : 3; |
143 mutable unsigned m_isMutable : 1; | 142 mutable unsigned m_isMutable : 1; |
144 unsigned m_arraySize : 28; | 143 unsigned m_arraySize : 28; |
145 | 144 |
146 friend class PropertySetCSSStyleDeclaration; | 145 friend class PropertySetCSSStyleDeclaration; |
| 146 |
147 }; | 147 }; |
148 | 148 |
149 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { | 149 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { |
150 public: | 150 public: |
151 ~ImmutableStylePropertySet(); | 151 ~ImmutableStylePropertySet(); |
152 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro
perty* properties, unsigned count, CSSParserMode); | 152 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro
perty* properties, unsigned count, CSSParserMode); |
153 | 153 |
154 unsigned propertyCount() const { return m_arraySize; } | 154 unsigned propertyCount() const { return m_arraySize; } |
155 | 155 |
156 const CSSValue* valueArray() const; | 156 const CSSValue* valueArray() const; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return toMutableStylePropertySet(set.get()); | 249 return toMutableStylePropertySet(set.get()); |
250 } | 250 } |
251 | 251 |
252 inline const StylePropertyMetadata& StylePropertySet::PropertyReference::propert
yMetadata() const | 252 inline const StylePropertyMetadata& StylePropertySet::PropertyReference::propert
yMetadata() const |
253 { | 253 { |
254 if (m_propertySet.isMutable()) | 254 if (m_propertySet.isMutable()) |
255 return toMutableStylePropertySet(m_propertySet).m_propertyVector.at(m_in
dex).metadata(); | 255 return toMutableStylePropertySet(m_propertySet).m_propertyVector.at(m_in
dex).metadata(); |
256 return toImmutableStylePropertySet(m_propertySet).metadataArray()[m_index]; | 256 return toImmutableStylePropertySet(m_propertySet).metadataArray()[m_index]; |
257 } | 257 } |
258 | 258 |
259 inline const CSSValue StylePropertySet::PropertyReference::propertyValue() const | 259 inline const CSSValue& StylePropertySet::PropertyReference::propertyValue() cons
t |
260 { | 260 { |
261 if (m_propertySet.isMutable()) | 261 if (m_propertySet.isMutable()) |
262 return toMutableStylePropertySet(m_propertySet).m_propertyVector.at(m_in
dex).value(); | 262 return toMutableStylePropertySet(m_propertySet).m_propertyVector.at(m_in
dex).value(); |
263 return toImmutableStylePropertySet(m_propertySet).valueArray()[m_index]; | 263 return toImmutableStylePropertySet(m_propertySet).valueArray()[m_index]; |
264 } | 264 } |
265 | 265 |
266 inline unsigned StylePropertySet::propertyCount() const | 266 inline unsigned StylePropertySet::propertyCount() const |
267 { | 267 { |
268 if (m_isMutable) | 268 if (m_isMutable) |
269 return toMutableStylePropertySet(this)->m_propertyVector.size(); | 269 return toMutableStylePropertySet(this)->m_propertyVector.size(); |
(...skipping 21 matching lines...) Expand all Loading... |
291 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const | 291 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
292 { | 292 { |
293 if (m_isMutable) | 293 if (m_isMutable) |
294 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID); | 294 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID); |
295 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID); | 295 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID); |
296 } | 296 } |
297 | 297 |
298 } // namespace blink | 298 } // namespace blink |
299 | 299 |
300 #endif // StylePropertySet_h | 300 #endif // StylePropertySet_h |
OLD | NEW |