mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 15:55:06 +00:00

We walk the entire DOM and check all selectors against all elements. Only id, class and tag name are checked right now. There's no ancestor stack or compound selectors. All in good time :^)
32 lines
752 B
C++
32 lines
752 B
C++
#pragma once
|
|
|
|
#include <AK/OwnPtr.h>
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
#include <LibHTML/Layout/LayoutStyle.h>
|
|
|
|
class Document;
|
|
class Element;
|
|
class StyleRule;
|
|
class StyleSheet;
|
|
|
|
class StyleResolver {
|
|
public:
|
|
explicit StyleResolver(Document&);
|
|
~StyleResolver();
|
|
|
|
Document& document() { return m_document; }
|
|
const Document& document() const { return m_document; }
|
|
|
|
void add_sheet(const StyleSheet& sheet) { m_sheets.append(sheet); }
|
|
|
|
OwnPtr<LayoutStyle> resolve_element_style(const Element&);
|
|
OwnPtr<LayoutStyle> resolve_document_style(const Document&);
|
|
|
|
NonnullRefPtrVector<StyleRule> collect_matching_rules(const Element&) const;
|
|
|
|
|
|
private:
|
|
Document& m_document;
|
|
|
|
NonnullRefPtrVector<StyleSheet> m_sheets;
|
|
};
|