Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: Source/core/dom/NamedNodeMap.cpp

Issue 387413003: Drop findAttribute*ByName() API from Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return m_element->getAttributeNode(name); 51 return m_element->getAttributeNode(name);
52 } 52 }
53 53
54 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& na mespaceURI, const AtomicString& localName) const 54 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& na mespaceURI, const AtomicString& localName) const
55 { 55 {
56 return m_element->getAttributeNodeNS(namespaceURI, localName); 56 return m_element->getAttributeNodeNS(namespaceURI, localName);
57 } 57 }
58 58
59 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& n ame, ExceptionState& exceptionState) 59 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& n ame, ExceptionState& exceptionState)
60 { 60 {
61 size_t index = m_element->hasAttributes() ? m_element->findAttributeIndexByN ame(name, m_element->shouldIgnoreAttributeCase()) : kNotFound; 61 size_t index = m_element->hasAttributes() ? m_element->attributes().findInde x(name, m_element->shouldIgnoreAttributeCase()) : kNotFound;
62 if (index == kNotFound) { 62 if (index == kNotFound) {
63 exceptionState.throwDOMException(NotFoundError, "No item with name '" + name + "' was found."); 63 exceptionState.throwDOMException(NotFoundError, "No item with name '" + name + "' was found.");
64 return nullptr; 64 return nullptr;
65 } 65 }
66 return m_element->detachAttribute(index); 66 return m_element->detachAttribute(index);
67 } 67 }
68 68
69 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState& exceptionState) 69 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState& exceptionState)
70 { 70 {
71 size_t index = m_element->hasAttributes() ? m_element->findAttributeIndexByN ame(QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound; 71 size_t index = m_element->hasAttributes() ? m_element->attributes().findInde x(QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound;
72 if (index == kNotFound) { 72 if (index == kNotFound) {
73 exceptionState.throwDOMException(NotFoundError, "No item with name '" + namespaceURI + "::" + localName + "' was found."); 73 exceptionState.throwDOMException(NotFoundError, "No item with name '" + namespaceURI + "::" + localName + "' was found.");
74 return nullptr; 74 return nullptr;
75 } 75 }
76 return m_element->detachAttribute(index); 76 return m_element->detachAttribute(index);
77 } 77 }
78 78
79 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionSta te& exceptionState) 79 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionSta te& exceptionState)
80 { 80 {
81 if (!node) { 81 if (!node) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return 0; 113 return 0;
114 return m_element->attributes().size(); 114 return m_element->attributes().size();
115 } 115 }
116 116
117 void NamedNodeMap::trace(Visitor* visitor) 117 void NamedNodeMap::trace(Visitor* visitor)
118 { 118 {
119 visitor->trace(m_element); 119 visitor->trace(m_element);
120 } 120 }
121 121
122 } // namespace WebCore 122 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698