OLD | NEW |
---|---|
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. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
6 * All rights reserved. | 6 * All rights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
8 * (http://www.torchmobile.com/) | 8 * (http://www.torchmobile.com/) |
9 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 9 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
10 * | 10 * |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 } | 114 } |
115 static Node* childAt(const ContainerNode& parent, unsigned index) { | 115 static Node* childAt(const ContainerNode& parent, unsigned index) { |
116 return childAtTemplate(parent, index); | 116 return childAtTemplate(parent, index); |
117 } | 117 } |
118 | 118 |
119 // These functions are provided for matching with |FlatTreeTraversal|. | 119 // These functions are provided for matching with |FlatTreeTraversal|. |
120 static bool hasChildren(const Node& parent) { return firstChild(parent); } | 120 static bool hasChildren(const Node& parent) { return firstChild(parent); } |
121 static bool isDescendantOf(const Node& node, const Node& other) { | 121 static bool isDescendantOf(const Node& node, const Node& other) { |
122 return node.isDescendantOf(&other); | 122 return node.isDescendantOf(&other); |
123 } | 123 } |
124 static bool contains(const ContainerNode& container, const Node& other) { | |
125 return container.contains(&other); | |
yosin_UTC9
2017/03/17 10:06:13
Since there is no unit test for ContainerNode::con
| |
126 } | |
124 static Node* firstChild(const Node& parent) { return parent.firstChild(); } | 127 static Node* firstChild(const Node& parent) { return parent.firstChild(); } |
125 static Node* lastChild(const Node& parent) { return parent.lastChild(); } | 128 static Node* lastChild(const Node& parent) { return parent.lastChild(); } |
126 static Node* nextSibling(const Node& node) { return node.nextSibling(); } | 129 static Node* nextSibling(const Node& node) { return node.nextSibling(); } |
127 static Node* previousSibling(const Node& node) { | 130 static Node* previousSibling(const Node& node) { |
128 return node.previousSibling(); | 131 return node.previousSibling(); |
129 } | 132 } |
130 static ContainerNode* parent(const Node& node) { return node.parentNode(); } | 133 static ContainerNode* parent(const Node& node) { return node.parentNode(); } |
131 static Node* commonAncestor(const Node& nodeA, const Node& nodeB); | 134 static Node* commonAncestor(const Node& nodeA, const Node& nodeB); |
132 static unsigned index(const Node& node) { return node.nodeIndex(); } | 135 static unsigned index(const Node& node) { return node.nodeIndex(); } |
133 static unsigned countChildren(const Node& parent) { | 136 static unsigned countChildren(const Node& parent) { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 inline Node* NodeTraversal::childAtTemplate(NodeType& parent, unsigned index) { | 395 inline Node* NodeTraversal::childAtTemplate(NodeType& parent, unsigned index) { |
393 Node* child = parent.firstChild(); | 396 Node* child = parent.firstChild(); |
394 while (child && index--) | 397 while (child && index--) |
395 child = child->nextSibling(); | 398 child = child->nextSibling(); |
396 return child; | 399 return child; |
397 } | 400 } |
398 | 401 |
399 } // namespace blink | 402 } // namespace blink |
400 | 403 |
401 #endif | 404 #endif |
OLD | NEW |