LibWeb: Make factory methods of DOM::Event fallible

Because of interdependencies between DOM::Event and UIEvents::MouseEvent
to template function fire_an_event() in WebDriverConnection.cpp, the
commit: 'LibWeb: Make factory methods of UIEvents::MouseEvent fallible'
have been squashed into this commit.
This commit is contained in:
Kenneth Myhra 2023-02-14 22:43:17 +01:00 committed by Linus Groh
parent 0d9076c9f5
commit c120c46acc
Notes: sideshowbarker 2024-07-17 08:13:43 +09:00
20 changed files with 85 additions and 85 deletions

View file

@ -134,12 +134,12 @@ void HTMLInputElement::update_the_file_selection(JS::NonnullGCPtr<FileAPI::FileL
this->set_files(files.ptr());
// 2. Fire an event named input at the input element, with the bubbles and composed attributes initialized to true.
auto input_event = DOM::Event::create(this->realm(), EventNames::input, { .bubbles = true, .composed = true });
this->dispatch_event(*input_event);
auto input_event = DOM::Event::create(this->realm(), EventNames::input, { .bubbles = true, .composed = true }).release_value_but_fixme_should_propagate_errors();
this->dispatch_event(input_event);
// 3. Fire an event named change at the input element, with the bubbles attribute initialized to true.
auto change_event = DOM::Event::create(this->realm(), EventNames::change, { .bubbles = true });
this->dispatch_event(*change_event);
auto change_event = DOM::Event::create(this->realm(), EventNames::change, { .bubbles = true }).release_value_but_fixme_should_propagate_errors();
this->dispatch_event(change_event);
});
}
@ -225,13 +225,13 @@ void HTMLInputElement::run_input_activation_behavior()
return;
// 2. Fire an event named input at the element with the bubbles and composed attributes initialized to true.
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input);
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input).release_value_but_fixme_should_propagate_errors();
input_event->set_bubbles(true);
input_event->set_composed(true);
dispatch_event(*input_event);
dispatch_event(input_event);
// 3. Fire an event named change at the element with the bubbles attribute initialized to true.
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change);
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change).release_value_but_fixme_should_propagate_errors();
change_event->set_bubbles(true);
dispatch_event(*change_event);
} else if (type_state() == TypeAttributeState::SubmitButton) {
@ -249,7 +249,7 @@ void HTMLInputElement::run_input_activation_behavior()
} else if (type_state() == TypeAttributeState::FileUpload) {
show_the_picker_if_applicable(*this);
} else {
dispatch_event(*DOM::Event::create(realm(), EventNames::change));
dispatch_event(DOM::Event::create(realm(), EventNames::change).release_value_but_fixme_should_propagate_errors());
}
}
@ -262,15 +262,15 @@ void HTMLInputElement::did_edit_text_node(Badge<BrowsingContext>)
// NOTE: This is a bit ad-hoc, but basically implements part of "4.10.5.5 Common event behaviors"
// https://html.spec.whatwg.org/multipage/input.html#common-input-element-events
queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input);
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input).release_value_but_fixme_should_propagate_errors();
input_event->set_bubbles(true);
input_event->set_composed(true);
dispatch_event(*input_event);
// FIXME: This should only fire when the input is "committed", whatever that means.
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change);
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change).release_value_but_fixme_should_propagate_errors();
change_event->set_bubbles(true);
dispatch_event(*change_event);
dispatch_event(change_event);
});
}