/* * 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 { WEB_PLATFORM_OBJECT(CSSStyleRule, CSSRule); public: static CSSStyleRule* create(JS::Realm&, NonnullRefPtrVector&&, CSSStyleDeclaration&); virtual ~CSSStyleRule() override = default; NonnullRefPtrVector const& selectors() const { return m_selectors; } CSSStyleDeclaration const& declaration() const { return m_declaration; } virtual Type type() const override { return Type::Style; }; DeprecatedString selector_text() const; void set_selector_text(StringView); CSSStyleDeclaration* style(); private: CSSStyleRule(JS::Realm&, NonnullRefPtrVector&&, CSSStyleDeclaration&); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual DeprecatedString serialized() const override; NonnullRefPtrVector m_selectors; CSSStyleDeclaration& m_declaration; }; template<> inline bool CSSRule::fast_is() const { return type() == CSSRule::Type::Style; } }