| 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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 if (!inSynchronizationOfLazyAttribute) | 916 if (!inSynchronizationOfLazyAttribute) |
| 917 willModifyAttribute(existingAttributeName, existingAttribute.value(), ne
wValue); | 917 willModifyAttribute(existingAttributeName, existingAttribute.value(), ne
wValue); |
| 918 | 918 |
| 919 if (newValue != existingAttribute.value()) { | 919 if (newValue != existingAttribute.value()) { |
| 920 // If there is an Attr node hooked to this attribute, the Attr::setValue
() call below | 920 // If there is an Attr node hooked to this attribute, the Attr::setValue
() call below |
| 921 // will write into the ElementData. | 921 // will write into the ElementData. |
| 922 // FIXME: Refactor this so it makes some sense. | 922 // FIXME: Refactor this so it makes some sense. |
| 923 if (RefPtrWillBeRawPtr<Attr> attrNode = inSynchronizationOfLazyAttribute
? nullptr : attrIfExists(existingAttributeName)) | 923 if (RefPtrWillBeRawPtr<Attr> attrNode = inSynchronizationOfLazyAttribute
? nullptr : attrIfExists(existingAttributeName)) |
| 924 attrNode->setValue(newValue); | 924 attrNode->setValue(newValue); |
| 925 else | 925 else |
| 926 ensureUniqueElementData().attributeAt(index).setValue(newValue); | 926 ensureUniqueElementData().attributes().at(index).setValue(newValue); |
| 927 } | 927 } |
| 928 | 928 |
| 929 if (!inSynchronizationOfLazyAttribute) | 929 if (!inSynchronizationOfLazyAttribute) |
| 930 didModifyAttribute(existingAttributeName, newValue); | 930 didModifyAttribute(existingAttributeName, newValue); |
| 931 } | 931 } |
| 932 | 932 |
| 933 static inline AtomicString makeIdForStyleResolution(const AtomicString& value, b
ool inQuirksMode) | 933 static inline AtomicString makeIdForStyleResolution(const AtomicString& value, b
ool inQuirksMode) |
| 934 { | 934 { |
| 935 if (inQuirksMode) | 935 if (inQuirksMode) |
| 936 return value.lower(); | 936 return value.lower(); |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 return attrNode; // This Attr is already attached to the element. | 1841 return attrNode; // This Attr is already attached to the element. |
| 1842 | 1842 |
| 1843 // InUseAttributeError: Raised if node is an Attr that is already an attribu
te of another Element object. | 1843 // InUseAttributeError: Raised if node is an Attr that is already an attribu
te of another Element object. |
| 1844 // The DOM user must explicitly clone Attr nodes to re-use them in other ele
ments. | 1844 // The DOM user must explicitly clone Attr nodes to re-use them in other ele
ments. |
| 1845 if (attrNode->ownerElement()) { | 1845 if (attrNode->ownerElement()) { |
| 1846 exceptionState.throwDOMException(InUseAttributeError, "The node provided
is an attribute node that is already an attribute of another Element; attribute
nodes must be explicitly cloned."); | 1846 exceptionState.throwDOMException(InUseAttributeError, "The node provided
is an attribute node that is already an attribute of another Element; attribute
nodes must be explicitly cloned."); |
| 1847 return nullptr; | 1847 return nullptr; |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 synchronizeAllAttributes(); | 1850 synchronizeAllAttributes(); |
| 1851 UniqueElementData& elementData = ensureUniqueElementData(); | 1851 const UniqueElementData& elementData = ensureUniqueElementData(); |
| 1852 | 1852 |
| 1853 AttributeCollection attributes = elementData.attributes(); | 1853 AttributeCollection attributes = elementData.attributes(); |
| 1854 size_t index = attributes.findIndex(attrNode->qualifiedName(), shouldIgnoreA
ttributeCase()); | 1854 size_t index = attributes.findIndex(attrNode->qualifiedName(), shouldIgnoreA
ttributeCase()); |
| 1855 AtomicString localName; | 1855 AtomicString localName; |
| 1856 if (index != kNotFound) { | 1856 if (index != kNotFound) { |
| 1857 const Attribute& attr = attributes[index]; | 1857 const Attribute& attr = attributes[index]; |
| 1858 | 1858 |
| 1859 // If the name of the ElementData attribute doesn't | 1859 // If the name of the ElementData attribute doesn't |
| 1860 // (case-sensitively) match that of the Attr node, record it | 1860 // (case-sensitively) match that of the Attr node, record it |
| 1861 // on the Attr so that it can correctly resolve the value on | 1861 // on the Attr so that it can correctly resolve the value on |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicStrin
g& qualifiedName, const AtomicString& value, ExceptionState& exceptionState) | 1953 void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicStrin
g& qualifiedName, const AtomicString& value, ExceptionState& exceptionState) |
| 1954 { | 1954 { |
| 1955 QualifiedName parsedName = anyName; | 1955 QualifiedName parsedName = anyName; |
| 1956 if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, exceptionSt
ate)) | 1956 if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, exceptionSt
ate)) |
| 1957 return; | 1957 return; |
| 1958 setAttribute(parsedName, value); | 1958 setAttribute(parsedName, value); |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 void Element::removeAttributeInternal(size_t index, SynchronizationOfLazyAttribu
te inSynchronizationOfLazyAttribute) | 1961 void Element::removeAttributeInternal(size_t index, SynchronizationOfLazyAttribu
te inSynchronizationOfLazyAttribute) |
| 1962 { | 1962 { |
| 1963 UniqueElementData& elementData = ensureUniqueElementData(); | 1963 MutableAttributeCollection attributes = ensureUniqueElementData().attributes
(); |
| 1964 AttributeCollection attributes = elementData.attributes(); | |
| 1965 ASSERT_WITH_SECURITY_IMPLICATION(index < attributes.size()); | 1964 ASSERT_WITH_SECURITY_IMPLICATION(index < attributes.size()); |
| 1966 | 1965 |
| 1967 QualifiedName name = attributes[index].name(); | 1966 QualifiedName name = attributes[index].name(); |
| 1968 AtomicString valueBeingRemoved = attributes[index].value(); | 1967 AtomicString valueBeingRemoved = attributes[index].value(); |
| 1969 | 1968 |
| 1970 if (!inSynchronizationOfLazyAttribute) { | 1969 if (!inSynchronizationOfLazyAttribute) { |
| 1971 if (!valueBeingRemoved.isNull()) | 1970 if (!valueBeingRemoved.isNull()) |
| 1972 willModifyAttribute(name, valueBeingRemoved, nullAtom); | 1971 willModifyAttribute(name, valueBeingRemoved, nullAtom); |
| 1973 } | 1972 } |
| 1974 | 1973 |
| 1975 if (RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(name)) | 1974 if (RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(name)) |
| 1976 detachAttrNodeFromElementWithValue(attrNode.get(), attributes[index].val
ue()); | 1975 detachAttrNodeFromElementWithValue(attrNode.get(), attributes[index].val
ue()); |
| 1977 | 1976 |
| 1978 elementData.removeAttributeAt(index); | 1977 attributes.remove(index); |
| 1979 | 1978 |
| 1980 if (!inSynchronizationOfLazyAttribute) | 1979 if (!inSynchronizationOfLazyAttribute) |
| 1981 didRemoveAttribute(name); | 1980 didRemoveAttribute(name); |
| 1982 } | 1981 } |
| 1983 | 1982 |
| 1984 void Element::appendAttributeInternal(const QualifiedName& name, const AtomicStr
ing& value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute) | 1983 void Element::appendAttributeInternal(const QualifiedName& name, const AtomicStr
ing& value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute) |
| 1985 { | 1984 { |
| 1986 if (!inSynchronizationOfLazyAttribute) | 1985 if (!inSynchronizationOfLazyAttribute) |
| 1987 willModifyAttribute(name, nullAtom, value); | 1986 willModifyAttribute(name, nullAtom, value); |
| 1988 ensureUniqueElementData().appendAttribute(name, value); | 1987 ensureUniqueElementData().attributes().append(name, value); |
| 1989 if (!inSynchronizationOfLazyAttribute) | 1988 if (!inSynchronizationOfLazyAttribute) |
| 1990 didAddAttribute(name, value); | 1989 didAddAttribute(name, value); |
| 1991 } | 1990 } |
| 1992 | 1991 |
| 1993 void Element::removeAttribute(const AtomicString& name) | 1992 void Element::removeAttribute(const AtomicString& name) |
| 1994 { | 1993 { |
| 1995 if (!elementData()) | 1994 if (!elementData()) |
| 1996 return; | 1995 return; |
| 1997 | 1996 |
| 1998 AtomicString localName = shouldIgnoreAttributeCase() ? name.lower() : name; | 1997 AtomicString localName = shouldIgnoreAttributeCase() ? name.lower() : name; |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3283 { | 3282 { |
| 3284 #if ENABLE(OILPAN) | 3283 #if ENABLE(OILPAN) |
| 3285 if (hasRareData()) | 3284 if (hasRareData()) |
| 3286 visitor->trace(elementRareData()); | 3285 visitor->trace(elementRareData()); |
| 3287 visitor->trace(m_elementData); | 3286 visitor->trace(m_elementData); |
| 3288 #endif | 3287 #endif |
| 3289 ContainerNode::trace(visitor); | 3288 ContainerNode::trace(visitor); |
| 3290 } | 3289 } |
| 3291 | 3290 |
| 3292 } // namespace blink | 3291 } // namespace blink |
| OLD | NEW |