summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/DOMComputedElementStyleModel.h
blob: b118c352549db81c69930624975ff4abea36626b (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
#include <AK/NonnullRefPtrVector.h>
#include <LibGUI/GModel.h>

class Element;

class DOMComputedElementStyleModel final : public GModel {
public:
    enum Column {
        PropertyName,
        PropertyValue,
        __Count
    };

    static NonnullRefPtr<DOMComputedElementStyleModel> create(const Element& element) { return adopt(*new DOMComputedElementStyleModel(element)); }

    virtual int row_count(const GModelIndex& = GModelIndex()) const override;
    virtual int column_count(const GModelIndex& = GModelIndex()) const override { return Column::__Count; }
    virtual String column_name(int) const override;
    virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
    virtual void update() override;

private:
    explicit DOMComputedElementStyleModel(const Element&);
    const Element& element() const { return *m_element; }

    NonnullRefPtr<Element> m_element;

    struct Value {
        String name;
        String value;
    };
    Vector<Value> m_values;
};