DocumentEventHandler

Struct DocumentEventHandler 

Source
pub(crate) struct DocumentEventHandler {
Show 14 fields window: Dom<Window>, pending_input_events: DomRefCell<Vec<ConstellationInputEvent>>, mouse_move_event_index: DomRefCell<Option<usize>>, click_counting_info: DomRefCell<ClickCountingInfo>, last_mouse_button_down_point: Cell<Option<Point2D<f32, CSSPixel>>>, down_button_count: Cell<u32>, current_hover_target: MutNullableDom<Element>, most_recently_clicked_element: MutNullableDom<Element>, most_recent_mousemove_point: Cell<Option<Point2D<f32, CSSPixel>>>, current_cursor: Cell<Option<Cursor>>, active_touch_points: DomRefCell<Vec<Dom<Touch>>>, active_keyboard_modifiers: Cell<Modifiers>, active_pointer_ids: DomRefCell<FxHashMap<i32, i32>>, next_touch_pointer_id: Cell<i32>,
}
Expand description

The DocumentEventHandler is a structure responsible for handling input events for the [crate::Document] and storing data related to event handling. It exists to decrease the size of the [crate::Document] structure.

Fields§

§window: Dom<Window>

The Window element for this DocumentEventHandler.

§pending_input_events: DomRefCell<Vec<ConstellationInputEvent>>

Pending input events, to be handled at the next rendering opportunity.

§mouse_move_event_index: DomRefCell<Option<usize>>

The index of the last mouse move event in the pending input events queue.

§click_counting_info: DomRefCell<ClickCountingInfo>§last_mouse_button_down_point: Cell<Option<Point2D<f32, CSSPixel>>>§down_button_count: Cell<u32>

The number of currently down buttons, used to decide which kind of pointer event to dispatch on MouseDown/MouseUp.

§current_hover_target: MutNullableDom<Element>

The element that is currently hovered by the cursor.

§most_recently_clicked_element: MutNullableDom<Element>

The element that was most recently clicked.

§most_recent_mousemove_point: Cell<Option<Point2D<f32, CSSPixel>>>

The most recent mouse movement point, used for processing mouseleave events.

§current_cursor: Cell<Option<Cursor>>

The currently set Cursor or None if the Document isn’t being hovered by the cursor.

§active_touch_points: DomRefCell<Vec<Dom<Touch>>>§active_keyboard_modifiers: Cell<Modifiers>

The active keyboard modifiers for the WebView. This is updated when receiving any input event.

§active_pointer_ids: DomRefCell<FxHashMap<i32, i32>>

Map from touch identifier to pointer ID for active touch points

§next_touch_pointer_id: Cell<i32>

Counter for generating unique pointer IDs for touch inputs

Implementations§

Source§

impl DocumentEventHandler

Source

pub(crate) fn new(window: &Window) -> Self

Source

pub(crate) fn note_pending_input_event(&self, event: ConstellationInputEvent)

Note a pending input event, to be processed at the next update_the_rendering task.

Source

pub(crate) fn has_pending_input_events(&self) -> bool

Whether or not this [Document] has any pending input events to be processed during “update the rendering.”

Source

pub(crate) fn alternate_action_keyboard_modifier_active(&self) -> bool

Source

pub(crate) fn handle_pending_input_events(&self, can_gc: CanGc)

Source

fn notify_embedder_that_event_was_handled( &self, event: InputEventAndId, result: InputEventResult, )

Source

pub(crate) fn set_cursor(&self, cursor: Option<Cursor>)

Source

fn handle_mouse_left_viewport_event( &self, input_event: &ConstellationInputEvent, mouse_leave_event: &MouseLeftViewportEvent, can_gc: CanGc, )

Source

fn handle_mouse_enter_leave_event( &self, event_target: DomRoot<Node>, related_target: Option<DomRoot<Node>>, event_type: FireMouseEventType, hit_test_result: &HitTestResult, input_event: &ConstellationInputEvent, can_gc: CanGc, )

Source

fn handle_native_mouse_move_event( &self, input_event: &ConstellationInputEvent, can_gc: CanGc, )

