Build a hit-test display list while recording paint output. Use it as
source of truth for point hit testing instead of recursively walking the
paintable tree in reverse paint order.
The retained list records target paintables, visual context indices,
border radii, caret rects, and line metadata needed by hit testing. It
also keeps a spatial index so point queries inspect nearby items before
checking containment in paint order.
Refresh scroll state before hit testing so visual context transforms use
current scroll offsets. Add text tests for rounded hit regions and
selection across non-text content.
This is preparation for moving the Paintable tree from GC allocation to
ordinary ref-counting. Paintables need tree ownership semantics that
match TreeNode, but their lifetime is about to stop being controlled by
the JS heap.
Add a small ref-counted tree helper and unit tests for ownership,
sibling links, removal, destruction, and preorder traversal. No
Paintable code uses it yet; the behavior change happens in the next
commit.