pub struct HitTestItem {
pub point_in_viewport: LogicalPosition,
pub point_relative_to_item: ContentBoxLocal,
pub is_focusable: bool,
pub is_virtual_view_hit: Option<(DomId, LogicalPosition)>,
pub hit_depth: u32,
}Expand description
A single hit-test result for a regular (non-scroll) DOM node.
Fields§
§point_in_viewport: LogicalPositionThe hit point in the coordinate space of the “viewport” of the display item. The viewport is the scroll node formed by the root reference frame of the display item’s pipeline.
point_relative_to_item: ContentBoxLocalThe hit point relative to this node’s static CONTENT-box origin, with the node’s own scroll offset NOT applied.
§Why this space, and why it is typed
The two hosts used to disagree here. WebRender reports the point
relative to the hit RECT, which azul pushes before the scroll frame —
i.e. BorderBoxLocal — while the CPU
tester used in headless E2E subtracted padding + border and reported
ContentBoxLocal. Same click, two answers, differing by exactly the
node’s content inset. It stayed latent only because the default
TextInput’s value <p> sets neither padding nor border; it goes live
for any padded editable.
Both producers now emit ContentBoxLocal, because that is the space
the consumer that cares (UnifiedLayout::hittest_cursor, via
LayoutWindow::ifc_local_point) actually needs. Consumers wanting the
border-box-relative point the public
CallbackInfo::get_cursor_relative_to_node promises convert back with
ContentBoxLocal::to_border_box_local.
is_focusable: boolNecessary to easily get the nearest VirtualView node
is_virtual_view_hit: Option<(DomId, LogicalPosition)>If this hit is a VirtualView node, stores the VirtualViews DomId + the origin of the VirtualView
hit_depth: u32Z-order depth from WebRender hit test (0 = frontmost/topmost in z-order).
Lower values are closer to the user. This preserves the ordering from
WebRender’s hit test results which returns items front-to-back.
Trait Implementations§
Source§impl Clone for HitTestItem
impl Clone for HitTestItem
Source§fn clone(&self) -> HitTestItem
fn clone(&self) -> HitTestItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more