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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
524 CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration() | 524 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() |
525 { | 525 { |
526 ASSERT(isMutable()); | |
527 | |
528 if (m_ownsCSSOMWrapper) { | 526 if (m_ownsCSSOMWrapper) { |
529 ASSERT(!static_cast<CSSStyleDeclaration*>(propertySetCSSOMWrapperMap().g
et(this))->parentRule()); | 527 ASSERT(!static_cast<CSSStyleDeclaration*>(propertySetCSSOMWrapperMap().g
et(this))->parentRule()); |
530 ASSERT(!propertySetCSSOMWrapperMap().get(this)->parentElement()); | 528 ASSERT(!propertySetCSSOMWrapperMap().get(this)->parentElement()); |
531 return propertySetCSSOMWrapperMap().get(this); | 529 return propertySetCSSOMWrapperMap().get(this); |
532 } | 530 } |
533 m_ownsCSSOMWrapper = true; | 531 m_ownsCSSOMWrapper = true; |
534 PropertySetCSSStyleDeclaration* cssomWrapper = new PropertySetCSSStyleDeclar
ation(const_cast<StylePropertySet*>(this)); | 532 PropertySetCSSStyleDeclaration* cssomWrapper = new PropertySetCSSStyleDeclar
ation(this); |
535 propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); | 533 propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); |
536 return cssomWrapper; | 534 return cssomWrapper; |
537 } | 535 } |
538 | 536 |
539 CSSStyleDeclaration* StylePropertySet::ensureInlineCSSStyleDeclaration(const Sty
ledElement* parentElement) | 537 CSSStyleDeclaration* MutableStylePropertySet::ensureInlineCSSStyleDeclaration(co
nst StyledElement* parentElement) |
540 { | 538 { |
541 ASSERT(isMutable()); | |
542 | |
543 if (m_ownsCSSOMWrapper) { | 539 if (m_ownsCSSOMWrapper) { |
544 ASSERT(propertySetCSSOMWrapperMap().get(this)->parentElement() == parent
Element); | 540 ASSERT(propertySetCSSOMWrapperMap().get(this)->parentElement() == parent
Element); |
545 return propertySetCSSOMWrapperMap().get(this); | 541 return propertySetCSSOMWrapperMap().get(this); |
546 } | 542 } |
547 m_ownsCSSOMWrapper = true; | 543 m_ownsCSSOMWrapper = true; |
548 PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration
(const_cast<StylePropertySet*>(this), const_cast<StyledElement*>(parentElement))
; | 544 PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration
(this, const_cast<StyledElement*>(parentElement)); |
549 propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); | 545 propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); |
550 return cssomWrapper; | 546 return cssomWrapper; |
551 } | 547 } |
552 | 548 |
553 unsigned StylePropertySet::averageSizeInBytes() | 549 unsigned StylePropertySet::averageSizeInBytes() |
554 { | 550 { |
555 // Please update this if the storage scheme changes so that this longer refl
ects the actual size. | 551 // Please update this if the storage scheme changes so that this longer refl
ects the actual size. |
556 return sizeForImmutableStylePropertySetWithPropertyCount(4); | 552 return sizeForImmutableStylePropertySetWithPropertyCount(4); |
557 } | 553 } |
558 | 554 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 result.appendLiteral(": "); | 605 result.appendLiteral(": "); |
610 result.append(propertyValue()->cssText()); | 606 result.append(propertyValue()->cssText()); |
611 if (isImportant()) | 607 if (isImportant()) |
612 result.appendLiteral(" !important"); | 608 result.appendLiteral(" !important"); |
613 result.append(';'); | 609 result.append(';'); |
614 return result.toString(); | 610 return result.toString(); |
615 } | 611 } |
616 | 612 |
617 | 613 |
618 } // namespace WebCore | 614 } // namespace WebCore |
OLD | NEW |