diff options
author | Andreas Kling <kling@serenityos.org> | 2022-08-07 15:46:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-06 00:27:09 +0200 |
commit | 12042f075767d357a3d54b008609b0dd76354ad9 (patch) | |
tree | eef7f18424d58fd341cd517f18c0903260e4ebb8 /Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp | |
parent | 5d6cb9cbdbb1ac309d68c41929ab84f73f68753c (diff) | |
download | serenity-12042f075767d357a3d54b008609b0dd76354ad9.zip |
LibWeb: Make CSSRule and all its subclasses GC-allocated
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp index 3e5361817e..698e563fa6 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp @@ -1,17 +1,26 @@ /* * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ +#include <LibWeb/Bindings/CSSMediaRulePrototype.h> +#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/CSS/CSSMediaRule.h> namespace Web::CSS { -CSSMediaRule::CSSMediaRule(NonnullRefPtr<MediaList>&& media, NonnullRefPtrVector<CSSRule>&& rules) - : CSSConditionRule(move(rules)) +CSSMediaRule* CSSMediaRule::create(Bindings::WindowObject& window_object, NonnullRefPtr<MediaList>&& media_queries, CSSRuleList& rules) +{ + return window_object.heap().allocate<CSSMediaRule>(window_object.realm(), window_object, move(media_queries), rules); +} + +CSSMediaRule::CSSMediaRule(Bindings::WindowObject& window_object, NonnullRefPtr<MediaList>&& media, CSSRuleList& rules) + : CSSConditionRule(window_object, rules) , m_media(move(media)) { + set_prototype(&window_object.ensure_web_prototype<Bindings::CSSMediaRulePrototype>("CSSMediaRule")); } String CSSMediaRule::condition_text() const |