summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/CSSRule.h
blob: 125f38d63df63b1be03d9219e2dab7903165630d (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) 2021, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Weakable.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/Selector.h>

namespace Web::CSS {

class CSSRule
    : public RefCounted<CSSRule>
    , public Bindings::Wrappable
    , public Weakable<CSSRule> {
public:
    using WrapperType = Bindings::CSSRuleWrapper;

    virtual ~CSSRule() = default;

    enum class Type : u32 {
        Style,
        Import,
        Media,
        Supports,
        __Count,
    };

    virtual StringView class_name() const = 0;
    virtual Type type() const = 0;

    String css_text() const;
    void set_css_text(StringView);

    template<typename T>
    bool fast_is() const = delete;

protected:
    virtual String serialized() const = 0;
};

}