| 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 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3430 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); | 3430 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); |
| 3431 } | 3431 } |
| 3432 | 3432 |
| 3433 CSSStyleDeclaration* Element::style() | 3433 CSSStyleDeclaration* Element::style() |
| 3434 { | 3434 { |
| 3435 if (!isStyledElement()) | 3435 if (!isStyledElement()) |
| 3436 return nullptr; | 3436 return nullptr; |
| 3437 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); | 3437 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); |
| 3438 } | 3438 } |
| 3439 | 3439 |
| 3440 StylePropertyMap* Element::styleMap() |
| 3441 { |
| 3442 if (!isStyledElement()) |
| 3443 return nullptr; |
| 3444 return &ensureElementRareData().ensureInlineStylePropertyMap(this); |
| 3445 } |
| 3446 |
| 3440 MutableStylePropertySet& Element::ensureMutableInlineStyle() | 3447 MutableStylePropertySet& Element::ensureMutableInlineStyle() |
| 3441 { | 3448 { |
| 3442 DCHECK(isStyledElement()); | 3449 DCHECK(isStyledElement()); |
| 3443 Member<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt
yle; | 3450 Member<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt
yle; |
| 3444 if (!inlineStyle) { | 3451 if (!inlineStyle) { |
| 3445 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H
TMLQuirksMode : HTMLStandardMode; | 3452 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H
TMLQuirksMode : HTMLStandardMode; |
| 3446 inlineStyle = MutableStylePropertySet::create(mode); | 3453 inlineStyle = MutableStylePropertySet::create(mode); |
| 3447 } else if (!inlineStyle->isMutable()) { | 3454 } else if (!inlineStyle->isMutable()) { |
| 3448 inlineStyle = inlineStyle->mutableCopy(); | 3455 inlineStyle = inlineStyle->mutableCopy(); |
| 3449 } | 3456 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3500 | 3507 |
| 3501 void Element::inlineStyleChanged() | 3508 void Element::inlineStyleChanged() |
| 3502 { | 3509 { |
| 3503 DCHECK(isStyledElement()); | 3510 DCHECK(isStyledElement()); |
| 3504 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(St
yleChangeReason::Inline)); | 3511 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(St
yleChangeReason::Inline)); |
| 3505 DCHECK(elementData()); | 3512 DCHECK(elementData()); |
| 3506 elementData()->m_styleAttributeIsDirty = true; | 3513 elementData()->m_styleAttributeIsDirty = true; |
| 3507 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3514 InspectorInstrumentation::didInvalidateStyleAttr(this); |
| 3508 } | 3515 } |
| 3509 | 3516 |
| 3510 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi
fier, bool important) | 3517 void Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi
fier, bool important) |
| 3518 { |
| 3519 setInlineStyleProperty(propertyID, cssValuePool().createIdentifierValue(iden
tifier), important); |
| 3520 } |
| 3521 |
| 3522 void Element::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSS
PrimitiveValue::UnitType unit, bool important) |
| 3523 { |
| 3524 setInlineStyleProperty(propertyID, cssValuePool().createValue(value, unit),
important); |
| 3525 } |
| 3526 |
| 3527 void Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValue* value,
bool important) |
| 3511 { | 3528 { |
| 3512 DCHECK(isStyledElement()); | 3529 DCHECK(isStyledElement()); |
| 3513 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden
tifierValue(identifier), important); | 3530 ensureMutableInlineStyle().setProperty(propertyID, value, important); |
| 3514 inlineStyleChanged(); | 3531 inlineStyleChanged(); |
| 3515 return true; | |
| 3516 } | |
| 3517 | |
| 3518 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSS
PrimitiveValue::UnitType unit, bool important) | |
| 3519 { | |
| 3520 DCHECK(isStyledElement()); | |
| 3521 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createValu
e(value, unit), important); | |
| 3522 inlineStyleChanged(); | |
| 3523 return true; | |
| 3524 } | 3532 } |
| 3525 | 3533 |
| 3526 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val
ue, bool important) | 3534 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val
ue, bool important) |
| 3527 { | 3535 { |
| 3528 DCHECK(isStyledElement()); | 3536 DCHECK(isStyledElement()); |
| 3529 bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, imp
ortant, document().elementSheet().contents()); | 3537 bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, imp
ortant, document().elementSheet().contents()); |
| 3530 if (changes) | 3538 if (changes) |
| 3531 inlineStyleChanged(); | 3539 inlineStyleChanged(); |
| 3532 return changes; | 3540 return changes; |
| 3533 } | 3541 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3678 | 3686 |
| 3679 DEFINE_TRACE(Element) | 3687 DEFINE_TRACE(Element) |
| 3680 { | 3688 { |
| 3681 if (hasRareData()) | 3689 if (hasRareData()) |
| 3682 visitor->trace(elementRareData()); | 3690 visitor->trace(elementRareData()); |
| 3683 visitor->trace(m_elementData); | 3691 visitor->trace(m_elementData); |
| 3684 ContainerNode::trace(visitor); | 3692 ContainerNode::trace(visitor); |
| 3685 } | 3693 } |
| 3686 | 3694 |
| 3687 } // namespace blink | 3695 } // namespace blink |
| OLD | NEW |