diff --git a/LibHTML/CSS/StyledNode.cpp b/LibHTML/CSS/StyledNode.cpp new file mode 100644 index 00000000000..ed8a1ec2111 --- /dev/null +++ b/LibHTML/CSS/StyledNode.cpp @@ -0,0 +1,10 @@ +#include + +StyledNode::StyledNode(const Node* node) + : m_node(node) +{ +} + +StyledNode::~StyledNode() +{ +} diff --git a/LibHTML/CSS/StyledNode.h b/LibHTML/CSS/StyledNode.h new file mode 100644 index 00000000000..eaf171e570b --- /dev/null +++ b/LibHTML/CSS/StyledNode.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include +#include + +class Node; + +class StyledNode : public TreeNode { +public: + ~StyledNode(); + + const Node* node() const { return m_node; } + + template + inline void for_each_child(Callback callback) const + { + for (auto* node = first_child(); node; node = node->next_sibling()) + callback(*node); + } + + template + inline void for_each_child(Callback callback) + { + for (auto* node = first_child(); node; node = node->next_sibling()) + callback(*node); + } + +protected: + explicit StyledNode(const Node*); + +private: + const Node* m_node { nullptr }; + HashMap> m_property_values; +}; diff --git a/LibHTML/Makefile.shared b/LibHTML/Makefile.shared index 89340faef79..fd30a0521c1 100644 --- a/LibHTML/Makefile.shared +++ b/LibHTML/Makefile.shared @@ -9,6 +9,7 @@ LIBHTML_OBJS = \ CSS/StyleRule.o \ CSS/StyleDeclaration.o \ CSS/StyleValue.o \ + CSS/StyledNode.o \ CSS/DefaultStyleSheetSource.o \ Parser/HTMLParser.o \ Parser/CSSParser.o \