
Instead of HtmlView clients having to worry about parsing and loading the default CSS, just take care of it inside StyleResolver. The default style is automatically inserted into the stylesheet list, at the very start, so everyone else gets a chance to override it.
30 lines
715 B
C++
30 lines
715 B
C++
#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;
|
|
};
|