| 463 | * undefined and this returns []). |
| 464 | */ |
| 465 | export function findOwnerChainAtRow(root: DOMElement, y: number): string[] { |
| 466 | let best: string[] = [] |
| 467 | walk(root, 0) |
| 468 | return best |
| 469 | |
| 470 | function walk(node: DOMElement, offsetY: number): void { |
| 471 | const yoga = node.yogaNode |
| 472 | if (!yoga || yoga.getDisplay() === LayoutDisplay.None) return |
| 473 | |
| 474 | const top = offsetY + yoga.getComputedTop() |
| 475 | const height = yoga.getComputedHeight() |
| 476 | if (y < top || y >= top + height) return |
| 477 | |
| 478 | if (node.debugOwnerChain) best = node.debugOwnerChain |
| 479 | |
| 480 | for (const child of node.childNodes) { |
| 481 | if (isDOMElement(child)) walk(child, top) |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | |