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

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

Issue 1249553002: CSSValue Immediates: Add move operators to CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_3_tagged_ptrs_with_copy_ops_mv_operators_ref_primvalue
Patch Set: Rebase Created 5 years, 4 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 | « Source/core/css/StylePropertySerializer.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const StylePropertySet& m_propertySet; 83 const StylePropertySet& m_propertySet;
84 unsigned m_index; 84 unsigned m_index;
85 }; 85 };
86 86
87 unsigned propertyCount() const; 87 unsigned propertyCount() const;
88 bool isEmpty() const; 88 bool isEmpty() const;
89 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc e(*this, index); } 89 PropertyReference propertyAt(unsigned index) const { return PropertyReferenc e(*this, index); }
90 int findPropertyIndex(CSSPropertyID) const; 90 int findPropertyIndex(CSSPropertyID) const;
91 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr operty) != -1; } 91 bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(pr operty) != -1; }
92 92
93 NullableCSSValue getPropertyCSSValue(CSSPropertyID) const; 93 const NullableCSSValue getPropertyCSSValue(CSSPropertyID) const;
94 String getPropertyValue(CSSPropertyID) const; 94 String getPropertyValue(CSSPropertyID) const;
95 95
96 bool propertyIsImportant(CSSPropertyID) const; 96 bool propertyIsImportant(CSSPropertyID) const;
97 CSSPropertyID getPropertyShorthand(CSSPropertyID) const; 97 CSSPropertyID getPropertyShorthand(CSSPropertyID) const;
98 bool isPropertyImplicit(CSSPropertyID) const; 98 bool isPropertyImplicit(CSSPropertyID) const;
99 99
100 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs sParserMode); } 100 CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cs sParserMode); }
101 101
102 PassRefPtrWillBeRawPtr<MutableStylePropertySet> mutableCopy() const; 102 PassRefPtrWillBeRawPtr<MutableStylePropertySet> mutableCopy() const;
103 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co nst; 103 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() co nst;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 : m_cssParserMode(cssParserMode) 135 : m_cssParserMode(cssParserMode)
136 , m_isMutable(false) 136 , m_isMutable(false)
137 , m_arraySize(std::min(immutableArraySize, unsigned(MaxArraySize))) 137 , m_arraySize(std::min(immutableArraySize, unsigned(MaxArraySize)))
138 { } 138 { }
139 139
140 unsigned m_cssParserMode : 3; 140 unsigned m_cssParserMode : 3;
141 mutable unsigned m_isMutable : 1; 141 mutable unsigned m_isMutable : 1;
142 unsigned m_arraySize : 28; 142 unsigned m_arraySize : 28;
143 143
144 friend class PropertySetCSSStyleDeclaration; 144 friend class PropertySetCSSStyleDeclaration;
145
145 }; 146 };
146 147
147 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet { 148 class CORE_EXPORT ImmutableStylePropertySet : public StylePropertySet {
148 public: 149 public:
149 ~ImmutableStylePropertySet(); 150 ~ImmutableStylePropertySet();
150 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro perty* properties, unsigned count, CSSParserMode); 151 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> create(const CSSPro perty* properties, unsigned count, CSSParserMode);
151 152
152 unsigned propertyCount() const { return m_arraySize; } 153 unsigned propertyCount() const { return m_arraySize; }
153 154
154 const CSSValue* valueArray() const; 155 const CSSValue* valueArray() const;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 189
189 unsigned propertyCount() const { return m_propertyVector.size(); } 190 unsigned propertyCount() const { return m_propertyVector.size(); }
190 191
191 // Returns whether this style set was changed. 192 // Returns whether this style set was changed.
192 bool addParsedProperties(const WillBeHeapVector<CSSProperty, 256>&); 193 bool addParsedProperties(const WillBeHeapVector<CSSProperty, 256>&);
193 bool addRespectingCascade(const CSSProperty&); 194 bool addRespectingCascade(const CSSProperty&);
194 195
195 // These expand shorthand properties into multiple properties. 196 // These expand shorthand properties into multiple properties.
196 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool important = false, StyleSheetContents* contextStyleSheet = 0); 197 bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
197 void setProperty(CSSPropertyID, const CSSValue&, bool important = false); 198 void setProperty(CSSPropertyID, const CSSValue&, bool important = false);
199 void setProperty(CSSPropertyID, const CSSPrimitiveValue&, bool important = f alse);
198 200
199 // These do not. FIXME: This is too messy, we can do better. 201 // These do not. FIXME: This is too messy, we can do better.
200 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals e); 202 bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = fals e);
201 bool setProperty(const CSSProperty&, CSSProperty* slot = 0); 203 bool setProperty(const CSSProperty&, CSSProperty* slot = 0);
202 204
203 bool removeProperty(CSSPropertyID, String* returnText = 0); 205 bool removeProperty(CSSPropertyID, String* returnText = 0);
204 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); 206 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
205 void removeEquivalentProperties(const StylePropertySet*); 207 void removeEquivalentProperties(const StylePropertySet*);
206 void removeEquivalentProperties(const CSSStyleDeclaration*); 208 void removeEquivalentProperties(const CSSStyleDeclaration*);
207 209
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const 290 inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const
289 { 291 {
290 if (m_isMutable) 292 if (m_isMutable)
291 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID); 293 return toMutableStylePropertySet(this)->findPropertyIndex(propertyID);
292 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID); 294 return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID);
293 } 295 }
294 296
295 } // namespace blink 297 } // namespace blink
296 298
297 #endif // StylePropertySet_h 299 #endif // StylePropertySet_h
OLDNEW
« no previous file with comments | « Source/core/css/StylePropertySerializer.cpp ('k') | Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698