| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet
adata().m_propertyID); } | 59 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet
adata().m_propertyID); } |
| 60 CSSPropertyID shorthandID() const { return propertyMetadata().shorthandI
D(); } | 60 CSSPropertyID shorthandID() const { return propertyMetadata().shorthandI
D(); } |
| 61 | 61 |
| 62 bool isImportant() const { return propertyMetadata().m_important; } | 62 bool isImportant() const { return propertyMetadata().m_important; } |
| 63 bool isInherited() const { return propertyMetadata().m_inherited; } | 63 bool isInherited() const { return propertyMetadata().m_inherited; } |
| 64 bool isImplicit() const { return propertyMetadata().m_implicit; } | 64 bool isImplicit() const { return propertyMetadata().m_implicit; } |
| 65 | 65 |
| 66 const CSSValue* value() const { return propertyValue(); } | 66 const CSSValue& value() const { return propertyValue(); } |
| 67 | 67 |
| 68 // FIXME: Remove this. | 68 // FIXME: Remove this. |
| 69 CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(
), *propertyValue()); } | 69 CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(
), propertyValue()); } |
| 70 | 70 |
| 71 const StylePropertyMetadata& propertyMetadata() const; | 71 const StylePropertyMetadata& propertyMetadata() const; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 const CSSValue* propertyValue() const; | 74 const CSSValue& propertyValue() const; |
| 75 | 75 |
| 76 Member<const StylePropertySet> m_propertySet; | 76 Member<const StylePropertySet> m_propertySet; |
| 77 unsigned m_index; | 77 unsigned m_index; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 unsigned propertyCount() const; | 80 unsigned propertyCount() const; |
| 81 bool isEmpty() const; | 81 bool isEmpty() const; |
| 82 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } | 82 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } |
| 83 | 83 |
| 84 template<typename T> // CSSPropertyID or AtomicString | 84 template<typename T> // CSSPropertyID or AtomicString |
| (...skipping 28 matching lines...) Expand all Loading... |
| 113 bool isMutable() const { return m_isMutable; } | 113 bool isMutable() const { return m_isMutable; } |
| 114 | 114 |
| 115 bool hasFailedOrCanceledSubresources() const; | 115 bool hasFailedOrCanceledSubresources() const; |
| 116 | 116 |
| 117 static unsigned averageSizeInBytes(); | 117 static unsigned averageSizeInBytes(); |
| 118 | 118 |
| 119 #ifndef NDEBUG | 119 #ifndef NDEBUG |
| 120 void showStyle(); | 120 void showStyle(); |
| 121 #endif | 121 #endif |
| 122 | 122 |
| 123 bool propertyMatches(CSSPropertyID, const CSSValue*) const; | 123 bool propertyMatches(CSSPropertyID, const CSSValue&) const; |
| 124 | 124 |
| 125 DECLARE_TRACE(); | 125 DECLARE_TRACE(); |
| 126 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } | 126 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } |
| 127 | 127 |
| 128 protected: | 128 protected: |
| 129 | 129 |
| 130 enum { MaxArraySize = (1 << 28) - 1 }; | 130 enum { MaxArraySize = (1 << 28) - 1 }; |
| 131 | 131 |
| 132 StylePropertySet(CSSParserMode cssParserMode) | 132 StylePropertySet(CSSParserMode cssParserMode) |
| 133 : m_cssParserMode(cssParserMode) | 133 : m_cssParserMode(cssParserMode) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 unsigned propertyCount() const { return m_propertyVector.size(); } | 195 unsigned propertyCount() const { return m_propertyVector.size(); } |
| 196 | 196 |
| 197 // Returns whether this style set was changed. | 197 // Returns whether this style set was changed. |
| 198 bool addParsedProperties(const HeapVector<CSSProperty, 256>&); | 198 bool addParsedProperties(const HeapVector<CSSProperty, 256>&); |
| 199 bool addRespectingCascade(const CSSProperty&); | 199 bool addRespectingCascade(const CSSProperty&); |
| 200 | 200 |
| 201 // These expand shorthand properties into multiple properties. | 201 // These expand shorthand properties into multiple properties. |
| 202 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool
important = false, StyleSheetContents* contextStyleSheet = 0); | 202 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool
important = false, StyleSheetContents* contextStyleSheet = 0); |
| 203 bool setProperty(const AtomicString& customPropertyName, const String& value
, bool important = false, StyleSheetContents* contextStyleSheet = 0); | 203 bool setProperty(const AtomicString& customPropertyName, const String& value
, bool important = false, StyleSheetContents* contextStyleSheet = 0); |
| 204 // TODO(sashab): Make this take a const CSSValue& |
| 204 void setProperty(CSSPropertyID, const CSSValue*, bool important = false); | 205 void setProperty(CSSPropertyID, const CSSValue*, bool important = false); |
| 205 | 206 |
| 206 // These do not. FIXME: This is too messy, we can do better. | 207 // These do not. FIXME: This is too messy, we can do better. |
| 207 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals
e); | 208 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals
e); |
| 208 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); | 209 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); |
| 209 | 210 |
| 210 template<typename T> // CSSPropertyID or AtomicString | 211 template<typename T> // CSSPropertyID or AtomicString |
| 211 bool removeProperty(T property, String* returnText = 0); | 212 bool removeProperty(T property, String* returnText = 0); |
| 212 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); | 213 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); |
| 213 void removeEquivalentProperties(const StylePropertySet*); | 214 void removeEquivalentProperties(const StylePropertySet*); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 return toMutableStylePropertySet(set.get()); | 255 return toMutableStylePropertySet(set.get()); |
| 255 } | 256 } |
| 256 | 257 |
| 257 inline const StylePropertyMetadata& StylePropertySet::PropertyReference::propert
yMetadata() const | 258 inline const StylePropertyMetadata& StylePropertySet::PropertyReference::propert
yMetadata() const |
| 258 { | 259 { |
| 259 if (m_propertySet->isMutable()) | 260 if (m_propertySet->isMutable()) |
| 260 return toMutableStylePropertySet(*m_propertySet).m_propertyVector.at(m_i
ndex).metadata(); | 261 return toMutableStylePropertySet(*m_propertySet).m_propertyVector.at(m_i
ndex).metadata(); |
| 261 return toImmutableStylePropertySet(*m_propertySet).metadataArray()[m_index]; | 262 return toImmutableStylePropertySet(*m_propertySet).metadataArray()[m_index]; |
| 262 } | 263 } |
| 263 | 264 |
| 264 inline const CSSValue* StylePropertySet::PropertyReference::propertyValue() cons
t | 265 inline const CSSValue& StylePropertySet::PropertyReference::propertyValue() cons
t |
| 265 { | 266 { |
| 266 if (m_propertySet->isMutable()) | 267 if (m_propertySet->isMutable()) |
| 267 return toMutableStylePropertySet(*m_propertySet).m_propertyVector.at(m_i
ndex).value(); | 268 return *toMutableStylePropertySet(*m_propertySet).m_propertyVector.at(m_
index).value(); |
| 268 return toImmutableStylePropertySet(*m_propertySet).valueArray()[m_index]; | 269 return *toImmutableStylePropertySet(*m_propertySet).valueArray()[m_index]; |
| 269 } | 270 } |
| 270 | 271 |
| 271 inline unsigned StylePropertySet::propertyCount() const | 272 inline unsigned StylePropertySet::propertyCount() const |
| 272 { | 273 { |
| 273 if (m_isMutable) | 274 if (m_isMutable) |
| 274 return toMutableStylePropertySet(this)->m_propertyVector.size(); | 275 return toMutableStylePropertySet(this)->m_propertyVector.size(); |
| 275 return m_arraySize; | 276 return m_arraySize; |
| 276 } | 277 } |
| 277 | 278 |
| 278 inline bool StylePropertySet::isEmpty() const | 279 inline bool StylePropertySet::isEmpty() const |
| 279 { | 280 { |
| 280 return !propertyCount(); | 281 return !propertyCount(); |
| 281 } | 282 } |
| 282 | 283 |
| 283 template<typename T> | 284 template<typename T> |
| 284 inline int StylePropertySet::findPropertyIndex(T property) const | 285 inline int StylePropertySet::findPropertyIndex(T property) const |
| 285 { | 286 { |
| 286 if (m_isMutable) | 287 if (m_isMutable) |
| 287 return toMutableStylePropertySet(this)->findPropertyIndex(property); | 288 return toMutableStylePropertySet(this)->findPropertyIndex(property); |
| 288 return toImmutableStylePropertySet(this)->findPropertyIndex(property); | 289 return toImmutableStylePropertySet(this)->findPropertyIndex(property); |
| 289 } | 290 } |
| 290 | 291 |
| 291 } // namespace blink | 292 } // namespace blink |
| 292 | 293 |
| 293 #endif // StylePropertySet_h | 294 #endif // StylePropertySet_h |
| OLD | NEW |