diff options
author | Andreas Kling <kling@serenityos.org> | 2022-08-07 13:14:54 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-06 00:27:09 +0200 |
commit | 5d60212076f05fd85607e05e1496ad009dcf501b (patch) | |
tree | f14e5cf5e08624aad9ea01ea99d0cc618ff1ac39 /Userland/Libraries/LibWeb/CSS/StyleSheet.h | |
parent | 0fe923e35580ce1745f47c0d812ce7689ae84063 (diff) | |
download | serenity-5d60212076f05fd85607e05e1496ad009dcf501b.zip |
LibWeb: Make StyleSheet and CSSStyleSheet GC-allocated
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleSheet.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleSheet.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleSheet.h b/Userland/Libraries/LibWeb/CSS/StyleSheet.h index 7c921a3f35..8da67177fa 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleSheet.h +++ b/Userland/Libraries/LibWeb/CSS/StyleSheet.h @@ -7,17 +7,16 @@ #pragma once -#include <AK/RefCounted.h> -#include <LibWeb/Bindings/Wrappable.h> +#include <LibWeb/Bindings/PlatformObject.h> #include <LibWeb/Forward.h> namespace Web::CSS { -class StyleSheet - : public RefCounted<StyleSheet> - , public Bindings::Wrappable { +class StyleSheet : public Bindings::PlatformObject { + JS_OBJECT(StyleSheet, Bindings::PlatformObject); + public: - using WrapperType = Bindings::StyleSheetWrapper; + StyleSheet& impl() { return *this; } virtual ~StyleSheet() = default; @@ -49,12 +48,14 @@ public: void set_parent_css_style_sheet(CSSStyleSheet*); protected: - StyleSheet() = default; + explicit StyleSheet(Bindings::WindowObject&); private: + virtual void visit_edges(Cell::Visitor&) override; + WeakPtr<DOM::Element> m_owner_node; - WeakPtr<CSSStyleSheet> m_parent_style_sheet; + CSSStyleSheet* m_parent_style_sheet { nullptr }; String m_location; String m_title; @@ -67,3 +68,8 @@ private: }; } + +namespace Web::Bindings { +inline JS::Object* wrap(JS::Realm&, Web::CSS::StyleSheet& object) { return &object; } +using StyleSheetWrapper = Web::CSS::StyleSheet; +} |