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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 | 272 |
273 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithoutAttributesAndChildre
n() | 273 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithoutAttributesAndChildre
n() |
274 { | 274 { |
275 return document().createElement(tagQName(), false); | 275 return document().createElement(tagQName(), false); |
276 } | 276 } |
277 | 277 |
278 PassRefPtrWillBeRawPtr<Attr> Element::detachAttribute(size_t index) | 278 PassRefPtrWillBeRawPtr<Attr> Element::detachAttribute(size_t index) |
279 { | 279 { |
280 ASSERT(elementData()); | 280 ASSERT(elementData()); |
281 const Attribute& attribute = elementData()->attributeAt(index); | 281 const Attribute& attribute = elementData()->attributes().at(index); |
282 RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(attribute.name()); | 282 RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(attribute.name()); |
283 if (attrNode) | 283 if (attrNode) |
284 detachAttrNodeAtIndex(attrNode.get(), index); | 284 detachAttrNodeAtIndex(attrNode.get(), index); |
285 else { | 285 else { |
286 attrNode = Attr::create(document(), attribute.name(), attribute.value())
; | 286 attrNode = Attr::create(document(), attribute.name(), attribute.value())
; |
287 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); | 287 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); |
288 } | 288 } |
289 return attrNode.release(); | 289 return attrNode.release(); |
290 } | 290 } |
291 | 291 |
292 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index) | 292 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index) |
293 { | 293 { |
294 ASSERT(attr); | 294 ASSERT(attr); |
295 ASSERT(elementData()); | 295 ASSERT(elementData()); |
296 | 296 |
297 const Attribute& attribute = elementData()->attributeAt(index); | 297 const Attribute& attribute = elementData()->attributes().at(index); |
298 ASSERT(attribute.name() == attr->qualifiedName()); | 298 ASSERT(attribute.name() == attr->qualifiedName()); |
299 detachAttrNodeFromElementWithValue(attr, attribute.value()); | 299 detachAttrNodeFromElementWithValue(attr, attribute.value()); |
300 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); | 300 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); |
301 } | 301 } |
302 | 302 |
303 void Element::removeAttribute(const QualifiedName& name) | 303 void Element::removeAttribute(const QualifiedName& name) |
304 { | 304 { |
305 if (!elementData()) | 305 if (!elementData()) |
306 return; | 306 return; |
307 | 307 |
308 size_t index = elementData()->findAttributeIndexByName(name); | 308 size_t index = elementData()->attributes().findIndex(name); |
309 if (index == kNotFound) | 309 if (index == kNotFound) |
310 return; | 310 return; |
311 | 311 |
312 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); | 312 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); |
313 } | 313 } |
314 | 314 |
315 void Element::setBooleanAttribute(const QualifiedName& name, bool value) | 315 void Element::setBooleanAttribute(const QualifiedName& name, bool value) |
316 { | 316 { |
317 if (value) | 317 if (value) |
318 setAttribute(name, emptyAtom); | 318 setAttribute(name, emptyAtom); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 return IntRect(); | 873 return IntRect(); |
874 // FIXME: this should probably respect transforms | 874 // FIXME: this should probably respect transforms |
875 return document().view()->contentsToScreen(renderer()->absoluteBoundingBoxRe
ctIgnoringTransforms()); | 875 return document().view()->contentsToScreen(renderer()->absoluteBoundingBoxRe
ctIgnoringTransforms()); |
876 } | 876 } |
877 | 877 |
878 const AtomicString& Element::getAttribute(const AtomicString& localName) const | 878 const AtomicString& Element::getAttribute(const AtomicString& localName) const |
879 { | 879 { |
880 if (!elementData()) | 880 if (!elementData()) |
881 return nullAtom; | 881 return nullAtom; |
882 synchronizeAttribute(localName); | 882 synchronizeAttribute(localName); |
883 if (const Attribute* attribute = elementData()->findAttributeByName(localNam
e, shouldIgnoreAttributeCase())) | 883 if (const Attribute* attribute = elementData()->attributes().find(localName,
shouldIgnoreAttributeCase())) |
884 return attribute->value(); | 884 return attribute->value(); |
885 return nullAtom; | 885 return nullAtom; |
886 } | 886 } |
887 | 887 |
888 const AtomicString& Element::getAttributeNS(const AtomicString& namespaceURI, co
nst AtomicString& localName) const | 888 const AtomicString& Element::getAttributeNS(const AtomicString& namespaceURI, co
nst AtomicString& localName) const |
889 { | 889 { |
890 return getAttribute(QualifiedName(nullAtom, localName, namespaceURI)); | 890 return getAttribute(QualifiedName(nullAtom, localName, namespaceURI)); |
891 } | 891 } |
892 | 892 |
893 void Element::setAttribute(const AtomicString& localName, const AtomicString& va
lue, ExceptionState& exceptionState) | 893 void Element::setAttribute(const AtomicString& localName, const AtomicString& va
lue, ExceptionState& exceptionState) |
894 { | 894 { |
895 if (!Document::isValidName(localName)) { | 895 if (!Document::isValidName(localName)) { |
896 exceptionState.throwDOMException(InvalidCharacterError, "'" + localName
+ "' is not a valid attribute name."); | 896 exceptionState.throwDOMException(InvalidCharacterError, "'" + localName
+ "' is not a valid attribute name."); |
897 return; | 897 return; |
898 } | 898 } |
899 | 899 |
900 synchronizeAttribute(localName); | 900 synchronizeAttribute(localName); |
901 const AtomicString& caseAdjustedLocalName = shouldIgnoreAttributeCase() ? lo
calName.lower() : localName; | 901 const AtomicString& caseAdjustedLocalName = shouldIgnoreAttributeCase() ? lo
calName.lower() : localName; |
902 | 902 |
903 size_t index = elementData() ? elementData()->findAttributeIndexByName(caseA
djustedLocalName, false) : kNotFound; | 903 if (!elementData()) { |
904 const QualifiedName& qName = index != kNotFound ? attributeAt(index).name()
: QualifiedName(nullAtom, caseAdjustedLocalName, nullAtom); | 904 setAttributeInternal(kNotFound, QualifiedName(nullAtom, caseAdjustedLoca
lName, nullAtom), value, NotInSynchronizationOfLazyAttribute); |
| 905 return; |
| 906 } |
| 907 |
| 908 AttributeCollection attributes = elementData()->attributes(); |
| 909 size_t index = attributes.findIndex(caseAdjustedLocalName, false); |
| 910 const QualifiedName& qName = index != kNotFound ? attributes[index].name() :
QualifiedName(nullAtom, caseAdjustedLocalName, nullAtom); |
905 setAttributeInternal(index, qName, value, NotInSynchronizationOfLazyAttribut
e); | 911 setAttributeInternal(index, qName, value, NotInSynchronizationOfLazyAttribut
e); |
906 } | 912 } |
907 | 913 |
908 void Element::setAttribute(const QualifiedName& name, const AtomicString& value) | 914 void Element::setAttribute(const QualifiedName& name, const AtomicString& value) |
909 { | 915 { |
910 synchronizeAttribute(name); | 916 synchronizeAttribute(name); |
911 size_t index = elementData() ? elementData()->findAttributeIndexByName(name)
: kNotFound; | 917 size_t index = elementData() ? elementData()->attributes().findIndex(name) :
kNotFound; |
912 setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute
); | 918 setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute
); |
913 } | 919 } |
914 | 920 |
915 void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const Atom
icString& value) | 921 void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const Atom
icString& value) |
916 { | 922 { |
917 size_t index = elementData() ? elementData()->findAttributeIndexByName(name)
: kNotFound; | 923 size_t index = elementData() ? elementData()->attributes().findIndex(name) :
kNotFound; |
918 setAttributeInternal(index, name, value, InSynchronizationOfLazyAttribute); | 924 setAttributeInternal(index, name, value, InSynchronizationOfLazyAttribute); |
919 } | 925 } |
920 | 926 |
921 ALWAYS_INLINE void Element::setAttributeInternal(size_t index, const QualifiedNa
me& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchro
nizationOfLazyAttribute) | 927 ALWAYS_INLINE void Element::setAttributeInternal(size_t index, const QualifiedNa
me& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchro
nizationOfLazyAttribute) |
922 { | 928 { |
923 if (newValue.isNull()) { | 929 if (newValue.isNull()) { |
924 if (index != kNotFound) | 930 if (index != kNotFound) |
925 removeAttributeInternal(index, inSynchronizationOfLazyAttribute); | 931 removeAttributeInternal(index, inSynchronizationOfLazyAttribute); |
926 return; | 932 return; |
927 } | 933 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 m_elementData = ShareableElementData::createWithAttributes(attributeVect
or); | 1158 m_elementData = ShareableElementData::createWithAttributes(attributeVect
or); |
1153 | 1159 |
1154 // Use attributeVector instead of m_elementData because attributeChanged mig
ht modify m_elementData. | 1160 // Use attributeVector instead of m_elementData because attributeChanged mig
ht modify m_elementData. |
1155 for (unsigned i = 0; i < attributeVector.size(); ++i) | 1161 for (unsigned i = 0; i < attributeVector.size(); ++i) |
1156 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu
teVector[i].value(), ModifiedDirectly); | 1162 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu
teVector[i].value(), ModifiedDirectly); |
1157 } | 1163 } |
1158 | 1164 |
1159 bool Element::hasAttributes() const | 1165 bool Element::hasAttributes() const |
1160 { | 1166 { |
1161 synchronizeAllAttributes(); | 1167 synchronizeAllAttributes(); |
1162 return elementData() && elementData()->hasAttributes(); | 1168 return elementData() && !elementData()->attributes().isEmpty(); |
1163 } | 1169 } |
1164 | 1170 |
1165 bool Element::hasEquivalentAttributes(const Element* other) const | 1171 bool Element::hasEquivalentAttributes(const Element* other) const |
1166 { | 1172 { |
1167 synchronizeAllAttributes(); | 1173 synchronizeAllAttributes(); |
1168 other->synchronizeAllAttributes(); | 1174 other->synchronizeAllAttributes(); |
1169 if (elementData() == other->elementData()) | 1175 if (elementData() == other->elementData()) |
1170 return true; | 1176 return true; |
1171 if (elementData()) | 1177 if (elementData()) |
1172 return elementData()->isEquivalent(other->elementData()); | 1178 return elementData()->isEquivalent(other->elementData()); |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 // InUseAttributeError: Raised if node is an Attr that is already an attribu
te of another Element object. | 1876 // InUseAttributeError: Raised if node is an Attr that is already an attribu
te of another Element object. |
1871 // The DOM user must explicitly clone Attr nodes to re-use them in other ele
ments. | 1877 // The DOM user must explicitly clone Attr nodes to re-use them in other ele
ments. |
1872 if (attrNode->ownerElement()) { | 1878 if (attrNode->ownerElement()) { |
1873 exceptionState.throwDOMException(InUseAttributeError, "The node provided
is an attribute node that is already an attribute of another Element; attribute
nodes must be explicitly cloned."); | 1879 exceptionState.throwDOMException(InUseAttributeError, "The node provided
is an attribute node that is already an attribute of another Element; attribute
nodes must be explicitly cloned."); |
1874 return nullptr; | 1880 return nullptr; |
1875 } | 1881 } |
1876 | 1882 |
1877 synchronizeAllAttributes(); | 1883 synchronizeAllAttributes(); |
1878 UniqueElementData& elementData = ensureUniqueElementData(); | 1884 UniqueElementData& elementData = ensureUniqueElementData(); |
1879 | 1885 |
1880 size_t index = elementData.findAttributeIndexByName(attrNode->qualifiedName(
), shouldIgnoreAttributeCase()); | 1886 AttributeCollection attributes = elementData.attributes(); |
| 1887 size_t index = attributes.findIndex(attrNode->qualifiedName(), shouldIgnoreA
ttributeCase()); |
1881 AtomicString localName; | 1888 AtomicString localName; |
1882 if (index != kNotFound) { | 1889 if (index != kNotFound) { |
1883 const Attribute& attr = elementData.attributeAt(index); | 1890 const Attribute& attr = attributes[index]; |
1884 | 1891 |
1885 // If the name of the ElementData attribute doesn't | 1892 // If the name of the ElementData attribute doesn't |
1886 // (case-sensitively) match that of the Attr node, record it | 1893 // (case-sensitively) match that of the Attr node, record it |
1887 // on the Attr so that it can correctly resolve the value on | 1894 // on the Attr so that it can correctly resolve the value on |
1888 // the Element. | 1895 // the Element. |
1889 if (!attr.name().matches(attrNode->qualifiedName())) | 1896 if (!attr.name().matches(attrNode->qualifiedName())) |
1890 localName = attr.localName(); | 1897 localName = attr.localName(); |
1891 | 1898 |
1892 if (oldAttrNode) { | 1899 if (oldAttrNode) { |
1893 detachAttrNodeFromElementWithValue(oldAttrNode.get(), attr.value()); | 1900 detachAttrNodeFromElementWithValue(oldAttrNode.get(), attr.value()); |
(...skipping 28 matching lines...) Expand all Loading... |
1922 } | 1929 } |
1923 if (attr->ownerElement() != this) { | 1930 if (attr->ownerElement() != this) { |
1924 exceptionState.throwDOMException(NotFoundError, "The node provided is ow
ned by another element."); | 1931 exceptionState.throwDOMException(NotFoundError, "The node provided is ow
ned by another element."); |
1925 return nullptr; | 1932 return nullptr; |
1926 } | 1933 } |
1927 | 1934 |
1928 ASSERT(document() == attr->document()); | 1935 ASSERT(document() == attr->document()); |
1929 | 1936 |
1930 synchronizeAttribute(attr->qualifiedName()); | 1937 synchronizeAttribute(attr->qualifiedName()); |
1931 | 1938 |
1932 size_t index = elementData()->findAttrNodeIndex(attr); | 1939 size_t index = elementData()->attributes().findIndex(attr); |
1933 if (index == kNotFound) { | 1940 if (index == kNotFound) { |
1934 exceptionState.throwDOMException(NotFoundError, "The attribute was not f
ound on this element."); | 1941 exceptionState.throwDOMException(NotFoundError, "The attribute was not f
ound on this element."); |
1935 return nullptr; | 1942 return nullptr; |
1936 } | 1943 } |
1937 | 1944 |
1938 RefPtrWillBeRawPtr<Attr> guard(attr); | 1945 RefPtrWillBeRawPtr<Attr> guard(attr); |
1939 detachAttrNodeAtIndex(attr, index); | 1946 detachAttrNodeAtIndex(attr, index); |
1940 return guard.release(); | 1947 return guard.release(); |
1941 } | 1948 } |
1942 | 1949 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 if (!inSynchronizationOfLazyAttribute) | 2022 if (!inSynchronizationOfLazyAttribute) |
2016 didAddAttribute(name, value); | 2023 didAddAttribute(name, value); |
2017 } | 2024 } |
2018 | 2025 |
2019 void Element::removeAttribute(const AtomicString& name) | 2026 void Element::removeAttribute(const AtomicString& name) |
2020 { | 2027 { |
2021 if (!elementData()) | 2028 if (!elementData()) |
2022 return; | 2029 return; |
2023 | 2030 |
2024 AtomicString localName = shouldIgnoreAttributeCase() ? name.lower() : name; | 2031 AtomicString localName = shouldIgnoreAttributeCase() ? name.lower() : name; |
2025 size_t index = elementData()->findAttributeIndexByName(localName, false); | 2032 size_t index = elementData()->attributes().findIndex(localName, false); |
2026 if (index == kNotFound) { | 2033 if (index == kNotFound) { |
2027 if (UNLIKELY(localName == styleAttr) && elementData()->m_styleAttributeI
sDirty && isStyledElement()) | 2034 if (UNLIKELY(localName == styleAttr) && elementData()->m_styleAttributeI
sDirty && isStyledElement()) |
2028 removeAllInlineStyleProperties(); | 2035 removeAllInlineStyleProperties(); |
2029 return; | 2036 return; |
2030 } | 2037 } |
2031 | 2038 |
2032 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); | 2039 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); |
2033 } | 2040 } |
2034 | 2041 |
2035 void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt
ring& localName) | 2042 void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt
ring& localName) |
2036 { | 2043 { |
2037 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI)); | 2044 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI)); |
2038 } | 2045 } |
2039 | 2046 |
2040 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNode(const AtomicString& local
Name) | 2047 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNode(const AtomicString& local
Name) |
2041 { | 2048 { |
2042 if (!elementData()) | 2049 if (!elementData()) |
2043 return nullptr; | 2050 return nullptr; |
2044 synchronizeAttribute(localName); | 2051 synchronizeAttribute(localName); |
2045 const Attribute* attribute = elementData()->findAttributeByName(localName, s
houldIgnoreAttributeCase()); | 2052 const Attribute* attribute = elementData()->attributes().find(localName, sho
uldIgnoreAttributeCase()); |
2046 if (!attribute) | 2053 if (!attribute) |
2047 return nullptr; | 2054 return nullptr; |
2048 return ensureAttr(attribute->name()); | 2055 return ensureAttr(attribute->name()); |
2049 } | 2056 } |
2050 | 2057 |
2051 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNodeNS(const AtomicString& nam
espaceURI, const AtomicString& localName) | 2058 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNodeNS(const AtomicString& nam
espaceURI, const AtomicString& localName) |
2052 { | 2059 { |
2053 if (!elementData()) | 2060 if (!elementData()) |
2054 return nullptr; | 2061 return nullptr; |
2055 QualifiedName qName(nullAtom, localName, namespaceURI); | 2062 QualifiedName qName(nullAtom, localName, namespaceURI); |
2056 synchronizeAttribute(qName); | 2063 synchronizeAttribute(qName); |
2057 const Attribute* attribute = elementData()->findAttributeByName(qName); | 2064 const Attribute* attribute = elementData()->attributes().find(qName); |
2058 if (!attribute) | 2065 if (!attribute) |
2059 return nullptr; | 2066 return nullptr; |
2060 return ensureAttr(attribute->name()); | 2067 return ensureAttr(attribute->name()); |
2061 } | 2068 } |
2062 | 2069 |
2063 bool Element::hasAttribute(const AtomicString& localName) const | 2070 bool Element::hasAttribute(const AtomicString& localName) const |
2064 { | 2071 { |
2065 if (!elementData()) | 2072 if (!elementData()) |
2066 return false; | 2073 return false; |
2067 synchronizeAttribute(localName); | 2074 synchronizeAttribute(localName); |
2068 return elementData()->findAttributeByName(shouldIgnoreAttributeCase() ? loca
lName.lower() : localName, false); | 2075 return elementData()->attributes().findIndex(shouldIgnoreAttributeCase() ? l
ocalName.lower() : localName, false) != kNotFound; |
2069 } | 2076 } |
2070 | 2077 |
2071 bool Element::hasAttributeNS(const AtomicString& namespaceURI, const AtomicStrin
g& localName) const | 2078 bool Element::hasAttributeNS(const AtomicString& namespaceURI, const AtomicStrin
g& localName) const |
2072 { | 2079 { |
2073 if (!elementData()) | 2080 if (!elementData()) |
2074 return false; | 2081 return false; |
2075 QualifiedName qName(nullAtom, localName, namespaceURI); | 2082 QualifiedName qName(nullAtom, localName, namespaceURI); |
2076 synchronizeAttribute(qName); | 2083 synchronizeAttribute(qName); |
2077 return elementData()->findAttributeByName(qName); | 2084 return elementData()->attributes().find(qName); |
2078 } | 2085 } |
2079 | 2086 |
2080 void Element::focus(bool restorePreviousSelection, FocusType type) | 2087 void Element::focus(bool restorePreviousSelection, FocusType type) |
2081 { | 2088 { |
2082 if (!inDocument()) | 2089 if (!inDocument()) |
2083 return; | 2090 return; |
2084 | 2091 |
2085 if (document().focusedElement() == this) | 2092 if (document().focusedElement() == this) |
2086 return; | 2093 return; |
2087 | 2094 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 } | 2480 } |
2474 | 2481 |
2475 AtomicString Element::computeInheritedLanguage() const | 2482 AtomicString Element::computeInheritedLanguage() const |
2476 { | 2483 { |
2477 const Node* n = this; | 2484 const Node* n = this; |
2478 AtomicString value; | 2485 AtomicString value; |
2479 // The language property is inherited, so we iterate over the parents to fin
d the first language. | 2486 // The language property is inherited, so we iterate over the parents to fin
d the first language. |
2480 do { | 2487 do { |
2481 if (n->isElementNode()) { | 2488 if (n->isElementNode()) { |
2482 if (const ElementData* elementData = toElement(n)->elementData()) { | 2489 if (const ElementData* elementData = toElement(n)->elementData()) { |
| 2490 AttributeCollection attributes = elementData->attributes(); |
2483 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml
1/#C_7 | 2491 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml
1/#C_7 |
2484 if (const Attribute* attribute = elementData->findAttributeByNam
e(XMLNames::langAttr)) | 2492 if (const Attribute* attribute = attributes.find(XMLNames::langA
ttr)) |
2485 value = attribute->value(); | 2493 value = attribute->value(); |
2486 else if (const Attribute* attribute = elementData->findAttribute
ByName(HTMLNames::langAttr)) | 2494 else if (const Attribute* attribute = attributes.find(HTMLNames:
:langAttr)) |
2487 value = attribute->value(); | 2495 value = attribute->value(); |
2488 } | 2496 } |
2489 } else if (n->isDocumentNode()) { | 2497 } else if (n->isDocumentNode()) { |
2490 // checking the MIME content-language | 2498 // checking the MIME content-language |
2491 value = toDocument(n)->contentLanguage(); | 2499 value = toDocument(n)->contentLanguage(); |
2492 } | 2500 } |
2493 | 2501 |
2494 n = n->parentNode(); | 2502 n = n->parentNode(); |
2495 } while (n && value.isNull()); | 2503 } while (n && value.isNull()); |
2496 | 2504 |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3324 | 3332 |
3325 void Element::trace(Visitor* visitor) | 3333 void Element::trace(Visitor* visitor) |
3326 { | 3334 { |
3327 if (hasRareData()) | 3335 if (hasRareData()) |
3328 visitor->trace(elementRareData()); | 3336 visitor->trace(elementRareData()); |
3329 visitor->trace(m_elementData); | 3337 visitor->trace(m_elementData); |
3330 ContainerNode::trace(visitor); | 3338 ContainerNode::trace(visitor); |
3331 } | 3339 } |
3332 | 3340 |
3333 } // namespace WebCore | 3341 } // namespace WebCore |
OLD | NEW |