/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2021, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::CSS { class CSSStyleRule final : public CSSRule { AK_MAKE_NONCOPYABLE(CSSStyleRule); AK_MAKE_NONMOVABLE(CSSStyleRule); public: using WrapperType = Bindings::CSSStyleRuleWrapper; static NonnullRefPtr create(NonnullRefPtrVector&& selectors, NonnullRefPtr&& declaration) { return adopt_ref(*new CSSStyleRule(move(selectors), move(declaration))); } virtual ~CSSStyleRule() override = default; NonnullRefPtrVector const& selectors() const { return m_selectors; } CSSStyleDeclaration const& declaration() const { return m_declaration; } virtual StringView class_name() const override { return "CSSStyleRule"; }; virtual Type type() const override { return Type::Style; }; String selector_text() const; void set_selector_text(StringView); CSSStyleDeclaration* style(); private: CSSStyleRule(NonnullRefPtrVector&&, NonnullRefPtr&&); virtual String serialized() const override; NonnullRefPtrVector m_selectors; NonnullRefPtr m_declaration; }; template<> inline bool CSSRule::fast_is() const { return type() == CSSRule::Type::Style; } }