summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Parser/StyleRule.h
blob: 267bfc80df8a25992a949b267a70fc59868db300 (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
/*
 * Copyright (c) 2020-2021, the SerenityOS developers.
 * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RefCounted.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/Parser/StyleBlockRule.h>
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>

namespace Web::CSS {

class StyleRule : public RefCounted<StyleRule> {
    friend class Parser;

public:
    enum class Type {
        At,
        Qualified,
    };

    StyleRule(Type);
    ~StyleRule();

    Vector<StyleComponentValueRule> const& prelude() const { return m_prelude; }
    StyleBlockRule const& block() const { return *m_block; }

    String to_string() const;

private:
    Type const m_type;
    String m_name; // At-rules only
    Vector<StyleComponentValueRule> m_prelude;
    RefPtr<StyleBlockRule> m_block;
};

}