1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

LibWeb: Add basic support for HTMLInputElement.form

HTMLInputElement now inherits from FormAssociatedElement, which will
be a common base for the handful of elements that need to track their
owner form (and register with it for the form.elements collection.)

At the moment, the owner form is assigned during DOM insertion/removal
of an HTMLInputElement. I didn't implement any of the legacy behaviors
defined by the HTML parsing spec yet.
This commit is contained in:
Andreas Kling 2021-04-20 11:50:29 +02:00
parent 00d8e3b02b
commit b092353e4d
8 changed files with 110 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,11 +26,14 @@
#pragma once
#include <LibWeb/HTML/FormAssociatedElement.h>
#include <LibWeb/HTML/HTMLElement.h>
namespace Web::HTML {
class HTMLInputElement final : public HTMLElement {
class HTMLInputElement final
: public HTMLElement
, public FormAssociatedElement {
public:
using WrapperType = Bindings::HTMLInputElementWrapper;
@ -54,6 +57,9 @@ public:
void did_click_button(Badge<Layout::ButtonBox>);
private:
virtual void inserted() override;
virtual void removed_from(Node*) override;
void create_shadow_tree_if_needed();
RefPtr<DOM::Text> m_text_node;