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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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/NamedNodeMap.cpp ('k') | Source/core/dom/Position.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 * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 3 * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
4 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
5 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 NodeIterator::~NodeIterator() 84 NodeIterator::~NodeIterator()
85 { 85 {
86 root()->document().detachNodeIterator(this); 86 root()->document().detachNodeIterator(this);
87 } 87 }
88 88
89 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionState& exce ptionState) 89 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionState& exce ptionState)
90 { 90 {
91 if (m_detached) { 91 if (m_detached) {
92 exceptionState.throwDOMException(InvalidStateError, "The iterator is det ached."); 92 exceptionState.throwDOMException(InvalidStateError, "The iterator is det ached.");
93 return 0; 93 return nullptr;
94 } 94 }
95 95
96 RefPtr<Node> result; 96 RefPtr<Node> result;
97 97
98 m_candidateNode = m_referenceNode; 98 m_candidateNode = m_referenceNode;
99 while (m_candidateNode.moveToNext(root())) { 99 while (m_candidateNode.moveToNext(root())) {
100 // NodeIterators treat the DOM tree as a flat list of nodes. 100 // NodeIterators treat the DOM tree as a flat list of nodes.
101 // In other words, FILTER_REJECT does not pass over descendants 101 // In other words, FILTER_REJECT does not pass over descendants
102 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP . 102 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP .
103 RefPtr<Node> provisionalResult = m_candidateNode.node; 103 RefPtr<Node> provisionalResult = m_candidateNode.node;
104 bool nodeWasAccepted = acceptNode(state, provisionalResult.get()) == Nod eFilter::FILTER_ACCEPT; 104 bool nodeWasAccepted = acceptNode(state, provisionalResult.get()) == Nod eFilter::FILTER_ACCEPT;
105 if (state && state->hadException()) 105 if (state && state->hadException())
106 break; 106 break;
107 if (nodeWasAccepted) { 107 if (nodeWasAccepted) {
108 m_referenceNode = m_candidateNode; 108 m_referenceNode = m_candidateNode;
109 result = provisionalResult.release(); 109 result = provisionalResult.release();
110 break; 110 break;
111 } 111 }
112 } 112 }
113 113
114 m_candidateNode.clear(); 114 m_candidateNode.clear();
115 return result.release(); 115 return result.release();
116 } 116 }
117 117
118 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionState& exceptionState) 118 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionState& exceptionState)
119 { 119 {
120 if (m_detached) { 120 if (m_detached) {
121 exceptionState.throwDOMException(InvalidStateError, "The iterator is det ached."); 121 exceptionState.throwDOMException(InvalidStateError, "The iterator is det ached.");
122 return 0; 122 return nullptr;
123 } 123 }
124 124
125 RefPtr<Node> result; 125 RefPtr<Node> result;
126 126
127 m_candidateNode = m_referenceNode; 127 m_candidateNode = m_referenceNode;
128 while (m_candidateNode.moveToPrevious(root())) { 128 while (m_candidateNode.moveToPrevious(root())) {
129 // NodeIterators treat the DOM tree as a flat list of nodes. 129 // NodeIterators treat the DOM tree as a flat list of nodes.
130 // In other words, FILTER_REJECT does not pass over descendants 130 // In other words, FILTER_REJECT does not pass over descendants
131 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP . 131 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP .
132 RefPtr<Node> provisionalResult = m_candidateNode.node; 132 RefPtr<Node> provisionalResult = m_candidateNode.node;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 node = NodeTraversal::previous(*node, root()); 219 node = NodeTraversal::previous(*node, root());
220 } 220 }
221 if (node) 221 if (node)
222 referenceNode.node = node; 222 referenceNode.node = node;
223 } 223 }
224 } 224 }
225 } 225 }
226 226
227 227
228 } // namespace WebCore 228 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/NamedNodeMap.cpp ('k') | Source/core/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698