1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 20:02:12 +00:00

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.
This commit is contained in:
Andreas Kling 2022-08-28 13:42:07 +02:00
parent bb547ce1c4
commit 6f433c8656
445 changed files with 4797 additions and 4268 deletions

View file

@ -12,16 +12,15 @@
namespace Web::HTML {
class HTMLFormElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLFormElementWrapper;
WEB_PLATFORM_OBJECT(HTMLFormElement, HTMLElement);
HTMLFormElement(DOM::Document&, DOM::QualifiedName);
public:
virtual ~HTMLFormElement() override;
String action() const;
String method() const { return attribute(HTML::AttributeNames::method); }
void submit_form(RefPtr<HTMLElement> submitter, bool from_submit_binding = false);
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();
@ -33,9 +32,15 @@ public:
unsigned length() const;
private:
HTMLFormElement(DOM::Document&, DOM::QualifiedName);
virtual void visit_edges(Cell::Visitor&) override;
bool m_firing_submission_events { false };
Vector<WeakPtr<HTMLElement>> m_associated_elements;
Vector<JS::GCPtr<HTMLElement>> m_associated_elements;
};
}
WRAPPER_HACK(HTMLFormElement, Web::HTML)