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

Side by Side Diff: third_party/WebKit/Source/core/dom/NodeTraversal.cpp

Issue 1854423002: ASSERT -> {DCHECK|DCHECK_XX}, ENABLE(ASSERT) -> DCHECK_IS_ON() in dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark svg/as-image/svg-nested.html crash on win Created 4 years, 8 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
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 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (parent == stayWithin) 68 if (parent == stayWithin)
69 return 0; 69 return 0;
70 if (Node* next = parent->pseudoAwareNextSibling()) 70 if (Node* next = parent->pseudoAwareNextSibling())
71 return next; 71 return next;
72 } 72 }
73 return 0; 73 return 0;
74 } 74 }
75 75
76 Node* NodeTraversal::nextAncestorSibling(const Node& current) 76 Node* NodeTraversal::nextAncestorSibling(const Node& current)
77 { 77 {
78 ASSERT(!current.nextSibling()); 78 DCHECK(!current.nextSibling());
79 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod e()) { 79 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod e()) {
80 if (parent->nextSibling()) 80 if (parent->nextSibling())
81 return parent->nextSibling(); 81 return parent->nextSibling();
82 } 82 }
83 return 0; 83 return 0;
84 } 84 }
85 85
86 Node* NodeTraversal::nextAncestorSibling(const Node& current, const Node* stayWi thin) 86 Node* NodeTraversal::nextAncestorSibling(const Node& current, const Node* stayWi thin)
87 { 87 {
88 ASSERT(!current.nextSibling()); 88 DCHECK(!current.nextSibling());
89 ASSERT(current != stayWithin); 89 DCHECK_NE(current, stayWithin);
90 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod e()) { 90 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod e()) {
91 if (parent == stayWithin) 91 if (parent == stayWithin)
92 return 0; 92 return 0;
93 if (parent->nextSibling()) 93 if (parent->nextSibling())
94 return parent->nextSibling(); 94 return parent->nextSibling();
95 } 95 }
96 return 0; 96 return 0;
97 } 97 }
98 98
99 Node* NodeTraversal::lastWithin(const ContainerNode& current) 99 Node* NodeTraversal::lastWithin(const ContainerNode& current)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (!current.nextSibling()) 145 if (!current.nextSibling())
146 return current.parentNode(); 146 return current.parentNode();
147 Node* next = current.nextSibling(); 147 Node* next = current.nextSibling();
148 while (Node* child = next->firstChild()) 148 while (Node* child = next->firstChild())
149 next = child; 149 next = child;
150 return next; 150 return next;
151 } 151 }
152 152
153 static Node* previousAncestorSiblingPostOrder(const Node& current, const Node* s tayWithin) 153 static Node* previousAncestorSiblingPostOrder(const Node& current, const Node* s tayWithin)
154 { 154 {
155 ASSERT(!current.previousSibling()); 155 DCHECK(!current.previousSibling());
156 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod e()) { 156 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod e()) {
157 if (parent == stayWithin) 157 if (parent == stayWithin)
158 return 0; 158 return 0;
159 if (parent->previousSibling()) 159 if (parent->previousSibling())
160 return parent->previousSibling(); 160 return parent->previousSibling();
161 } 161 }
162 return 0; 162 return 0;
163 } 163 }
164 164
165 Node* NodeTraversal::previousPostOrder(const Node& current, const Node* stayWith in) 165 Node* NodeTraversal::previousPostOrder(const Node& current, const Node* stayWith in)
166 { 166 {
167 if (Node* lastChild = current.lastChild()) 167 if (Node* lastChild = current.lastChild())
168 return lastChild; 168 return lastChild;
169 if (current == stayWithin) 169 if (current == stayWithin)
170 return 0; 170 return 0;
171 if (current.previousSibling()) 171 if (current.previousSibling())
172 return current.previousSibling(); 172 return current.previousSibling();
173 return previousAncestorSiblingPostOrder(current, stayWithin); 173 return previousAncestorSiblingPostOrder(current, stayWithin);
174 } 174 }
175 175
176 Node* NodeTraversal::commonAncestor(const Node& nodeA, const Node& nodeB) 176 Node* NodeTraversal::commonAncestor(const Node& nodeA, const Node& nodeB)
177 { 177 {
178 return Range::commonAncestorContainer(&nodeA, &nodeB); 178 return Range::commonAncestorContainer(&nodeA, &nodeB);
179 } 179 }
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/NodeRareData.h ('k') | third_party/WebKit/Source/core/dom/NodeWithIndex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698