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 Apple Inc. All r
ights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propert
yID) const | 127 PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propert
yID) const |
128 { | 128 { |
129 int foundPropertyIndex = findPropertyIndex(propertyID); | 129 int foundPropertyIndex = findPropertyIndex(propertyID); |
130 if (foundPropertyIndex == -1) | 130 if (foundPropertyIndex == -1) |
131 return 0; | 131 return 0; |
132 return propertyAt(foundPropertyIndex).value(); | 132 return propertyAt(foundPropertyIndex).value(); |
133 } | 133 } |
134 | 134 |
135 bool StylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) | 135 bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) |
136 { | 136 { |
137 ASSERT(isMutable()); | |
138 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 137 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
139 if (!shorthand.length()) | 138 if (!shorthand.length()) |
140 return false; | 139 return false; |
141 | 140 |
142 bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length())
; | 141 bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length())
; |
143 | 142 |
144 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID); | 143 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID); |
145 if (prefixingVariant == propertyID) | 144 if (prefixingVariant == propertyID) |
146 return ret; | 145 return ret; |
147 | 146 |
148 StylePropertyShorthand shorthandPrefixingVariant = shorthandForProperty(pref
ixingVariant); | 147 StylePropertyShorthand shorthandPrefixingVariant = shorthandForProperty(pref
ixingVariant); |
149 return removePropertiesInSet(shorthandPrefixingVariant.properties(), shortha
ndPrefixingVariant.length()); | 148 return removePropertiesInSet(shorthandPrefixingVariant.properties(), shortha
ndPrefixingVariant.length()); |
150 } | 149 } |
151 | 150 |
152 bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnTe
xt) | 151 bool MutableStylePropertySet::removeProperty(CSSPropertyID propertyID, String* r
eturnText) |
153 { | 152 { |
154 ASSERT(isMutable()); | |
155 if (removeShorthandProperty(propertyID)) { | 153 if (removeShorthandProperty(propertyID)) { |
156 // FIXME: Return an equivalent shorthand when possible. | 154 // FIXME: Return an equivalent shorthand when possible. |
157 if (returnText) | 155 if (returnText) |
158 *returnText = ""; | 156 *returnText = ""; |
159 return true; | 157 return true; |
160 } | 158 } |
161 | 159 |
162 int foundPropertyIndex = findPropertyIndex(propertyID); | 160 int foundPropertyIndex = findPropertyIndex(propertyID); |
163 if (foundPropertyIndex == -1) { | 161 if (foundPropertyIndex == -1) { |
164 if (returnText) | 162 if (returnText) |
165 *returnText = ""; | 163 *returnText = ""; |
166 return false; | 164 return false; |
167 } | 165 } |
168 | 166 |
169 if (returnText) | 167 if (returnText) |
170 *returnText = propertyAt(foundPropertyIndex).value()->cssText(); | 168 *returnText = propertyAt(foundPropertyIndex).value()->cssText(); |
171 | 169 |
172 // A more efficient removal strategy would involve marking entries as empty | 170 // A more efficient removal strategy would involve marking entries as empty |
173 // and sweeping them when the vector grows too big. | 171 // and sweeping them when the vector grows too big. |
174 mutablePropertyVector().remove(foundPropertyIndex); | 172 mutablePropertyVector().remove(foundPropertyIndex); |
175 | 173 |
176 removePrefixedOrUnprefixedProperty(propertyID); | 174 removePrefixedOrUnprefixedProperty(propertyID); |
177 | 175 |
178 return true; | 176 return true; |
179 } | 177 } |
180 | 178 |
181 void StylePropertySet::removePrefixedOrUnprefixedProperty(CSSPropertyID property
ID) | 179 void MutableStylePropertySet::removePrefixedOrUnprefixedProperty(CSSPropertyID p
ropertyID) |
182 { | 180 { |
183 int foundPropertyIndex = findPropertyIndex(prefixingVariantForPropertyId(pro
pertyID)); | 181 int foundPropertyIndex = findPropertyIndex(prefixingVariantForPropertyId(pro
pertyID)); |
184 if (foundPropertyIndex == -1) | 182 if (foundPropertyIndex == -1) |
185 return; | 183 return; |
186 mutablePropertyVector().remove(foundPropertyIndex); | 184 mutablePropertyVector().remove(foundPropertyIndex); |
187 } | 185 } |
188 | 186 |
189 bool StylePropertySet::propertyIsImportant(CSSPropertyID propertyID) const | 187 bool StylePropertySet::propertyIsImportant(CSSPropertyID propertyID) const |
190 { | 188 { |
191 int foundPropertyIndex = findPropertyIndex(propertyID); | 189 int foundPropertyIndex = findPropertyIndex(propertyID); |
(...skipping 20 matching lines...) Expand all Loading... |
212 } | 210 } |
213 | 211 |
214 bool StylePropertySet::isPropertyImplicit(CSSPropertyID propertyID) const | 212 bool StylePropertySet::isPropertyImplicit(CSSPropertyID propertyID) const |
215 { | 213 { |
216 int foundPropertyIndex = findPropertyIndex(propertyID); | 214 int foundPropertyIndex = findPropertyIndex(propertyID); |
217 if (foundPropertyIndex == -1) | 215 if (foundPropertyIndex == -1) |
218 return false; | 216 return false; |
219 return propertyAt(foundPropertyIndex).isImplicit(); | 217 return propertyAt(foundPropertyIndex).isImplicit(); |
220 } | 218 } |
221 | 219 |
222 bool StylePropertySet::setProperty(CSSPropertyID propertyID, const String& value
, bool important, StyleSheetContents* contextStyleSheet) | 220 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const String
& value, bool important, StyleSheetContents* contextStyleSheet) |
223 { | 221 { |
224 ASSERT(isMutable()); | |
225 // Setting the value to an empty string just removes the property in both IE
and Gecko. | 222 // Setting the value to an empty string just removes the property in both IE
and Gecko. |
226 // Setting it to null seems to produce less consistent results, but we treat
it just the same. | 223 // Setting it to null seems to produce less consistent results, but we treat
it just the same. |
227 if (value.isEmpty()) | 224 if (value.isEmpty()) |
228 return removeProperty(propertyID); | 225 return removeProperty(propertyID); |
229 | 226 |
230 // When replacing an existing property value, this moves the property to the
end of the list. | 227 // When replacing an existing property value, this moves the property to the
end of the list. |
231 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. | 228 // Firefox preserves the position, and MSIE moves the property to the beginn
ing. |
232 return CSSParser::parseValue(this, propertyID, value, important, cssParserMo
de(), contextStyleSheet); | 229 return CSSParser::parseValue(this, propertyID, value, important, cssParserMo
de(), contextStyleSheet); |
233 } | 230 } |
234 | 231 |
235 void StylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue
> prpValue, bool important) | 232 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<C
SSValue> prpValue, bool important) |
236 { | 233 { |
237 ASSERT(isMutable()); | |
238 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 234 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
239 if (!shorthand.length()) { | 235 if (!shorthand.length()) { |
240 setProperty(CSSProperty(propertyID, prpValue, important)); | 236 setProperty(CSSProperty(propertyID, prpValue, important)); |
241 return; | 237 return; |
242 } | 238 } |
243 | 239 |
244 removePropertiesInSet(shorthand.properties(), shorthand.length()); | 240 removePropertiesInSet(shorthand.properties(), shorthand.length()); |
245 | 241 |
246 RefPtr<CSSValue> value = prpValue; | 242 RefPtr<CSSValue> value = prpValue; |
247 for (unsigned i = 0; i < shorthand.length(); ++i) | 243 for (unsigned i = 0; i < shorthand.length(); ++i) |
248 mutablePropertyVector().append(CSSProperty(shorthand.properties()[i], va
lue, important)); | 244 mutablePropertyVector().append(CSSProperty(shorthand.properties()[i], va
lue, important)); |
249 } | 245 } |
250 | 246 |
251 void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slo
t) | 247 void MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProper
ty* slot) |
252 { | 248 { |
253 ASSERT(isMutable()); | |
254 if (!removeShorthandProperty(property.id())) { | 249 if (!removeShorthandProperty(property.id())) { |
255 CSSProperty* toReplace = slot ? slot : findMutableCSSPropertyWithID(prop
erty.id()); | 250 CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id
()); |
256 if (toReplace) { | 251 if (toReplace) { |
257 *toReplace = property; | 252 *toReplace = property; |
258 setPrefixingVariantProperty(property); | 253 setPrefixingVariantProperty(property); |
259 return; | 254 return; |
260 } | 255 } |
261 } | 256 } |
262 appendPrefixingVariantProperty(property); | 257 appendPrefixingVariantProperty(property); |
263 } | 258 } |
264 | 259 |
265 void StylePropertySet::appendPrefixingVariantProperty(const CSSProperty& propert
y) | 260 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty&
property) |
266 { | 261 { |
267 mutablePropertyVector().append(property); | 262 mutablePropertyVector().append(property); |
268 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()
); | 263 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()
); |
269 if (prefixingVariant == property.id()) | 264 if (prefixingVariant == property.id()) |
270 return; | 265 return; |
271 mutablePropertyVector().append(CSSProperty(prefixingVariant, property.value(
), property.isImportant(), property.shorthandID(), property.metadata().m_implici
t)); | 266 mutablePropertyVector().append(CSSProperty(prefixingVariant, property.value(
), property.isImportant(), property.shorthandID(), property.metadata().m_implici
t)); |
272 } | 267 } |
273 | 268 |
274 void StylePropertySet::setPrefixingVariantProperty(const CSSProperty& property) | 269 void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& pro
perty) |
275 { | 270 { |
276 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()
); | 271 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()
); |
277 CSSProperty* toReplace = findMutableCSSPropertyWithID(prefixingVariant); | 272 CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant); |
278 if (toReplace) | 273 if (toReplace) |
279 *toReplace = CSSProperty(prefixingVariant, property.value(), property.is
Important(), property.shorthandID(), property.metadata().m_implicit); | 274 *toReplace = CSSProperty(prefixingVariant, property.value(), property.is
Important(), property.shorthandID(), property.metadata().m_implicit); |
280 } | 275 } |
281 | 276 |
282 bool StylePropertySet::setProperty(CSSPropertyID propertyID, int identifier, boo
l important) | 277 bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, int identifi
er, bool important) |
283 { | 278 { |
284 ASSERT(isMutable()); | |
285 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(ide
ntifier), important)); | 279 setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(ide
ntifier), important)); |
286 return true; | 280 return true; |
287 } | 281 } |
288 | 282 |
289 void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
tyleSheetContents* contextStyleSheet) | 283 void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
tyleSheetContents* contextStyleSheet) |
290 { | 284 { |
291 mutablePropertyVector().clear(); | 285 mutablePropertyVector().clear(); |
292 | 286 |
293 CSSParserContext context(cssParserMode()); | 287 CSSParserContext context(cssParserMode()); |
294 if (contextStyleSheet) { | 288 if (contextStyleSheet) { |
295 context = contextStyleSheet->parserContext(); | 289 context = contextStyleSheet->parserContext(); |
296 context.mode = cssParserMode(); | 290 context.mode = cssParserMode(); |
297 } | 291 } |
298 | 292 |
299 CSSParser parser(context, UseCounter::getFrom(contextStyleSheet)); | 293 CSSParser parser(context, UseCounter::getFrom(contextStyleSheet)); |
300 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); | 294 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); |
301 } | 295 } |
302 | 296 |
303 void StylePropertySet::addParsedProperties(const Vector<CSSProperty>& properties
) | 297 void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty>& pro
perties) |
304 { | 298 { |
305 ASSERT(isMutable()); | |
306 mutablePropertyVector().reserveCapacity(mutablePropertyVector().size() + pro
perties.size()); | 299 mutablePropertyVector().reserveCapacity(mutablePropertyVector().size() + pro
perties.size()); |
307 for (unsigned i = 0; i < properties.size(); ++i) | 300 for (unsigned i = 0; i < properties.size(); ++i) |
308 addParsedProperty(properties[i]); | 301 addParsedProperty(properties[i]); |
309 } | 302 } |
310 | 303 |
311 void StylePropertySet::addParsedProperty(const CSSProperty& property) | 304 void MutableStylePropertySet::addParsedProperty(const CSSProperty& property) |
312 { | 305 { |
313 ASSERT(isMutable()); | |
314 // Only add properties that have no !important counterpart present | 306 // Only add properties that have no !important counterpart present |
315 if (!propertyIsImportant(property.id()) || property.isImportant()) | 307 if (!propertyIsImportant(property.id()) || property.isImportant()) |
316 setProperty(property); | 308 setProperty(property); |
317 } | 309 } |
318 | 310 |
319 String StylePropertySet::asText() const | 311 String StylePropertySet::asText() const |
320 { | 312 { |
321 return StylePropertySerializer(*this).asText(); | 313 return StylePropertySerializer(*this).asText(); |
322 } | 314 } |
323 | 315 |
324 void StylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet* other) | 316 void MutableStylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet*
other) |
325 { | 317 { |
326 ASSERT(isMutable()); | 318 ASSERT(isMutable()); |
327 unsigned size = other->propertyCount(); | 319 unsigned size = other->propertyCount(); |
328 for (unsigned n = 0; n < size; ++n) { | 320 for (unsigned n = 0; n < size; ++n) { |
329 PropertyReference toMerge = other->propertyAt(n); | 321 PropertyReference toMerge = other->propertyAt(n); |
330 CSSProperty* old = findMutableCSSPropertyWithID(toMerge.id()); | 322 CSSProperty* old = findCSSPropertyWithID(toMerge.id()); |
331 if (old) | 323 if (old) |
332 setProperty(toMerge.toCSSProperty(), old); | 324 setProperty(toMerge.toCSSProperty(), old); |
333 else | 325 else |
334 appendPrefixingVariantProperty(toMerge.toCSSProperty()); | 326 appendPrefixingVariantProperty(toMerge.toCSSProperty()); |
335 } | 327 } |
336 } | 328 } |
337 | 329 |
338 void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls, StyleShe
etContents* contextStyleSheet) const | 330 void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls, StyleShe
etContents* contextStyleSheet) const |
339 { | 331 { |
340 unsigned size = propertyCount(); | 332 unsigned size = propertyCount(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (properties.isEmpty()) | 379 if (properties.isEmpty()) |
388 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticBlockPrope
rties, WTF_ARRAY_LENGTH(staticBlockProperties), properties); | 380 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticBlockPrope
rties, WTF_ARRAY_LENGTH(staticBlockProperties), properties); |
389 return properties; | 381 return properties; |
390 } | 382 } |
391 | 383 |
392 void MutableStylePropertySet::clear() | 384 void MutableStylePropertySet::clear() |
393 { | 385 { |
394 mutablePropertyVector().clear(); | 386 mutablePropertyVector().clear(); |
395 } | 387 } |
396 | 388 |
397 PassRefPtr<StylePropertySet> StylePropertySet::copyBlockProperties() const | 389 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyBlockProperties() cons
t |
398 { | 390 { |
399 return copyPropertiesInSet(blockProperties()); | 391 return copyPropertiesInSet(blockProperties()); |
400 } | 392 } |
401 | 393 |
402 void StylePropertySet::removeBlockProperties() | 394 void MutableStylePropertySet::removeBlockProperties() |
403 { | 395 { |
404 removePropertiesInSet(blockProperties().data(), blockProperties().size()); | 396 removePropertiesInSet(blockProperties().data(), blockProperties().size()); |
405 } | 397 } |
406 | 398 |
407 bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned
length) | 399 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
signed length) |
408 { | 400 { |
409 ASSERT(isMutable()); | |
410 if (mutablePropertyVector().isEmpty()) | 401 if (mutablePropertyVector().isEmpty()) |
411 return false; | 402 return false; |
412 | 403 |
413 // FIXME: This is always used with static sets and in that case constructing
the hash repeatedly is pretty pointless. | 404 // FIXME: This is always used with static sets and in that case constructing
the hash repeatedly is pretty pointless. |
414 HashSet<CSSPropertyID> toRemove; | 405 HashSet<CSSPropertyID> toRemove; |
415 for (unsigned i = 0; i < length; ++i) | 406 for (unsigned i = 0; i < length; ++i) |
416 toRemove.add(set[i]); | 407 toRemove.add(set[i]); |
417 | 408 |
418 Vector<CSSProperty> newProperties; | 409 Vector<CSSProperty> newProperties; |
419 newProperties.reserveInitialCapacity(mutablePropertyVector().size()); | 410 newProperties.reserveInitialCapacity(mutablePropertyVector().size()); |
(...skipping 19 matching lines...) Expand all Loading... |
439 for (int n = propertyCount() - 1 ; n >= 0; --n) { | 430 for (int n = propertyCount() - 1 ; n >= 0; --n) { |
440 if (propertyID == propertyAt(n).id()) { | 431 if (propertyID == propertyAt(n).id()) { |
441 // Only enabled properties should be part of the style. | 432 // Only enabled properties should be part of the style. |
442 ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)); | 433 ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)); |
443 return n; | 434 return n; |
444 } | 435 } |
445 } | 436 } |
446 return -1; | 437 return -1; |
447 } | 438 } |
448 | 439 |
449 CSSProperty* StylePropertySet::findMutableCSSPropertyWithID(CSSPropertyID proper
tyID) | 440 CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID proper
tyID) |
450 { | 441 { |
451 ASSERT(isMutable()); | |
452 int foundPropertyIndex = findPropertyIndex(propertyID); | 442 int foundPropertyIndex = findPropertyIndex(propertyID); |
453 if (foundPropertyIndex == -1) | 443 if (foundPropertyIndex == -1) |
454 return 0; | 444 return 0; |
455 return &mutablePropertyVector().at(foundPropertyIndex); | 445 return &mutablePropertyVector().at(foundPropertyIndex); |
456 } | 446 } |
457 | 447 |
458 bool StylePropertySet::propertyMatches(CSSPropertyID propertyID, const CSSValue*
propertyValue) const | 448 bool StylePropertySet::propertyMatches(CSSPropertyID propertyID, const CSSValue*
propertyValue) const |
459 { | 449 { |
460 int foundPropertyIndex = findPropertyIndex(propertyID); | 450 int foundPropertyIndex = findPropertyIndex(propertyID); |
461 if (foundPropertyIndex == -1) | 451 if (foundPropertyIndex == -1) |
462 return false; | 452 return false; |
463 return propertyAt(foundPropertyIndex).value()->equals(*propertyValue); | 453 return propertyAt(foundPropertyIndex).value()->equals(*propertyValue); |
464 } | 454 } |
465 | 455 |
466 void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style) | 456 void MutableStylePropertySet::removeEquivalentProperties(const StylePropertySet*
style) |
467 { | 457 { |
468 ASSERT(isMutable()); | |
469 Vector<CSSPropertyID> propertiesToRemove; | 458 Vector<CSSPropertyID> propertiesToRemove; |
470 unsigned size = mutablePropertyVector().size(); | 459 unsigned size = mutablePropertyVector().size(); |
471 for (unsigned i = 0; i < size; ++i) { | 460 for (unsigned i = 0; i < size; ++i) { |
472 PropertyReference property = propertyAt(i); | 461 PropertyReference property = propertyAt(i); |
473 if (style->propertyMatches(property.id(), property.value())) | 462 if (style->propertyMatches(property.id(), property.value())) |
474 propertiesToRemove.append(property.id()); | 463 propertiesToRemove.append(property.id()); |
475 } | 464 } |
476 // FIXME: This should use mass removal. | 465 // FIXME: This should use mass removal. |
477 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) | 466 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) |
478 removeProperty(propertiesToRemove[i]); | 467 removeProperty(propertiesToRemove[i]); |
479 } | 468 } |
480 | 469 |
481 void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* sty
le) | 470 void MutableStylePropertySet::removeEquivalentProperties(const CSSStyleDeclarati
on* style) |
482 { | 471 { |
483 ASSERT(isMutable()); | |
484 Vector<CSSPropertyID> propertiesToRemove; | 472 Vector<CSSPropertyID> propertiesToRemove; |
485 unsigned size = mutablePropertyVector().size(); | 473 unsigned size = mutablePropertyVector().size(); |
486 for (unsigned i = 0; i < size; ++i) { | 474 for (unsigned i = 0; i < size; ++i) { |
487 PropertyReference property = propertyAt(i); | 475 PropertyReference property = propertyAt(i); |
488 if (style->cssPropertyMatches(property.id(), property.value())) | 476 if (style->cssPropertyMatches(property.id(), property.value())) |
489 propertiesToRemove.append(property.id()); | 477 propertiesToRemove.append(property.id()); |
490 } | 478 } |
491 // FIXME: This should use mass removal. | 479 // FIXME: This should use mass removal. |
492 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) | 480 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) |
493 removeProperty(propertiesToRemove[i]); | 481 removeProperty(propertiesToRemove[i]); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 result.appendLiteral(": "); | 590 result.appendLiteral(": "); |
603 result.append(propertyValue()->cssText()); | 591 result.append(propertyValue()->cssText()); |
604 if (isImportant()) | 592 if (isImportant()) |
605 result.appendLiteral(" !important"); | 593 result.appendLiteral(" !important"); |
606 result.append(';'); | 594 result.append(';'); |
607 return result.toString(); | 595 return result.toString(); |
608 } | 596 } |
609 | 597 |
610 | 598 |
611 } // namespace WebCore | 599 } // namespace WebCore |
OLD | NEW |