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, 2013 Appl
e Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Appl
e 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 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // | 59 // |
60 // When looking for a specific element type, it is more efficient to do this: | 60 // When looking for a specific element type, it is more efficient to do this: |
61 // Traversal<HTMLTitleElement>::firstChild(someNode); | 61 // Traversal<HTMLTitleElement>::firstChild(someNode); |
62 // | 62 // |
63 // Traversal can also be used to find ancestors and descendants; see the | 63 // Traversal can also be used to find ancestors and descendants; see the |
64 // documentation in the class body below. | 64 // documentation in the class body below. |
65 // | 65 // |
66 // Note that these functions do not traverse into child shadow trees of any | 66 // Note that these functions do not traverse into child shadow trees of any |
67 // shadow hosts they encounter. If you need to traverse the shadow DOM, you can | 67 // shadow hosts they encounter. If you need to traverse the shadow DOM, you can |
68 // manually traverse the shadow trees using a second Traversal, or use | 68 // manually traverse the shadow trees using a second Traversal, or use |
69 // ComposedTreeTraversal. | 69 // FlatTreeTraversal. |
70 // | 70 // |
71 // ElementTraversal is a specialized version of Traversal<Element>. | 71 // ElementTraversal is a specialized version of Traversal<Element>. |
72 template <class ElementType> | 72 template <class ElementType> |
73 class Traversal { | 73 class Traversal { |
74 STATIC_ONLY(Traversal); | 74 STATIC_ONLY(Traversal); |
75 public: | 75 public: |
76 using TraversalNodeType = ElementType; | 76 using TraversalNodeType = ElementType; |
77 // First or last ElementType child of the node. | 77 // First or last ElementType child of the node. |
78 static ElementType* firstChild(const ContainerNode& current) { return firstC
hildTemplate(current); } | 78 static ElementType* firstChild(const ContainerNode& current) { return firstC
hildTemplate(current); } |
79 static ElementType* firstChild(const Node& current) { return firstChildTempl
ate(current); } | 79 static ElementType* firstChild(const Node& current) { return firstChildTempl
ate(current); } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 { | 462 { |
463 ElementType* element = Traversal<ElementType>::nextSibling(current); | 463 ElementType* element = Traversal<ElementType>::nextSibling(current); |
464 while (element && !isMatch(*element)) | 464 while (element && !isMatch(*element)) |
465 element = Traversal<ElementType>::nextSibling(*element); | 465 element = Traversal<ElementType>::nextSibling(*element); |
466 return element; | 466 return element; |
467 } | 467 } |
468 | 468 |
469 } // namespace blink | 469 } // namespace blink |
470 | 470 |
471 #endif | 471 #endif |
OLD | NEW |