| 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 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3129 CSSStyleDeclaration* Element::style() | 3129 CSSStyleDeclaration* Element::style() |
| 3130 { | 3130 { |
| 3131 if (!isStyledElement()) | 3131 if (!isStyledElement()) |
| 3132 return 0; | 3132 return 0; |
| 3133 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); | 3133 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); |
| 3134 } | 3134 } |
| 3135 | 3135 |
| 3136 MutableStylePropertySet& Element::ensureMutableInlineStyle() | 3136 MutableStylePropertySet& Element::ensureMutableInlineStyle() |
| 3137 { | 3137 { |
| 3138 ASSERT(isStyledElement()); | 3138 ASSERT(isStyledElement()); |
| 3139 RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt
yle; | 3139 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData(
).m_inlineStyle; |
| 3140 if (!inlineStyle) { | 3140 if (!inlineStyle) { |
| 3141 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H
TMLQuirksMode : HTMLStandardMode; | 3141 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H
TMLQuirksMode : HTMLStandardMode; |
| 3142 inlineStyle = MutableStylePropertySet::create(mode); | 3142 inlineStyle = MutableStylePropertySet::create(mode); |
| 3143 } else if (!inlineStyle->isMutable()) { | 3143 } else if (!inlineStyle->isMutable()) { |
| 3144 inlineStyle = inlineStyle->mutableCopy(); | 3144 inlineStyle = inlineStyle->mutableCopy(); |
| 3145 } | 3145 } |
| 3146 return *toMutableStylePropertySet(inlineStyle); | 3146 return *toMutableStylePropertySet(inlineStyle); |
| 3147 } | 3147 } |
| 3148 | 3148 |
| 3149 void Element::clearMutableInlineStyleIfEmpty() | 3149 void Element::clearMutableInlineStyleIfEmpty() |
| 3150 { | 3150 { |
| 3151 if (ensureMutableInlineStyle().isEmpty()) { | 3151 if (ensureMutableInlineStyle().isEmpty()) { |
| 3152 ensureUniqueElementData().m_inlineStyle.clear(); | 3152 ensureUniqueElementData().m_inlineStyle.clear(); |
| 3153 } | 3153 } |
| 3154 } | 3154 } |
| 3155 | 3155 |
| 3156 inline void Element::setInlineStyleFromString(const AtomicString& newStyleString
) | 3156 inline void Element::setInlineStyleFromString(const AtomicString& newStyleString
) |
| 3157 { | 3157 { |
| 3158 ASSERT(isStyledElement()); | 3158 ASSERT(isStyledElement()); |
| 3159 RefPtr<StylePropertySet>& inlineStyle = elementData()->m_inlineStyle; | 3159 RefPtrWillBeMember<StylePropertySet>& inlineStyle = elementData()->m_inlineS
tyle; |
| 3160 | 3160 |
| 3161 // Avoid redundant work if we're using shared attribute data with already pa
rsed inline style. | 3161 // Avoid redundant work if we're using shared attribute data with already pa
rsed inline style. |
| 3162 if (inlineStyle && !elementData()->isUnique()) | 3162 if (inlineStyle && !elementData()->isUnique()) |
| 3163 return; | 3163 return; |
| 3164 | 3164 |
| 3165 // We reconstruct the property set instead of mutating if there is no CSSOM
wrapper. | 3165 // We reconstruct the property set instead of mutating if there is no CSSOM
wrapper. |
| 3166 // This makes wrapperless property sets immutable and so cacheable. | 3166 // This makes wrapperless property sets immutable and so cacheable. |
| 3167 if (inlineStyle && !inlineStyle->isMutable()) | 3167 if (inlineStyle && !inlineStyle->isMutable()) |
| 3168 inlineStyle.clear(); | 3168 inlineStyle.clear(); |
| 3169 | 3169 |
| 3170 if (!inlineStyle) { | 3170 if (!inlineStyle) { |
| 3171 inlineStyle = BisonCSSParser::parseInlineStyleDeclaration(newStyleString
, this); | 3171 inlineStyle = BisonCSSParser::parseInlineStyleDeclaration(newStyleString
, this); |
| 3172 } else { | 3172 } else { |
| 3173 ASSERT(inlineStyle->isMutable()); | 3173 ASSERT(inlineStyle->isMutable()); |
| 3174 static_pointer_cast<MutableStylePropertySet>(inlineStyle)->parseDeclarat
ion(newStyleString, document().elementSheet().contents()); | 3174 static_cast<MutableStylePropertySet*>(inlineStyle.get())->parseDeclarati
on(newStyleString, document().elementSheet().contents()); |
| 3175 } | 3175 } |
| 3176 } | 3176 } |
| 3177 | 3177 |
| 3178 void Element::styleAttributeChanged(const AtomicString& newStyleString, Attribut
eModificationReason modificationReason) | 3178 void Element::styleAttributeChanged(const AtomicString& newStyleString, Attribut
eModificationReason modificationReason) |
| 3179 { | 3179 { |
| 3180 ASSERT(isStyledElement()); | 3180 ASSERT(isStyledElement()); |
| 3181 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); | 3181 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); |
| 3182 if (document().scriptableDocumentParser() && !document().isInDocumentWrite()
) | 3182 if (document().scriptableDocumentParser() && !document().isInDocumentWrite()
) |
| 3183 startLineNumber = document().scriptableDocumentParser()->lineNumber(); | 3183 startLineNumber = document().scriptableDocumentParser()->lineNumber(); |
| 3184 | 3184 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3319 return false; | 3319 return false; |
| 3320 if (FullscreenElementStack::isActiveFullScreenElement(*this)) | 3320 if (FullscreenElementStack::isActiveFullScreenElement(*this)) |
| 3321 return false; | 3321 return false; |
| 3322 return true; | 3322 return true; |
| 3323 } | 3323 } |
| 3324 | 3324 |
| 3325 void Element::trace(Visitor* visitor) | 3325 void Element::trace(Visitor* visitor) |
| 3326 { | 3326 { |
| 3327 if (hasRareData()) | 3327 if (hasRareData()) |
| 3328 visitor->trace(elementRareData()); | 3328 visitor->trace(elementRareData()); |
| 3329 | 3329 visitor->trace(m_elementData); |
| 3330 ContainerNode::trace(visitor); | 3330 ContainerNode::trace(visitor); |
| 3331 } | 3331 } |
| 3332 | 3332 |
| 3333 } // namespace WebCore | 3333 } // namespace WebCore |
| OLD | NEW |