mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:27:44 +00:00
LibWeb: Emit "focusin" and "focusout" events
This commit is contained in:
parent
cd7b5b18e4
commit
934aa6af6a
7 changed files with 78 additions and 0 deletions
|
@ -41,6 +41,8 @@ interface mixin GlobalEventHandlers {
|
|||
attribute EventHandler onended;
|
||||
attribute OnErrorEventHandler onerror;
|
||||
attribute EventHandler onfocus;
|
||||
attribute EventHandler onfocusin;
|
||||
attribute EventHandler onfocusout;
|
||||
attribute EventHandler onformdata;
|
||||
attribute EventHandler oninput;
|
||||
attribute EventHandler oninvalid;
|
||||
|
|
|
@ -141,6 +141,8 @@ namespace AttributeNames {
|
|||
__ENUMERATE_HTML_ATTRIBUTE(onended) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onerror) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onfocus) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onfocusin) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onfocusout) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onformdata) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onhashchange) \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(oninput) \
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace Web::HTML::EventNames {
|
|||
__ENUMERATE_HTML_EVENT(error) \
|
||||
__ENUMERATE_HTML_EVENT(finish) \
|
||||
__ENUMERATE_HTML_EVENT(focus) \
|
||||
__ENUMERATE_HTML_EVENT(focusin) \
|
||||
__ENUMERATE_HTML_EVENT(focusout) \
|
||||
__ENUMERATE_HTML_EVENT(formdata) \
|
||||
__ENUMERATE_HTML_EVENT(hashchange) \
|
||||
__ENUMERATE_HTML_EVENT(input) \
|
||||
|
|
|
@ -79,6 +79,11 @@ static void run_focus_update_steps(Vector<JS::Handle<DOM::Node>> old_chain, Vect
|
|||
blur_event->set_related_target(related_blur_target);
|
||||
blur_event_target->dispatch_event(blur_event);
|
||||
}
|
||||
|
||||
auto focusout_event = UIEvents::FocusEvent::create(blur_event_target->realm(), HTML::EventNames::focusout);
|
||||
focusout_event->set_bubbles(true);
|
||||
focusout_event->set_related_target(related_blur_target);
|
||||
blur_event_target->dispatch_event(focusout_event);
|
||||
}
|
||||
|
||||
// FIXME: 3. Apply any relevant platform-specific conventions for focusing new focus target.
|
||||
|
@ -123,6 +128,11 @@ static void run_focus_update_steps(Vector<JS::Handle<DOM::Node>> old_chain, Vect
|
|||
auto focus_event = UIEvents::FocusEvent::create(focus_event_target->realm(), HTML::EventNames::focus);
|
||||
focus_event->set_related_target(related_focus_target);
|
||||
focus_event_target->dispatch_event(focus_event);
|
||||
|
||||
auto focusin_event = UIEvents::FocusEvent::create(focus_event_target->realm(), HTML::EventNames::focusin);
|
||||
focusin_event->set_bubbles(true);
|
||||
focusin_event->set_related_target(related_focus_target);
|
||||
focus_event_target->dispatch_event(focusin_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
E(onended, HTML::EventNames::ended) \
|
||||
E(onerror, HTML::EventNames::error) \
|
||||
E(onfocus, HTML::EventNames::focus) \
|
||||
E(onfocusin, HTML::EventNames::focusin) \
|
||||
E(onfocusout, HTML::EventNames::focusout) \
|
||||
E(onformdata, HTML::EventNames::formdata) \
|
||||
E(oninput, HTML::EventNames::input) \
|
||||
E(oninvalid, HTML::EventNames::invalid) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue