( node: DOMElement, output: Output, prevScreen: Screen, px: number, py: number, pw: number, ph: number, )
| 1335 | // to float above the prompt; a spinner tick in the ScrollBox above re-renders |
| 1336 | // and overwrites those cells. Without this, the menu vanishes on the next frame. |
| 1337 | function blitEscapingAbsoluteDescendants( |
| 1338 | node: DOMElement, |
| 1339 | output: Output, |
| 1340 | prevScreen: Screen, |
| 1341 | px: number, |
| 1342 | py: number, |
| 1343 | pw: number, |
| 1344 | ph: number, |
| 1345 | ): void { |
| 1346 | const pr = px + pw |
| 1347 | const pb = py + ph |
| 1348 | for (const child of node.childNodes) { |
| 1349 | if (child.nodeName === '#text') continue |
| 1350 | const elem = child as DOMElement |
| 1351 | if (elem.style.position === 'absolute') { |
| 1352 | const cached = nodeCache.get(elem) |
| 1353 | if (cached) { |
| 1354 | absoluteRectsCur.push(cached) |
| 1355 | const cx = Math.floor(cached.x) |
| 1356 | const cy = Math.floor(cached.y) |
| 1357 | const cw = Math.floor(cached.width) |
| 1358 | const ch = Math.floor(cached.height) |
| 1359 | // Only blit rects that extend outside the parent's layout bounds — |
| 1360 | // cells within the parent rect are already covered by the parent blit. |
| 1361 | if (cx < px || cy < py || cx + cw > pr || cy + ch > pb) { |
| 1362 | output.blit(prevScreen, cx, cy, cw, ch) |
| 1363 | } |
| 1364 | } |
| 1365 | } |
| 1366 | // Recurse — absolute descendants can be nested arbitrarily deep |
| 1367 | blitEscapingAbsoluteDescendants(elem, output, prevScreen, px, py, pw, ph) |
| 1368 | } |
| 1369 | } |
| 1370 | |
| 1371 | // Render children of a scroll container with viewport culling. |
| 1372 | // scrollTopY..scrollBottomY are the visible window in CHILD-LOCAL Yoga coords |
no test coverage detected