LibWeb: Make EventTarget::activation_behavior a virtual function

(Instead of using an AK::Function on EventTarget). This shaves 48 bytes
off of every EventTarget instance.
This commit is contained in:
Andreas Kling 2023-11-18 10:48:09 +01:00
parent 84eecbb10e
commit a71eaefdf6
Notes: sideshowbarker 2024-07-18 08:59:31 +09:00
11 changed files with 108 additions and 64 deletions

View file

@ -38,14 +38,6 @@ HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName q
: HTMLElement(document, move(qualified_name))
, m_value(DeprecatedString::empty())
{
activation_behavior = [this](auto&) {
// The activation behavior for input elements are these steps:
// FIXME: 1. If this element is not mutable and is not in the Checkbox state and is not in the Radio state, then return.
// 2. Run this element's input activation behavior, if any, and do nothing otherwise.
run_input_activation_behavior().release_value_but_fixme_should_propagate_errors();
};
}
HTMLInputElement::~HTMLInputElement() = default;
@ -1284,4 +1276,20 @@ bool HTMLInputElement::is_submit_button() const
return type_state() == TypeAttributeState::SubmitButton
|| type_state() == TypeAttributeState::ImageButton;
}
bool HTMLInputElement::has_activation_behavior() const
{
return true;
}
void HTMLInputElement::activation_behavior(DOM::Event const&)
{
// The activation behavior for input elements are these steps:
// FIXME: 1. If this element is not mutable and is not in the Checkbox state and is not in the Radio state, then return.
// 2. Run this element's input activation behavior, if any, and do nothing otherwise.
run_input_activation_behavior().release_value_but_fixme_should_propagate_errors();
}
}