| 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
| 7 * (C) 2007 Eric Seidel (eric@webkit.org) | 7 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 { | 38 { |
| 39 m_element->ref(); | 39 m_element->ref(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void NamedNodeMap::deref() | 42 void NamedNodeMap::deref() |
| 43 { | 43 { |
| 44 m_element->deref(); | 44 m_element->deref(); |
| 45 } | 45 } |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::getNamedItem(const AtomicString& name
) const | 48 RawPtr<Attr> NamedNodeMap::getNamedItem(const AtomicString& name) const |
| 49 { | 49 { |
| 50 return m_element->getAttributeNode(name); | 50 return m_element->getAttributeNode(name); |
| 51 } | 51 } |
| 52 | 52 |
| 53 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::getNamedItemNS(const AtomicString& na
mespaceURI, const AtomicString& localName) const | 53 RawPtr<Attr> NamedNodeMap::getNamedItemNS(const AtomicString& namespaceURI, cons
t AtomicString& localName) const |
| 54 { | 54 { |
| 55 return m_element->getAttributeNodeNS(namespaceURI, localName); | 55 return m_element->getAttributeNodeNS(namespaceURI, localName); |
| 56 } | 56 } |
| 57 | 57 |
| 58 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::removeNamedItem(const AtomicString& n
ame, ExceptionState& exceptionState) | 58 RawPtr<Attr> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionSt
ate& exceptionState) |
| 59 { | 59 { |
| 60 size_t index = m_element->attributes().findIndex(name, m_element->shouldIgno
reAttributeCase()); | 60 size_t index = m_element->attributes().findIndex(name, m_element->shouldIgno
reAttributeCase()); |
| 61 if (index == kNotFound) { | 61 if (index == kNotFound) { |
| 62 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
name + "' was found."); | 62 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
name + "' was found."); |
| 63 return nullptr; | 63 return nullptr; |
| 64 } | 64 } |
| 65 return m_element->detachAttribute(index); | 65 return m_element->detachAttribute(index); |
| 66 } | 66 } |
| 67 | 67 |
| 68 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::removeNamedItemNS(const AtomicString&
namespaceURI, const AtomicString& localName, ExceptionState& exceptionState) | 68 RawPtr<Attr> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, c
onst AtomicString& localName, ExceptionState& exceptionState) |
| 69 { | 69 { |
| 70 size_t index = m_element->attributes().findIndex(QualifiedName(nullAtom, loc
alName, namespaceURI)); | 70 size_t index = m_element->attributes().findIndex(QualifiedName(nullAtom, loc
alName, namespaceURI)); |
| 71 if (index == kNotFound) { | 71 if (index == kNotFound) { |
| 72 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
namespaceURI + "::" + localName + "' was found."); | 72 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
namespaceURI + "::" + localName + "' was found."); |
| 73 return nullptr; | 73 return nullptr; |
| 74 } | 74 } |
| 75 return m_element->detachAttribute(index); | 75 return m_element->detachAttribute(index); |
| 76 } | 76 } |
| 77 | 77 |
| 78 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::setNamedItem(Attr* attr, ExceptionSta
te& exceptionState) | 78 RawPtr<Attr> NamedNodeMap::setNamedItem(Attr* attr, ExceptionState& exceptionSta
te) |
| 79 { | 79 { |
| 80 ASSERT(attr); | 80 ASSERT(attr); |
| 81 return m_element->setAttributeNode(attr, exceptionState); | 81 return m_element->setAttributeNode(attr, exceptionState); |
| 82 } | 82 } |
| 83 | 83 |
| 84 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::setNamedItemNS(Attr* attr, ExceptionS
tate& exceptionState) | 84 RawPtr<Attr> NamedNodeMap::setNamedItemNS(Attr* attr, ExceptionState& exceptionS
tate) |
| 85 { | 85 { |
| 86 ASSERT(attr); | 86 ASSERT(attr); |
| 87 return m_element->setAttributeNodeNS(attr, exceptionState); | 87 return m_element->setAttributeNodeNS(attr, exceptionState); |
| 88 } | 88 } |
| 89 | 89 |
| 90 PassRefPtrWillBeRawPtr<Attr> NamedNodeMap::item(unsigned index) const | 90 RawPtr<Attr> NamedNodeMap::item(unsigned index) const |
| 91 { | 91 { |
| 92 AttributeCollection attributes = m_element->attributes(); | 92 AttributeCollection attributes = m_element->attributes(); |
| 93 if (index >= attributes.size()) | 93 if (index >= attributes.size()) |
| 94 return nullptr; | 94 return nullptr; |
| 95 return m_element->ensureAttr(attributes[index].name()); | 95 return m_element->ensureAttr(attributes[index].name()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 size_t NamedNodeMap::length() const | 98 size_t NamedNodeMap::length() const |
| 99 { | 99 { |
| 100 return m_element->attributes().size(); | 100 return m_element->attributes().size(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 DEFINE_TRACE(NamedNodeMap) | 103 DEFINE_TRACE(NamedNodeMap) |
| 104 { | 104 { |
| 105 visitor->trace(m_element); | 105 visitor->trace(m_element); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |