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

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

Issue 428533006: Use ContainerNode::hasChildren() instead of firstChild() in conditionals (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fix Created 6 years, 4 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/ScriptLoader.cpp ('k') | Source/core/editing/ApplyStyleCommand.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 { 75 {
76 for (RefPtrWillBeRawPtr<Node> node = m_current->firstChild(); node; ) { 76 for (RefPtrWillBeRawPtr<Node> node = m_current->firstChild(); node; ) {
77 short acceptNodeResult = acceptNode(node.get(), exceptionState); 77 short acceptNodeResult = acceptNode(node.get(), exceptionState);
78 if (exceptionState.hadException()) 78 if (exceptionState.hadException())
79 return 0; 79 return 0;
80 switch (acceptNodeResult) { 80 switch (acceptNodeResult) {
81 case NodeFilter::FILTER_ACCEPT: 81 case NodeFilter::FILTER_ACCEPT:
82 m_current = node.release(); 82 m_current = node.release();
83 return m_current.get(); 83 return m_current.get();
84 case NodeFilter::FILTER_SKIP: 84 case NodeFilter::FILTER_SKIP:
85 if (node->firstChild()) { 85 if (node->hasChildren()) {
86 node = node->firstChild(); 86 node = node->firstChild();
87 continue; 87 continue;
88 } 88 }
89 break; 89 break;
90 case NodeFilter::FILTER_REJECT: 90 case NodeFilter::FILTER_REJECT:
91 break; 91 break;
92 } 92 }
93 do { 93 do {
94 if (node->nextSibling()) { 94 if (node->nextSibling()) {
95 node = node->nextSibling(); 95 node = node->nextSibling();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 while (1) { 182 while (1) {
183 for (RefPtrWillBeRawPtr<Node> sibling = node->nextSibling(); sibling; ) { 183 for (RefPtrWillBeRawPtr<Node> sibling = node->nextSibling(); sibling; ) {
184 short acceptNodeResult = acceptNode(sibling.get(), exceptionState); 184 short acceptNodeResult = acceptNode(sibling.get(), exceptionState);
185 if (exceptionState.hadException()) 185 if (exceptionState.hadException())
186 return 0; 186 return 0;
187 switch (acceptNodeResult) { 187 switch (acceptNodeResult) {
188 case NodeFilter::FILTER_ACCEPT: 188 case NodeFilter::FILTER_ACCEPT:
189 m_current = sibling.release(); 189 m_current = sibling.release();
190 return m_current.get(); 190 return m_current.get();
191 case NodeFilter::FILTER_SKIP: 191 case NodeFilter::FILTER_SKIP:
192 if (sibling->firstChild()) { 192 if (sibling->hasChildren()) {
193 sibling = sibling->firstChild(); 193 sibling = sibling->firstChild();
194 node = sibling; 194 node = sibling;
195 continue; 195 continue;
196 } 196 }
197 break; 197 break;
198 case NodeFilter::FILTER_REJECT: 198 case NodeFilter::FILTER_REJECT:
199 break; 199 break;
200 } 200 }
201 sibling = sibling->nextSibling(); 201 sibling = sibling->nextSibling();
202 } 202 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return 0; 277 return 0;
278 } 278 }
279 279
280 void TreeWalker::trace(Visitor* visitor) 280 void TreeWalker::trace(Visitor* visitor)
281 { 281 {
282 visitor->trace(m_current); 282 visitor->trace(m_current);
283 NodeIteratorBase::trace(visitor); 283 NodeIteratorBase::trace(visitor);
284 } 284 }
285 285
286 } // namespace blink 286 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/ScriptLoader.cpp ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698