ladybird/Libraries/LibHTML/CSS/StyleResolver.h
Andreas Kling 4e35bbffdd LibHTML: LayoutText should always use parent's style properties
This patch makes StyleProperties heap-allocated and ref-counted so that
a LayoutNode can be without one. The ref-counting also allows anonymous
blocks to share style with their parent block.

LayoutText never needs a StyleProperties, since text always inherits
style from its parent element. This is handled by style_properties().
2019-10-04 12:12:39 +02:00

27 lines
636 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:
Document& m_document;
};