Source

fn update_current_hover_target_and_status( &self, new_hover_target: Option<DomRoot<Element>>, )

Source

pub(crate) fn handle_refresh_cursor(&self)

Source

fn handle_native_mouse_button_event( &self, event: MouseButtonEvent, input_event: &ConstellationInputEvent, can_gc: CanGc, )

https://w3c.github.io/uievents/#mouseevent-algorithms Handles native mouse down, mouse up, mouse click.

Source

fn maybe_trigger_click_for_mouse_button_down_event( &self, event: MouseButtonEvent, input_event: &ConstellationInputEvent, hit_test_result: &HitTestResult, element: &Element, can_gc: CanGc, )

Source

fn maybe_show_context_menu( &self, target: &EventTarget, hit_test_result: &HitTestResult, input_event: &ConstellationInputEvent, can_gc: CanGc, )

Source

fn handle_touch_event( &self, event: EmbedderTouchEvent, input_event: &ConstellationInputEvent, can_gc: CanGc, ) -> InputEventResult

Source

fn update_active_touch_points_when_early_return( &self, event: EmbedderTouchEvent, )

Updates the active touch points when a hit test fails early.

  • For Down: No action needed; a failed down event won’t create an active point.
  • For Move: No action needed; position information is unavailable, so we cannot update.
  • For Up/Cancel: Remove the corresponding touch point and its pointer ID mapping.

When a touchup or touchcancel occurs at that touch point, a warning is triggered: Received touchup/touchcancel event for a non-active touch point.

Source

fn handle_keyboard_event( &self, keyboard_event: EmbedderKeyboardEvent, can_gc: CanGc, ) -> InputEventResult

The entry point for all key processing for web content

Source

fn handle_ime_event(&self, event: ImeEvent, can_gc: CanGc) -> InputEventResult

Source

fn handle_wheel_event( &self, event: EmbedderWheelEvent, input_event: &ConstellationInputEvent, can_gc: CanGc, ) -> InputEventResult

Source

fn handle_gamepad_event(&self, gamepad_event: EmbedderGamepadEvent)

Source

fn handle_gamepad_connect( &self, _index: usize, name: String, axis_bounds: (f64, f64), button_bounds: (f64, f64), supported_haptic_effects: GamepadSupportedHapticEffects, )

Source

fn handle_gamepad_disconnect(&self, index: usize)

Source

fn receive_new_gamepad_button_or_axis( &self, index: usize, update_type: GamepadUpdateType, )

Source

pub(crate) fn handle_editing_action( &self, element: Option<DomRoot<Element>>, action: EditingActionEvent, can_gc: CanGc, ) -> InputEventResult

Source

pub(crate) fn fire_clipboard_event( &self, target: Option<DomRoot<Element>>, clipboard_event_type: ClipboardEventType, can_gc: CanGc, ) -> DomRoot<ClipboardEvent>

Source

fn write_content_to_the_clipboard(&self, drag_data_store: &DragDataStore)

Source

pub(crate) fn handle_embedder_scroll_event( &self, scrolled_node: ExternalScrollId, )

Handle a scroll event triggered by user interactions from the embedder. https://drafts.csswg.org/cssom-view/#scrolling-events

Source

pub(crate) fn run_default_keyboard_event_handler(&self, event: &KeyboardEvent)

Source

pub(crate) fn do_keyboard_scroll(&self, scroll: KeyboardScroll)

Source

fn get_or_create_pointer_id_for_touch(&self, touch_id: i32) -> i32

Get or create a pointer ID for the given touch identifier. Returns the pointer ID to use for this touch.

Source

fn remove_pointer_id_for_touch(&self, touch_id: i32)

Remove the pointer ID mapping for the given touch identifier.

Source

fn is_primary_pointer(&self, pointer_id: i32) -> bool

Check if this is the primary pointer (for touch events). The first touch to make contact is the primary pointer.

Trait Implementations§

Source§

impl MallocSizeOf for DocumentEventHandler

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
Source§

impl Traceable for DocumentEventHandler

Source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T