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

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

Issue 292503006: Oilpan: add [WillBeGarbageCollected] for Node. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add now-required tracing of m_domWindow (oops) Created 6 years, 7 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
« no previous file with comments | « Source/core/dom/NamedNodeMap.h ('k') | Source/core/dom/Node.idl » ('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 29 matching lines...) Expand all
40 { 40 {
41 m_element->ref(); 41 m_element->ref();
42 } 42 }
43 43
44 void NamedNodeMap::deref() 44 void NamedNodeMap::deref()
45 { 45 {
46 m_element->deref(); 46 m_element->deref();
47 } 47 }
48 #endif 48 #endif
49 49
50 PassRefPtr<Node> NamedNodeMap::getNamedItem(const AtomicString& name) const 50 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::getNamedItem(const AtomicString& name ) const
51 { 51 {
52 return m_element->getAttributeNode(name); 52 return m_element->getAttributeNode(name);
53 } 53 }
54 54
55 PassRefPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const 55 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& na mespaceURI, const AtomicString& localName) const
56 { 56 {
57 return m_element->getAttributeNodeNS(namespaceURI, localName); 57 return m_element->getAttributeNodeNS(namespaceURI, localName);
58 } 58 }
59 59
60 PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, Excepti onState& exceptionState) 60 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& n ame, ExceptionState& exceptionState)
61 { 61 {
62 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (name, m_element->shouldIgnoreAttributeCase()) : kNotFound; 62 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (name, m_element->shouldIgnoreAttributeCase()) : kNotFound;
63 if (index == kNotFound) { 63 if (index == kNotFound) {
64 exceptionState.throwDOMException(NotFoundError, "No item with name '" + name + "' was found."); 64 exceptionState.throwDOMException(NotFoundError, "No item with name '" + name + "' was found.");
65 return nullptr; 65 return nullptr;
66 } 66 }
67 return m_element->detachAttribute(index); 67 return m_element->detachAttribute(index);
68 } 68 }
69 69
70 PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceUR I, const AtomicString& localName, ExceptionState& exceptionState) 70 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState& exceptionState)
71 { 71 {
72 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound; 72 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex (QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound;
73 if (index == kNotFound) { 73 if (index == kNotFound) {
74 exceptionState.throwDOMException(NotFoundError, "No item with name '" + namespaceURI + "::" + localName + "' was found."); 74 exceptionState.throwDOMException(NotFoundError, "No item with name '" + namespaceURI + "::" + localName + "' was found.");
75 return nullptr; 75 return nullptr;
76 } 76 }
77 return m_element->detachAttribute(index); 77 return m_element->detachAttribute(index);
78 } 78 }
79 79
80 PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionState& exceptio nState) 80 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionSta te& exceptionState)
81 { 81 {
82 if (!node) { 82 if (!node) {
83 exceptionState.throwDOMException(NotFoundError, "The node provided was n ull."); 83 exceptionState.throwDOMException(NotFoundError, "The node provided was n ull.");
84 return nullptr; 84 return nullptr;
85 } 85 }
86 86
87 // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node 87 // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
88 if (!node->isAttributeNode()) { 88 if (!node->isAttributeNode()) {
89 exceptionState.throwDOMException(HierarchyRequestError, "The node provid ed is not an attribute node."); 89 exceptionState.throwDOMException(HierarchyRequestError, "The node provid ed is not an attribute node.");
90 return nullptr; 90 return nullptr;
91 } 91 }
92 92
93 return m_element->setAttributeNode(toAttr(node), exceptionState); 93 return m_element->setAttributeNode(toAttr(node), exceptionState);
94 } 94 }
95 95
96 PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionState& except ionState) 96 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS tate& exceptionState)
97 { 97 {
98 return setNamedItem(node, exceptionState); 98 return setNamedItem(node, exceptionState);
99 } 99 }
100 100
101 PassRefPtr<Node> NamedNodeMap::item(unsigned index) const 101 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const
102 { 102 {
103 if (index >= length()) 103 if (index >= length())
104 return nullptr; 104 return nullptr;
105 return m_element->ensureAttr(m_element->attributeItem(index).name()); 105 return m_element->ensureAttr(m_element->attributeItem(index).name());
106 } 106 }
107 107
108 size_t NamedNodeMap::length() const 108 size_t NamedNodeMap::length() const
109 { 109 {
110 if (!m_element->hasAttributes()) 110 if (!m_element->hasAttributes())
111 return 0; 111 return 0;
112 return m_element->attributeCount(); 112 return m_element->attributeCount();
113 } 113 }
114 114
115 void NamedNodeMap::trace(Visitor* visitor) 115 void NamedNodeMap::trace(Visitor* visitor)
116 { 116 {
117 visitor->trace(m_element); 117 visitor->trace(m_element);
118 } 118 }
119 119
120 } // namespace WebCore 120 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/NamedNodeMap.h ('k') | Source/core/dom/Node.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698