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

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

Issue 18548003: Rename ExceptionCode constants to use the names in the spec (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/Node.cpp ('k') | Source/core/dom/Range.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 NodeIterator::~NodeIterator() 87 NodeIterator::~NodeIterator()
88 { 88 {
89 if (Document* ownerDocument = root()->document()) 89 if (Document* ownerDocument = root()->document())
90 ownerDocument->detachNodeIterator(this); 90 ownerDocument->detachNodeIterator(this);
91 } 91 }
92 92
93 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionCode& ec) 93 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionCode& ec)
94 { 94 {
95 if (m_detached) { 95 if (m_detached) {
96 ec = INVALID_STATE_ERR; 96 ec = InvalidStateError;
97 return 0; 97 return 0;
98 } 98 }
99 99
100 RefPtr<Node> result; 100 RefPtr<Node> result;
101 101
102 m_candidateNode = m_referenceNode; 102 m_candidateNode = m_referenceNode;
103 while (m_candidateNode.moveToNext(root())) { 103 while (m_candidateNode.moveToNext(root())) {
104 // NodeIterators treat the DOM tree as a flat list of nodes. 104 // NodeIterators treat the DOM tree as a flat list of nodes.
105 // In other words, FILTER_REJECT does not pass over descendants 105 // In other words, FILTER_REJECT does not pass over descendants
106 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP . 106 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP .
107 RefPtr<Node> provisionalResult = m_candidateNode.node; 107 RefPtr<Node> provisionalResult = m_candidateNode.node;
108 bool nodeWasAccepted = acceptNode(state, provisionalResult.get()) == Nod eFilter::FILTER_ACCEPT; 108 bool nodeWasAccepted = acceptNode(state, provisionalResult.get()) == Nod eFilter::FILTER_ACCEPT;
109 if (state && state->hadException()) 109 if (state && state->hadException())
110 break; 110 break;
111 if (nodeWasAccepted) { 111 if (nodeWasAccepted) {
112 m_referenceNode = m_candidateNode; 112 m_referenceNode = m_candidateNode;
113 result = provisionalResult.release(); 113 result = provisionalResult.release();
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 m_candidateNode.clear(); 118 m_candidateNode.clear();
119 return result.release(); 119 return result.release();
120 } 120 }
121 121
122 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionCode& e c) 122 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionCode& e c)
123 { 123 {
124 if (m_detached) { 124 if (m_detached) {
125 ec = INVALID_STATE_ERR; 125 ec = InvalidStateError;
126 return 0; 126 return 0;
127 } 127 }
128 128
129 RefPtr<Node> result; 129 RefPtr<Node> result;
130 130
131 m_candidateNode = m_referenceNode; 131 m_candidateNode = m_referenceNode;
132 while (m_candidateNode.moveToPrevious(root())) { 132 while (m_candidateNode.moveToPrevious(root())) {
133 // NodeIterators treat the DOM tree as a flat list of nodes. 133 // NodeIterators treat the DOM tree as a flat list of nodes.
134 // In other words, FILTER_REJECT does not pass over descendants 134 // In other words, FILTER_REJECT does not pass over descendants
135 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP . 135 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP .
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 node = NodeTraversal::previous(node, root()); 226 node = NodeTraversal::previous(node, root());
227 } 227 }
228 if (node) 228 if (node)
229 referenceNode.node = node; 229 referenceNode.node = node;
230 } 230 }
231 } 231 }
232 } 232 }
233 233
234 234
235 } // namespace WebCore 235 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/Range.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698