1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:37: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

@ -17,18 +17,13 @@ namespace Web::CSS {
// https://www.w3.org/TR/css-conditional-3/#the-csssupportsrule-interface
class CSSSupportsRule final : public CSSConditionRule {
JS_OBJECT(CSSSupportsRule, CSSConditionRule);
AK_MAKE_NONCOPYABLE(CSSSupportsRule);
AK_MAKE_NONMOVABLE(CSSSupportsRule);
WEB_PLATFORM_OBJECT(CSSSupportsRule, CSSConditionRule);
public:
static CSSSupportsRule* create(Bindings::WindowObject&, NonnullRefPtr<Supports>&&, CSSRuleList&);
explicit CSSSupportsRule(Bindings::WindowObject&, NonnullRefPtr<Supports>&&, CSSRuleList&);
static CSSSupportsRule* create(HTML::Window&, NonnullRefPtr<Supports>&&, CSSRuleList&);
virtual ~CSSSupportsRule() = default;
CSSSupportsRule& impl() { return *this; }
virtual Type type() const override { return Type::Supports; };
String condition_text() const override;
@ -36,6 +31,8 @@ public:
virtual bool condition_matches() const override { return m_supports->matches(); }
private:
explicit CSSSupportsRule(HTML::Window&, NonnullRefPtr<Supports>&&, CSSRuleList&);
virtual String serialized() const override;
NonnullRefPtr<Supports> m_supports;
@ -46,7 +43,4 @@ inline bool CSSRule::fast_is<CSSSupportsRule>() const { return type() == CSSRule
}
namespace Web::Bindings {
inline JS::Object* wrap(JS::Realm&, Web::CSS::CSSSupportsRule& object) { return &object; }
using CSSSupportsRuleWrapper = Web::CSS::CSSSupportsRule;
}
WRAPPER_HACK(CSSSupportsRule, Web::CSS)