(fiber)
| 11865 | } |
| 11866 | |
| 11867 | function getHostSibling(fiber) { |
| 11868 | // We're going to search forward into the tree until we find a sibling host |
| 11869 | // node. Unfortunately, if multiple insertions are done in a row we have to |
| 11870 | // search past them. This leads to exponential search for the next sibling. |
| 11871 | var node = fiber; |
| 11872 | siblings: while (true) { |
| 11873 | // If we didn't find anything, let's try the next sibling. |
| 11874 | while (node.sibling === null) { |
| 11875 | if (node['return'] === null || isHostParent(node['return'])) { |
| 11876 | // If we pop out of the root or hit the parent the fiber we are the |
| 11877 | // last sibling. |
| 11878 | return null; |
| 11879 | } |
| 11880 | node = node['return']; |
| 11881 | } |
| 11882 | node.sibling['return'] = node['return']; |
| 11883 | node = node.sibling; |
| 11884 | while (node.tag !== HostComponent && node.tag !== HostText) { |
| 11885 | // If it is not host node and, we might have a host node inside it. |
| 11886 | // Try to search down until we find one. |
| 11887 | if (node.effectTag & Placement) { |
| 11888 | // If we don't have a child, try the siblings instead. |
| 11889 | continue siblings; |
| 11890 | } |
| 11891 | // If we don't have a child, try the siblings instead. |
| 11892 | // We also skip portals because they are not part of this host tree. |
| 11893 | if (node.child === null || node.tag === HostPortal) { |
| 11894 | continue siblings; |
| 11895 | } else { |
| 11896 | node.child['return'] = node; |
| 11897 | node = node.child; |
| 11898 | } |
| 11899 | } |
| 11900 | // Check if this host node is stable or about to be placed. |
| 11901 | if (!(node.effectTag & Placement)) { |
| 11902 | // Found it! |
| 11903 | return node.stateNode; |
| 11904 | } |
| 11905 | } |
| 11906 | } |
| 11907 | |
| 11908 | function commitPlacement(finishedWork) { |
| 11909 | // Recursively insert all host nodes into the parent. |
no test coverage detected