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, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/css/StylePropertySet.h" | 24 #include "core/css/StylePropertySet.h" |
25 | 25 |
26 #include "core/StylePropertyShorthand.h" | 26 #include "core/StylePropertyShorthand.h" |
| 27 #include "core/css/CSSCustomPropertyDeclaration.h" |
27 #include "core/css/CSSPropertyMetadata.h" | 28 #include "core/css/CSSPropertyMetadata.h" |
28 #include "core/css/CSSValuePool.h" | 29 #include "core/css/CSSValuePool.h" |
29 #include "core/css/StylePropertySerializer.h" | 30 #include "core/css/StylePropertySerializer.h" |
30 #include "core/css/StyleSheetContents.h" | 31 #include "core/css/StyleSheetContents.h" |
31 #include "core/css/parser/CSSParser.h" | 32 #include "core/css/parser/CSSParser.h" |
32 #include "core/frame/UseCounter.h" | 33 #include "core/frame/UseCounter.h" |
33 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
34 #include "wtf/text/StringBuilder.h" | 35 #include "wtf/text/StringBuilder.h" |
35 | 36 |
36 #ifndef NDEBUG | 37 #ifndef NDEBUG |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #if !ENABLE(OILPAN) | 97 #if !ENABLE(OILPAN) |
97 RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSS
Value>*>(this->valueArray()); | 98 RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSS
Value>*>(this->valueArray()); |
98 for (unsigned i = 0; i < m_arraySize; ++i) { | 99 for (unsigned i = 0; i < m_arraySize; ++i) { |
99 // Checking for nullptr here is a workaround to prevent crashing. http:
//crbug.com/449032 | 100 // Checking for nullptr here is a workaround to prevent crashing. http:
//crbug.com/449032 |
100 if (valueArray[i]) | 101 if (valueArray[i]) |
101 valueArray[i]->deref(); | 102 valueArray[i]->deref(); |
102 } | 103 } |
103 #endif | 104 #endif |
104 } | 105 } |
105 | 106 |
106 int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const | 107 // Convert property into an uint16_t for comparison with metadata's m_propertyID
to avoid |
| 108 // the compiler converting it to an int multiple times in a loop. |
| 109 static uint16_t getConvertedCSSPropertyID(CSSPropertyID propertyID) |
107 { | 110 { |
108 // Convert here propertyID into an uint16_t to compare it with the metadata'
s m_propertyID to avoid | 111 return static_cast<uint16_t>(propertyID); |
109 // the compiler converting it to an int multiple times in the loop. | |
110 uint16_t id = static_cast<uint16_t>(propertyID); | |
111 for (int n = m_arraySize - 1 ; n >= 0; --n) { | |
112 if (metadataArray()[n].m_propertyID == id) { | |
113 // Only enabled properties should be part of the style. | |
114 ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID)); | |
115 return n; | |
116 } | |
117 } | |
118 | |
119 return -1; | |
120 } | 112 } |
121 | 113 |
122 int ImmutableStylePropertySet::findCustomPropertyIndex(const AtomicString& prope
rtyName) const | 114 static uint16_t getConvertedCSSPropertyID(const AtomicString&) |
123 { | 115 { |
124 // Convert here propertyID into an uint16_t to compare it with the metadata'
s m_propertyID to avoid | 116 return static_cast<uint16_t>(CSSPropertyVariable); |
125 // the compiler converting it to an int multiple times in the loop. | 117 } |
126 const uint16_t variableId = static_cast<uint16_t>(CSSPropertyVariable); | |
127 | 118 |
| 119 static bool isPropertyMatch(const StylePropertyMetadata& metadata, const CSSValu
e&, uint16_t id, CSSPropertyID propertyID) |
| 120 { |
| 121 ASSERT(id == propertyID); |
| 122 bool result = metadata.m_propertyID == id; |
| 123 // Only enabled properties should be part of the style. |
| 124 ASSERT(!result || CSSPropertyMetadata::isEnabledProperty(propertyID)); |
| 125 return result; |
| 126 } |
| 127 |
| 128 static bool isPropertyMatch(const StylePropertyMetadata& metadata, const CSSValu
e& value, uint16_t id, const AtomicString& customPropertyName) |
| 129 { |
| 130 ASSERT(id == CSSPropertyVariable); |
| 131 return metadata.m_propertyID == id |
| 132 && toCSSCustomPropertyDeclaration(value).name() == customPropertyName; |
| 133 } |
| 134 |
| 135 template<typename T> |
| 136 int ImmutableStylePropertySet::findPropertyIndex(T property) const |
| 137 { |
| 138 uint16_t id = getConvertedCSSPropertyID(property); |
128 for (int n = m_arraySize - 1 ; n >= 0; --n) { | 139 for (int n = m_arraySize - 1 ; n >= 0; --n) { |
129 if (metadataArray()[n].m_propertyID == variableId | 140 if (isPropertyMatch(metadataArray()[n], *valueArray()[n], id, property)) |
130 && toCSSCustomPropertyDeclaration(valueArray()[n])->name() == proper
tyName) | |
131 return n; | 141 return n; |
132 } | 142 } |
133 | 143 |
134 return -1; | 144 return -1; |
135 } | 145 } |
136 | 146 |
137 DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet) | 147 DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet) |
138 { | 148 { |
139 const RawPtrWillBeMember<CSSValue>* values = valueArray(); | 149 const RawPtrWillBeMember<CSSValue>* values = valueArray(); |
140 for (unsigned i = 0; i < m_arraySize; i++) | 150 for (unsigned i = 0; i < m_arraySize; i++) |
141 visitor->trace(values[i]); | 151 visitor->trace(values[i]); |
142 StylePropertySet::traceAfterDispatch(visitor); | 152 StylePropertySet::traceAfterDispatch(visitor); |
143 } | 153 } |
144 | 154 |
145 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) | 155 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) |
146 : StylePropertySet(other.cssParserMode()) | 156 : StylePropertySet(other.cssParserMode()) |
147 { | 157 { |
148 if (other.isMutable()) { | 158 if (other.isMutable()) { |
149 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; | 159 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; |
150 } else { | 160 } else { |
151 m_propertyVector.reserveInitialCapacity(other.propertyCount()); | 161 m_propertyVector.reserveInitialCapacity(other.propertyCount()); |
152 for (unsigned i = 0; i < other.propertyCount(); ++i) | 162 for (unsigned i = 0; i < other.propertyCount(); ++i) |
153 m_propertyVector.uncheckedAppend(other.propertyAt(i).toCSSProperty()
); | 163 m_propertyVector.uncheckedAppend(other.propertyAt(i).toCSSProperty()
); |
154 } | 164 } |
155 } | 165 } |
156 | 166 |
157 String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const | 167 static String serializeShorthand(const StylePropertySet& propertySet, CSSPropert
yID propertyID) |
158 { | 168 { |
159 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID); | 169 return StylePropertySerializer(propertySet).getPropertyValue(propertyID); |
| 170 } |
| 171 |
| 172 static String serializeShorthand(const StylePropertySet&, const AtomicString& cu
stomPropertyName) |
| 173 { |
| 174 // Custom properties are never shorthands. |
| 175 return ""; |
| 176 } |
| 177 |
| 178 template<typename T> |
| 179 String StylePropertySet::getPropertyValue(T property) const |
| 180 { |
| 181 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(property); |
160 if (value) | 182 if (value) |
161 return value->cssText(); | 183 return value->cssText(); |
| 184 return serializeShorthand(*this, property); |
| 185 } |
| 186 template String StylePropertySet::getPropertyValue<CSSPropertyID>(CSSPropertyID)
const; |
| 187 template String StylePropertySet::getPropertyValue<AtomicString>(AtomicString) c
onst; |
162 | 188 |
163 return StylePropertySerializer(*this).getPropertyValue(propertyID); | 189 template<typename T> |
164 } | 190 PassRefPtrWillBeRawPtr<CSSValue> StylePropertySet::getPropertyCSSValue(T propert
y) const |
165 | |
166 String StylePropertySet::getCustomPropertyValue(const AtomicString& propertyName
) const | |
167 { | 191 { |
168 RefPtrWillBeRawPtr<CSSValue> value = getCustomPropertyCSSValue(propertyName)
; | 192 int foundPropertyIndex = findPropertyIndex(property); |
169 return value ? value->cssText() : ""; | |
170 } | |
171 | |
172 PassRefPtrWillBeRawPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSProper
tyID propertyID) const | |
173 { | |
174 int foundPropertyIndex = findPropertyIndex(propertyID); | |
175 if (foundPropertyIndex == -1) | 193 if (foundPropertyIndex == -1) |
176 return nullptr; | 194 return nullptr; |
177 return propertyAt(foundPropertyIndex).value(); | 195 return propertyAt(foundPropertyIndex).value(); |
178 } | 196 } |
179 | 197 |
180 PassRefPtrWillBeRawPtr<CSSCustomPropertyDeclaration> StylePropertySet::getCustom
PropertyCSSValue(const AtomicString& propertyName) const | |
181 { | |
182 int foundPropertyIndex = findCustomPropertyIndex(propertyName); | |
183 if (foundPropertyIndex == -1) | |
184 return nullptr; | |
185 return toCSSCustomPropertyDeclaration(propertyAt(foundPropertyIndex).value()
); | |
186 } | |
187 | |
188 DEFINE_TRACE(StylePropertySet) | 198 DEFINE_TRACE(StylePropertySet) |
189 { | 199 { |
190 if (m_isMutable) | 200 if (m_isMutable) |
191 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); | 201 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); |
192 else | 202 else |
193 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); | 203 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); |
194 } | 204 } |
195 | 205 |
196 #if ENABLE(OILPAN) | 206 #if ENABLE(OILPAN) |
197 void StylePropertySet::finalizeGarbageCollectedObject() | 207 void StylePropertySet::finalizeGarbageCollectedObject() |
(...skipping 25 matching lines...) Expand all Loading... |
223 if (returnText) | 233 if (returnText) |
224 *returnText = propertyAt(propertyIndex).value()->cssText(); | 234 *returnText = propertyAt(propertyIndex).value()->cssText(); |
225 | 235 |
226 // A more efficient removal strategy would involve marking entries as empty | 236 // A more efficient removal strategy would involve marking entries as empty |
227 // and sweeping them when the vector grows too big. | 237 // and sweeping them when the vector grows too big. |
228 m_propertyVector.remove(propertyIndex); | 238 m_propertyVector.remove(propertyIndex); |
229 | 239 |
230 return true; | 240 return true; |
231 } | 241 } |
232 | 242 |
233 bool MutableStylePropertySet::removeProperty(CSSPropertyID propertyID, String* r
eturnText) | 243 template<typename T> |
| 244 bool MutableStylePropertySet::removeProperty(T property, String* returnText) |
234 { | 245 { |
235 if (removeShorthandProperty(propertyID)) { | 246 if (removeShorthandProperty(property)) { |
236 // FIXME: Return an equivalent shorthand when possible. | 247 // FIXME: Return an equivalent shorthand when possible. |
237 if (returnText) | 248 if (returnText) |
238 *returnText = ""; | 249 *returnText = ""; |
239 return true; | 250 return true; |
240 } | 251 } |
241 | 252 |
242 int foundPropertyIndex = findPropertyIndex(propertyID); | 253 int foundPropertyIndex = findPropertyIndex(property); |
243 return removePropertyAtIndex(foundPropertyIndex, returnText); | 254 return removePropertyAtIndex(foundPropertyIndex, returnText); |
244 } | 255 } |
245 | 256 |
246 bool MutableStylePropertySet::removeCustomProperty(const AtomicString& propertyN
ame, String* returnText) | 257 template<typename T> |
| 258 bool StylePropertySet::propertyIsImportant(T property) const |
247 { | 259 { |
248 int foundPropertyIndex = findCustomPropertyIndex(propertyName); | 260 int foundPropertyIndex = findPropertyIndex(property); |
249 return removePropertyAtIndex(foundPropertyIndex, returnText); | |
250 } | |
251 | |
252 bool StylePropertySet::propertyIsImportant(CSSPropertyID propertyID) const | |
253 { | |
254 int foundPropertyIndex = findPropertyIndex(propertyID); | |
255 if (foundPropertyIndex != -1) | 261 if (foundPropertyIndex != -1) |
256 return propertyAt(foundPropertyIndex).isImportant(); | 262 return propertyAt(foundPropertyIndex).isImportant(); |
| 263 return shorthandIsImportant(property); |
| 264 } |
| 265 template bool StylePropertySet::propertyIsImportant<CSSPropertyID>(CSSPropertyID
) const; |
| 266 template bool StylePropertySet::propertyIsImportant<AtomicString>(AtomicString)
const; |
257 | 267 |
| 268 bool StylePropertySet::shorthandIsImportant(CSSPropertyID propertyID) const |
| 269 { |
258 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 270 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
259 if (!shorthand.length()) | 271 if (!shorthand.length()) |
260 return false; | 272 return false; |
261 | 273 |
262 for (unsigned i = 0; i < shorthand.length(); ++i) { | 274 for (unsigned i = 0; i < shorthand.length(); ++i) { |
263 if (!propertyIsImportant(shorthand.properties()[i])) | 275 if (!propertyIsImportant(shorthand.properties()[i])) |
264 return false; | 276 return false; |
265 } | 277 } |
266 return true; | 278 return true; |
267 } | 279 } |
268 | 280 |
269 bool StylePropertySet::customPropertyIsImportant(const AtomicString& propertyNam
e) const | 281 bool StylePropertySet::shorthandIsImportant(const AtomicString& customPropertyNa
me) const |
270 { | 282 { |
271 int foundPropertyIndex = findCustomPropertyIndex(propertyName); | 283 // Custom properties are never shorthands. |
272 if (foundPropertyIndex != -1) | |
273 return propertyAt(foundPropertyIndex).isImportant(); | |
274 return false; | 284 return false; |
275 } | 285 } |
276 | 286 |
277 CSSPropertyID StylePropertySet::getPropertyShorthand(CSSPropertyID propertyID) c
onst | 287 CSSPropertyID StylePropertySet::getPropertyShorthand(CSSPropertyID propertyID) c
onst |
278 { | 288 { |
279 int foundPropertyIndex = findPropertyIndex(propertyID); | 289 int foundPropertyIndex = findPropertyIndex(propertyID); |
280 if (foundPropertyIndex == -1) | 290 if (foundPropertyIndex == -1) |
281 return CSSPropertyInvalid; | 291 return CSSPropertyInvalid; |
282 return propertyAt(foundPropertyIndex).shorthandID(); | 292 return propertyAt(foundPropertyIndex).shorthandID(); |
283 } | 293 } |
(...skipping 11 matching lines...) Expand all Loading... |
295 // Setting the value to an empty string just removes the property in both IE
and Gecko. | 305 // Setting the value to an empty string just removes the property in both IE
and Gecko. |
296 // Setting it to null seems to produce less consistent results, but we treat
it just the same. | 306 // Setting it to null seems to produce less consistent results, but we treat
it just the same. |
297 if (value.isEmpty()) | 307 if (value.isEmpty()) |
298 return removeProperty(resolveCSSPropertyID(unresolvedProperty)); | 308 return removeProperty(resolveCSSPropertyID(unresolvedProperty)); |
299 | 309 |
300 // When replacing an existing property value, this moves the property to the
end of the list. | 310 // When replacing an existing property value, this moves the property to the
end of the list. |
301 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. | 311 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. |
302 return CSSParser::parseValue(this, unresolvedProperty, value, important, con
textStyleSheet); | 312 return CSSParser::parseValue(this, unresolvedProperty, value, important, con
textStyleSheet); |
303 } | 313 } |
304 | 314 |
305 bool MutableStylePropertySet::setCustomProperty(const AtomicString& propertyName
, const String& value, bool important, StyleSheetContents* contextStyleSheet) | 315 bool MutableStylePropertySet::setProperty(const AtomicString& customPropertyName
, const String& value, bool important, StyleSheetContents* contextStyleSheet) |
306 { | 316 { |
307 if (value.isEmpty()) | 317 if (value.isEmpty()) |
308 return removeCustomProperty(propertyName); | 318 return removeProperty(customPropertyName); |
309 return CSSParser::parseValueForCustomProperty(this, propertyName, value, imp
ortant, contextStyleSheet); | 319 return CSSParser::parseValueForCustomProperty(this, customPropertyName, valu
e, important, contextStyleSheet); |
310 } | 320 } |
311 | 321 |
312 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWi
llBeRawPtr<CSSValue> prpValue, bool important) | 322 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWi
llBeRawPtr<CSSValue> prpValue, bool important) |
313 { | 323 { |
314 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 324 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
315 if (!shorthand.length()) { | 325 if (!shorthand.length()) { |
316 setProperty(CSSProperty(propertyID, prpValue, important)); | 326 setProperty(CSSProperty(propertyID, prpValue, important)); |
317 return; | 327 return; |
318 } | 328 } |
319 | 329 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // style property set. | 523 // style property set. |
514 if (m_cssomWrapper) { | 524 if (m_cssomWrapper) { |
515 ASSERT(!static_cast<CSSStyleDeclaration*>(m_cssomWrapper.get())->parentR
ule()); | 525 ASSERT(!static_cast<CSSStyleDeclaration*>(m_cssomWrapper.get())->parentR
ule()); |
516 ASSERT(!m_cssomWrapper->parentElement()); | 526 ASSERT(!m_cssomWrapper->parentElement()); |
517 return m_cssomWrapper.get(); | 527 return m_cssomWrapper.get(); |
518 } | 528 } |
519 m_cssomWrapper = adoptPtrWillBeNoop(new PropertySetCSSStyleDeclaration(*this
)); | 529 m_cssomWrapper = adoptPtrWillBeNoop(new PropertySetCSSStyleDeclaration(*this
)); |
520 return m_cssomWrapper.get(); | 530 return m_cssomWrapper.get(); |
521 } | 531 } |
522 | 532 |
523 int MutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const | 533 template<typename T> |
| 534 int MutableStylePropertySet::findPropertyIndex(T property) const |
524 { | 535 { |
525 const CSSProperty* begin = m_propertyVector.data(); | 536 const CSSProperty* begin = m_propertyVector.data(); |
526 const CSSProperty* end = begin + m_propertyVector.size(); | 537 const CSSProperty* end = begin + m_propertyVector.size(); |
527 // Convert here propertyID into an uint16_t to compare it with the metadata'
s m_propertyID to avoid | |
528 // the compiler converting it to an int multiple times in the loop. | |
529 uint16_t id = static_cast<uint16_t>(propertyID); | |
530 | 538 |
531 auto compare = [propertyID, id](const CSSProperty& property) -> bool { | 539 uint16_t id = getConvertedCSSPropertyID(property); |
532 if (property.metadata().m_propertyID == id) { | |
533 // Only enabled properties should be part of the style. | |
534 ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID)); | |
535 return true; | |
536 } | |
537 return false; | |
538 }; | |
539 | 540 |
540 const CSSProperty* it = std::find_if(begin, end, compare); | 541 const CSSProperty* it = std::find_if(begin, end, [property, id](const CSSPro
perty& cssProperty) -> bool { |
| 542 return isPropertyMatch(cssProperty.metadata(), *cssProperty.value(), id,
property); |
| 543 }); |
541 | 544 |
542 return (it == end) ? -1 : it - begin; | 545 return (it == end) ? -1 : it - begin; |
543 } | 546 } |
544 | |
545 int MutableStylePropertySet::findCustomPropertyIndex(const AtomicString& propert
yName) const | |
546 { | |
547 const CSSProperty* begin = m_propertyVector.data(); | |
548 const CSSProperty* end = begin + m_propertyVector.size(); | |
549 // Convert here propertyID into an uint16_t to compare it with the metadata'
s m_propertyID to avoid | |
550 // the compiler converting it to an int multiple times in the loop. | |
551 const uint16_t variableId = static_cast<uint16_t>(CSSPropertyVariable); | |
552 | |
553 auto compare = [variableId, propertyName](const CSSProperty& property) -> bo
ol { | |
554 if (property.metadata().m_propertyID == variableId) { | |
555 return toCSSCustomPropertyDeclaration(property.value())->name() == p
ropertyName; | |
556 } | |
557 return false; | |
558 }; | |
559 | |
560 const CSSProperty* it = std::find_if(begin, end, compare); | |
561 | |
562 return (it == end) ? -1 : it - begin; | |
563 } | |
564 | 547 |
565 DEFINE_TRACE_AFTER_DISPATCH(MutableStylePropertySet) | 548 DEFINE_TRACE_AFTER_DISPATCH(MutableStylePropertySet) |
566 { | 549 { |
567 #if ENABLE(OILPAN) | 550 #if ENABLE(OILPAN) |
568 visitor->trace(m_cssomWrapper); | 551 visitor->trace(m_cssomWrapper); |
569 visitor->trace(m_propertyVector); | 552 visitor->trace(m_propertyVector); |
570 #endif | 553 #endif |
571 StylePropertySet::traceAfterDispatch(visitor); | 554 StylePropertySet::traceAfterDispatch(visitor); |
572 } | 555 } |
573 | 556 |
(...skipping 20 matching lines...) Expand all Loading... |
594 { | 577 { |
595 return adoptRefWillBeNoop(new MutableStylePropertySet(cssParserMode)); | 578 return adoptRefWillBeNoop(new MutableStylePropertySet(cssParserMode)); |
596 } | 579 } |
597 | 580 |
598 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create(
const CSSProperty* properties, unsigned count) | 581 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create(
const CSSProperty* properties, unsigned count) |
599 { | 582 { |
600 return adoptRefWillBeNoop(new MutableStylePropertySet(properties, count)); | 583 return adoptRefWillBeNoop(new MutableStylePropertySet(properties, count)); |
601 } | 584 } |
602 | 585 |
603 } // namespace blink | 586 } // namespace blink |
OLD | NEW |