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

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

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 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 | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 { 81 {
82 ScriptWrappable::init(this); 82 ScriptWrappable::init(this);
83 root()->document().attachNodeIterator(this); 83 root()->document().attachNodeIterator(this);
84 } 84 }
85 85
86 NodeIterator::~NodeIterator() 86 NodeIterator::~NodeIterator()
87 { 87 {
88 root()->document().detachNodeIterator(this); 88 root()->document().detachNodeIterator(this);
89 } 89 }
90 90
91 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionState& es) 91 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionState& exce ptionState)
92 { 92 {
93 if (m_detached) { 93 if (m_detached) {
94 es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecu te("nextNode", "NodeIterator", "The iterator is detached.")); 94 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f ailedToExecute("nextNode", "NodeIterator", "The iterator is detached."));
95 return 0; 95 return 0;
96 } 96 }
97 97
98 RefPtr<Node> result; 98 RefPtr<Node> result;
99 99
100 m_candidateNode = m_referenceNode; 100 m_candidateNode = m_referenceNode;
101 while (m_candidateNode.moveToNext(root())) { 101 while (m_candidateNode.moveToNext(root())) {
102 // NodeIterators treat the DOM tree as a flat list of nodes. 102 // NodeIterators treat the DOM tree as a flat list of nodes.
103 // In other words, FILTER_REJECT does not pass over descendants 103 // In other words, FILTER_REJECT does not pass over descendants
104 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP . 104 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP .
105 RefPtr<Node> provisionalResult = m_candidateNode.node; 105 RefPtr<Node> provisionalResult = m_candidateNode.node;
106 bool nodeWasAccepted = acceptNode(state, provisionalResult.get()) == Nod eFilter::FILTER_ACCEPT; 106 bool nodeWasAccepted = acceptNode(state, provisionalResult.get()) == Nod eFilter::FILTER_ACCEPT;
107 if (state && state->hadException()) 107 if (state && state->hadException())
108 break; 108 break;
109 if (nodeWasAccepted) { 109 if (nodeWasAccepted) {
110 m_referenceNode = m_candidateNode; 110 m_referenceNode = m_candidateNode;
111 result = provisionalResult.release(); 111 result = provisionalResult.release();
112 break; 112 break;
113 } 113 }
114 } 114 }
115 115
116 m_candidateNode.clear(); 116 m_candidateNode.clear();
117 return result.release(); 117 return result.release();
118 } 118 }
119 119
120 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionState& es) 120 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionState& exceptionState)
121 { 121 {
122 if (m_detached) { 122 if (m_detached) {
123 es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecu te("previousNode", "NodeIterator", "The iterator is detached.")); 123 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f ailedToExecute("previousNode", "NodeIterator", "The iterator is detached."));
124 return 0; 124 return 0;
125 } 125 }
126 126
127 RefPtr<Node> result; 127 RefPtr<Node> result;
128 128
129 m_candidateNode = m_referenceNode; 129 m_candidateNode = m_referenceNode;
130 while (m_candidateNode.moveToPrevious(root())) { 130 while (m_candidateNode.moveToPrevious(root())) {
131 // NodeIterators treat the DOM tree as a flat list of nodes. 131 // NodeIterators treat the DOM tree as a flat list of nodes.
132 // In other words, FILTER_REJECT does not pass over descendants 132 // In other words, FILTER_REJECT does not pass over descendants
133 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP . 133 // of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP .
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 node = NodeTraversal::previous(*node, root()); 221 node = NodeTraversal::previous(*node, root());
222 } 222 }
223 if (node) 223 if (node)
224 referenceNode.node = node; 224 referenceNode.node = node;
225 } 225 }
226 } 226 }
227 } 227 }
228 228
229 229
230 } // namespace WebCore 230 } // 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