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

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

Issue 425223005: Move Node/ContainerNode's traverseToChildAt() to NodeTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/ContainerNode.h ('k') | Source/core/dom/Node.h » ('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 * (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, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1098
1099 unsigned ContainerNode::countChildren() const 1099 unsigned ContainerNode::countChildren() const
1100 { 1100 {
1101 unsigned count = 0; 1101 unsigned count = 0;
1102 Node *n; 1102 Node *n;
1103 for (n = firstChild(); n; n = n->nextSibling()) 1103 for (n = firstChild(); n; n = n->nextSibling())
1104 count++; 1104 count++;
1105 return count; 1105 return count;
1106 } 1106 }
1107 1107
1108 Node* ContainerNode::traverseToChildAt(unsigned index) const
1109 {
1110 unsigned i;
1111 Node *n = firstChild();
1112 for (i = 0; n != 0 && i < index; i++)
1113 n = n->nextSibling();
1114 return n;
1115 }
1116
1117 PassRefPtrWillBeRawPtr<Element> ContainerNode::querySelector(const AtomicString& selectors, ExceptionState& exceptionState) 1108 PassRefPtrWillBeRawPtr<Element> ContainerNode::querySelector(const AtomicString& selectors, ExceptionState& exceptionState)
1118 { 1109 {
1119 if (selectors.isEmpty()) { 1110 if (selectors.isEmpty()) {
1120 exceptionState.throwDOMException(SyntaxError, "The provided selector is empty."); 1111 exceptionState.throwDOMException(SyntaxError, "The provided selector is empty.");
1121 return nullptr; 1112 return nullptr;
1122 } 1113 }
1123 1114
1124 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState); 1115 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors , document(), exceptionState);
1125 if (!selectorQuery) 1116 if (!selectorQuery)
1126 return nullptr; 1117 return nullptr;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 return true; 1411 return true;
1421 1412
1422 if (node->isElementNode() && toElement(node)->shadow()) 1413 if (node->isElementNode() && toElement(node)->shadow())
1423 return true; 1414 return true;
1424 1415
1425 return false; 1416 return false;
1426 } 1417 }
1427 #endif 1418 #endif
1428 1419
1429 } // namespace blink 1420 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698