Chromium Code Reviews| 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 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3412 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); | 3412 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); |
| 3413 } | 3413 } |
| 3414 | 3414 |
| 3415 CSSStyleDeclaration* Element::style() | 3415 CSSStyleDeclaration* Element::style() |
| 3416 { | 3416 { |
| 3417 if (!isStyledElement()) | 3417 if (!isStyledElement()) |
| 3418 return nullptr; | 3418 return nullptr; |
| 3419 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); | 3419 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); |
| 3420 } | 3420 } |
| 3421 | 3421 |
| 3422 StylePropertyMap* Element::styleMap() | |
| 3423 { | |
| 3424 if (!isStyledElement()) | |
| 3425 return nullptr; | |
| 3426 return &ensureElementRareData().ensureInlineStylePropertyMap(this); | |
| 3427 } | |
| 3428 | |
| 3422 MutableStylePropertySet& Element::ensureMutableInlineStyle() | 3429 MutableStylePropertySet& Element::ensureMutableInlineStyle() |
| 3423 { | 3430 { |
| 3424 ASSERT(isStyledElement()); | 3431 ASSERT(isStyledElement()); |
| 3425 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData( ).m_inlineStyle; | 3432 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData( ).m_inlineStyle; |
| 3426 if (!inlineStyle) { | 3433 if (!inlineStyle) { |
| 3427 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode; | 3434 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode; |
| 3428 inlineStyle = MutableStylePropertySet::create(mode); | 3435 inlineStyle = MutableStylePropertySet::create(mode); |
| 3429 } else if (!inlineStyle->isMutable()) { | 3436 } else if (!inlineStyle->isMutable()) { |
| 3430 inlineStyle = inlineStyle->mutableCopy(); | 3437 inlineStyle = inlineStyle->mutableCopy(); |
| 3431 } | 3438 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3507 | 3514 |
| 3508 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val ue, bool important) | 3515 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val ue, bool important) |
| 3509 { | 3516 { |
| 3510 ASSERT(isStyledElement()); | 3517 ASSERT(isStyledElement()); |
| 3511 bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, imp ortant, document().elementSheet().contents()); | 3518 bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, imp ortant, document().elementSheet().contents()); |
| 3512 if (changes) | 3519 if (changes) |
| 3513 inlineStyleChanged(); | 3520 inlineStyleChanged(); |
| 3514 return changes; | 3521 return changes; |
| 3515 } | 3522 } |
| 3516 | 3523 |
| 3524 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const PassRefPtrW illBeRawPtr<CSSValue> value, bool important) | |
|
Timothy Loh
2016/03/23 03:45:09
To save some copy paste and make this patch a litt
meade_UTC10
2016/03/29 06:27:37
Done.
| |
| 3525 { | |
| 3526 ASSERT(isStyledElement()); | |
| 3527 ensureMutableInlineStyle().setProperty(propertyID, value); | |
|
Timothy Loh
2016/03/23 03:45:09
Missing important argument
meade_UTC10
2016/03/29 06:27:37
Done.
| |
| 3528 inlineStyleChanged(); | |
| 3529 return true; | |
| 3530 } | |
| 3531 | |
| 3517 bool Element::removeInlineStyleProperty(CSSPropertyID propertyID) | 3532 bool Element::removeInlineStyleProperty(CSSPropertyID propertyID) |
| 3518 { | 3533 { |
| 3519 ASSERT(isStyledElement()); | 3534 ASSERT(isStyledElement()); |
| 3520 if (!inlineStyle()) | 3535 if (!inlineStyle()) |
| 3521 return false; | 3536 return false; |
| 3522 bool changes = ensureMutableInlineStyle().removeProperty(propertyID); | 3537 bool changes = ensureMutableInlineStyle().removeProperty(propertyID); |
| 3523 if (changes) | 3538 if (changes) |
| 3524 inlineStyleChanged(); | 3539 inlineStyleChanged(); |
| 3525 return changes; | 3540 return changes; |
| 3526 } | 3541 } |
| 3527 | 3542 |
| 3528 void Element::removeAllInlineStyleProperties() | 3543 void Element::removeAllInlineStyleProperties() |
| 3529 { | 3544 { |
| 3530 ASSERT(isStyledElement()); | 3545 ASSERT(isStyledElement()); |
| 3531 if (!inlineStyle()) | 3546 if (!inlineStyle()) |
| 3532 return; | 3547 return; |
| 3533 ensureMutableInlineStyle().clear(); | 3548 ensureMutableInlineStyle().clear(); |
| 3534 inlineStyleChanged(); | 3549 inlineStyleChanged(); |
| 3535 } | 3550 } |
| 3536 | 3551 |
| 3537 void Element::updatePresentationAttributeStyle() | 3552 void Element::updatePresentationAttributeStyle() |
| 3538 { | 3553 { |
| 3539 synchronizeAllAttributes(); | 3554 synchronizeAllAttributes(); |
| 3540 // ShareableElementData doesn't store presentation attribute style, so make sure we have a UniqueElementData. | 3555 // ShareableElementData doesn't store presentation attribute style, so make sure we have a UniqueElementData. |
| 3541 UniqueElementData& elementData = ensureUniqueElementData(); | 3556 UniqueElementData& elementData = ensureUniqueElementData(); |
| 3542 elementData.m_presentationAttributeStyleIsDirty = false; | 3557 elementData.m_presentationAttributeStyleIsDirty = false; |
| 3543 elementData.m_presentationAttributeStyle = computePresentationAttributeStyle (*this); | 3558 elementData.m_presentationAttributeStyle = computePresentationAttributeStyle (*this); |
| 3544 } | 3559 } |
| 3545 | 3560 |
| 3561 void Element::invalidateInlineStylePropertyMap() | |
| 3562 { | |
| 3563 if (!hasRareData()) | |
| 3564 return; | |
| 3565 ElementRareData* rareData = elementRareData(); | |
| 3566 InlineStylePropertyMap* inlineStylePropertyMap = rareData->inlineStyleProper tyMap(); | |
| 3567 if (!inlineStylePropertyMap) { | |
| 3568 // If it doesn't exist, it isn't being used, so nothing to do. | |
| 3569 return; | |
| 3570 } | |
| 3571 | |
| 3572 inlineStylePropertyMap->invalidate(); | |
| 3573 } | |
| 3574 | |
| 3546 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, CSSValueID identifier) | 3575 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, CSSValueID identifier) |
| 3547 { | 3576 { |
| 3548 ASSERT(isStyledElement()); | 3577 ASSERT(isStyledElement()); |
| 3549 style->setProperty(propertyID, cssValuePool().createIdentifierValue(identifi er)); | 3578 style->setProperty(propertyID, cssValuePool().createIdentifierValue(identifi er)); |
| 3550 } | 3579 } |
| 3551 | 3580 |
| 3552 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit) | 3581 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitType unit) |
| 3553 { | 3582 { |
| 3554 ASSERT(isStyledElement()); | 3583 ASSERT(isStyledElement()); |
| 3555 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); | 3584 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3662 { | 3691 { |
| 3663 #if ENABLE(OILPAN) | 3692 #if ENABLE(OILPAN) |
| 3664 if (hasRareData()) | 3693 if (hasRareData()) |
| 3665 visitor->trace(elementRareData()); | 3694 visitor->trace(elementRareData()); |
| 3666 visitor->trace(m_elementData); | 3695 visitor->trace(m_elementData); |
| 3667 #endif | 3696 #endif |
| 3668 ContainerNode::trace(visitor); | 3697 ContainerNode::trace(visitor); |
| 3669 } | 3698 } |
| 3670 | 3699 |
| 3671 } // namespace blink | 3700 } // namespace blink |
| OLD | NEW |