| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3365 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); | 3365 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); |
| 3366 } | 3366 } |
| 3367 | 3367 |
| 3368 CSSStyleDeclaration* Element::style() | 3368 CSSStyleDeclaration* Element::style() |
| 3369 { | 3369 { |
| 3370 if (!isStyledElement()) | 3370 if (!isStyledElement()) |
| 3371 return nullptr; | 3371 return nullptr; |
| 3372 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); | 3372 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); |
| 3373 } | 3373 } |
| 3374 | 3374 |
| 3375 StylePropertyMap* Element::styleMap() |
| 3376 { |
| 3377 if (!isStyledElement()) |
| 3378 return nullptr; |
| 3379 return &ensureElementRareData().ensureInlineStylePropertyMap(this); |
| 3380 } |
| 3381 |
| 3375 MutableStylePropertySet& Element::ensureMutableInlineStyle() | 3382 MutableStylePropertySet& Element::ensureMutableInlineStyle() |
| 3376 { | 3383 { |
| 3377 ASSERT(isStyledElement()); | 3384 ASSERT(isStyledElement()); |
| 3378 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData(
).m_inlineStyle; | 3385 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData(
).m_inlineStyle; |
| 3379 if (!inlineStyle) { | 3386 if (!inlineStyle) { |
| 3380 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H
TMLQuirksMode : HTMLStandardMode; | 3387 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H
TMLQuirksMode : HTMLStandardMode; |
| 3381 inlineStyle = MutableStylePropertySet::create(mode); | 3388 inlineStyle = MutableStylePropertySet::create(mode); |
| 3382 } else if (!inlineStyle->isMutable()) { | 3389 } else if (!inlineStyle->isMutable()) { |
| 3383 inlineStyle = inlineStyle->mutableCopy(); | 3390 inlineStyle = inlineStyle->mutableCopy(); |
| 3384 } | 3391 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3460 | 3467 |
| 3461 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val
ue, bool important) | 3468 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val
ue, bool important) |
| 3462 { | 3469 { |
| 3463 ASSERT(isStyledElement()); | 3470 ASSERT(isStyledElement()); |
| 3464 bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, imp
ortant, document().elementSheet().contents()); | 3471 bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, imp
ortant, document().elementSheet().contents()); |
| 3465 if (changes) | 3472 if (changes) |
| 3466 inlineStyleChanged(); | 3473 inlineStyleChanged(); |
| 3467 return changes; | 3474 return changes; |
| 3468 } | 3475 } |
| 3469 | 3476 |
| 3477 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const PassRefPtrW
illBeRawPtr<CSSValue> value, bool important) |
| 3478 { |
| 3479 ASSERT(isStyledElement()); |
| 3480 ensureMutableInlineStyle().setProperty(propertyID, value); |
| 3481 inlineStyleChanged(); |
| 3482 return true; |
| 3483 } |
| 3484 |
| 3470 bool Element::removeInlineStyleProperty(CSSPropertyID propertyID) | 3485 bool Element::removeInlineStyleProperty(CSSPropertyID propertyID) |
| 3471 { | 3486 { |
| 3472 ASSERT(isStyledElement()); | 3487 ASSERT(isStyledElement()); |
| 3473 if (!inlineStyle()) | 3488 if (!inlineStyle()) |
| 3474 return false; | 3489 return false; |
| 3475 bool changes = ensureMutableInlineStyle().removeProperty(propertyID); | 3490 bool changes = ensureMutableInlineStyle().removeProperty(propertyID); |
| 3476 if (changes) | 3491 if (changes) |
| 3477 inlineStyleChanged(); | 3492 inlineStyleChanged(); |
| 3478 return changes; | 3493 return changes; |
| 3479 } | 3494 } |
| 3480 | 3495 |
| 3481 void Element::removeAllInlineStyleProperties() | 3496 void Element::removeAllInlineStyleProperties() |
| 3482 { | 3497 { |
| 3483 ASSERT(isStyledElement()); | 3498 ASSERT(isStyledElement()); |
| 3484 if (!inlineStyle()) | 3499 if (!inlineStyle()) |
| 3485 return; | 3500 return; |
| 3486 ensureMutableInlineStyle().clear(); | 3501 ensureMutableInlineStyle().clear(); |
| 3487 inlineStyleChanged(); | 3502 inlineStyleChanged(); |
| 3488 } | 3503 } |
| 3489 | 3504 |
| 3490 void Element::updatePresentationAttributeStyle() | 3505 void Element::updatePresentationAttributeStyle() |
| 3491 { | 3506 { |
| 3492 synchronizeAllAttributes(); | 3507 synchronizeAllAttributes(); |
| 3493 // ShareableElementData doesn't store presentation attribute style, so make
sure we have a UniqueElementData. | 3508 // ShareableElementData doesn't store presentation attribute style, so make
sure we have a UniqueElementData. |
| 3494 UniqueElementData& elementData = ensureUniqueElementData(); | 3509 UniqueElementData& elementData = ensureUniqueElementData(); |
| 3495 elementData.m_presentationAttributeStyleIsDirty = false; | 3510 elementData.m_presentationAttributeStyleIsDirty = false; |
| 3496 elementData.m_presentationAttributeStyle = computePresentationAttributeStyle
(*this); | 3511 elementData.m_presentationAttributeStyle = computePresentationAttributeStyle
(*this); |
| 3497 } | 3512 } |
| 3498 | 3513 |
| 3514 void Element::invalidateInlineStylePropertyMap() |
| 3515 { |
| 3516 if (!hasRareData()) |
| 3517 return; |
| 3518 ElementRareData* rareData = elementRareData(); |
| 3519 InlineStylePropertyMap* inlineStylePropertyMap = rareData->inlineStyleProper
tyMap(); |
| 3520 if (!inlineStylePropertyMap) { |
| 3521 // If it doesn't exist, it isn't being used, so nothing to do. |
| 3522 return; |
| 3523 } |
| 3524 |
| 3525 inlineStylePropertyMap->invalidate(); |
| 3526 } |
| 3527 |
| 3499 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s
tyle, CSSPropertyID propertyID, CSSValueID identifier) | 3528 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s
tyle, CSSPropertyID propertyID, CSSValueID identifier) |
| 3500 { | 3529 { |
| 3501 ASSERT(isStyledElement()); | 3530 ASSERT(isStyledElement()); |
| 3502 style->setProperty(propertyID, cssValuePool().createIdentifierValue(identifi
er)); | 3531 style->setProperty(propertyID, cssValuePool().createIdentifierValue(identifi
er)); |
| 3503 } | 3532 } |
| 3504 | 3533 |
| 3505 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s
tyle, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit) | 3534 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s
tyle, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit) |
| 3506 { | 3535 { |
| 3507 ASSERT(isStyledElement()); | 3536 ASSERT(isStyledElement()); |
| 3508 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); | 3537 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3615 { | 3644 { |
| 3616 #if ENABLE(OILPAN) | 3645 #if ENABLE(OILPAN) |
| 3617 if (hasRareData()) | 3646 if (hasRareData()) |
| 3618 visitor->trace(elementRareData()); | 3647 visitor->trace(elementRareData()); |
| 3619 visitor->trace(m_elementData); | 3648 visitor->trace(m_elementData); |
| 3620 #endif | 3649 #endif |
| 3621 ContainerNode::trace(visitor); | 3650 ContainerNode::trace(visitor); |
| 3622 } | 3651 } |
| 3623 | 3652 |
| 3624 } // namespace blink | 3653 } // namespace blink |
| OLD | NEW |