script: Move the majority of the input event handling code to DocumentEventHandler (#38584)

This moves the majority of the input event handler code to the
`DocumentEventHandler` helper structure. It better encapsulates event
handling, hiding most of the details from both `ScriptThread` and
`Document`. The benefit here is that the majority of the functions can
become private and `Document` is over 1000 lines shorter.

Testing: This should not change any behavior so is covered by existing
WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-13 11:38:58 +02:00 committed by GitHub
parent bd9bb77295
commit 069ad40872
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 1519 additions and 1484 deletions

View file

@ -358,7 +358,10 @@ pub(crate) fn follow_hyperlink(
let document = subject.owner_document();
let target_attribute_value =
if subject.is::<HTMLAreaElement>() || subject.is::<HTMLAnchorElement>() {
if document.alternate_action_keyboard_modifier_active() {
if document
.event_handler()
.alternate_action_keyboard_modifier_active()
{
Some("_blank".into())
} else {
get_element_target(subject)