In the hypothetical design, placement for transparent nodes occurs in two distinct phases to ensure correct coordinate rebasing:
Phase 1: Record Effective Child Placements
When a parent layout places projected children, it does not call placeNode immediately. Instead, it records a PlacementRecord for each effective child:
type PlacementRecord = {
node: Layout
transparentPath: Layout[]
bounds: Rect
proposal: ProposedSize
}
Phase 2: Resolve Transparent Ancestor Bounds
After all projected children are placed, the engine computes a union for each transparent ancestor. Because a later child might expand the union of a transparent ancestor, the engine must rebase all layout rects in parent-local coordinates.
Example of coordinate rebasing:
If HStack places children X, Y, Z, and W, and A is a transparent ancestor of X, Y, and Z:
A's rect is calculated as the union of X, Y, and Z relative to HStack.X's rect is then rebased to be local to A.
This two-phase approach ensures that even if an ancestor's bounds change due to a later sibling, all descendants receive correct local coordinates.