| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 private: | 83 private: |
| 84 const CSSValue* propertyValue() const; | 84 const CSSValue* propertyValue() const; |
| 85 | 85 |
| 86 RawPtrWillBeMember<const StylePropertySet> m_propertySet; | 86 RawPtrWillBeMember<const StylePropertySet> m_propertySet; |
| 87 unsigned m_index; | 87 unsigned m_index; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 unsigned propertyCount() const; | 90 unsigned propertyCount() const; |
| 91 bool isEmpty() const; | 91 bool isEmpty() const; |
| 92 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } | 92 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc
e(*this, index); } |
| 93 int findPropertyIndex(CSSPropertyID) const; | 93 |
| 94 template<typename T> // CSSPropertyID or AtomicString |
| 95 int findPropertyIndex(T property) const; |
| 96 |
| 94 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr
operty) != -1; } | 97 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr
operty) != -1; } |
| 95 | 98 |
| 96 PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const; | 99 template<typename T> // CSSPropertyID or AtomicString |
| 97 String getPropertyValue(CSSPropertyID) const; | 100 PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(T property) const; |
| 98 | 101 |
| 99 bool propertyIsImportant(CSSPropertyID) const; | 102 template<typename T> // CSSPropertyID or AtomicString |
| 103 String getPropertyValue(T property) const; |
| 104 |
| 105 template<typename T> // CSSPropertyID or AtomicString |
| 106 bool propertyIsImportant(T property) const; |
| 107 |
| 108 bool shorthandIsImportant(CSSPropertyID) const; |
| 109 bool shorthandIsImportant(AtomicString customPropertyName) const; |
| 110 |
| 100 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; | 111 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; |
| 101 bool isPropertyImplicit(CSSPropertyID) const; | 112 bool isPropertyImplicit(CSSPropertyID) const; |
| 102 | 113 |
| 103 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs
sParserMode); } | 114 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs
sParserMode); } |
| 104 | 115 |
| 105 PassRefPtrWillBeRawPtr<MutableStylePropertySet> mutableCopy() const; | 116 PassRefPtrWillBeRawPtr<MutableStylePropertySet> mutableCopy() const; |
| 106 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co
nst; | 117 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co
nst; |
| 107 | 118 |
| 108 PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyPropertiesInSet(const Ve
ctor<CSSPropertyID>&) const; | 119 PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyPropertiesInSet(const Ve
ctor<CSSPropertyID>&) const; |
| 109 | 120 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 160 |
| 150 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { | 161 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { |
| 151 public: | 162 public: |
| 152 ~ImmutableStylePropertySet(); | 163 ~ImmutableStylePropertySet(); |
| 153 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro
perty* properties, unsigned count, CSSParserMode); | 164 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro
perty* properties, unsigned count, CSSParserMode); |
| 154 | 165 |
| 155 unsigned propertyCount() const { return m_arraySize; } | 166 unsigned propertyCount() const { return m_arraySize; } |
| 156 | 167 |
| 157 const RawPtrWillBeMember<CSSValue>* valueArray() const; | 168 const RawPtrWillBeMember<CSSValue>* valueArray() const; |
| 158 const StylePropertyMetadata* metadataArray() const; | 169 const StylePropertyMetadata* metadataArray() const; |
| 159 int findPropertyIndex(CSSPropertyID) const; | 170 |
| 171 template<typename T> // CSSPropertyID or AtomicString |
| 172 int findPropertyIndex(T property) const; |
| 160 | 173 |
| 161 DECLARE_TRACE_AFTER_DISPATCH(); | 174 DECLARE_TRACE_AFTER_DISPATCH(); |
| 162 | 175 |
| 163 void* operator new(std::size_t, void* location) | 176 void* operator new(std::size_t, void* location) |
| 164 { | 177 { |
| 165 return location; | 178 return location; |
| 166 } | 179 } |
| 167 | 180 |
| 168 void* m_storage; | 181 void* m_storage; |
| 169 | 182 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 190 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> create(const CSSPrope
rty* properties, unsigned count); | 203 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> create(const CSSPrope
rty* properties, unsigned count); |
| 191 | 204 |
| 192 unsigned propertyCount() const { return m_propertyVector.size(); } | 205 unsigned propertyCount() const { return m_propertyVector.size(); } |
| 193 | 206 |
| 194 // Returns whether this style set was changed. | 207 // Returns whether this style set was changed. |
| 195 bool addParsedProperties(const WillBeHeapVector<CSSProperty, 256>&); | 208 bool addParsedProperties(const WillBeHeapVector<CSSProperty, 256>&); |
| 196 bool addRespectingCascade(const CSSProperty&); | 209 bool addRespectingCascade(const CSSProperty&); |
| 197 | 210 |
| 198 // These expand shorthand properties into multiple properties. | 211 // These expand shorthand properties into multiple properties. |
| 199 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool
important = false, StyleSheetContents* contextStyleSheet = 0); | 212 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool
important = false, StyleSheetContents* contextStyleSheet = 0); |
| 213 bool setProperty(const AtomicString& customPropertyName, const String& value
, bool important = false, StyleSheetContents* contextStyleSheet = 0); |
| 200 void setProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor
tant = false); | 214 void setProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor
tant = false); |
| 201 | 215 |
| 202 // These do not. FIXME: This is too messy, we can do better. | 216 // These do not. FIXME: This is too messy, we can do better. |
| 203 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals
e); | 217 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals
e); |
| 204 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); | 218 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); |
| 205 | 219 |
| 206 bool removeProperty(CSSPropertyID, String* returnText = 0); | 220 template<typename T> // CSSPropertyID or AtomicString |
| 221 bool removeProperty(T property, String* returnText = 0); |
| 207 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); | 222 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); |
| 208 void removeEquivalentProperties(const StylePropertySet*); | 223 void removeEquivalentProperties(const StylePropertySet*); |
| 209 void removeEquivalentProperties(const CSSStyleDeclaration*); | 224 void removeEquivalentProperties(const CSSStyleDeclaration*); |
| 210 | 225 |
| 211 void mergeAndOverrideOnConflict(const StylePropertySet*); | 226 void mergeAndOverrideOnConflict(const StylePropertySet*); |
| 212 | 227 |
| 213 void clear(); | 228 void clear(); |
| 214 void parseDeclarationList(const String& styleDeclaration, StyleSheetContents
* contextStyleSheet); | 229 void parseDeclarationList(const String& styleDeclaration, StyleSheetContents
* contextStyleSheet); |
| 215 | 230 |
| 216 CSSStyleDeclaration* ensureCSSStyleDeclaration(); | 231 CSSStyleDeclaration* ensureCSSStyleDeclaration(); |
| 217 int findPropertyIndex(CSSPropertyID) const; | 232 |
| 233 template<typename T> // CSSPropertyID or AtomicString |
| 234 int findPropertyIndex(T property) const; |
| 218 | 235 |
| 219 DECLARE_TRACE_AFTER_DISPATCH(); | 236 DECLARE_TRACE_AFTER_DISPATCH(); |
| 220 | 237 |
| 221 private: | 238 private: |
| 222 explicit MutableStylePropertySet(CSSParserMode); | 239 explicit MutableStylePropertySet(CSSParserMode); |
| 223 explicit MutableStylePropertySet(const StylePropertySet&); | 240 explicit MutableStylePropertySet(const StylePropertySet&); |
| 224 MutableStylePropertySet(const CSSProperty* properties, unsigned count); | 241 MutableStylePropertySet(const CSSProperty* properties, unsigned count); |
| 225 | 242 |
| 243 bool removePropertyAtIndex(int, String* returnText); |
| 244 |
| 226 bool removeShorthandProperty(CSSPropertyID); | 245 bool removeShorthandProperty(CSSPropertyID); |
| 246 bool removeShorthandProperty(const AtomicString& customPropertyName) { retur
n false; } |
| 227 CSSProperty* findCSSPropertyWithID(CSSPropertyID); | 247 CSSProperty* findCSSPropertyWithID(CSSPropertyID); |
| 228 OwnPtrWillBeMember<PropertySetCSSStyleDeclaration> m_cssomWrapper; | 248 OwnPtrWillBeMember<PropertySetCSSStyleDeclaration> m_cssomWrapper; |
| 229 | 249 |
| 230 friend class StylePropertySet; | 250 friend class StylePropertySet; |
| 231 | 251 |
| 232 WillBeHeapVector<CSSProperty, 4> m_propertyVector; | 252 WillBeHeapVector<CSSProperty, 4> m_propertyVector; |
| 233 }; | 253 }; |
| 234 | 254 |
| 235 DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable
(), set.isMutable()); | 255 DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable
(), set.isMutable()); |
| 236 | 256 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (!derefBase()) | 301 if (!derefBase()) |
| 282 return; | 302 return; |
| 283 | 303 |
| 284 if (m_isMutable) | 304 if (m_isMutable) |
| 285 delete toMutableStylePropertySet(this); | 305 delete toMutableStylePropertySet(this); |
| 286 else | 306 else |
| 287 delete toImmutableStylePropertySet(this); | 307 delete toImmutableStylePropertySet(this); |
| 288 } | 308 } |
| 289 #endif // !ENABLE(OILPAN) | 309 #endif // !ENABLE(OILPAN) |
| 290 | 310 |
| 291 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const | 311 template<typename T> |
| 312 inline int StylePropertySet::findPropertyIndex(T property) const |
| 292 { | 313 { |
| 293 if (m_isMutable) | 314 if (m_isMutable) |
| 294 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID); | 315 return toMutableStylePropertySet(this)->findPropertyIndex(property); |
| 295 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID); | 316 return toImmutableStylePropertySet(this)->findPropertyIndex(property); |
| 296 } | 317 } |
| 297 | 318 |
| 298 } // namespace blink | 319 } // namespace blink |
| 299 | 320 |
| 300 #endif // StylePropertySet_h | 321 #endif // StylePropertySet_h |
| OLD | NEW |