MCPcopy Create free account
hub / github.com/Noumena-Network/code / siblingSharesY

Function siblingSharesY

src/ink/render-node-to-output.ts:1327–1346  ·  view source on GitHub ↗
(node: DOMElement, yogaNode: LayoutNode)

Source from the content-addressed store, hash-verified

1325// rounding can give h=0 while still advancing the next sibling's top
1326// (HelpV2's third shortcuts column), so h=0 alone isn't sufficient.
1327function siblingSharesY(node: DOMElement, yogaNode: LayoutNode): boolean {
1328 const parent = node.parentNode
1329 if (!parent) return false
1330 const myTop = yogaNode.getComputedTop()
1331 const siblings = parent.childNodes
1332 const idx = siblings.indexOf(node)
1333 for (let i = idx + 1; i < siblings.length; i++) {
1334 const sib = (siblings[i] as DOMElement).yogaNode
1335 if (!sib) continue
1336 return sib.getComputedTop() === myTop
1337 }
1338 // No next sibling with a yoga node — check previous. A run of h=0 boxes
1339 // at the tail would all share y with each other.
1340 for (let i = idx - 1; i >= 0; i--) {
1341 const sib = (siblings[i] as DOMElement).yogaNode
1342 if (!sib) continue
1343 return sib.getComputedTop() === myTop
1344 }
1345 return false
1346}
1347
1348// When a node blits, its absolute-positioned descendants that paint outside
1349// the node's layout bounds are NOT covered by the blit (which only copies

Callers 1

renderNodeToOutputFunction · 0.85

Calls 1

getComputedTopMethod · 0.45

Tested by

no test coverage detected