summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/ListItemMarkerBox.h
blob: 152c000c50f02a53d0b8d9f9e719448ae3839ff9 (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
/*
 * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
 * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/Layout/Box.h>

namespace Web::Layout {

class ListItemMarkerBox final : public Box {
    JS_CELL(ListItemMarkerBox, Box);

public:
    explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, size_t index, NonnullRefPtr<CSS::StyleProperties>);
    virtual ~ListItemMarkerBox() override;

    DeprecatedString const& text() const { return m_text; }

    virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;

    CSS::ListStyleType list_style_type() const { return m_list_style_type; }

private:
    virtual bool is_list_item_marker_box() const final { return true; }
    virtual bool can_have_children() const override { return false; }

    CSS::ListStyleType m_list_style_type { CSS::ListStyleType::None };
    size_t m_index;

    DeprecatedString m_text {};
};

template<>
inline bool Node::fast_is<ListItemMarkerBox>() const { return is_list_item_marker_box(); }

}