(fiber)
| 11649 | } |
| 11650 | |
| 11651 | function getHostSibling(fiber) { |
| 11652 | // We're going to search forward into the tree until we find a sibling host |
| 11653 | // node. Unfortunately, if multiple insertions are done in a row we have to |
| 11654 | // search past them. This leads to exponential search for the next sibling. |
| 11655 | var node = fiber; |
| 11656 | siblings: while (true) { |
| 11657 | // If we didn't find anything, let's try the next sibling. |
| 11658 | while (node.sibling === null) { |
| 11659 | if (node['return'] === null || isHostParent(node['return'])) { |
| 11660 | // If we pop out of the root or hit the parent the fiber we are the |
| 11661 | // last sibling. |
| 11662 | return null; |
| 11663 | } |
| 11664 | node = node['return']; |
| 11665 | } |
| 11666 | node.sibling['return'] = node['return']; |
| 11667 | node = node.sibling; |
| 11668 | while (node.tag !== HostComponent && node.tag !== HostText) { |
| 11669 | // If it is not host node and, we might have a host node inside it. |
| 11670 | // Try to search down until we find one. |
| 11671 | if (node.effectTag & Placement) { |
| 11672 | // If we don't have a child, try the siblings instead. |
| 11673 | continue siblings; |
| 11674 | } |
| 11675 | // If we don't have a child, try the siblings instead. |
| 11676 | // We also skip portals because they are not part of this host tree. |
| 11677 | if (node.child === null || node.tag === HostPortal) { |
| 11678 | continue siblings; |
| 11679 | } else { |
| 11680 | node.child['return'] = node; |
| 11681 | node = node.child; |
| 11682 | } |
| 11683 | } |
| 11684 | // Check if this host node is stable or about to be placed. |
| 11685 | if (!(node.effectTag & Placement)) { |
| 11686 | // Found it! |
| 11687 | return node.stateNode; |
| 11688 | } |
| 11689 | } |
| 11690 | } |
| 11691 | |
| 11692 | function commitPlacement(finishedWork) { |
| 11693 | // Recursively insert all host nodes into the parent. |
no test coverage detected