| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 if (shadowWhereNodeCanBeDistributedForV0(node)) | 128 if (shadowWhereNodeCanBeDistributedForV0(node)) |
| 129 return traverseSiblingsForV0Distribution(node, direction); | 129 return traverseSiblingsForV0Distribution(node, direction); |
| 130 | 130 |
| 131 if (Node* found = resolveDistributionStartingAt( | 131 if (Node* found = resolveDistributionStartingAt( |
| 132 direction == TraversalDirectionForward ? node.nextSibling() | 132 direction == TraversalDirectionForward ? node.nextSibling() |
| 133 : node.previousSibling(), | 133 : node.previousSibling(), |
| 134 direction)) | 134 direction)) |
| 135 return found; | 135 return found; |
| 136 | 136 |
| 137 // Slotted nodes are already handled in traverseSiblingsForV1HostChild() |
| 138 // above, here is for fallback contents. |
| 139 Element* parent = node.parentElement(); |
| 140 if (parent && isHTMLSlotElement(parent)) { |
| 141 HTMLSlotElement& slot = toHTMLSlotElement(*parent); |
| 142 if (slot.supportsDistribution() && slot.assignedNodes().isEmpty()) |
| 143 return traverseSiblings(slot, direction); |
| 144 } |
| 145 |
| 137 if (!node.isInV0ShadowTree()) | 146 if (!node.isInV0ShadowTree()) |
| 138 return nullptr; | 147 return nullptr; |
| 139 | 148 |
| 140 // For v0 older shadow tree | 149 // For v0 older shadow tree |
| 141 if (node.parentNode() && node.parentNode()->isShadowRoot()) { | 150 if (node.parentNode() && node.parentNode()->isShadowRoot()) { |
| 142 ShadowRoot* parentShadowRoot = toShadowRoot(node.parentNode()); | 151 ShadowRoot* parentShadowRoot = toShadowRoot(node.parentNode()); |
| 143 if (!parentShadowRoot->isYoungest()) { | 152 if (!parentShadowRoot->isYoungest()) { |
| 144 HTMLShadowElement* assignedInsertionPoint = | 153 HTMLShadowElement* assignedInsertionPoint = |
| 145 parentShadowRoot->shadowInsertionPointOfYoungerShadowRoot(); | 154 parentShadowRoot->shadowInsertionPointOfYoungerShadowRoot(); |
| 146 DCHECK(assignedInsertionPoint); | 155 DCHECK(assignedInsertionPoint); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 392 |
| 384 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { | 393 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { |
| 385 assertPrecondition(node); | 394 assertPrecondition(node); |
| 386 Node* lastDescendant = lastWithin(node); | 395 Node* lastDescendant = lastWithin(node); |
| 387 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); | 396 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); |
| 388 assertPostcondition(&result); | 397 assertPostcondition(&result); |
| 389 return result; | 398 return result; |
| 390 } | 399 } |
| 391 | 400 |
| 392 } // namespace blink | 401 } // namespace blink |
| OLD | NEW |