blob: d0d6ced46024926617c75882a3693c646aee045a (
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
|
/*
* Copyright (c) 2020-2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/Parser/Declaration.h>
#include <LibWeb/CSS/Parser/Rule.h>
namespace Web::CSS::Parser {
class DeclarationOrAtRule {
public:
explicit DeclarationOrAtRule(RefPtr<Rule> at);
explicit DeclarationOrAtRule(Declaration declaration);
~DeclarationOrAtRule();
enum class DeclarationType {
At,
Declaration,
};
bool is_at_rule() const { return m_type == DeclarationType::At; }
bool is_declaration() const { return m_type == DeclarationType::Declaration; }
Rule const& at_rule() const
{
VERIFY(is_at_rule());
return *m_at;
}
Declaration const& declaration() const
{
VERIFY(is_declaration());
return *m_declaration;
}
DeprecatedString to_deprecated_string() const;
private:
DeclarationType m_type;
RefPtr<Rule> m_at;
Optional<Declaration> m_declaration;
};
}
|