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

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

Issue 16021003: Move StylePropertySet::createImmutable() to ImmutableStylePropertySet. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSParser.cpp ('k') | 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ~StylePropertySet(); 47 ~StylePropertySet();
48 48
49 // Override RefCounted's deref() to ensure operator delete is called on 49 // Override RefCounted's deref() to ensure operator delete is called on
50 // the appropriate subclass type. 50 // the appropriate subclass type.
51 void deref(); 51 void deref();
52 52
53 static PassRefPtr<StylePropertySet> createImmutable(const CSSProperty* prope rties, unsigned count, CSSParserMode);
54
55 class PropertyReference { 53 class PropertyReference {
56 public: 54 public:
57 PropertyReference(const StylePropertySet& propertySet, unsigned index) 55 PropertyReference(const StylePropertySet& propertySet, unsigned index)
58 : m_propertySet(propertySet) 56 : m_propertySet(propertySet)
59 , m_index(index) 57 , m_index(index)
60 { 58 {
61 } 59 }
62 60
63 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet adata().m_propertyID); } 61 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMet adata().m_propertyID); }
64 CSSPropertyID shorthandID() const { return static_cast<CSSPropertyID>(pr opertyMetadata().m_shorthandID); } 62 CSSPropertyID shorthandID() const { return static_cast<CSSPropertyID>(pr opertyMetadata().m_shorthandID); }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 void removeBlockProperties(); 125 void removeBlockProperties();
128 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); 126 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
129 127
130 void mergeAndOverrideOnConflict(const StylePropertySet*); 128 void mergeAndOverrideOnConflict(const StylePropertySet*);
131 129
132 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs sParserMode); } 130 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs sParserMode); }
133 131
134 void addSubresourceStyleURLs(ListHashSet<KURL>&, StyleSheetContents* context StyleSheet) const; 132 void addSubresourceStyleURLs(ListHashSet<KURL>&, StyleSheetContents* context StyleSheet) const;
135 133
136 PassRefPtr<MutableStylePropertySet> mutableCopy() const; 134 PassRefPtr<MutableStylePropertySet> mutableCopy() const;
137 PassRefPtr<StylePropertySet> immutableCopyIfNeeded() const; 135 PassRefPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() const;
138 136
139 void removeEquivalentProperties(const StylePropertySet*); 137 void removeEquivalentProperties(const StylePropertySet*);
140 void removeEquivalentProperties(const CSSStyleDeclaration*); 138 void removeEquivalentProperties(const CSSStyleDeclaration*);
141 139
142 PassRefPtr<MutableStylePropertySet> copyPropertiesInSet(const Vector<CSSProp ertyID>&) const; 140 PassRefPtr<MutableStylePropertySet> copyPropertiesInSet(const Vector<CSSProp ertyID>&) const;
143 141
144 String asText() const; 142 String asText() const;
145 143
146 PropertySetCSSStyleDeclaration* cssStyleDeclaration(); 144 PropertySetCSSStyleDeclaration* cssStyleDeclaration();
147 145
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 189
192 friend class PropertySetCSSStyleDeclaration; 190 friend class PropertySetCSSStyleDeclaration;
193 }; 191 };
194 192
195 class ImmutableStylePropertySet : public StylePropertySet { 193 class ImmutableStylePropertySet : public StylePropertySet {
196 // This is needed because we malloc() space for an 194 // This is needed because we malloc() space for an
197 // ImmutableStylePropertySet plus following properties, as a performance 195 // ImmutableStylePropertySet plus following properties, as a performance
198 // tweak. 196 // tweak.
199 NEW_DELETE_SAME_AS_MALLOC_FREE; 197 NEW_DELETE_SAME_AS_MALLOC_FREE;
200 public: 198 public:
201 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode) ;
202 ~ImmutableStylePropertySet(); 199 ~ImmutableStylePropertySet();
200 static PassRefPtr<ImmutableStylePropertySet> create(const CSSProperty* prope rties, unsigned count, CSSParserMode);
203 201
204 void* m_storage; 202 void* m_storage;
203
204 private:
205 ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode) ;
205 }; 206 };
206 207
207 inline const CSSValue** StylePropertySet::immutableValueArray() const 208 inline const CSSValue** StylePropertySet::immutableValueArray() const
208 { 209 {
209 ASSERT(!m_isMutable); 210 ASSERT(!m_isMutable);
210 return reinterpret_cast<const CSSValue**>(const_cast<const void**>((&static_ cast<const ImmutableStylePropertySet*>(this)->m_storage))); 211 return reinterpret_cast<const CSSValue**>(const_cast<const void**>((&static_ cast<const ImmutableStylePropertySet*>(this)->m_storage)));
211 } 212 }
212 213
213 inline const StylePropertyMetadata* StylePropertySet::immutableMetadataArray() c onst 214 inline const StylePropertyMetadata* StylePropertySet::immutableMetadataArray() c onst
214 { 215 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 if (m_isMutable) 271 if (m_isMutable)
271 delete static_cast<MutableStylePropertySet*>(this); 272 delete static_cast<MutableStylePropertySet*>(this);
272 else 273 else
273 delete static_cast<ImmutableStylePropertySet*>(this); 274 delete static_cast<ImmutableStylePropertySet*>(this);
274 } 275 }
275 276
276 } // namespace WebCore 277 } // namespace WebCore
277 278
278 #endif // StylePropertySet_h 279 #endif // StylePropertySet_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser.cpp ('k') | Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698