1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibWeb: Make DOM::Event and all its subclasses GC-allocated

This commit is contained in:
Andreas Kling 2022-08-08 22:29:40 +02:00
parent a4ddb0ef87
commit 7c3db526b0
76 changed files with 892 additions and 565 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -15,31 +16,27 @@ struct WebGLContextEventInit final : public DOM::EventInit {
};
class WebGLContextEvent final : public DOM::Event {
JS_OBJECT(WebGLContextEvent, DOM::Event);
public:
using WrapperType = Bindings::WebGLContextEventWrapper;
static WebGLContextEvent* create(Bindings::WindowObject&, FlyString const& type, WebGLContextEventInit const& event_init);
static WebGLContextEvent* create_with_global_object(Bindings::WindowObject&, FlyString const& type, WebGLContextEventInit const& event_init);
static NonnullRefPtr<WebGLContextEvent> create(FlyString const& type, WebGLContextEventInit const& event_init)
{
return adopt_ref(*new WebGLContextEvent(type, event_init));
}
WebGLContextEvent(Bindings::WindowObject&, FlyString const& type, WebGLContextEventInit const& event_init);
static NonnullRefPtr<WebGLContextEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& type, WebGLContextEventInit const& event_init)
{
return adopt_ref(*new WebGLContextEvent(type, event_init));
}
virtual ~WebGLContextEvent() override;
virtual ~WebGLContextEvent() override = default;
WebGLContextEvent& impl() { return *this; }
String const& status_message() const { return m_status_message; }
private:
WebGLContextEvent(FlyString const& type, WebGLContextEventInit const& event_init)
: DOM::Event(type, event_init)
, m_status_message(event_init.status_message)
{
}
String m_status_message { String::empty() };
};
}
namespace Web::Bindings {
inline JS::Object* wrap(JS::Realm&, Web::WebGL::WebGLContextEvent& object) { return &object; }
using WebGLContextEventWrapper = Web::WebGL::WebGLContextEvent;
}