| 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 27 matching lines...) Expand all Loading... |
| 38 class ImmutableStylePropertySet; | 38 class ImmutableStylePropertySet; |
| 39 class KURL; | 39 class KURL; |
| 40 class MutableStylePropertySet; | 40 class MutableStylePropertySet; |
| 41 class StylePropertyShorthand; | 41 class StylePropertyShorthand; |
| 42 class StyleSheetContents; | 42 class StyleSheetContents; |
| 43 | 43 |
| 44 class StylePropertySet : public RefCounted<StylePropertySet> { | 44 class StylePropertySet : public RefCounted<StylePropertySet> { |
| 45 friend class PropertyReference; | 45 friend class PropertyReference; |
| 46 public: | 46 public: |
| 47 | 47 |
| 48 #if ENABLE(OILPAN) | |
| 49 // When oilpan is enabled override the finalize method to dispatch to the su
bclasses' | |
| 50 // destructor. This can be removed once the MutableStylePropertySet's OwnPtr
is moved | |
| 51 // to the heap. | |
| 52 void finalizeGarbageCollectedObject(); | |
| 53 #else | |
| 54 // Override RefCounted's deref() to ensure operator delete is called on | 48 // Override RefCounted's deref() to ensure operator delete is called on |
| 55 // the appropriate subclass type. | 49 // the appropriate subclass type. |
| 56 void deref(); | 50 void deref(); |
| 57 #endif | |
| 58 | 51 |
| 59 class PropertyReference { | 52 class PropertyReference { |
| 60 public: | 53 public: |
| 61 PropertyReference(const StylePropertySet& propertySet, unsigned index) | 54 PropertyReference(const StylePropertySet& propertySet, unsigned index) |
| 62 : m_propertySet(propertySet) | 55 : m_propertySet(propertySet) |
| 63 , m_index(index) | 56 , m_index(index) |
| 64 { | 57 { |
| 65 } | 58 } |
| 66 | 59 |
| 67 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet
adata().m_propertyID); } | 60 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet
adata().m_propertyID); } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 bool hasFailedOrCanceledSubresources() const; | 112 bool hasFailedOrCanceledSubresources() const; |
| 120 | 113 |
| 121 static unsigned averageSizeInBytes(); | 114 static unsigned averageSizeInBytes(); |
| 122 | 115 |
| 123 #ifndef NDEBUG | 116 #ifndef NDEBUG |
| 124 void showStyle(); | 117 void showStyle(); |
| 125 #endif | 118 #endif |
| 126 | 119 |
| 127 bool propertyMatches(CSSPropertyID, const CSSValue*) const; | 120 bool propertyMatches(CSSPropertyID, const CSSValue*) const; |
| 128 | 121 |
| 129 void trace(Visitor*); | |
| 130 void traceAfterDispatch(Visitor*) { } | |
| 131 | |
| 132 protected: | 122 protected: |
| 133 | 123 |
| 134 enum { MaxArraySize = (1 << 28) - 1 }; | 124 enum { MaxArraySize = (1 << 28) - 1 }; |
| 135 | 125 |
| 136 StylePropertySet(CSSParserMode cssParserMode) | 126 StylePropertySet(CSSParserMode cssParserMode) |
| 137 : m_cssParserMode(cssParserMode) | 127 : m_cssParserMode(cssParserMode) |
| 138 , m_isMutable(true) | 128 , m_isMutable(true) |
| 139 , m_arraySize(0) | 129 , m_arraySize(0) |
| 140 { } | 130 { } |
| 141 | 131 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 156 public: | 146 public: |
| 157 ~ImmutableStylePropertySet(); | 147 ~ImmutableStylePropertySet(); |
| 158 static PassRefPtr<ImmutableStylePropertySet> create(const CSSProperty* prope
rties, unsigned count, CSSParserMode); | 148 static PassRefPtr<ImmutableStylePropertySet> create(const CSSProperty* prope
rties, unsigned count, CSSParserMode); |
| 159 | 149 |
| 160 unsigned propertyCount() const { return m_arraySize; } | 150 unsigned propertyCount() const { return m_arraySize; } |
| 161 | 151 |
| 162 const RawPtr<CSSValue>* valueArray() const; | 152 const RawPtr<CSSValue>* valueArray() const; |
| 163 const StylePropertyMetadata* metadataArray() const; | 153 const StylePropertyMetadata* metadataArray() const; |
| 164 int findPropertyIndex(CSSPropertyID) const; | 154 int findPropertyIndex(CSSPropertyID) const; |
| 165 | 155 |
| 166 void traceAfterDispatch(Visitor*); | |
| 167 | |
| 168 void* operator new(std::size_t, void* location) | 156 void* operator new(std::size_t, void* location) |
| 169 { | 157 { |
| 170 return location; | 158 return location; |
| 171 } | 159 } |
| 172 | 160 |
| 173 void* m_storage; | 161 void* m_storage; |
| 174 | 162 |
| 175 private: | 163 private: |
| 176 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode)
; | 164 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode)
; |
| 177 }; | 165 }; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 void removeEquivalentProperties(const CSSStyleDeclaration*); | 206 void removeEquivalentProperties(const CSSStyleDeclaration*); |
| 219 | 207 |
| 220 void mergeAndOverrideOnConflict(const StylePropertySet*); | 208 void mergeAndOverrideOnConflict(const StylePropertySet*); |
| 221 | 209 |
| 222 void clear(); | 210 void clear(); |
| 223 void parseDeclaration(const String& styleDeclaration, StyleSheetContents* co
ntextStyleSheet); | 211 void parseDeclaration(const String& styleDeclaration, StyleSheetContents* co
ntextStyleSheet); |
| 224 | 212 |
| 225 CSSStyleDeclaration* ensureCSSStyleDeclaration(); | 213 CSSStyleDeclaration* ensureCSSStyleDeclaration(); |
| 226 int findPropertyIndex(CSSPropertyID) const; | 214 int findPropertyIndex(CSSPropertyID) const; |
| 227 | 215 |
| 228 void traceAfterDispatch(Visitor*); | |
| 229 | |
| 230 private: | 216 private: |
| 231 explicit MutableStylePropertySet(CSSParserMode); | 217 explicit MutableStylePropertySet(CSSParserMode); |
| 232 explicit MutableStylePropertySet(const StylePropertySet&); | 218 explicit MutableStylePropertySet(const StylePropertySet&); |
| 233 MutableStylePropertySet(const CSSProperty* properties, unsigned count); | 219 MutableStylePropertySet(const CSSProperty* properties, unsigned count); |
| 234 | 220 |
| 235 bool removeShorthandProperty(CSSPropertyID); | 221 bool removeShorthandProperty(CSSPropertyID); |
| 236 CSSProperty* findCSSPropertyWithID(CSSPropertyID); | 222 CSSProperty* findCSSPropertyWithID(CSSPropertyID); |
| 237 OwnPtr<PropertySetCSSStyleDeclaration> m_cssomWrapper; | 223 OwnPtr<PropertySetCSSStyleDeclaration> m_cssomWrapper; |
| 238 | 224 |
| 239 friend class StylePropertySet; | 225 friend class StylePropertySet; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const | 276 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
| 291 { | 277 { |
| 292 if (m_isMutable) | 278 if (m_isMutable) |
| 293 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID); | 279 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID); |
| 294 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID); | 280 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID); |
| 295 } | 281 } |
| 296 | 282 |
| 297 } // namespace blink | 283 } // namespace blink |
| 298 | 284 |
| 299 #endif // StylePropertySet_h | 285 #endif // StylePropertySet_h |
| OLD | NEW |