| 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 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "core/dom/shadow/ComposedTreeWalker.h" | 29 #include "core/dom/shadow/ComposedTreeWalker.h" |
| 30 | 30 |
| 31 #include "core/dom/Element.h" | 31 #include "core/dom/Element.h" |
| 32 #include "core/dom/shadow/ElementShadow.h" | 32 #include "core/dom/shadow/ElementShadow.h" |
| 33 #include "core/dom/shadow/InsertionPoint.h" | 33 #include "core/dom/shadow/InsertionPoint.h" |
| 34 #include "core/html/shadow/HTMLContentElement.h" |
| 34 #include "core/html/shadow/HTMLShadowElement.h" | 35 #include "core/html/shadow/HTMLShadowElement.h" |
| 35 | 36 |
| 36 namespace WebCore { | 37 namespace WebCore { |
| 37 | 38 |
| 38 static inline ElementShadow* shadowFor(const Node* node) | 39 static inline ElementShadow* shadowFor(const Node* node) |
| 39 { | 40 { |
| 40 if (node && node->isElementNode()) | 41 if (node && node->isElementNode()) |
| 41 return toElement(node)->shadow(); | 42 return toElement(node)->shadow(); |
| 42 return 0; | 43 return 0; |
| 43 } | 44 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 66 } | 67 } |
| 67 | 68 |
| 68 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire
ction) | 69 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire
ction) |
| 69 { | 70 { |
| 70 ASSERT(node); | 71 ASSERT(node); |
| 71 if (!isActiveInsertionPoint(*node)) | 72 if (!isActiveInsertionPoint(*node)) |
| 72 return const_cast<Node*>(node); | 73 return const_cast<Node*>(node); |
| 73 const InsertionPoint* insertionPoint = toInsertionPoint(node); | 74 const InsertionPoint* insertionPoint = toInsertionPoint(node); |
| 74 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo
rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct
ion)) | 75 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo
rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct
ion)) |
| 75 return found; | 76 return found; |
| 76 return traverseLightChildren(node, direction); | 77 ASSERT(isHTMLShadowElement(node) || (isHTMLContentElement(node) && !node->ha
sChildNodes())); |
| 78 return 0; |
| 77 } | 79 } |
| 78 | 80 |
| 79 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser
tionPoint* insertionPoint, TraversalDirection direction) | 81 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser
tionPoint* insertionPoint, TraversalDirection direction) |
| 80 { | 82 { |
| 81 for (const Node* next = node; next; next = (direction == TraversalDirectionF
orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { | 83 for (const Node* next = node; next; next = (direction == TraversalDirectionF
orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { |
| 82 if (Node* found = traverseNode(next, direction)) | 84 if (Node* found = traverseNode(next, direction)) |
| 83 return found; | 85 return found; |
| 84 } | 86 } |
| 85 return 0; | 87 return 0; |
| 86 } | 88 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 ShadowRoot* shadowRoot = toShadowRoot(parent); | 158 ShadowRoot* shadowRoot = toShadowRoot(parent); |
| 157 ASSERT(!shadowRoot->shadowInsertionPointOfYoungerShadowRoot()); | 159 ASSERT(!shadowRoot->shadowInsertionPointOfYoungerShadowRoot()); |
| 158 if (!shadowRoot->isYoungest()) | 160 if (!shadowRoot->isYoungest()) |
| 159 return 0; | 161 return 0; |
| 160 if (details) | 162 if (details) |
| 161 details->didTraverseShadowRoot(shadowRoot); | 163 details->didTraverseShadowRoot(shadowRoot); |
| 162 return shadowRoot->host(); | 164 return shadowRoot->host(); |
| 163 } | 165 } |
| 164 | 166 |
| 165 } // namespace | 167 } // namespace |
| OLD | NEW |