2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2021-02-21 08:45:26 -03:00
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
2020-01-18 05:38:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-06-20 18:25:25 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-07-12 13:30:40 -03:00
|
|
|
#include <AK/NonnullRefPtr.h>
|
2019-06-27 07:16:20 -03:00
|
|
|
#include <AK/NonnullRefPtrVector.h>
|
2021-02-21 08:45:26 -03:00
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
2021-03-13 16:11:33 -03:00
|
|
|
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
2020-03-07 06:32:51 -03:00
|
|
|
#include <LibWeb/CSS/Selector.h>
|
2019-06-20 18:25:25 -03:00
|
|
|
|
2020-07-26 15:01:35 -03:00
|
|
|
namespace Web::CSS {
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2021-10-01 14:04:00 -03:00
|
|
|
class CSSStyleRule final : public CSSRule {
|
2022-08-28 08:42:07 -03:00
|
|
|
WEB_PLATFORM_OBJECT(CSSStyleRule, CSSRule);
|
2020-06-10 11:41:30 -03:00
|
|
|
|
2019-06-20 18:25:25 -03:00
|
|
|
public:
|
2022-08-28 08:42:07 -03:00
|
|
|
static CSSStyleRule* create(HTML::Window&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
|
2019-06-21 14:19:49 -03:00
|
|
|
|
2022-03-14 16:21:51 -03:00
|
|
|
virtual ~CSSStyleRule() override = default;
|
2019-06-20 18:25:25 -03:00
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
NonnullRefPtrVector<Selector> const& selectors() const { return m_selectors; }
|
|
|
|
|
CSSStyleDeclaration const& declaration() const { return m_declaration; }
|
2019-06-25 01:31:47 -03:00
|
|
|
|
2021-10-01 14:04:00 -03:00
|
|
|
virtual Type type() const override { return Type::Style; };
|
2021-02-21 08:45:26 -03:00
|
|
|
|
2021-09-29 18:43:18 -03:00
|
|
|
String selector_text() const;
|
|
|
|
|
void set_selector_text(StringView);
|
|
|
|
|
|
|
|
|
|
CSSStyleDeclaration* style();
|
|
|
|
|
|
2019-06-20 18:25:25 -03:00
|
|
|
private:
|
2022-08-28 08:42:07 -03:00
|
|
|
CSSStyleRule(HTML::Window&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
|
|
|
|
|
|
2022-08-07 11:21:26 -03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2021-10-01 14:57:45 -03:00
|
|
|
virtual String serialized() const override;
|
|
|
|
|
|
2021-07-12 13:30:40 -03:00
|
|
|
NonnullRefPtrVector<Selector> m_selectors;
|
2022-08-07 11:21:26 -03:00
|
|
|
CSSStyleDeclaration& m_declaration;
|
2019-06-20 18:25:25 -03:00
|
|
|
};
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2021-03-18 17:50:52 -03:00
|
|
|
template<>
|
|
|
|
|
inline bool CSSRule::fast_is<CSSStyleRule>() const { return type() == CSSRule::Type::Style; }
|
|
|
|
|
|
2020-03-07 06:27:02 -03:00
|
|
|
}
|