| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire
ction) | 65 Node* ComposedTreeWalker::traverseNode(const Node* node, TraversalDirection dire
ction) |
| 66 { | 66 { |
| 67 ASSERT(node); | 67 ASSERT(node); |
| 68 if (!isActiveInsertionPoint(*node)) | 68 if (!isActiveInsertionPoint(*node)) |
| 69 return const_cast<Node*>(node); | 69 return const_cast<Node*>(node); |
| 70 const InsertionPoint* insertionPoint = toInsertionPoint(node); | 70 const InsertionPoint* insertionPoint = toInsertionPoint(node); |
| 71 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo
rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct
ion)) | 71 if (Node* found = traverseDistributedNodes(direction == TraversalDirectionFo
rward ? insertionPoint->first() : insertionPoint->last(), insertionPoint, direct
ion)) |
| 72 return found; | 72 return found; |
| 73 ASSERT(isHTMLContentElement(node) && !node->hasChildren()); | 73 ASSERT_NOT_REACHED(); |
| 74 return 0; | 74 return 0; |
| 75 } | 75 } |
| 76 | 76 |
| 77 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser
tionPoint* insertionPoint, TraversalDirection direction) | 77 Node* ComposedTreeWalker::traverseDistributedNodes(const Node* node, const Inser
tionPoint* insertionPoint, TraversalDirection direction) |
| 78 { | 78 { |
| 79 for (const Node* next = node; next; next = (direction == TraversalDirectionF
orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { | 79 for (const Node* next = node; next; next = (direction == TraversalDirectionF
orward ? insertionPoint->nextTo(next) : insertionPoint->previousTo(next))) { |
| 80 if (Node* found = traverseNode(next, direction)) | 80 if (Node* found = traverseNode(next, direction)) |
| 81 return found; | 81 return found; |
| 82 } | 82 } |
| 83 return 0; | 83 return 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 Node* parent = node->parentNode(); | 130 Node* parent = node->parentNode(); |
| 131 if (!parent) | 131 if (!parent) |
| 132 return 0; | 132 return 0; |
| 133 if (!parent->isShadowRoot()) | 133 if (!parent->isShadowRoot()) |
| 134 return parent; | 134 return parent; |
| 135 ShadowRoot* shadowRoot = toShadowRoot(parent); | 135 ShadowRoot* shadowRoot = toShadowRoot(parent); |
| 136 return shadowRoot->host(); | 136 return shadowRoot->host(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace | 139 } // namespace |
| OLD | NEW |