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

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

Issue 15864004: Move create() methods from StylePropertySet to MutableStylePropertySet. (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/FontLoader.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> create(CSSParserMode = CSSQuirksMode);
54 static PassRefPtr<StylePropertySet> create(const CSSProperty* properties, un signed count);
55 static PassRefPtr<StylePropertySet> createImmutable(const CSSProperty* prope rties, unsigned count, CSSParserMode); 53 static PassRefPtr<StylePropertySet> createImmutable(const CSSProperty* prope rties, unsigned count, CSSParserMode);
56 54
57 class PropertyReference { 55 class PropertyReference {
58 public: 56 public:
59 PropertyReference(const StylePropertySet& propertySet, unsigned index) 57 PropertyReference(const StylePropertySet& propertySet, unsigned index)
60 : m_propertySet(propertySet) 58 : m_propertySet(propertySet)
61 , m_index(index) 59 , m_index(index)
62 { 60 {
63 } 61 }
64 62
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 216 }
219 217
220 inline const StylePropertyMetadata* StylePropertySet::immutableMetadataArray() c onst 218 inline const StylePropertyMetadata* StylePropertySet::immutableMetadataArray() c onst
221 { 219 {
222 ASSERT(!m_isMutable); 220 ASSERT(!m_isMutable);
223 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons t char*>((&static_cast<const ImmutableStylePropertySet*>(this)->m_storage))[m_ar raySize * sizeof(CSSValue*)]); 221 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<cons t char*>((&static_cast<const ImmutableStylePropertySet*>(this)->m_storage))[m_ar raySize * sizeof(CSSValue*)]);
224 } 222 }
225 223
226 class MutableStylePropertySet : public StylePropertySet { 224 class MutableStylePropertySet : public StylePropertySet {
227 public: 225 public:
226 static PassRefPtr<MutableStylePropertySet> create(CSSParserMode = CSSQuirksM ode);
227 static PassRefPtr<MutableStylePropertySet> create(const CSSProperty* propert ies, unsigned count);
228
229 MutableStylePropertySet(const StylePropertySet&);
230
231 Vector<CSSProperty, 4> m_propertyVector;
232
233 private:
228 MutableStylePropertySet(CSSParserMode cssParserMode) 234 MutableStylePropertySet(CSSParserMode cssParserMode)
229 : StylePropertySet(cssParserMode) 235 : StylePropertySet(cssParserMode)
230 { } 236 { }
231 MutableStylePropertySet(const CSSProperty* properties, unsigned count); 237 MutableStylePropertySet(const CSSProperty* properties, unsigned count);
232 MutableStylePropertySet(const StylePropertySet&);
233
234 Vector<CSSProperty, 4> m_propertyVector;
235 }; 238 };
236 239
237 inline Vector<CSSProperty, 4>& StylePropertySet::mutablePropertyVector() 240 inline Vector<CSSProperty, 4>& StylePropertySet::mutablePropertyVector()
238 { 241 {
239 ASSERT(m_isMutable); 242 ASSERT(m_isMutable);
240 return static_cast<MutableStylePropertySet*>(this)->m_propertyVector; 243 return static_cast<MutableStylePropertySet*>(this)->m_propertyVector;
241 } 244 }
242 245
243 inline const Vector<CSSProperty, 4>& StylePropertySet::mutablePropertyVector() c onst 246 inline const Vector<CSSProperty, 4>& StylePropertySet::mutablePropertyVector() c onst
244 { 247 {
(...skipping 20 matching lines...) Expand all
265 268
266 if (m_isMutable) 269 if (m_isMutable)
267 delete static_cast<MutableStylePropertySet*>(this); 270 delete static_cast<MutableStylePropertySet*>(this);
268 else 271 else
269 delete static_cast<ImmutableStylePropertySet*>(this); 272 delete static_cast<ImmutableStylePropertySet*>(this);
270 } 273 }
271 274
272 } // namespace WebCore 275 } // namespace WebCore
273 276
274 #endif // StylePropertySet_h 277 #endif // StylePropertySet_h
OLDNEW
« no previous file with comments | « Source/core/css/FontLoader.cpp ('k') | Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698