summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.h
blob: 80b8866dc37e07b1cb5bd2719c4872caab50b41c (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
/*
 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/CSS/CSSRule.h>
#include <LibWeb/CSS/FontFace.h>

namespace Web::CSS {

class CSSFontFaceRule final : public CSSRule {
    AK_MAKE_NONCOPYABLE(CSSFontFaceRule);
    AK_MAKE_NONMOVABLE(CSSFontFaceRule);

public:
    using WrapperType = Bindings::CSSFontFaceRuleWrapper;

    static NonnullRefPtr<CSSFontFaceRule> create(FontFace&& font_face)
    {
        return adopt_ref(*new CSSFontFaceRule(move(font_face)));
    }

    virtual ~CSSFontFaceRule() override = default;

    virtual StringView class_name() const override { return "CSSFontFaceRule"sv; }
    virtual Type type() const override { return Type::FontFace; }

    FontFace const& font_face() const { return m_font_face; }
    CSSStyleDeclaration* style();

private:
    explicit CSSFontFaceRule(FontFace&&);

    virtual String serialized() const override;

    FontFace m_font_face;
};

template<>
inline bool CSSRule::fast_is<CSSFontFaceRule>() const { return type() == CSSRule::Type::FontFace; }

}