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

LibWeb: Make CSSRule and all its subclasses GC-allocated

This commit is contained in:
Andreas Kling 2022-08-07 15:46:44 +02:00
parent 5d6cb9cbdb
commit 12042f0757
39 changed files with 338 additions and 236 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -14,26 +15,21 @@ namespace Web::CSS {
class CSSFontFaceRule final : public CSSRule {
AK_MAKE_NONCOPYABLE(CSSFontFaceRule);
AK_MAKE_NONMOVABLE(CSSFontFaceRule);
JS_OBJECT(CSSFontFaceRule, CSSRule);
public:
using WrapperType = Bindings::CSSFontFaceRuleWrapper;
static NonnullRefPtr<CSSFontFaceRule> create(FontFace&& font_face)
{
return adopt_ref(*new CSSFontFaceRule(move(font_face)));
}
static CSSFontFaceRule* create(Bindings::WindowObject&, FontFace&&);
explicit CSSFontFaceRule(Bindings::WindowObject&, FontFace&&);
virtual ~CSSFontFaceRule() override = default;
CSSFontFaceRule& impl() { return *this; }
virtual StringView class_name() const override { return "CSSFontFaceRule"sv; }
virtual Type type() const override { return Type::FontFace; }
FontFace const& font_face() const { return m_font_face; }
CSSStyleDeclaration* style();
private:
explicit CSSFontFaceRule(FontFace&&);
virtual String serialized() const override;
FontFace m_font_face;
@ -43,3 +39,8 @@ template<>
inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }
}
namespace Web::Bindings {
inline JS::Object* wrap(JS::Realm&, Web::CSS::CSSFontFaceRule& object) { return &object; }
using CSSFontFaceRuleWrapper = Web::CSS::CSSFontFaceRule;
}