| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 unsigned propertyCount() const; | 91 unsigned propertyCount() const; |
| 92 bool isEmpty() const; | 92 bool isEmpty() const; |
| 93 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } | 93 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } |
| 94 | 94 |
| 95 template<typename T> // CSSPropertyID or AtomicString | 95 template<typename T> // CSSPropertyID or AtomicString |
| 96 int findPropertyIndex(T property) const; | 96 int findPropertyIndex(T property) const; |
| 97 | 97 |
| 98 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr
operty) != -1; } | 98 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr
operty) != -1; } |
| 99 | 99 |
| 100 template<typename T> // CSSPropertyID or AtomicString | 100 template<typename T> // CSSPropertyID or AtomicString |
| 101 RawPtr<CSSValue> getPropertyCSSValue(T property) const; | 101 CSSValue* getPropertyCSSValue(T property) const; |
| 102 | 102 |
| 103 template<typename T> // CSSPropertyID or AtomicString | 103 template<typename T> // CSSPropertyID or AtomicString |
| 104 String getPropertyValue(T property) const; | 104 String getPropertyValue(T property) const; |
| 105 | 105 |
| 106 template<typename T> // CSSPropertyID or AtomicString | 106 template<typename T> // CSSPropertyID or AtomicString |
| 107 bool propertyIsImportant(T property) const; | 107 bool propertyIsImportant(T property) const; |
| 108 | 108 |
| 109 bool shorthandIsImportant(CSSPropertyID) const; | 109 bool shorthandIsImportant(CSSPropertyID) const; |
| 110 bool shorthandIsImportant(AtomicString customPropertyName) const; | 110 bool shorthandIsImportant(AtomicString customPropertyName) const; |
| 111 | 111 |
| 112 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; | 112 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; |
| 113 bool isPropertyImplicit(CSSPropertyID) const; | 113 bool isPropertyImplicit(CSSPropertyID) const; |
| 114 | 114 |
| 115 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs
sParserMode); } | 115 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs
sParserMode); } |
| 116 | 116 |
| 117 RawPtr<MutableStylePropertySet> mutableCopy() const; | 117 MutableStylePropertySet* mutableCopy() const; |
| 118 RawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() const; | 118 ImmutableStylePropertySet* immutableCopyIfNeeded() const; |
| 119 | 119 |
| 120 RawPtr<MutableStylePropertySet> copyPropertiesInSet(const Vector<CSSProperty
ID>&) const; | 120 MutableStylePropertySet* copyPropertiesInSet(const Vector<CSSPropertyID>&) c
onst; |
| 121 | 121 |
| 122 String asText() const; | 122 String asText() const; |
| 123 | 123 |
| 124 bool isMutable() const { return m_isMutable; } | 124 bool isMutable() const { return m_isMutable; } |
| 125 | 125 |
| 126 bool hasFailedOrCanceledSubresources() const; | 126 bool hasFailedOrCanceledSubresources() const; |
| 127 | 127 |
| 128 static unsigned averageSizeInBytes(); | 128 static unsigned averageSizeInBytes(); |
| 129 | 129 |
| 130 #ifndef NDEBUG | 130 #ifndef NDEBUG |
| (...skipping 24 matching lines...) Expand all Loading... |
| 155 unsigned m_cssParserMode : 3; | 155 unsigned m_cssParserMode : 3; |
| 156 mutable unsigned m_isMutable : 1; | 156 mutable unsigned m_isMutable : 1; |
| 157 unsigned m_arraySize : 28; | 157 unsigned m_arraySize : 28; |
| 158 | 158 |
| 159 friend class PropertySetCSSStyleDeclaration; | 159 friend class PropertySetCSSStyleDeclaration; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { | 162 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { |
| 163 public: | 163 public: |
| 164 ~ImmutableStylePropertySet(); | 164 ~ImmutableStylePropertySet(); |
| 165 static RawPtr<ImmutableStylePropertySet> create(const CSSProperty* propertie
s, unsigned count, CSSParserMode); | 165 static ImmutableStylePropertySet* create(const CSSProperty* properties, unsi
gned count, CSSParserMode); |
| 166 | 166 |
| 167 unsigned propertyCount() const { return m_arraySize; } | 167 unsigned propertyCount() const { return m_arraySize; } |
| 168 | 168 |
| 169 const Member<CSSValue>* valueArray() const; | 169 const Member<CSSValue>* valueArray() const; |
| 170 const StylePropertyMetadata* metadataArray() const; | 170 const StylePropertyMetadata* metadataArray() const; |
| 171 | 171 |
| 172 template<typename T> // CSSPropertyID or AtomicString | 172 template<typename T> // CSSPropertyID or AtomicString |
| 173 int findPropertyIndex(T property) const; | 173 int findPropertyIndex(T property) const; |
| 174 | 174 |
| 175 DECLARE_TRACE_AFTER_DISPATCH(); | 175 DECLARE_TRACE_AFTER_DISPATCH(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 193 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c
onst | 193 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c
onst |
| 194 { | 194 { |
| 195 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons
t char*>(&(this->m_storage))[m_arraySize * sizeof(Member<CSSValue>)]); | 195 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons
t char*>(&(this->m_storage))[m_arraySize * sizeof(Member<CSSValue>)]); |
| 196 } | 196 } |
| 197 | 197 |
| 198 DEFINE_TYPE_CASTS(ImmutableStylePropertySet, StylePropertySet, set, !set->isMuta
ble(), !set.isMutable()); | 198 DEFINE_TYPE_CASTS(ImmutableStylePropertySet, StylePropertySet, set, !set->isMuta
ble(), !set.isMutable()); |
| 199 | 199 |
| 200 class CORE_EXPORT MutableStylePropertySet : public StylePropertySet { | 200 class CORE_EXPORT MutableStylePropertySet : public StylePropertySet { |
| 201 public: | 201 public: |
| 202 ~MutableStylePropertySet() { } | 202 ~MutableStylePropertySet() { } |
| 203 static RawPtr<MutableStylePropertySet> create(CSSParserMode); | 203 static MutableStylePropertySet* create(CSSParserMode); |
| 204 static RawPtr<MutableStylePropertySet> create(const CSSProperty* properties,
unsigned count); | 204 static MutableStylePropertySet* create(const CSSProperty* properties, unsign
ed count); |
| 205 | 205 |
| 206 unsigned propertyCount() const { return m_propertyVector.size(); } | 206 unsigned propertyCount() const { return m_propertyVector.size(); } |
| 207 | 207 |
| 208 // Returns whether this style set was changed. | 208 // Returns whether this style set was changed. |
| 209 bool addParsedProperties(const HeapVector<CSSProperty, 256>&); | 209 bool addParsedProperties(const HeapVector<CSSProperty, 256>&); |
| 210 bool addRespectingCascade(const CSSProperty&); | 210 bool addRespectingCascade(const CSSProperty&); |
| 211 | 211 |
| 212 // These expand shorthand properties into multiple properties. | 212 // These expand shorthand properties into multiple properties. |
| 213 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool
important = false, StyleSheetContents* contextStyleSheet = 0); | 213 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool
important = false, StyleSheetContents* contextStyleSheet = 0); |
| 214 bool setProperty(const AtomicString& customPropertyName, const String& value
, bool important = false, StyleSheetContents* contextStyleSheet = 0); | 214 bool setProperty(const AtomicString& customPropertyName, const String& value
, bool important = false, StyleSheetContents* contextStyleSheet = 0); |
| 215 void setProperty(CSSPropertyID, RawPtr<CSSValue>, bool important = false); | 215 void setProperty(CSSPropertyID, CSSValue*, bool important = false); |
| 216 | 216 |
| 217 // These do not. FIXME: This is too messy, we can do better. | 217 // These do not. FIXME: This is too messy, we can do better. |
| 218 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals
e); | 218 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals
e); |
| 219 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); | 219 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); |
| 220 | 220 |
| 221 template<typename T> // CSSPropertyID or AtomicString | 221 template<typename T> // CSSPropertyID or AtomicString |
| 222 bool removeProperty(T property, String* returnText = 0); | 222 bool removeProperty(T property, String* returnText = 0); |
| 223 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); | 223 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); |
| 224 void removeEquivalentProperties(const StylePropertySet*); | 224 void removeEquivalentProperties(const StylePropertySet*); |
| 225 void removeEquivalentProperties(const CSSStyleDeclaration*); | 225 void removeEquivalentProperties(const CSSStyleDeclaration*); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 248 CSSProperty* findCSSPropertyWithID(CSSPropertyID, const AtomicString& custom
PropertyName = nullAtom); | 248 CSSProperty* findCSSPropertyWithID(CSSPropertyID, const AtomicString& custom
PropertyName = nullAtom); |
| 249 Member<PropertySetCSSStyleDeclaration> m_cssomWrapper; | 249 Member<PropertySetCSSStyleDeclaration> m_cssomWrapper; |
| 250 | 250 |
| 251 friend class StylePropertySet; | 251 friend class StylePropertySet; |
| 252 | 252 |
| 253 HeapVector<CSSProperty, 4> m_propertyVector; | 253 HeapVector<CSSProperty, 4> m_propertyVector; |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable
(), set.isMutable()); | 256 DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable
(), set.isMutable()); |
| 257 | 257 |
| 258 inline MutableStylePropertySet* toMutableStylePropertySet(const RawPtr<StyleProp
ertySet>& set) | |
| 259 { | |
| 260 return toMutableStylePropertySet(set.get()); | |
| 261 } | |
| 262 | |
| 263 inline MutableStylePropertySet* toMutableStylePropertySet(const Persistent<Style
PropertySet>& set) | 258 inline MutableStylePropertySet* toMutableStylePropertySet(const Persistent<Style
PropertySet>& set) |
| 264 { | 259 { |
| 265 return toMutableStylePropertySet(set.get()); | 260 return toMutableStylePropertySet(set.get()); |
| 266 } | 261 } |
| 267 | 262 |
| 268 inline MutableStylePropertySet* toMutableStylePropertySet(const Member<StyleProp
ertySet>& set) | 263 inline MutableStylePropertySet* toMutableStylePropertySet(const Member<StyleProp
ertySet>& set) |
| 269 { | 264 { |
| 270 return toMutableStylePropertySet(set.get()); | 265 return toMutableStylePropertySet(set.get()); |
| 271 } | 266 } |
| 272 | 267 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 inline int StylePropertySet::findPropertyIndex(T property) const | 308 inline int StylePropertySet::findPropertyIndex(T property) const |
| 314 { | 309 { |
| 315 if (m_isMutable) | 310 if (m_isMutable) |
| 316 return toMutableStylePropertySet(this)->findPropertyIndex(property); | 311 return toMutableStylePropertySet(this)->findPropertyIndex(property); |
| 317 return toImmutableStylePropertySet(this)->findPropertyIndex(property); | 312 return toImmutableStylePropertySet(this)->findPropertyIndex(property); |
| 318 } | 313 } |
| 319 | 314 |
| 320 } // namespace blink | 315 } // namespace blink |
| 321 | 316 |
| 322 #endif // StylePropertySet_h | 317 #endif // StylePropertySet_h |
| OLD | NEW |