Skip to content

feat(gpui): expose the inspector's element map of the last frame - #142

Merged
guyverino merged 1 commit into
masterfrom
feat/inspector-hitbox-map
Nov 4, 2026
Merged

guyverino merged 1 commit into
masterfrom
feat/inspector-hitbox-map

Conversation

@guyverino

Copy link
Copy Markdown
Collaborator

Adds Window::inspector_hitboxes() and InspectorHitbox: every element the inspector could pick in the last rendered frame, in paint order, with its inspector id (global id path and source location), its bounds and the content mask it was drawn under.

Picking mode already registers a hitbox and an inspector id for every non-transparent div, but only in pub(crate) frame fields, so a tool that needs the whole screen had to hover each element and wait a frame for the inspector to name it. MoonTerminal's UI scene capture reads the whole frame at once through this method.

  • Additive, behind debug_assertions like the rest of the inspector API; outside picking mode the list is empty.
  • Test: window::tests::the_inspector_map_lists_every_div_of_a_picking_frame_in_paint_order (catches reading next_frame, losing paint order, or filling outside picking mode).
  • Local gate: tools/run-component-guardrails.ps1 PASS, cargo test -p moon-gpui green.

Add `Window::inspector_hitboxes()` and `InspectorHitbox`: every element the
inspector could pick in the last rendered frame, in paint order, with its
inspector id (global id path and source location), its bounds and the
content mask it was drawn under.

Picking mode already gives every non-transparent div a hitbox and records
its inspector id, but only in `pub(crate)` frame fields. A tool that wants
the whole screen therefore had to hover each element and wait for the
inspector to name it, one frame per element. With the map public it reads
the whole frame at once.

Additive and behind `debug_assertions`, like the rest of the inspector API;
outside picking mode the list is empty.
@guyverino
guyverino merged commit 5869982 into master Nov 4, 2026
2 checks passed
@guyverino
guyverino deleted the feat/inspector-hitbox-map branch November 4, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant