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

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

Issue 357033002: Remove attributeCount() / attributeAt() API from Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clean up 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/editing/ApplyStyleCommand.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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return m_element->setAttributeNode(toAttr(node), exceptionState); 92 return m_element->setAttributeNode(toAttr(node), exceptionState);
93 } 93 }
94 94
95 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS tate& exceptionState) 95 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS tate& exceptionState)
96 { 96 {
97 return setNamedItem(node, exceptionState); 97 return setNamedItem(node, exceptionState);
98 } 98 }
99 99
100 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const 100 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const
101 { 101 {
102 if (index >= length()) 102 if (!m_element->hasAttributes())
103 return nullptr; 103 return nullptr;
104 return m_element->ensureAttr(m_element->attributeAt(index).name()); 104 AttributeCollection attributes = m_element->attributes();
105 if (index >= attributes.size())
106 return nullptr;
107 return m_element->ensureAttr(attributes[index].name());
105 } 108 }
106 109
107 size_t NamedNodeMap::length() const 110 size_t NamedNodeMap::length() const
108 { 111 {
109 if (!m_element->hasAttributes()) 112 if (!m_element->hasAttributes())
110 return 0; 113 return 0;
111 return m_element->attributeCount(); 114 return m_element->attributes().size();
112 } 115 }
113 116
114 void NamedNodeMap::trace(Visitor* visitor) 117 void NamedNodeMap::trace(Visitor* visitor)
115 { 118 {
116 visitor->trace(m_element); 119 visitor->trace(m_element);
117 } 120 }
118 121
119 } // namespace WebCore 122 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698