| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 class Node; | 36 class Node; |
| 37 class ShadowRoot; | 37 class ShadowRoot; |
| 38 | 38 |
| 39 // FIXME: Make some functions inline to optimise the performance. | 39 // FIXME: Make some functions inline to optimise the performance. |
| 40 // https://bugs.webkit.org/show_bug.cgi?id=82702 | 40 // https://bugs.webkit.org/show_bug.cgi?id=82702 |
| 41 class ComposedTreeWalker { | 41 class ComposedTreeWalker { |
| 42 STACK_ALLOCATED(); |
| 42 public: | 43 public: |
| 43 typedef NodeRenderingTraversal::ParentDetails ParentTraversalDetails; | 44 typedef NodeRenderingTraversal::ParentDetails ParentTraversalDetails; |
| 44 | 45 |
| 45 enum StartPolicy { | 46 enum StartPolicy { |
| 46 CanStartFromShadowBoundary, | 47 CanStartFromShadowBoundary, |
| 47 CannotStartFromShadowBoundary | 48 CannotStartFromShadowBoundary |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 ComposedTreeWalker(const Node*, StartPolicy = CannotStartFromShadowBoundary)
; | 51 ComposedTreeWalker(const Node*, StartPolicy = CannotStartFromShadowBoundary)
; |
| 51 | 52 |
| 52 Node* get() const { return const_cast<Node*>(m_node); } | 53 Node* get() const { return const_cast<Node*>(m_node.get()); } |
| 53 | 54 |
| 54 void firstChild(); | 55 void firstChild(); |
| 55 void lastChild(); | 56 void lastChild(); |
| 56 | 57 |
| 57 void nextSibling(); | 58 void nextSibling(); |
| 58 void previousSibling(); | 59 void previousSibling(); |
| 59 | 60 |
| 60 void parent(); | 61 void parent(); |
| 61 | 62 |
| 62 void next(); | 63 void next(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 static Node* traverseSiblingOrBackToInsertionPoint(const Node*, TraversalDir
ection); | 103 static Node* traverseSiblingOrBackToInsertionPoint(const Node*, TraversalDir
ection); |
| 103 static Node* traverseSiblingInCurrentTree(const Node*, TraversalDirection); | 104 static Node* traverseSiblingInCurrentTree(const Node*, TraversalDirection); |
| 104 | 105 |
| 105 static Node* traverseSiblings(const Node*, TraversalDirection); | 106 static Node* traverseSiblings(const Node*, TraversalDirection); |
| 106 static Node* traverseDistributedNodes(const Node*, const InsertionPoint*, Tr
aversalDirection); | 107 static Node* traverseDistributedNodes(const Node*, const InsertionPoint*, Tr
aversalDirection); |
| 107 | 108 |
| 108 static Node* traverseBackToYoungerShadowRoot(const Node*, TraversalDirection
); | 109 static Node* traverseBackToYoungerShadowRoot(const Node*, TraversalDirection
); |
| 109 | 110 |
| 110 Node* traverseParentOrHost(const Node*) const; | 111 Node* traverseParentOrHost(const Node*) const; |
| 111 | 112 |
| 112 const Node* m_node; | 113 RawPtrWillBeMember<const Node> m_node; |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 inline ComposedTreeWalker::ComposedTreeWalker(const Node* node, StartPolicy star
tPolicy) | 116 inline ComposedTreeWalker::ComposedTreeWalker(const Node* node, StartPolicy star
tPolicy) |
| 116 : m_node(node) | 117 : m_node(node) |
| 117 { | 118 { |
| 118 #ifndef NDEBUG | 119 #ifndef NDEBUG |
| 119 if (m_node && startPolicy == CannotStartFromShadowBoundary) | 120 if (m_node && startPolicy == CannotStartFromShadowBoundary) |
| 120 assertPrecondition(); | 121 assertPrecondition(); |
| 121 #endif | 122 #endif |
| 122 } | 123 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 207 |
| 207 inline Node* ComposedTreeWalker::traverseLastChild(const Node* node) const | 208 inline Node* ComposedTreeWalker::traverseLastChild(const Node* node) const |
| 208 { | 209 { |
| 209 ASSERT(node); | 210 ASSERT(node); |
| 210 return traverseChild(node, TraversalDirectionBackward); | 211 return traverseChild(node, TraversalDirectionBackward); |
| 211 } | 212 } |
| 212 | 213 |
| 213 } // namespace | 214 } // namespace |
| 214 | 215 |
| 215 #endif | 216 #endif |
| OLD | NEW |