(fiber)
| 10975 | } |
| 10976 | |
| 10977 | function getHostSibling(fiber) { |
| 10978 | // We're going to search forward into the tree until we find a sibling host |
| 10979 | // node. Unfortunately, if multiple insertions are done in a row we have to |
| 10980 | // search past them. This leads to exponential search for the next sibling. |
| 10981 | var node = fiber; |
| 10982 | siblings: while (true) { |
| 10983 | // If we didn't find anything, let's try the next sibling. |
| 10984 | while (node.sibling === null) { |
| 10985 | if (node['return'] === null || isHostParent(node['return'])) { |
| 10986 | // If we pop out of the root or hit the parent the fiber we are the |
| 10987 | // last sibling. |
| 10988 | return null; |
| 10989 | } |
| 10990 | node = node['return']; |
| 10991 | } |
| 10992 | node.sibling['return'] = node['return']; |
| 10993 | node = node.sibling; |
| 10994 | while (node.tag !== HostComponent && node.tag !== HostText) { |
| 10995 | // If it is not host node and, we might have a host node inside it. |
| 10996 | // Try to search down until we find one. |
| 10997 | if (node.effectTag & Placement) { |
| 10998 | // If we don't have a child, try the siblings instead. |
| 10999 | continue siblings; |
| 11000 | } |
| 11001 | // If we don't have a child, try the siblings instead. |
| 11002 | // We also skip portals because they are not part of this host tree. |
| 11003 | if (node.child === null || node.tag === HostPortal) { |
| 11004 | continue siblings; |
| 11005 | } else { |
| 11006 | node.child['return'] = node; |
| 11007 | node = node.child; |
| 11008 | } |
| 11009 | } |
| 11010 | // Check if this host node is stable or about to be placed. |
| 11011 | if (!(node.effectTag & Placement)) { |
| 11012 | // Found it! |
| 11013 | return node.stateNode; |
| 11014 | } |
| 11015 | } |
| 11016 | } |
| 11017 | |
| 11018 | function commitPlacement(finishedWork) { |
| 11019 | // Recursively insert all host nodes into the parent. |
no test coverage detected