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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 // The DOM user must explicitly clone Attr nodes to re-use them in other ele
ments. | 1887 // The DOM user must explicitly clone Attr nodes to re-use them in other ele
ments. |
1888 if (attrNode->ownerElement()) { | 1888 if (attrNode->ownerElement()) { |
1889 exceptionState.throwDOMException(InUseAttributeError, "The node provided
is an attribute node that is already an attribute of another Element; attribute
nodes must be explicitly cloned."); | 1889 exceptionState.throwDOMException(InUseAttributeError, "The node provided
is an attribute node that is already an attribute of another Element; attribute
nodes must be explicitly cloned."); |
1890 return nullptr; | 1890 return nullptr; |
1891 } | 1891 } |
1892 | 1892 |
1893 synchronizeAllAttributes(); | 1893 synchronizeAllAttributes(); |
1894 UniqueElementData& elementData = ensureUniqueElementData(); | 1894 UniqueElementData& elementData = ensureUniqueElementData(); |
1895 | 1895 |
1896 size_t index = elementData.getAttributeItemIndex(attrNode->qualifiedName(),
shouldIgnoreAttributeCase()); | 1896 size_t index = elementData.getAttributeItemIndex(attrNode->qualifiedName(),
shouldIgnoreAttributeCase()); |
| 1897 AtomicString localName; |
1897 if (index != kNotFound) { | 1898 if (index != kNotFound) { |
| 1899 const Attribute& attr = elementData.attributeItem(index); |
| 1900 |
| 1901 // If the name of the ElementData attribute doesn't |
| 1902 // (case-sensitively) match that of the Attr node, record it |
| 1903 // on the Attr so that it can correctly resolve the value on |
| 1904 // the Element. |
| 1905 if (!attr.name().matches(attrNode->qualifiedName())) |
| 1906 localName = attr.localName(); |
1898 if (oldAttrNode) | 1907 if (oldAttrNode) |
1899 detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData.at
tributeItem(index).value()); | 1908 detachAttrNodeFromElementWithValue(oldAttrNode.get(), attr.value()); |
1900 else | 1909 else |
1901 oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), el
ementData.attributeItem(index).value()); | 1910 oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), at
tr.value()); |
1902 } | 1911 } |
1903 | 1912 |
1904 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No
tInSynchronizationOfLazyAttribute); | 1913 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No
tInSynchronizationOfLazyAttribute); |
1905 | 1914 |
1906 attrNode->attachToElement(this); | 1915 attrNode->attachToElement(this, localName); |
1907 treeScope().adoptIfNeeded(*attrNode); | 1916 treeScope().adoptIfNeeded(*attrNode); |
1908 ensureAttrNodeListForElement(this).append(attrNode); | 1917 ensureAttrNodeListForElement(this).append(attrNode); |
1909 | 1918 |
1910 return oldAttrNode.release(); | 1919 return oldAttrNode.release(); |
1911 } | 1920 } |
1912 | 1921 |
1913 PassRefPtrWillBeRawPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionSt
ate& exceptionState) | 1922 PassRefPtrWillBeRawPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionSt
ate& exceptionState) |
1914 { | 1923 { |
1915 return setAttributeNode(attr, exceptionState); | 1924 return setAttributeNode(attr, exceptionState); |
1916 } | 1925 } |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3310 | 3319 |
3311 void Element::trace(Visitor* visitor) | 3320 void Element::trace(Visitor* visitor) |
3312 { | 3321 { |
3313 if (hasRareData()) | 3322 if (hasRareData()) |
3314 visitor->trace(elementRareData()); | 3323 visitor->trace(elementRareData()); |
3315 | 3324 |
3316 ContainerNode::trace(visitor); | 3325 ContainerNode::trace(visitor); |
3317 } | 3326 } |
3318 | 3327 |
3319 } // namespace WebCore | 3328 } // namespace WebCore |
OLD | NEW |