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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (properties.isEmpty()) | 424 if (properties.isEmpty()) |
425 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticBlockPrope
rties, WTF_ARRAY_LENGTH(staticBlockProperties), properties); | 425 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticBlockPrope
rties, WTF_ARRAY_LENGTH(staticBlockProperties), properties); |
426 return properties; | 426 return properties; |
427 } | 427 } |
428 | 428 |
429 void MutableStylePropertySet::clear() | 429 void MutableStylePropertySet::clear() |
430 { | 430 { |
431 m_propertyVector.clear(); | 431 m_propertyVector.clear(); |
432 } | 432 } |
433 | 433 |
434 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyBlockProperties() cons
t | 434 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyBlockPrope
rties() const |
435 { | 435 { |
436 return copyPropertiesInSet(blockProperties()); | 436 return copyPropertiesInSet(blockProperties()); |
437 } | 437 } |
438 | 438 |
439 void MutableStylePropertySet::removeBlockProperties() | 439 void MutableStylePropertySet::removeBlockProperties() |
440 { | 440 { |
441 removePropertiesInSet(blockProperties().data(), blockProperties().size()); | 441 removePropertiesInSet(blockProperties().data(), blockProperties().size()); |
442 } | 442 } |
443 | 443 |
444 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
signed length) | 444 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
signed length) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 for (unsigned i = 0; i < size; ++i) { | 507 for (unsigned i = 0; i < size; ++i) { |
508 PropertyReference property = propertyAt(i); | 508 PropertyReference property = propertyAt(i); |
509 if (style->cssPropertyMatches(property.id(), property.value())) | 509 if (style->cssPropertyMatches(property.id(), property.value())) |
510 propertiesToRemove.append(property.id()); | 510 propertiesToRemove.append(property.id()); |
511 } | 511 } |
512 // FIXME: This should use mass removal. | 512 // FIXME: This should use mass removal. |
513 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) | 513 for (unsigned i = 0; i < propertiesToRemove.size(); ++i) |
514 removeProperty(propertiesToRemove[i]); | 514 removeProperty(propertiesToRemove[i]); |
515 } | 515 } |
516 | 516 |
517 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const | 517 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::mutableCopy()
const |
518 { | 518 { |
519 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
*this)); | 519 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
*this)); |
520 } | 520 } |
521 | 521 |
522 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const
Vector<CSSPropertyID>& properties) const | 522 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyProperties
InSet(const Vector<CSSPropertyID>& properties) const |
523 { | 523 { |
524 WillBeHeapVector<CSSProperty, 256> list; | 524 WillBeHeapVector<CSSProperty, 256> list; |
525 list.reserveInitialCapacity(properties.size()); | 525 list.reserveInitialCapacity(properties.size()); |
526 for (unsigned i = 0; i < properties.size(); ++i) { | 526 for (unsigned i = 0; i < properties.size(); ++i) { |
527 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); | 527 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); |
528 if (value) | 528 if (value) |
529 list.append(CSSProperty(properties[i], value.release(), false)); | 529 list.append(CSSProperty(properties[i], value.release(), false)); |
530 } | 530 } |
531 return MutableStylePropertySet::create(list.data(), list.size()); | 531 return MutableStylePropertySet::create(list.data(), list.size()); |
532 } | 532 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 }; | 578 }; |
579 COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), s
tyle_property_set_should_stay_small); | 579 COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), s
tyle_property_set_should_stay_small); |
580 | 580 |
581 #ifndef NDEBUG | 581 #ifndef NDEBUG |
582 void StylePropertySet::showStyle() | 582 void StylePropertySet::showStyle() |
583 { | 583 { |
584 fprintf(stderr, "%s\n", asText().ascii().data()); | 584 fprintf(stderr, "%s\n", asText().ascii().data()); |
585 } | 585 } |
586 #endif | 586 #endif |
587 | 587 |
588 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(CSSParserMod
e cssParserMode) | 588 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create(
CSSParserMode cssParserMode) |
589 { | 589 { |
590 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
cssParserMode)); | 590 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
cssParserMode)); |
591 } | 591 } |
592 | 592 |
593 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSPro
perty* properties, unsigned count) | 593 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create(
const CSSProperty* properties, unsigned count) |
594 { | 594 { |
595 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
properties, count)); | 595 return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(
properties, count)); |
596 } | 596 } |
597 | 597 |
598 String StylePropertySet::PropertyReference::cssName() const | 598 String StylePropertySet::PropertyReference::cssName() const |
599 { | 599 { |
600 return getPropertyNameString(id()); | 600 return getPropertyNameString(id()); |
601 } | 601 } |
602 | 602 |
603 String StylePropertySet::PropertyReference::cssText() const | 603 String StylePropertySet::PropertyReference::cssText() const |
604 { | 604 { |
605 StringBuilder result; | 605 StringBuilder result; |
606 result.append(cssName()); | 606 result.append(cssName()); |
607 result.appendLiteral(": "); | 607 result.appendLiteral(": "); |
608 result.append(propertyValue()->cssText()); | 608 result.append(propertyValue()->cssText()); |
609 if (isImportant()) | 609 if (isImportant()) |
610 result.appendLiteral(" !important"); | 610 result.appendLiteral(" !important"); |
611 result.append(';'); | 611 result.append(';'); |
612 return result.toString(); | 612 return result.toString(); |
613 } | 613 } |
614 | 614 |
615 | 615 |
616 } // namespace WebCore | 616 } // namespace WebCore |
OLD | NEW |