mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-30 12:50:58 +00:00
38 lines
869 B
C
38 lines
869 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <AK/HashMap.h>
|
||
|
|
#include <AK/NonnullRefPtr.h>
|
||
|
|
#include <AK/AKString.h>
|
||
|
|
#include <LibHTML/TreeNode.h>
|
||
|
|
#include <LibHTML/CSS/StyleValue.h>
|
||
|
|
|
||
|
|
class Node;
|
||
|
|
|
||
|
|
class StyledNode : public TreeNode<StyledNode> {
|
||
|
|
public:
|
||
|
|
~StyledNode();
|
||
|
|
|
||
|
|
const Node* node() const { return m_node; }
|
||
|
|
|
||
|
|
template<typename Callback>
|
||
|
|
inline void for_each_child(Callback callback) const
|
||
|
|
{
|
||
|
|
for (auto* node = first_child(); node; node = node->next_sibling())
|
||
|
|
callback(*node);
|
||
|
|
}
|
||
|
|
|
||
|
|
template<typename Callback>
|
||
|
|
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<String, NonnullRefPtr<StyleValue>> m_property_values;
|
||
|
|
};
|