pub(crate) struct HitTest<'a> {
point_to_test: LayoutPoint,
projected_point_to_test: Option<(ScrollTreeNodeId, LayoutPoint, FastLayoutTransform)>,
stacking_context_tree: &'a StackingContextTree,
results: Vec<ElementsFromPointResult>,
clip_hit_test_results: FxHashMap<ClipId, bool>,
collected_reference_frame_clips: Vec<ClipId>,
}Fields§
§point_to_test: LayoutPointThe point to test for this hit test, relative to the page.
projected_point_to_test: Option<(ScrollTreeNodeId, LayoutPoint, FastLayoutTransform)>A cached version of Self::point_to_test projected to a spatial node, to avoid
doing a lot of matrix math over and over.
stacking_context_tree: &'a StackingContextTreeThe stacking context tree against which to perform the hit test.
results: Vec<ElementsFromPointResult>The resulting [HitTestResultItems] for this hit test.
clip_hit_test_results: FxHashMap<ClipId, bool>A cache of hit test results for shared clip nodes.
collected_reference_frame_clips: Vec<ClipId>Collected reference frame clips. For painting, reference frame clips are handled by enclosing reference frames in stacking contexts, but we don’t have that option here, so we must handle them manually.
Implementations§
Source§impl<'a> HitTest<'a>
impl<'a> HitTest<'a>
pub(crate) fn run( stacking_context_tree: &'a StackingContextTree, point_to_test: LayoutPoint, ) -> Vec<ElementsFromPointResult>
Sourcefn hit_test_clip_id(&mut self, clip_id: ClipId) -> bool
fn hit_test_clip_id(&mut self, clip_id: ClipId) -> bool
Perform a hit test against the clip node for the given ClipId, returning
true if it is not clipped out or false if is clipped out.
fn hit_test_individual_clip_id(&mut self, clip_id: ClipId) -> bool
Sourcefn location_in_spatial_node(
&mut self,
scroll_tree_node_id: ScrollTreeNodeId,
) -> Option<(LayoutPoint, FastLayoutTransform)>
fn location_in_spatial_node( &mut self, scroll_tree_node_id: ScrollTreeNodeId, ) -> Option<(LayoutPoint, FastLayoutTransform)>
Get the hit test location in the coordinate system of the given spatial node,
returning None if the transformation is uninvertible or the point cannot be
projected into the spatial node.
Trait Implementations§
Source§impl PaintTraversalHandler for HitTest<'_>
impl PaintTraversalHandler for HitTest<'_>
Source§type StackingContextState = bool
type StackingContextState = bool
true if we pushed a reference frame clip and false otherwise.
fn visit_stacking_context( &mut self, stacking_context: &StackingContext, ) -> Self::StackingContextState
fn leave_stacking_context( &mut self, _: &TraversalState, pushed_reference_frame_clip: Self::StackingContextState, )
fn visit_box( &mut self, state: &TraversalState, fragment: &BoxFragmentWithStyle<'_>, )
fn visit_text( &mut self, state: &TraversalState, _: PhysicalRect<Au>, fragment: &Arc<TextFragment>, )
fn visit_iframe( &mut self, _state: &TraversalState, _fragment: &Arc<IFrameFragment>, )
fn visit_image( &mut self, _state: &TraversalState, _containing_block: PhysicalRect<Au>, _fragment: &Arc<ImageFragment>, )
fn visit_positioning( &mut self, _state: &TraversalState, _fragment: &Arc<PositioningFragment>, )
fn visit_box_for_root_background(&mut self, _state: &TraversalState)
fn visit_box_for_outline( &mut self, _state: &TraversalState, _fragment: &Arc<BoxFragment>, )
fn visit_box_for_collapsed_table_borders( &mut self, _state: &TraversalState, _fragment: &BoxFragmentWithStyle<'_>, )
Auto Trait Implementations§
impl<'a> Freeze for HitTest<'a>
impl<'a> !RefUnwindSafe for HitTest<'a>
impl<'a> !Send for HitTest<'a>
impl<'a> !Sync for HitTest<'a>
impl<'a> Unpin for HitTest<'a>
impl<'a> UnsafeUnpin for HitTest<'a>
impl<'a> !UnwindSafe for HitTest<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more