| 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. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count) | 45 static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count) |
| 46 { | 46 { |
| 47 return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*)
* count + sizeof(StylePropertyMetadata) * count; | 47 return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*)
* count + sizeof(StylePropertyMetadata) * count; |
| 48 } | 48 } |
| 49 | 49 |
| 50 PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CS
SProperty* properties, unsigned count, CSSParserMode cssParserMode) | 50 PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CS
SProperty* properties, unsigned count, CSSParserMode cssParserMode) |
| 51 { | 51 { |
| 52 ASSERT(count <= MaxArraySize); | 52 ASSERT(count <= MaxArraySize); |
| 53 #if ENABLE(OILPAN) |
| 54 void* slot = Heap::allocate<StylePropertySet>(sizeForImmutableStylePropertyS
etWithPropertyCount(count)); |
| 55 #else |
| 53 void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCou
nt(count)); | 56 void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCou
nt(count)); |
| 54 return adoptRef(new (slot) ImmutableStylePropertySet(properties, count, cssP
arserMode)); | 57 #endif // ENABLE(OILPAN) |
| 58 return adoptRefWillBeRefCountedGarbageCollected(new (slot) ImmutableStylePro
pertySet(properties, count, cssParserMode)); |
| 55 } | 59 } |
| 56 | 60 |
| 57 PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded()
const | 61 PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded()
const |
| 58 { | 62 { |
| 59 if (!isMutable()) | 63 if (!isMutable()) |
| 60 return toImmutableStylePropertySet(const_cast<StylePropertySet*>(this)); | 64 return toImmutableStylePropertySet(const_cast<StylePropertySet*>(this)); |
| 61 const MutableStylePropertySet* mutableThis = toMutableStylePropertySet(this)
; | 65 const MutableStylePropertySet* mutableThis = toMutableStylePropertySet(this)
; |
| 62 return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(
), mutableThis->m_propertyVector.size(), cssParserMode()); | 66 return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(
), mutableThis->m_propertyVector.size(), cssParserMode()); |
| 63 } | 67 } |
| 64 | 68 |
| 65 MutableStylePropertySet::MutableStylePropertySet(CSSParserMode cssParserMode) | 69 MutableStylePropertySet::MutableStylePropertySet(CSSParserMode cssParserMode) |
| 66 : StylePropertySet(cssParserMode) | 70 : StylePropertySet(cssParserMode) |
| 67 { | 71 { |
| 68 } | 72 } |
| 69 | 73 |
| 70 MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties,
unsigned length) | 74 MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties,
unsigned length) |
| 71 : StylePropertySet(HTMLStandardMode) | 75 : StylePropertySet(HTMLStandardMode) |
| 72 { | 76 { |
| 73 m_propertyVector.reserveInitialCapacity(length); | 77 m_propertyVector.reserveInitialCapacity(length); |
| 74 for (unsigned i = 0; i < length; ++i) | 78 for (unsigned i = 0; i < length; ++i) |
| 75 m_propertyVector.uncheckedAppend(properties[i]); | 79 m_propertyVector.uncheckedAppend(properties[i]); |
| 76 } | 80 } |
| 77 | 81 |
| 78 ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti
es, unsigned length, CSSParserMode cssParserMode) | 82 ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti
es, unsigned length, CSSParserMode cssParserMode) |
| 79 : StylePropertySet(cssParserMode, length) | 83 : StylePropertySet(cssParserMode, length) |
| 80 { | 84 { |
| 81 StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(th
is->metadataArray()); | 85 StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(th
is->metadataArray()); |
| 82 CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray()); | 86 RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSS
Value>*>(this->valueArray()); |
| 83 for (unsigned i = 0; i < m_arraySize; ++i) { | 87 for (unsigned i = 0; i < m_arraySize; ++i) { |
| 84 metadataArray[i] = properties[i].metadata(); | 88 metadataArray[i] = properties[i].metadata(); |
| 85 valueArray[i] = properties[i].value(); | 89 valueArray[i] = properties[i].value(); |
| 86 valueArray[i]->ref(); | 90 valueArray[i]->ref(); |
| 87 } | 91 } |
| 88 } | 92 } |
| 89 | 93 |
| 94 #if !ENABLE(OILPAN) |
| 90 ImmutableStylePropertySet::~ImmutableStylePropertySet() | 95 ImmutableStylePropertySet::~ImmutableStylePropertySet() |
| 91 { | 96 { |
| 92 CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray()); | 97 RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSS
Value>*>(this->valueArray()); |
| 93 for (unsigned i = 0; i < m_arraySize; ++i) | 98 for (unsigned i = 0; i < m_arraySize; ++i) |
| 94 valueArray[i]->deref(); | 99 valueArray[i]->deref(); |
| 95 } | 100 } |
| 101 #endif |
| 96 | 102 |
| 97 int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const | 103 int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
| 98 { | 104 { |
| 99 // Convert here propertyID into an uint16_t to compare it with the metadata'
s m_propertyID to avoid | 105 // Convert here propertyID into an uint16_t to compare it with the metadata'
s m_propertyID to avoid |
| 100 // the compiler converting it to an int multiple times in the loop. | 106 // the compiler converting it to an int multiple times in the loop. |
| 101 uint16_t id = static_cast<uint16_t>(propertyID); | 107 uint16_t id = static_cast<uint16_t>(propertyID); |
| 102 for (int n = m_arraySize - 1 ; n >= 0; --n) { | 108 for (int n = m_arraySize - 1 ; n >= 0; --n) { |
| 103 if (metadataArray()[n].m_propertyID == id) { | 109 if (metadataArray()[n].m_propertyID == id) { |
| 104 // Only enabled or internal properties should be part of the style. | 110 // Only enabled or internal properties should be part of the style. |
| 105 ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInte
rnalProperty(propertyID)); | 111 ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInte
rnalProperty(propertyID)); |
| 106 return n; | 112 return n; |
| 107 } | 113 } |
| 108 } | 114 } |
| 109 | 115 |
| 110 return -1; | 116 return -1; |
| 111 } | 117 } |
| 112 | 118 |
| 119 void ImmutableStylePropertySet::traceAfterDispatch(Visitor* visitor) |
| 120 { |
| 121 const RawPtrWillBeMember<CSSValue>* values = valueArray(); |
| 122 for (unsigned i = 0; i < m_arraySize; i++) |
| 123 visitor->trace(values[i]); |
| 124 StylePropertySet::traceAfterDispatch(visitor); |
| 125 } |
| 126 |
| 113 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) | 127 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) |
| 114 : StylePropertySet(other.cssParserMode()) | 128 : StylePropertySet(other.cssParserMode()) |
| 115 { | 129 { |
| 116 if (other.isMutable()) { | 130 if (other.isMutable()) { |
| 117 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; | 131 m_propertyVector = toMutableStylePropertySet(other).m_propertyVector; |
| 118 } else { | 132 } else { |
| 119 m_propertyVector.reserveInitialCapacity(other.propertyCount()); | 133 m_propertyVector.reserveInitialCapacity(other.propertyCount()); |
| 120 for (unsigned i = 0; i < other.propertyCount(); ++i) | 134 for (unsigned i = 0; i < other.propertyCount(); ++i) |
| 121 m_propertyVector.uncheckedAppend(other.propertyAt(i).toCSSProperty()
); | 135 m_propertyVector.uncheckedAppend(other.propertyAt(i).toCSSProperty()
); |
| 122 } | 136 } |
| 123 } | 137 } |
| 124 | 138 |
| 125 String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const | 139 String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const |
| 126 { | 140 { |
| 127 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID); | 141 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID); |
| 128 if (value) | 142 if (value) |
| 129 return value->cssText(); | 143 return value->cssText(); |
| 130 | 144 |
| 131 return StylePropertySerializer(*this).getPropertyValue(propertyID); | 145 return StylePropertySerializer(*this).getPropertyValue(propertyID); |
| 132 } | 146 } |
| 133 | 147 |
| 134 PassRefPtrWillBeRawPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSProper
tyID propertyID) const | 148 PassRefPtrWillBeRawPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSProper
tyID propertyID) const |
| 135 { | 149 { |
| 136 int foundPropertyIndex = findPropertyIndex(propertyID); | 150 int foundPropertyIndex = findPropertyIndex(propertyID); |
| 137 if (foundPropertyIndex == -1) | 151 if (foundPropertyIndex == -1) |
| 138 return nullptr; | 152 return nullptr; |
| 139 return propertyAt(foundPropertyIndex).value(); | 153 return propertyAt(foundPropertyIndex).value(); |
| 140 } | 154 } |
| 141 | 155 |
| 156 void StylePropertySet::trace(Visitor* visitor) |
| 157 { |
| 158 if (m_isMutable) |
| 159 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); |
| 160 else |
| 161 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); |
| 162 } |
| 163 |
| 142 bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) | 164 bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID) |
| 143 { | 165 { |
| 144 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); | 166 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); |
| 145 if (!shorthand.length()) | 167 if (!shorthand.length()) |
| 146 return false; | 168 return false; |
| 147 | 169 |
| 148 bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length())
; | 170 bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length())
; |
| 149 | 171 |
| 150 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID); | 172 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID); |
| 151 if (prefixingVariant == propertyID) | 173 if (prefixingVariant == propertyID) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSh
eet)); | 334 CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSh
eet)); |
| 313 if (contextStyleSheet) { | 335 if (contextStyleSheet) { |
| 314 context = contextStyleSheet->parserContext(); | 336 context = contextStyleSheet->parserContext(); |
| 315 context.setMode(cssParserMode()); | 337 context.setMode(cssParserMode()); |
| 316 } | 338 } |
| 317 | 339 |
| 318 BisonCSSParser parser(context); | 340 BisonCSSParser parser(context); |
| 319 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); | 341 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); |
| 320 } | 342 } |
| 321 | 343 |
| 322 void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty, 256>
& properties) | 344 void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProp
erty, 256>& properties) |
| 323 { | 345 { |
| 324 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()
); | 346 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size()
); |
| 325 for (unsigned i = 0; i < properties.size(); ++i) | 347 for (unsigned i = 0; i < properties.size(); ++i) |
| 326 addParsedProperty(properties[i]); | 348 addParsedProperty(properties[i]); |
| 327 } | 349 } |
| 328 | 350 |
| 329 void MutableStylePropertySet::addParsedProperty(const CSSProperty& property) | 351 void MutableStylePropertySet::addParsedProperty(const CSSProperty& property) |
| 330 { | 352 { |
| 331 // Only add properties that have no !important counterpart present | 353 // Only add properties that have no !important counterpart present |
| 332 if (!propertyIsImportant(property.id()) || property.isImportant()) | 354 if (!propertyIsImportant(property.id()) || property.isImportant()) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
signed length) | 434 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
signed length) |
| 413 { | 435 { |
| 414 if (m_propertyVector.isEmpty()) | 436 if (m_propertyVector.isEmpty()) |
| 415 return false; | 437 return false; |
| 416 | 438 |
| 417 // FIXME: This is always used with static sets and in that case constructing
the hash repeatedly is pretty pointless. | 439 // FIXME: This is always used with static sets and in that case constructing
the hash repeatedly is pretty pointless. |
| 418 HashSet<CSSPropertyID> toRemove; | 440 HashSet<CSSPropertyID> toRemove; |
| 419 for (unsigned i = 0; i < length; ++i) | 441 for (unsigned i = 0; i < length; ++i) |
| 420 toRemove.add(set[i]); | 442 toRemove.add(set[i]); |
| 421 | 443 |
| 422 Vector<CSSProperty> newProperties; | 444 WillBeHeapVector<CSSProperty> newProperties; |
| 423 newProperties.reserveInitialCapacity(m_propertyVector.size()); | 445 newProperties.reserveInitialCapacity(m_propertyVector.size()); |
| 424 | 446 |
| 425 unsigned size = m_propertyVector.size(); | 447 unsigned size = m_propertyVector.size(); |
| 426 for (unsigned n = 0; n < size; ++n) { | 448 for (unsigned n = 0; n < size; ++n) { |
| 427 const CSSProperty& property = m_propertyVector.at(n); | 449 const CSSProperty& property = m_propertyVector.at(n); |
| 428 // Not quite sure if the isImportant test is needed but it matches the e
xisting behavior. | 450 // Not quite sure if the isImportant test is needed but it matches the e
xisting behavior. |
| 429 if (!property.isImportant()) { | 451 if (!property.isImportant()) { |
| 430 if (toRemove.contains(property.id())) | 452 if (toRemove.contains(property.id())) |
| 431 continue; | 453 continue; |
| 432 } | 454 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 if (style->cssPropertyMatches(property.id(), property.value())) | 499 if (style->cssPropertyMatches(property.id(), property.value())) |
| 478 propertiesToRemove.append(property.id()); | 500 propertiesToRemove.append(property.id()); |
| 479 } | 501 } |
| 480 // FIXME: This should use mass removal. | 502 // FIXME: This should use mass removal. |
| 481 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) | 503 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) |
| 482 removeProperty(propertiesToRemove[i]); | 504 removeProperty(propertiesToRemove[i]); |
| 483 } | 505 } |
| 484 | 506 |
| 485 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const | 507 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const |
| 486 { | 508 { |
| 487 return adoptRef(new MutableStylePropertySet(*this)); | 509 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
*this)); |
| 488 } | 510 } |
| 489 | 511 |
| 490 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const
Vector<CSSPropertyID>& properties) const | 512 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const
Vector<CSSPropertyID>& properties) const |
| 491 { | 513 { |
| 492 Vector<CSSProperty, 256> list; | 514 WillBeHeapVector<CSSProperty, 256> list; |
| 493 list.reserveInitialCapacity(properties.size()); | 515 list.reserveInitialCapacity(properties.size()); |
| 494 for (unsigned i = 0; i < properties.size(); ++i) { | 516 for (unsigned i = 0; i < properties.size(); ++i) { |
| 495 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); | 517 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); |
| 496 if (value) | 518 if (value) |
| 497 list.append(CSSProperty(properties[i], value.release(), false)); | 519 list.append(CSSProperty(properties[i], value.release(), false)); |
| 498 } | 520 } |
| 499 return MutableStylePropertySet::create(list.data(), list.size()); | 521 return MutableStylePropertySet::create(list.data(), list.size()); |
| 500 } | 522 } |
| 501 | 523 |
| 502 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() | 524 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() |
| (...skipping 18 matching lines...) Expand all Loading... |
| 521 if (m_propertyVector.at(n).metadata().m_propertyID == id) { | 543 if (m_propertyVector.at(n).metadata().m_propertyID == id) { |
| 522 // Only enabled or internal properties should be part of the style. | 544 // Only enabled or internal properties should be part of the style. |
| 523 ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInte
rnalProperty(propertyID)); | 545 ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInte
rnalProperty(propertyID)); |
| 524 return n; | 546 return n; |
| 525 } | 547 } |
| 526 } | 548 } |
| 527 | 549 |
| 528 return -1; | 550 return -1; |
| 529 } | 551 } |
| 530 | 552 |
| 553 void MutableStylePropertySet::traceAfterDispatch(Visitor* visitor) |
| 554 { |
| 555 visitor->trace(m_propertyVector); |
| 556 StylePropertySet::traceAfterDispatch(visitor); |
| 557 } |
| 558 |
| 531 unsigned StylePropertySet::averageSizeInBytes() | 559 unsigned StylePropertySet::averageSizeInBytes() |
| 532 { | 560 { |
| 533 // Please update this if the storage scheme changes so that this longer refl
ects the actual size. | 561 // Please update this if the storage scheme changes so that this longer refl
ects the actual size. |
| 534 return sizeForImmutableStylePropertySetWithPropertyCount(4); | 562 return sizeForImmutableStylePropertySetWithPropertyCount(4); |
| 535 } | 563 } |
| 536 | 564 |
| 537 // See the function above if you need to update this. | 565 // See the function above if you need to update this. |
| 538 struct SameSizeAsStylePropertySet : public RefCounted<SameSizeAsStylePropertySet
> { | 566 struct SameSizeAsStylePropertySet : public RefCountedWillBeRefCountedGarbageColl
ected<SameSizeAsStylePropertySet> { |
| 539 unsigned bitfield; | 567 unsigned bitfield; |
| 540 }; | 568 }; |
| 541 COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), s
tyle_property_set_should_stay_small); | 569 COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), s
tyle_property_set_should_stay_small); |
| 542 | 570 |
| 543 #ifndef NDEBUG | 571 #ifndef NDEBUG |
| 544 void StylePropertySet::showStyle() | 572 void StylePropertySet::showStyle() |
| 545 { | 573 { |
| 546 fprintf(stderr, "%s\n", asText().ascii().data()); | 574 fprintf(stderr, "%s\n", asText().ascii().data()); |
| 547 } | 575 } |
| 548 #endif | 576 #endif |
| 549 | 577 |
| 550 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(CSSParserMod
e cssParserMode) | 578 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(CSSParserMod
e cssParserMode) |
| 551 { | 579 { |
| 552 return adoptRef(new MutableStylePropertySet(cssParserMode)); | 580 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
cssParserMode)); |
| 553 } | 581 } |
| 554 | 582 |
| 555 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSPro
perty* properties, unsigned count) | 583 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSPro
perty* properties, unsigned count) |
| 556 { | 584 { |
| 557 return adoptRef(new MutableStylePropertySet(properties, count)); | 585 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
properties, count)); |
| 558 } | 586 } |
| 559 | 587 |
| 560 String StylePropertySet::PropertyReference::cssName() const | 588 String StylePropertySet::PropertyReference::cssName() const |
| 561 { | 589 { |
| 562 return getPropertyNameString(id()); | 590 return getPropertyNameString(id()); |
| 563 } | 591 } |
| 564 | 592 |
| 565 String StylePropertySet::PropertyReference::cssText() const | 593 String StylePropertySet::PropertyReference::cssText() const |
| 566 { | 594 { |
| 567 StringBuilder result; | 595 StringBuilder result; |
| 568 result.append(cssName()); | 596 result.append(cssName()); |
| 569 result.appendLiteral(": "); | 597 result.appendLiteral(": "); |
| 570 result.append(propertyValue()->cssText()); | 598 result.append(propertyValue()->cssText()); |
| 571 if (isImportant()) | 599 if (isImportant()) |
| 572 result.appendLiteral(" !important"); | 600 result.appendLiteral(" !important"); |
| 573 result.append(';'); | 601 result.append(';'); |
| 574 return result.toString(); | 602 return result.toString(); |
| 575 } | 603 } |
| 576 | 604 |
| 577 | 605 |
| 578 } // namespace WebCore | 606 } // namespace WebCore |
| OLD | NEW |