| 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 17 matching lines...) Expand all Loading... |
| 28 #include "core/css/PropertySetCSSStyleDeclaration.h" | 28 #include "core/css/PropertySetCSSStyleDeclaration.h" |
| 29 #include "core/css/parser/CSSParserMode.h" | 29 #include "core/css/parser/CSSParserMode.h" |
| 30 #include "wtf/ListHashSet.h" | 30 #include "wtf/ListHashSet.h" |
| 31 #include "wtf/Noncopyable.h" | 31 #include "wtf/Noncopyable.h" |
| 32 #include "wtf/Vector.h" | 32 #include "wtf/Vector.h" |
| 33 #include "wtf/text/WTFString.h" | 33 #include "wtf/text/WTFString.h" |
| 34 #include <algorithm> | 34 #include <algorithm> |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class CSSDeserializeStream; |
| 38 class CSSStyleDeclaration; | 39 class CSSStyleDeclaration; |
| 40 class CSSSerializeStream; |
| 39 class ImmutableStylePropertySet; | 41 class ImmutableStylePropertySet; |
| 40 class MutableStylePropertySet; | 42 class MutableStylePropertySet; |
| 41 class StyleSheetContents; | 43 class StyleSheetContents; |
| 42 | 44 |
| 43 class CORE_EXPORT StylePropertySet : public RefCountedWillBeGarbageCollectedFina
lized<StylePropertySet> { | 45 class CORE_EXPORT StylePropertySet : public RefCountedWillBeGarbageCollectedFina
lized<StylePropertySet> { |
| 44 WTF_MAKE_NONCOPYABLE(StylePropertySet); | 46 WTF_MAKE_NONCOPYABLE(StylePropertySet); |
| 45 friend class PropertyReference; | 47 friend class PropertyReference; |
| 46 public: | 48 public: |
| 47 | 49 |
| 48 #if ENABLE(OILPAN) | 50 #if ENABLE(OILPAN) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co
nst; | 120 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co
nst; |
| 119 | 121 |
| 120 PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyPropertiesInSet(const Ve
ctor<CSSPropertyID>&) const; | 122 PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyPropertiesInSet(const Ve
ctor<CSSPropertyID>&) const; |
| 121 | 123 |
| 122 String asText() const; | 124 String asText() const; |
| 123 | 125 |
| 124 bool isMutable() const { return m_isMutable; } | 126 bool isMutable() const { return m_isMutable; } |
| 125 | 127 |
| 126 bool hasFailedOrCanceledSubresources() const; | 128 bool hasFailedOrCanceledSubresources() const; |
| 127 | 129 |
| 130 void serialize(CSSSerializeStream*) const; |
| 131 |
| 128 static unsigned averageSizeInBytes(); | 132 static unsigned averageSizeInBytes(); |
| 129 | 133 |
| 130 #ifndef NDEBUG | 134 #ifndef NDEBUG |
| 131 void showStyle(); | 135 void showStyle(); |
| 132 #endif | 136 #endif |
| 133 | 137 |
| 134 bool propertyMatches(CSSPropertyID, const CSSValue*) const; | 138 bool propertyMatches(CSSPropertyID, const CSSValue*) const; |
| 135 | 139 |
| 136 DECLARE_TRACE(); | 140 DECLARE_TRACE(); |
| 137 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } | 141 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 156 mutable unsigned m_isMutable : 1; | 160 mutable unsigned m_isMutable : 1; |
| 157 unsigned m_arraySize : 28; | 161 unsigned m_arraySize : 28; |
| 158 | 162 |
| 159 friend class PropertySetCSSStyleDeclaration; | 163 friend class PropertySetCSSStyleDeclaration; |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { | 166 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { |
| 163 public: | 167 public: |
| 164 ~ImmutableStylePropertySet(); | 168 ~ImmutableStylePropertySet(); |
| 165 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro
perty* properties, unsigned count, CSSParserMode); | 169 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro
perty* properties, unsigned count, CSSParserMode); |
| 170 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> deserialize(CSSDese
rializeStream*); |
| 166 | 171 |
| 167 unsigned propertyCount() const { return m_arraySize; } | 172 unsigned propertyCount() const { return m_arraySize; } |
| 168 | 173 |
| 169 const RawPtrWillBeMember<CSSValue>* valueArray() const; | 174 const RawPtrWillBeMember<CSSValue>* valueArray() const; |
| 170 const StylePropertyMetadata* metadataArray() const; | 175 const StylePropertyMetadata* metadataArray() const; |
| 171 | 176 |
| 172 template<typename T> // CSSPropertyID or AtomicString | 177 template<typename T> // CSSPropertyID or AtomicString |
| 173 int findPropertyIndex(T property) const; | 178 int findPropertyIndex(T property) const; |
| 174 | 179 |
| 180 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 181 |
| 175 DECLARE_TRACE_AFTER_DISPATCH(); | 182 DECLARE_TRACE_AFTER_DISPATCH(); |
| 176 | 183 |
| 177 void* operator new(std::size_t, void* location) | 184 void* operator new(std::size_t, void* location) |
| 178 { | 185 { |
| 179 return location; | 186 return location; |
| 180 } | 187 } |
| 181 | 188 |
| 182 void* m_storage; | 189 void* m_storage; |
| 183 | 190 |
| 184 private: | 191 private: |
| 185 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode)
; | 192 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode)
; |
| 193 ImmutableStylePropertySet(CSSDeserializeStream*, unsigned count, CSSParserMo
de); |
| 186 }; | 194 }; |
| 187 | 195 |
| 188 inline const RawPtrWillBeMember<CSSValue>* ImmutableStylePropertySet::valueArray
() const | 196 inline const RawPtrWillBeMember<CSSValue>* ImmutableStylePropertySet::valueArray
() const |
| 189 { | 197 { |
| 190 return reinterpret_cast<const RawPtrWillBeMember<CSSValue>*>(const_cast<cons
t void**>(&(this->m_storage))); | 198 return reinterpret_cast<const RawPtrWillBeMember<CSSValue>*>(const_cast<cons
t void**>(&(this->m_storage))); |
| 191 } | 199 } |
| 192 | 200 |
| 193 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c
onst | 201 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c
onst |
| 194 { | 202 { |
| 195 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons
t char*>(&(this->m_storage))[m_arraySize * sizeof(RawPtrWillBeMember<CSSValue>)]
); | 203 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons
t char*>(&(this->m_storage))[m_arraySize * sizeof(RawPtrWillBeMember<CSSValue>)]
); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 inline int StylePropertySet::findPropertyIndex(T property) const | 321 inline int StylePropertySet::findPropertyIndex(T property) const |
| 314 { | 322 { |
| 315 if (m_isMutable) | 323 if (m_isMutable) |
| 316 return toMutableStylePropertySet(this)->findPropertyIndex(property); | 324 return toMutableStylePropertySet(this)->findPropertyIndex(property); |
| 317 return toImmutableStylePropertySet(this)->findPropertyIndex(property); | 325 return toImmutableStylePropertySet(this)->findPropertyIndex(property); |
| 318 } | 326 } |
| 319 | 327 |
| 320 } // namespace blink | 328 } // namespace blink |
| 321 | 329 |
| 322 #endif // StylePropertySet_h | 330 #endif // StylePropertySet_h |
| OLD | NEW |