mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibWeb: Make FormAssociatedElement inherit from HTMLElement
The new event target implementation requires us to downcast an EventTarget to a FormAssociatedElement to check if the current Element EventTarget has a form owner to setup a with scope for the form owner. This also makes all form associated elements inherit from FormAssociatedElement where it was previously missing. https://html.spec.whatwg.org/#form-associated-element
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user