ladybird/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h
Andreas Kling 6f433c8656 LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00

46 lines
1.2 KiB
C++

/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
namespace Web::HTML {
class HTMLFormElement final : public HTMLElement {
WEB_PLATFORM_OBJECT(HTMLFormElement, HTMLElement);
public:
virtual ~HTMLFormElement() override;
String action() const;
String method() const { return attribute(HTML::AttributeNames::method); }
void submit_form(JS::GCPtr<HTMLElement> submitter, bool from_submit_binding = false);
// NOTE: This is for the JS bindings. Use submit_form instead.
void submit();
void add_associated_element(Badge<FormAssociatedElement>, HTMLElement&);
void remove_associated_element(Badge<FormAssociatedElement>, HTMLElement&);
NonnullRefPtr<DOM::HTMLCollection> elements() const;
unsigned length() const;
private:
HTMLFormElement(DOM::Document&, DOM::QualifiedName);
virtual void visit_edges(Cell::Visitor&) override;
bool m_firing_submission_events { false };
Vector<JS::GCPtr<HTMLElement>> m_associated_elements;
};
}
WRAPPER_HACK(HTMLFormElement, Web::HTML)