Introspection reports a mapped absolutePosition with an unmapped size, so an element's rendered rect can't be recovered
Bug Description
ElementHandle::absolute_position maps the element origin through the item transform (internal/backends/testing/search_api.rs:871, via map_to_window), while ElementHandle::size returns the element's layout size in its own local units (:859).
The introspection layer reports both as a pair: absolutePosition and size on get_element_properties (internal/backends/testing/introspection/mod.rs:585 and :588).
Under an ancestor transform-scale or rotation the two are in different coordinate systems, so the pair doesn't describe any rectangle that exists on screen.
With a scale of z the reported size is off by a factor of z; under rotation an axis-aligned local size doesn't describe the rendered shape at all.
This is the same mismatch #13242 reported in absolute_center, which mapped the origin and then added an unmapped half-extent.
#13247 fixed the aiming by mapping the center, so pointer events now land correctly.
This issue is about what introspection reports, which is unchanged.
Consequence
A client can't recover an element's rendered extent from the MCP surface at all. That blocks anything that needs the rect rather than a point:
- Cropping a screenshot to one element, which is also what #13244 asks for under "screenshots are whole-window only".
- Deciding whether an element is on screen, or how much of it is.
- Aiming at a sub-region of an element rather than its center.
The failure is quiet, because the numbers look plausible. A caller that multiplies or compares them gets a rectangle that is simply wrong, with nothing marking it as untrustworthy.
Suggested fix
Report the rendered rect in window coordinates.
Either add it alongside the existing fields, so absolutePosition and size keep their current meaning, or change size to be the mapped extent and say so.
For rotation, the axis-aligned bounding box of the four mapped corners is the thing a caller can act on.
ElementHandle needs the same accessor for callers of the Rust API, not just for the MCP and systest transports.
Environment Details
- Slint Version: master
- Platform/OS: any; the code is in the shared introspection layer
- Programming Language: any language binding that exposes the MCP server
Related
- #13242 / #13247 — the same mapped/unmapped mismatch in
absolute_center, fixed for aiming only. - #13244 — asks for element-scoped screenshots, which need this rect to be expressible.
Source: slint-ui/slint