(fiber)
| 10847 | } |
| 10848 | |
| 10849 | function getHostSibling(fiber) { |
| 10850 | // We're going to search forward into the tree until we find a sibling host |
| 10851 | // node. Unfortunately, if multiple insertions are done in a row we have to |
| 10852 | // search past them. This leads to exponential search for the next sibling. |
| 10853 | var node = fiber; |
| 10854 | siblings: while (true) { |
| 10855 | // If we didn't find anything, let's try the next sibling. |
| 10856 | while (node.sibling === null) { |
| 10857 | if (node['return'] === null || isHostParent(node['return'])) { |
| 10858 | // If we pop out of the root or hit the parent the fiber we are the |
| 10859 | // last sibling. |
| 10860 | return null; |
| 10861 | } |
| 10862 | node = node['return']; |
| 10863 | } |
| 10864 | node.sibling['return'] = node['return']; |
| 10865 | node = node.sibling; |
| 10866 | while (node.tag !== HostComponent && node.tag !== HostText) { |
| 10867 | // If it is not host node and, we might have a host node inside it. |
| 10868 | // Try to search down until we find one. |
| 10869 | if (node.effectTag & Placement) { |
| 10870 | // If we don't have a child, try the siblings instead. |
| 10871 | continue siblings; |
| 10872 | } |
| 10873 | // If we don't have a child, try the siblings instead. |
| 10874 | // We also skip portals because they are not part of this host tree. |
| 10875 | if (node.child === null || node.tag === HostPortal) { |
| 10876 | continue siblings; |
| 10877 | } else { |
| 10878 | node.child['return'] = node; |
| 10879 | node = node.child; |
| 10880 | } |
| 10881 | } |
| 10882 | // Check if this host node is stable or about to be placed. |
| 10883 | if (!(node.effectTag & Placement)) { |
| 10884 | // Found it! |
| 10885 | return node.stateNode; |
| 10886 | } |
| 10887 | } |
| 10888 | } |
| 10889 | |
| 10890 | function commitPlacement(finishedWork) { |
| 10891 | // Recursively insert all host nodes into the parent. |
no test coverage detected