Files
Zachary D. Rowitsch 808dbcec63 Add layout-geometry host APIs: getBoundingClientRect, offsetWidth/etc. (F-052)
The layout cache mirrors the computed-style cache: `ensure_layout_fresh`
chains `ensure_styles_fresh` (layout consumes computed styles), and
`layout_dirty` is set by `mark_dom_dirty` and by `set_document` /
`set_stylesheets`. On a dirty geometry read the engine does a single
full-document relayout (no incremental); subsequent reads are cache hits.

New Element APIs (web_api host):
  - getBoundingClientRect() → {x,y,width,height,top,right,bottom,left}
    in client coords (border box minus scroll_offset); all-zero for
    detached / display:none / un-laid-out elements (no error).
  - offsetWidth/Height, offsetLeft/Top  (border box, rounded)
  - clientWidth/Height                  (content box, rounded)
  - scrollWidth/Height                  (content box, rounded; approx)
Plus WebApiFacade::set_scroll_offset (+ BrowserRuntime passthrough).

Approximations: the host has no decoded images, so replaced elements
(<img>) have no intrinsic size and report approximate geometry;
offsetParent is approximated as document-relative; scrollWidth/Height ≈
content box (no overflow tracking).

Also drops the unnecessary Rc on computed_cache (host reads only borrow
&ComputedStyles, and the layout engine wants &HashMap<NodeId,
ComputedStyles> directly).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 09:31:02 -04:00
..