LibWeb: Add HTML::EventNames and UIEvents::EventNames

This commit is contained in:
Luke 2020-11-21 19:15:57 +00:00 committed by Andreas Kling
parent e68348298f
commit 9950270808
Notes: sideshowbarker 2024-07-19 01:18:34 +09:00
15 changed files with 271 additions and 19 deletions

View file

@ -28,6 +28,7 @@
#include <LibGUI/TextBox.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/HTMLFormElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/InProcessWebView.h>
@ -49,7 +50,8 @@ HTMLInputElement::~HTMLInputElement()
void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
{
dispatch_event(DOM::Event::create("click"));
// FIXME: This should be a PointerEvent.
dispatch_event(DOM::Event::create(EventNames::click));
if (type().equals_ignoring_case("submit")) {
if (auto* form = first_ancestor_of_type<HTMLFormElement>()) {
@ -104,7 +106,7 @@ void HTMLInputElement::set_checked(bool checked)
if (layout_node())
layout_node()->set_needs_display();
dispatch_event(DOM::Event::create("change"));
dispatch_event(DOM::Event::create(EventNames::change));
}
bool HTMLInputElement::enabled() const