(node: Node, flow: Node[], abs: Node[])
| 2404 | } |
| 2405 | |
| 2406 | function collectLayoutChildren(node: Node, flow: Node[], abs: Node[]): void { |
| 2407 | // Partition a node's children into flow and absolute lists, flattening |
| 2408 | // display:contents subtrees so their children are laid out as direct |
| 2409 | // children of this node (per CSS display:contents spec — the box is removed |
| 2410 | // from the layout tree but its children remain, lifted to the grandparent). |
| 2411 | for (const c of node.children) { |
| 2412 | const disp = c.style.display |
| 2413 | if (disp === Display.None) { |
| 2414 | c.layout.left = 0 |
| 2415 | c.layout.top = 0 |
| 2416 | c.layout.width = 0 |
| 2417 | c.layout.height = 0 |
| 2418 | zeroLayoutRecursive(c) |
| 2419 | } else if (disp === Display.Contents) { |
| 2420 | c.layout.left = 0 |
| 2421 | c.layout.top = 0 |
| 2422 | c.layout.width = 0 |
| 2423 | c.layout.height = 0 |
| 2424 | // Recurse — nested display:contents lifts all the way up. The contents |
| 2425 | // node's own margin/padding/position/dimensions are ignored. |
| 2426 | collectLayoutChildren(c, flow, abs) |
| 2427 | } else if (c.style.positionType === PositionType.Absolute) { |
| 2428 | abs.push(c) |
| 2429 | } else { |
| 2430 | flow.push(c) |
| 2431 | } |
| 2432 | } |
| 2433 | } |
| 2434 | |
| 2435 | function roundLayout( |
| 2436 | node: Node, |
no test coverage detected