(fiber)
| 20370 | } |
| 20371 | |
| 20372 | function getHostSibling(fiber) { |
| 20373 | // We're going to search forward into the tree until we find a sibling host |
| 20374 | // node. Unfortunately, if multiple insertions are done in a row we have to |
| 20375 | // search past them. This leads to exponential search for the next sibling. |
| 20376 | // TODO: Find a more efficient way to do this. |
| 20377 | var node = fiber; |
| 20378 | |
| 20379 | siblings: while (true) { |
| 20380 | // If we didn't find anything, let's try the next sibling. |
| 20381 | while (node.sibling === null) { |
| 20382 | if (node.return === null || isHostParent(node.return)) { |
| 20383 | // If we pop out of the root or hit the parent the fiber we are the |
| 20384 | // last sibling. |
| 20385 | return null; |
| 20386 | } |
| 20387 | |
| 20388 | node = node.return; |
| 20389 | } |
| 20390 | |
| 20391 | node.sibling.return = node.return; |
| 20392 | node = node.sibling; |
| 20393 | |
| 20394 | while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { |
| 20395 | // If it is not host node and, we might have a host node inside it. |
| 20396 | // Try to search down until we find one. |
| 20397 | if (node.effectTag & Placement) { |
| 20398 | // If we don't have a child, try the siblings instead. |
| 20399 | continue siblings; |
| 20400 | } // If we don't have a child, try the siblings instead. |
| 20401 | // We also skip portals because they are not part of this host tree. |
| 20402 | |
| 20403 | |
| 20404 | if (node.child === null || node.tag === HostPortal) { |
| 20405 | continue siblings; |
| 20406 | } else { |
| 20407 | node.child.return = node; |
| 20408 | node = node.child; |
| 20409 | } |
| 20410 | } // Check if this host node is stable or about to be placed. |
| 20411 | |
| 20412 | |
| 20413 | if (!(node.effectTag & Placement)) { |
| 20414 | // Found it! |
| 20415 | return node.stateNode; |
| 20416 | } |
| 20417 | } |
| 20418 | } |
| 20419 | |
| 20420 | function commitPlacement(finishedWork) { |
| 20421 |
no test coverage detected