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

Side by Side Diff: sky/engine/core/dom/NamedNodeMap.cpp

Issue 697773002: Remove Element#attributes. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix template binding. Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/dom/NamedNodeMap.h ('k') | sky/engine/core/dom/NamedNodeMap.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
7 * (C) 2007 Eric Seidel (eric@webkit.org)
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25 #include "config.h"
26 #include "core/dom/NamedNodeMap.h"
27
28 #include "bindings/core/v8/ExceptionState.h"
29 #include "core/dom/Attr.h"
30 #include "core/dom/Element.h"
31 #include "core/dom/ExceptionCode.h"
32
33 namespace blink {
34
35 NamedNodeMap::NamedNodeMap(Element* element)
36 : m_element(element)
37 {
38 // Only supports NamedNodeMaps with Element associated.
39 ASSERT(m_element);
40 ScriptWrappable::init(this);
41 }
42
43 #if !ENABLE(OILPAN)
44 void NamedNodeMap::ref()
45 {
46 m_element->ref();
47 }
48
49 void NamedNodeMap::deref()
50 {
51 m_element->deref();
52 }
53 #endif
54
55 PassRefPtr<Attr> NamedNodeMap::getNamedItem(const AtomicString& name) const
56 {
57 return m_element->getAttributeNode(name);
58 }
59
60 PassRefPtr<Attr> NamedNodeMap::item(unsigned index) const
61 {
62 AttributeCollection attributes = m_element->attributes();
63 if (index >= attributes.size())
64 return nullptr;
65 return m_element->ensureAttr(attributes[index].name());
66 }
67
68 size_t NamedNodeMap::length() const
69 {
70 return m_element->attributes().size();
71 }
72
73 void NamedNodeMap::trace(Visitor* visitor)
74 {
75 visitor->trace(m_element);
76 }
77
78 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/NamedNodeMap.h ('k') | sky/engine/core/dom/NamedNodeMap.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698