diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/CSSMediaRule.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSMediaRule.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h index 3bd7214243..f3563660d2 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -16,18 +17,16 @@ namespace Web::CSS { class CSSMediaRule final : public CSSConditionRule { AK_MAKE_NONCOPYABLE(CSSMediaRule); AK_MAKE_NONMOVABLE(CSSMediaRule); + JS_OBJECT(CSSMediaRule, CSSConditionRule); public: - using WrapperType = Bindings::CSSMediaRuleWrapper; + CSSMediaRule& impl() { return *this; } - static NonnullRefPtr<CSSMediaRule> create(NonnullRefPtr<MediaList>&& media_queries, NonnullRefPtrVector<CSSRule>&& rules) - { - return adopt_ref(*new CSSMediaRule(move(media_queries), move(rules))); - } + static CSSMediaRule* create(Bindings::WindowObject&, NonnullRefPtr<MediaList>&& media_queries, CSSRuleList&); + explicit CSSMediaRule(Bindings::WindowObject&, NonnullRefPtr<MediaList>&&, CSSRuleList&); virtual ~CSSMediaRule() = default; - virtual StringView class_name() const override { return "CSSMediaRule"sv; }; virtual Type type() const override { return Type::Media; }; virtual String condition_text() const override; @@ -39,8 +38,6 @@ public: bool evaluate(HTML::Window const& window) { return m_media->evaluate(window); } private: - explicit CSSMediaRule(NonnullRefPtr<MediaList>&&, NonnullRefPtrVector<CSSRule>&&); - virtual String serialized() const override; NonnullRefPtr<MediaList> m_media; @@ -50,3 +47,8 @@ template<> inline bool CSSRule::fast_is<CSSMediaRule>() const { return type() == CSSRule::Type::Media; } } + +namespace Web::Bindings { +inline JS::Object* wrap(JS::Realm&, Web::CSS::CSSMediaRule& object) { return &object; } +using CSSMediaRuleWrapper = Web::CSS::CSSMediaRule; +} |