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

#pragma once

#include <AK/RefCounted.h>
#include <AK/String.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:
    using WrapperType = Bindings::CSSRuleWrapper;

    virtual ~CSSRule();

    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;
};

}