mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Consolidate the attribute change handlers
We currently have 2 virtual methods to inform DOM::Element subclasses when an attribute has changed, one of which is spec-compliant. This patch removes the non-compliant variant.
This commit is contained in:
parent
c2988a7dd5
commit
d4f8b598cb
Notes:
github-actions[bot]
2024-11-14 18:19:35 +00:00
Author: https://github.com/trflynn89
Commit: d4f8b598cb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2337
83 changed files with 224 additions and 228 deletions
|
@ -23,33 +23,33 @@ namespace Web::HTML {
|
|||
// HTMLElement::inserted() -> Use form_associated_element_was_inserted()
|
||||
// HTMLElement::removed_from() -> Use form_associated_element_was_removed()
|
||||
//
|
||||
#define FORM_ASSOCIATED_ELEMENT(ElementBaseClass, ElementClass) \
|
||||
private: \
|
||||
virtual HTMLElement& form_associated_element_to_html_element() override \
|
||||
{ \
|
||||
static_assert(IsBaseOf<HTMLElement, ElementClass>); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
virtual void inserted() override \
|
||||
{ \
|
||||
ElementBaseClass::inserted(); \
|
||||
form_node_was_inserted(); \
|
||||
form_associated_element_was_inserted(); \
|
||||
} \
|
||||
\
|
||||
virtual void removed_from(DOM::Node* node) override \
|
||||
{ \
|
||||
ElementBaseClass::removed_from(node); \
|
||||
form_node_was_removed(); \
|
||||
form_associated_element_was_removed(node); \
|
||||
} \
|
||||
\
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override \
|
||||
{ \
|
||||
ElementBaseClass::attribute_changed(name, old_value, value); \
|
||||
form_node_attribute_changed(name, value); \
|
||||
form_associated_element_attribute_changed(name, value); \
|
||||
#define FORM_ASSOCIATED_ELEMENT(ElementBaseClass, ElementClass) \
|
||||
private: \
|
||||
virtual HTMLElement& form_associated_element_to_html_element() override \
|
||||
{ \
|
||||
static_assert(IsBaseOf<HTMLElement, ElementClass>); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
virtual void inserted() override \
|
||||
{ \
|
||||
ElementBaseClass::inserted(); \
|
||||
form_node_was_inserted(); \
|
||||
form_associated_element_was_inserted(); \
|
||||
} \
|
||||
\
|
||||
virtual void removed_from(DOM::Node* node) override \
|
||||
{ \
|
||||
ElementBaseClass::removed_from(node); \
|
||||
form_node_was_removed(); \
|
||||
form_associated_element_was_removed(node); \
|
||||
} \
|
||||
\
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override \
|
||||
{ \
|
||||
ElementBaseClass::attribute_changed(name, old_value, value, namespace_); \
|
||||
form_node_attribute_changed(name, value); \
|
||||
form_associated_element_attribute_changed(name, value); \
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#selection-direction
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue