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

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

Issue 180723006: Have ElementData::attributeItem() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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/ElementData.cpp ('k') | Source/core/dom/Node.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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionState& except ionState) 94 PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionState& except ionState)
95 { 95 {
96 return setNamedItem(node, exceptionState); 96 return setNamedItem(node, exceptionState);
97 } 97 }
98 98
99 PassRefPtr<Node> NamedNodeMap::item(unsigned index) const 99 PassRefPtr<Node> NamedNodeMap::item(unsigned index) const
100 { 100 {
101 if (index >= length()) 101 if (index >= length())
102 return nullptr; 102 return nullptr;
103 return m_element->ensureAttr(m_element->attributeItem(index)->name()); 103 return m_element->ensureAttr(m_element->attributeItem(index).name());
104 } 104 }
105 105
106 size_t NamedNodeMap::length() const 106 size_t NamedNodeMap::length() const
107 { 107 {
108 if (!m_element->hasAttributes()) 108 if (!m_element->hasAttributes())
109 return 0; 109 return 0;
110 return m_element->attributeCount(); 110 return m_element->attributeCount();
111 } 111 }
112 112
113 } // namespace WebCore 113 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ElementData.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698