LibWeb: Factor out HTMLOrSVGElement

This is a mixin in the IDL, so let's treat it as a mixin in our code and
let both SVGElement and MathMLElement reuse the implementations that we
wrote for HTMLElement.
This commit is contained in:
Jelle Raaijmakers 2024-10-29 11:07:02 +01:00
commit 5f84c2c3af
Notes: github-actions[bot] 2024-10-31 09:47:30 +00:00
14 changed files with 130 additions and 117 deletions

View file

@ -9,6 +9,7 @@
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
#include <LibWeb/HTML/HTMLOrSVGElement.h>
#include <LibWeb/HTML/TokenizedFeatures.h>
namespace Web::HTML {
@ -21,7 +22,8 @@ namespace Web::HTML {
class HTMLElement
: public DOM::Element
, public HTML::GlobalEventHandlers {
, public HTML::GlobalEventHandlers
, public HTML::HTMLOrSVGElement<HTMLElement> {
WEB_PLATFORM_OBJECT(HTMLElement, DOM::Element);
JS_DECLARE_ALLOCATOR(HTMLElement);
@ -53,14 +55,8 @@ public:
bool cannot_navigate() const;
[[nodiscard]] JS::NonnullGCPtr<DOMStringMap> dataset();
void focus();
void click();
void blur();
[[nodiscard]] String access_key_label() const;
bool fire_a_synthetic_pointer_event(FlyString const& type, DOM::Element& target, bool not_trusted);
@ -100,8 +96,6 @@ private:
[[nodiscard]] String get_the_text_steps();
void append_rendered_text_fragment(StringView input);
JS::GCPtr<DOMStringMap> m_dataset;
JS::GCPtr<DOM::NodeList> m_labels;
// https://html.spec.whatwg.org/multipage/custom-elements.html#attached-internals
@ -114,9 +108,6 @@ private:
};
ContentEditableState m_content_editable_state { ContentEditableState::Inherit };
// https://html.spec.whatwg.org/multipage/interaction.html#locked-for-focus
bool m_locked_for_focus { false };
// https://html.spec.whatwg.org/multipage/interaction.html#click-in-progress-flag
bool m_click_in_progress { false };
};