diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
18 files changed, 31 insertions, 38 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp index c522f0018b..93e8213ff9 100644 --- a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.cpp @@ -12,10 +12,10 @@ namespace Web::HTML { void FormAssociatedElement::set_form(HTMLFormElement* form) { if (m_form) - m_form->remove_associated_element({}, form_associated_element_to_html_element()); + m_form->remove_associated_element({}, *this); m_form = form; if (m_form) - m_form->add_associated_element({}, form_associated_element_to_html_element()); + m_form->add_associated_element({}, *this); } } diff --git a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h index e66b3a918a..bbae4ae586 100644 --- a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h +++ b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h @@ -8,10 +8,11 @@ #include <AK/WeakPtr.h> #include <LibWeb/Forward.h> +#include <LibWeb/HTML/HTMLElement.h> namespace Web::HTML { -class FormAssociatedElement { +class FormAssociatedElement : public HTMLElement { public: HTMLFormElement* form() { return m_form; } HTMLFormElement const* form() const { return m_form; } @@ -19,10 +20,12 @@ public: void set_form(HTMLFormElement*); protected: - FormAssociatedElement() = default; - virtual ~FormAssociatedElement() = default; + FormAssociatedElement(DOM::Document& document, QualifiedName qualified_name) + : HTMLElement(document, move(qualified_name)) + { + } - virtual HTMLElement& form_associated_element_to_html_element() = 0; + virtual ~FormAssociatedElement() = default; private: WeakPtr<HTMLFormElement> m_form; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp index dfec42e253..83af70fe28 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp @@ -9,7 +9,7 @@ namespace Web::HTML { HTMLButtonElement::HTMLButtonElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) { } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h index 91e95d8b59..840553325e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h @@ -6,11 +6,11 @@ #pragma once -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/FormAssociatedElement.h> namespace Web::HTML { -class HTMLButtonElement final : public HTMLElement { +class HTMLButtonElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLButtonElementWrapper; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp index 93cc14afa9..aecbcf30c7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp @@ -9,7 +9,7 @@ namespace Web::HTML { HTMLFieldSetElement::HTMLFieldSetElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) { } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index 0788bf2e03..9e645510a3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -6,11 +6,11 @@ #pragma once -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/FormAssociatedElement.h> namespace Web::HTML { -class HTMLFieldSetElement final : public HTMLElement { +class HTMLFieldSetElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLFieldSetElementWrapper; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index d4b7463b71..6867740fe9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -17,7 +17,7 @@ namespace Web::HTML { HTMLImageElement::HTMLImageElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) , m_image_loader(*this) { m_image_loader.on_load = [this] { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index d5a9454600..6c9c138316 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -9,12 +9,12 @@ #include <AK/ByteBuffer.h> #include <AK/OwnPtr.h> #include <LibGfx/Forward.h> -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/FormAssociatedElement.h> #include <LibWeb/Loader/ImageLoader.h> namespace Web::HTML { -class HTMLImageElement final : public HTMLElement { +class HTMLImageElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLImageElementWrapper; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 77005f55b2..2e548cfdd2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -20,7 +20,7 @@ namespace Web::HTML { HTMLInputElement::HTMLInputElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) { } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index edd1d2c2d9..acf3577166 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -11,9 +11,7 @@ namespace Web::HTML { -class HTMLInputElement final - : public HTMLElement - , public FormAssociatedElement { +class HTMLInputElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLInputElementWrapper; @@ -43,9 +41,6 @@ private: virtual void inserted() override; virtual void removed_from(Node*) override; - // ^HTML::FormAssociatedElement - virtual HTMLElement& form_associated_element_to_html_element() override { return *this; } - // ^DOM::EventTarget virtual void did_receive_focus() override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 1170487f73..657893720f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -15,7 +15,7 @@ namespace Web::HTML { HTMLObjectElement::HTMLObjectElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) , m_image_loader(*this) { m_image_loader.on_load = [this] { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index 315a348c83..8b1e844e65 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -8,12 +8,12 @@ #include <LibCore/Forward.h> #include <LibGfx/Forward.h> -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/FormAssociatedElement.h> #include <LibWeb/Loader/ImageLoader.h> namespace Web::HTML { -class HTMLObjectElement final : public HTMLElement { +class HTMLObjectElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLObjectElementWrapper; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp index 508ed340bc..238ed1a2b0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp @@ -9,7 +9,7 @@ namespace Web::HTML { HTMLOutputElement::HTMLOutputElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) { } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index da9f0d64e5..3dd673ce2c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -6,11 +6,11 @@ #pragma once -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/FormAssociatedElement.h> namespace Web::HTML { -class HTMLOutputElement final : public HTMLElement { +class HTMLOutputElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLOutputElementWrapper; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index bf02e1e1e6..4e3a6ae1d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -11,7 +11,7 @@ namespace Web::HTML { HTMLSelectElement::HTMLSelectElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) { } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h index 55180e30da..e9b7a7a744 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h @@ -12,9 +12,7 @@ namespace Web::HTML { -class HTMLSelectElement final - : public HTMLElement - , public FormAssociatedElement { +class HTMLSelectElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLSelectElementWrapper; @@ -25,9 +23,6 @@ private: // ^DOM::Node virtual void inserted() override; virtual void removed_from(DOM::Node*) override; - - // ^HTML::FormAssociatedElement - virtual HTMLElement& form_associated_element_to_html_element() override { return *this; } }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index 22813242d7..8d7c55d1ff 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -9,7 +9,7 @@ namespace Web::HTML { HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, QualifiedName qualified_name) - : HTMLElement(document, move(qualified_name)) + : FormAssociatedElement(document, move(qualified_name)) { } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index 4d8feeeb68..8742a616aa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -6,11 +6,11 @@ #pragma once -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/FormAssociatedElement.h> namespace Web::HTML { -class HTMLTextAreaElement final : public HTMLElement { +class HTMLTextAreaElement final : public FormAssociatedElement { public: using WrapperType = Bindings::HTMLTextAreaElementWrapper; |