summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Layout/ComputedStyle.h
blob: cbb0f5383aec9dd727a46c1299a849adfd8d1412 (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
#pragma once

#include <LibDraw/Size.h>
#include <LibHTML/CSS/LengthBox.h>

enum FontStyle {
    Normal,
    Bold,
};

class ComputedStyle {
public:
    ComputedStyle();
    ~ComputedStyle();

    LengthBox& margin() { return m_margin; }
    LengthBox& padding() { return m_padding; }
    LengthBox& border() { return m_border; }

    const LengthBox& margin() const { return m_margin; }
    const LengthBox& padding() const { return m_padding; }
    const LengthBox& border() const { return m_border; }

    FontStyle font_style() const { return m_font_style; }

    const Size& size() const { return m_size; }
    Size& size() { return m_size; }

    struct PixelBox {
        int top;
        int right;
        int bottom;
        int left;
    };

    PixelBox full_margin() const;

private:
    LengthBox m_margin;
    LengthBox m_padding;
    LengthBox m_border;

    Size m_size;

    FontStyle m_font_style { FontStyle::Normal };
};