1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +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

@ -44,27 +44,27 @@ ParsingContext::ParsingContext()
{
}
ParsingContext::ParsingContext(Bindings::WindowObject& window_object)
ParsingContext::ParsingContext(HTML::Window& window_object)
: m_window_object(window_object)
{
}
ParsingContext::ParsingContext(DOM::Document const& document, AK::URL url)
: m_window_object(document.preferred_window_object())
: m_window_object(const_cast<HTML::Window&>(document.window()))
, m_document(&document)
, m_url(move(url))
{
}
ParsingContext::ParsingContext(DOM::Document const& document)
: m_window_object(document.preferred_window_object())
: m_window_object(const_cast<HTML::Window&>(document.window()))
, m_document(&document)
, m_url(document.url())
{
}
ParsingContext::ParsingContext(DOM::ParentNode& parent_node)
: m_window_object(parent_node.document().preferred_window_object())
: m_window_object(parent_node.document().window())
, m_document(&parent_node.document())
, m_url(parent_node.document().url())
{

View file

@ -35,7 +35,7 @@ namespace Web::CSS::Parser {
class ParsingContext {
public:
ParsingContext();
explicit ParsingContext(Bindings::WindowObject&);
explicit ParsingContext(HTML::Window&);
explicit ParsingContext(DOM::Document const&);
explicit ParsingContext(DOM::Document const&, AK::URL);
explicit ParsingContext(DOM::ParentNode&);
@ -47,10 +47,10 @@ public:
PropertyID current_property_id() const { return m_current_property_id; }
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
Bindings::WindowObject& window_object() const { return m_window_object; }
HTML::Window& window_object() const { return m_window_object; }
private:
Bindings::WindowObject& m_window_object;
HTML::Window& m_window_object;
DOM::Document const* m_document { nullptr };
PropertyID m_current_property_id { PropertyID::Invalid };
AK::URL m_url;