blob: 1a9b15466aa85fc2d242e1bae71c27859151ba94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <AK/NonnullRefPtrVector.h>
#include <LibWeb/CSS/CSSRule.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/Selector.h>
namespace Web::CSS {
class CSSStyleRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSStyleRule, CSSRule);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleRule>> create(JS::Realm&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
virtual ~CSSStyleRule() override = default;
NonnullRefPtrVector<Selector> 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<Selector>&&, CSSStyleDeclaration&);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual DeprecatedString serialized() const override;
NonnullRefPtrVector<Selector> m_selectors;
CSSStyleDeclaration& m_declaration;
};
template<>
inline bool CSSRule::fast_is<CSSStyleRule>() const { return type() == CSSRule::Type::Style; }
}
|