Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 direction); | 52 direction); |
| 53 } | 53 } |
| 54 return resolveDistributionStartingAt(direction == TraversalDirectionForward | 54 return resolveDistributionStartingAt(direction == TraversalDirectionForward |
| 55 ? node.firstChild() | 55 ? node.firstChild() |
| 56 : node.lastChild(), | 56 : node.lastChild(), |
| 57 direction); | 57 direction); |
| 58 } | 58 } |
| 59 | 59 |
| 60 Node* FlatTreeTraversal::resolveDistributionStartingAt( | 60 Node* FlatTreeTraversal::resolveDistributionStartingAt( |
| 61 const Node* node, | 61 const Node* node, |
| 62 TraversalDirection direction) { | 62 TraversalDirection direction) { |
|
yosin_UTC9
2016/10/14 01:44:40
BTW, how about using template function to avoid |T
hayato
2016/10/14 03:05:35
That could be possible. We should do it in another
| |
| 63 if (!node) | 63 if (!node) |
| 64 return nullptr; | 64 return nullptr; |
| 65 for (const Node* sibling = node; sibling; | 65 for (const Node* sibling = node; sibling; |
| 66 sibling = (direction == TraversalDirectionForward | 66 sibling = (direction == TraversalDirectionForward |
| 67 ? sibling->nextSibling() | 67 ? sibling->nextSibling() |
| 68 : sibling->previousSibling())) { | 68 : sibling->previousSibling())) { |
| 69 if (isHTMLSlotElement(*sibling)) { | 69 if (isHTMLSlotElement(*sibling)) { |
| 70 const HTMLSlotElement& slot = toHTMLSlotElement(*sibling); | 70 const HTMLSlotElement& slot = toHTMLSlotElement(*sibling); |
| 71 if (slot.isInDocumentTree()) { | |
| 72 const_cast<HTMLSlotElement&>(slot) | |
|
yosin_UTC9
2016/10/14 01:44:40
Can we integrate collecting distributed nodes into
hayato
2016/10/14 03:05:35
Yeah, that is one of TODO items. That could not be
| |
| 73 .updateDistributedNodesInDocumentTree(); | |
|
yosin_UTC9
2016/10/14 01:44:40
It is better that using |collectDistributionNodesI
hayato
2016/10/14 03:05:35
I think using *update* is consistent within this f
| |
| 74 } | |
| 71 if (Node* found = (direction == TraversalDirectionForward | 75 if (Node* found = (direction == TraversalDirectionForward |
| 72 ? slot.firstDistributedNode() | 76 ? slot.firstDistributedNode() |
| 73 : slot.lastDistributedNode())) | 77 : slot.lastDistributedNode())) |
| 74 return found; | 78 return found; |
| 75 continue; | 79 continue; |
| 76 } | 80 } |
| 77 if (node->isInV0ShadowTree()) | 81 if (node->isInV0ShadowTree()) |
| 78 return v0ResolveDistributionStartingAt(*sibling, direction); | 82 return v0ResolveDistributionStartingAt(*sibling, direction); |
| 79 return const_cast<Node*>(sibling); | 83 return const_cast<Node*>(sibling); |
| 80 } | 84 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 | 382 |
| 379 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { | 383 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { |
| 380 assertPrecondition(node); | 384 assertPrecondition(node); |
| 381 Node* lastDescendant = lastWithin(node); | 385 Node* lastDescendant = lastWithin(node); |
| 382 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); | 386 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); |
| 383 assertPostcondition(&result); | 387 assertPostcondition(&result); |
| 384 return result; | 388 return result; |
| 385 } | 389 } |
| 386 | 390 |
| 387 } // namespace blink | 391 } // namespace blink |
| OLD | NEW |