Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: third_party/WebKit/Source/core/css/StylePropertySet.h

Issue 2032613007: Change ImmutableStylePropertySet to store const CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@+make_elementstyleresources_store_const
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 friend class PropertySetCSSStyleDeclaration; 150 friend class PropertySetCSSStyleDeclaration;
151 }; 151 };
152 152
153 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { 153 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet {
154 public: 154 public:
155 ~ImmutableStylePropertySet(); 155 ~ImmutableStylePropertySet();
156 static ImmutableStylePropertySet* create(const CSSProperty* properties, unsi gned count, CSSParserMode); 156 static ImmutableStylePropertySet* create(const CSSProperty* properties, unsi gned count, CSSParserMode);
157 157
158 unsigned propertyCount() const { return m_arraySize; } 158 unsigned propertyCount() const { return m_arraySize; }
159 159
160 const Member<CSSValue>* valueArray() const; 160 const Member<const CSSValue>* valueArray() const;
161 const StylePropertyMetadata* metadataArray() const; 161 const StylePropertyMetadata* metadataArray() const;
162 162
163 template<typename T> // CSSPropertyID or AtomicString 163 template<typename T> // CSSPropertyID or AtomicString
164 int findPropertyIndex(T property) const; 164 int findPropertyIndex(T property) const;
165 165
166 DECLARE_TRACE_AFTER_DISPATCH(); 166 DECLARE_TRACE_AFTER_DISPATCH();
167 167
168 void* operator new(std::size_t, void* location) 168 void* operator new(std::size_t, void* location)
169 { 169 {
170 return location; 170 return location;
171 } 171 }
172 172
173 void* m_storage; 173 void* m_storage;
174 174
175 private: 175 private:
176 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode) ; 176 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode) ;
177 }; 177 };
178 178
179 inline const Member<CSSValue>* ImmutableStylePropertySet::valueArray() const 179 inline const Member<const CSSValue>* ImmutableStylePropertySet::valueArray() con st
180 { 180 {
181 return reinterpret_cast<const Member<CSSValue>*>(const_cast<const void**>(&( this->m_storage))); 181 return reinterpret_cast<const Member<const CSSValue>*>(const_cast<const void **>(&(this->m_storage)));
182 } 182 }
183 183
184 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c onst 184 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c onst
185 { 185 {
186 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons t char*>(&(this->m_storage))[m_arraySize * sizeof(Member<CSSValue>)]); 186 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons t char*>(&(this->m_storage))[m_arraySize * sizeof(Member<CSSValue>)]);
187 } 187 }
188 188
189 DEFINE_TYPE_CASTS(ImmutableStylePropertySet, StylePropertySet, set, !set->isMuta ble(), !set.isMutable()); 189 DEFINE_TYPE_CASTS(ImmutableStylePropertySet, StylePropertySet, set, !set->isMuta ble(), !set.isMutable());
190 190
191 class CORE_EXPORT MutableStylePropertySet : public StylePropertySet { 191 class CORE_EXPORT MutableStylePropertySet : public StylePropertySet {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 inline int StylePropertySet::findPropertyIndex(T property) const 286 inline int StylePropertySet::findPropertyIndex(T property) const
287 { 287 {
288 if (m_isMutable) 288 if (m_isMutable)
289 return toMutableStylePropertySet(this)->findPropertyIndex(property); 289 return toMutableStylePropertySet(this)->findPropertyIndex(property);
290 return toImmutableStylePropertySet(this)->findPropertyIndex(property); 290 return toImmutableStylePropertySet(this)->findPropertyIndex(property);
291 } 291 }
292 292
293 } // namespace blink 293 } // namespace blink
294 294
295 #endif // StylePropertySet_h 295 #endif // StylePropertySet_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698