OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire
ction) | 67 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire
ction) |
68 { | 68 { |
69 ASSERT(node); | 69 ASSERT(node); |
70 if (!isActiveInsertionPoint(*node)) | 70 if (!isActiveInsertionPoint(*node)) |
71 return const_cast<Node*>(node); | 71 return const_cast<Node*>(node); |
72 const InsertionPoint* insertionPoint = toInsertionPoint(node); | 72 const InsertionPoint* insertionPoint = toInsertionPoint(node); |
73 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo
rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct
ion)) | 73 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo
rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct
ion)) |
74 return found; | 74 return found; |
75 ASSERT(node->hasTagName(HTMLNames::shadowTag) || (node->hasTagName(HTMLNames
::contentTag) && !node->hasChildNodes())); | 75 ASSERT(node->hasTagName(HTMLNames::shadowTag) || (node->hasTagName(HTMLNames
::contentTag) && !node->hasChildren())); |
76 return 0; | 76 return 0; |
77 } | 77 } |
78 | 78 |
79 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser
tionPoint* insertionPoint, TraversalDirection direction) | 79 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser
tionPoint* insertionPoint, TraversalDirection direction) |
80 { | 80 { |
81 for (const Node* next = node; next; next = (direction == TraversalDirectionF
orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { | 81 for (const Node* next = node; next; next = (direction == TraversalDirectionF
orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { |
82 if (Node* found = traverseNode(next, direction)) | 82 if (Node* found = traverseNode(next, direction)) |
83 return found; | 83 return found; |
84 } | 84 } |
85 return 0; | 85 return 0; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ShadowRoot* shadowRoot = toShadowRoot(parent); | 156 ShadowRoot* shadowRoot = toShadowRoot(parent); |
157 ASSERT(!shadowRoot->shadowInsertionPointOfYoungerShadowRoot()); | 157 ASSERT(!shadowRoot->shadowInsertionPointOfYoungerShadowRoot()); |
158 if (!shadowRoot->isYoungest()) | 158 if (!shadowRoot->isYoungest()) |
159 return 0; | 159 return 0; |
160 if (details) | 160 if (details) |
161 details->didTraverseShadowRoot(shadowRoot); | 161 details->didTraverseShadowRoot(shadowRoot); |
162 return shadowRoot->host(); | 162 return shadowRoot->host(); |
163 } | 163 } |
164 | 164 |
165 } // namespace | 165 } // namespace |
OLD | NEW |