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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const
Vector<CSSPropertyID>& properties) const | 504 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const
Vector<CSSPropertyID>& properties) const |
505 { | 505 { |
506 Vector<CSSProperty, 256> list; | 506 Vector<CSSProperty, 256> list; |
507 list.reserveInitialCapacity(properties.size()); | 507 list.reserveInitialCapacity(properties.size()); |
508 for (unsigned i = 0; i < properties.size(); ++i) { | 508 for (unsigned i = 0; i < properties.size(); ++i) { |
509 RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); | 509 RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); |
510 if (value) | 510 if (value) |
511 list.append(CSSProperty(properties[i], value.release(), false)); | 511 list.append(CSSProperty(properties[i], value.release(), false)); |
512 } | 512 } |
513 return static_pointer_cast<MutableStylePropertySet>(StylePropertySet::create
(list.data(), list.size())); | 513 return MutableStylePropertySet::create(list.data(), list.size()); |
514 } | 514 } |
515 | 515 |
516 PropertySetCSSStyleDeclaration* StylePropertySet::cssStyleDeclaration() | 516 PropertySetCSSStyleDeclaration* StylePropertySet::cssStyleDeclaration() |
517 { | 517 { |
518 if (!m_ownsCSSOMWrapper) | 518 if (!m_ownsCSSOMWrapper) |
519 return 0; | 519 return 0; |
520 ASSERT(isMutable()); | 520 ASSERT(isMutable()); |
521 return propertySetCSSOMWrapperMap().get(this); | 521 return propertySetCSSOMWrapperMap().get(this); |
522 } | 522 } |
523 | 523 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 }; | 574 }; |
575 COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), s
tyle_property_set_should_stay_small); | 575 COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), s
tyle_property_set_should_stay_small); |
576 | 576 |
577 #ifndef NDEBUG | 577 #ifndef NDEBUG |
578 void StylePropertySet::showStyle() | 578 void StylePropertySet::showStyle() |
579 { | 579 { |
580 fprintf(stderr, "%s\n", asText().ascii().data()); | 580 fprintf(stderr, "%s\n", asText().ascii().data()); |
581 } | 581 } |
582 #endif | 582 #endif |
583 | 583 |
584 PassRefPtr<StylePropertySet> StylePropertySet::create(CSSParserMode cssParserMod
e) | 584 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(CSSParserMod
e cssParserMode) |
585 { | 585 { |
586 return adoptRef(new MutableStylePropertySet(cssParserMode)); | 586 return adoptRef(new MutableStylePropertySet(cssParserMode)); |
587 } | 587 } |
588 | 588 |
589 PassRefPtr<StylePropertySet> StylePropertySet::create(const CSSProperty* propert
ies, unsigned count) | 589 PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSPro
perty* properties, unsigned count) |
590 { | 590 { |
591 return adoptRef(new MutableStylePropertySet(properties, count)); | 591 return adoptRef(new MutableStylePropertySet(properties, count)); |
592 } | 592 } |
593 | 593 |
594 String StylePropertySet::PropertyReference::cssName() const | 594 String StylePropertySet::PropertyReference::cssName() const |
595 { | 595 { |
596 if (id() == CSSPropertyVariable) { | 596 if (id() == CSSPropertyVariable) { |
597 ASSERT(propertyValue()->isVariableValue()); | 597 ASSERT(propertyValue()->isVariableValue()); |
598 if (!propertyValue()->isVariableValue()) | 598 if (!propertyValue()->isVariableValue()) |
599 return emptyString(); // Should not happen, but if it does, avoid a
bad cast. | 599 return emptyString(); // Should not happen, but if it does, avoid a
bad cast. |
600 return "-webkit-var-" + static_cast<const CSSVariableValue*>(propertyVal
ue())->name(); | 600 return "-webkit-var-" + static_cast<const CSSVariableValue*>(propertyVal
ue())->name(); |
601 } | 601 } |
602 return getPropertyNameString(id()); | 602 return getPropertyNameString(id()); |
603 } | 603 } |
604 | 604 |
605 String StylePropertySet::PropertyReference::cssText() const | 605 String StylePropertySet::PropertyReference::cssText() const |
606 { | 606 { |
607 StringBuilder result; | 607 StringBuilder result; |
608 result.append(cssName()); | 608 result.append(cssName()); |
609 result.appendLiteral(": "); | 609 result.appendLiteral(": "); |
610 result.append(propertyValue()->cssText()); | 610 result.append(propertyValue()->cssText()); |
611 if (isImportant()) | 611 if (isImportant()) |
612 result.appendLiteral(" !important"); | 612 result.appendLiteral(" !important"); |
613 result.append(';'); | 613 result.append(';'); |
614 return result.toString(); | 614 return result.toString(); |
615 } | 615 } |
616 | 616 |
617 | 617 |
618 } // namespace WebCore | 618 } // namespace WebCore |
OLD | NEW |