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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu
ment) | 190 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu
ment) |
191 { | 191 { |
192 return adoptRef(new Element(tagName, document, CreateElement)); | 192 return adoptRef(new Element(tagName, document, CreateElement)); |
193 } | 193 } |
194 | 194 |
195 Element::~Element() | 195 Element::~Element() |
196 { | 196 { |
197 #ifndef NDEBUG | 197 #ifndef NDEBUG |
198 if (document() && document()->renderer()) { | 198 if (document()->renderer()) { |
199 // When the document is not destroyed, an element that was part of a nam
ed flow | 199 // When the document is not destroyed, an element that was part of a nam
ed flow |
200 // content nodes should have been removed from the content nodes collect
ion | 200 // content nodes should have been removed from the content nodes collect
ion |
201 // and the inNamedFlow flag reset. | 201 // and the inNamedFlow flag reset. |
202 ASSERT(!inNamedFlow()); | 202 ASSERT(!inNamedFlow()); |
203 } | 203 } |
204 #endif | 204 #endif |
205 | 205 |
206 if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapper()
) | 206 if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapper()
) |
207 cssomWrapper->clearParentElement(); | 207 cssomWrapper->clearParentElement(); |
208 | 208 |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1119 |
1120 void Element::parserSetAttributes(const Vector<Attribute>& attributeVector) | 1120 void Element::parserSetAttributes(const Vector<Attribute>& attributeVector) |
1121 { | 1121 { |
1122 ASSERT(!inDocument()); | 1122 ASSERT(!inDocument()); |
1123 ASSERT(!parentNode()); | 1123 ASSERT(!parentNode()); |
1124 ASSERT(!m_elementData); | 1124 ASSERT(!m_elementData); |
1125 | 1125 |
1126 if (attributeVector.isEmpty()) | 1126 if (attributeVector.isEmpty()) |
1127 return; | 1127 return; |
1128 | 1128 |
1129 if (document() && document()->sharedObjectPool()) | 1129 if (document()->sharedObjectPool()) |
1130 m_elementData = document()->sharedObjectPool()->cachedShareableElementDa
taWithAttributes(attributeVector); | 1130 m_elementData = document()->sharedObjectPool()->cachedShareableElementDa
taWithAttributes(attributeVector); |
1131 else | 1131 else |
1132 m_elementData = ShareableElementData::createWithAttributes(attributeVect
or); | 1132 m_elementData = ShareableElementData::createWithAttributes(attributeVect
or); |
1133 | 1133 |
1134 // Use attributeVector instead of m_elementData because attributeChanged mig
ht modify m_elementData. | 1134 // Use attributeVector instead of m_elementData because attributeChanged mig
ht modify m_elementData. |
1135 for (unsigned i = 0; i < attributeVector.size(); ++i) | 1135 for (unsigned i = 0; i < attributeVector.size(); ++i) |
1136 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu
teVector[i].value(), ModifiedDirectly); | 1136 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu
teVector[i].value(), ModifiedDirectly); |
1137 } | 1137 } |
1138 | 1138 |
1139 bool Element::hasAttributes() const | 1139 bool Element::hasAttributes() const |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3230 } else { | 3230 } else { |
3231 ASSERT(inlineStyle->isMutable()); | 3231 ASSERT(inlineStyle->isMutable()); |
3232 static_pointer_cast<MutableStylePropertySet>(inlineStyle)->parseDeclarat
ion(newStyleString, document()->elementSheet()->contents()); | 3232 static_pointer_cast<MutableStylePropertySet>(inlineStyle)->parseDeclarat
ion(newStyleString, document()->elementSheet()->contents()); |
3233 } | 3233 } |
3234 } | 3234 } |
3235 | 3235 |
3236 void Element::styleAttributeChanged(const AtomicString& newStyleString, Attribut
eModificationReason modificationReason) | 3236 void Element::styleAttributeChanged(const AtomicString& newStyleString, Attribut
eModificationReason modificationReason) |
3237 { | 3237 { |
3238 ASSERT(isStyledElement()); | 3238 ASSERT(isStyledElement()); |
3239 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); | 3239 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); |
3240 if (document() && document()->scriptableDocumentParser() && !document()->isI
nDocumentWrite()) | 3240 if (document()->scriptableDocumentParser() && !document()->isInDocumentWrite
()) |
3241 startLineNumber = document()->scriptableDocumentParser()->lineNumber(); | 3241 startLineNumber = document()->scriptableDocumentParser()->lineNumber(); |
3242 | 3242 |
3243 if (newStyleString.isNull()) { | 3243 if (newStyleString.isNull()) { |
3244 if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapp
er()) | 3244 if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapp
er()) |
3245 cssomWrapper->clearParentElement(); | 3245 cssomWrapper->clearParentElement(); |
3246 ensureUniqueElementData()->m_inlineStyle.clear(); | 3246 ensureUniqueElementData()->m_inlineStyle.clear(); |
3247 } else if (modificationReason == ModifiedByCloning || document()->contentSec
urityPolicy()->allowInlineStyle(document()->url(), startLineNumber)) { | 3247 } else if (modificationReason == ModifiedByCloning || document()->contentSec
urityPolicy()->allowInlineStyle(document()->url(), startLineNumber)) { |
3248 setInlineStyleFromString(newStyleString); | 3248 setInlineStyleFromString(newStyleString); |
3249 } | 3249 } |
3250 | 3250 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3634 return 0; | 3634 return 0; |
3635 } | 3635 } |
3636 | 3636 |
3637 Attribute* UniqueElementData::attributeItem(unsigned index) | 3637 Attribute* UniqueElementData::attributeItem(unsigned index) |
3638 { | 3638 { |
3639 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3639 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
3640 return &m_attributeVector.at(index); | 3640 return &m_attributeVector.at(index); |
3641 } | 3641 } |
3642 | 3642 |
3643 } // namespace WebCore | 3643 } // namespace WebCore |
OLD | NEW |