summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/CSS/StyleResolver.h
blob: 9056e130bac16dd13061e691002f4e444252659c (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
#pragma once

#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <LibHTML/CSS/StyleProperties.h>

class Document;
class Element;
class ParentNode;
class StyleRule;
class StyleSheet;

class StyleResolver {
public:
    explicit StyleResolver(Document&);
    ~StyleResolver();

    Document& document() { return m_document; }
    const Document& document() const { return m_document; }

    NonnullRefPtr<StyleProperties> resolve_style(const Element&, const StyleProperties* parent_properties) const;

    NonnullRefPtrVector<StyleRule> collect_matching_rules(const Element&) const;

private:
    template<typename Callback>
    void for_each_stylesheet(Callback) const;

    Document& m_document;
};