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

@ -11,25 +11,23 @@
namespace Web::DOM {
// NOTE: We must use RP instead of NNRP here, otherwise the generated code cannot default initialize this struct.
// NOTE: We must use GCP instead of NNGCP here, otherwise the generated code cannot default initialize this struct.
// They will never be null, as they are marked as required and non-null in the dictionary.
struct StaticRangeInit {
RefPtr<Node> start_container;
JS::GCPtr<Node> start_container;
u32 start_offset { 0 };
RefPtr<Node> end_container;
JS::GCPtr<Node> end_container;
u32 end_offset { 0 };
};
class StaticRange final : public AbstractRange {
JS_OBJECT(StaticRange, JS::Object);
WEB_PLATFORM_OBJECT(StaticRange, JS::Object);
public:
static ExceptionOr<StaticRange*> create_with_global_object(Bindings::WindowObject&, StaticRangeInit& init);
static ExceptionOr<StaticRange*> create_with_global_object(HTML::Window&, StaticRangeInit& init);
StaticRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
virtual ~StaticRange() override;
StaticRange& impl() { return *this; }
};
}