mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibHTML: Create some subdirectories.
This commit is contained in:
parent
0522a8f71c
commit
1f51c2b7da
25 changed files with 49 additions and 50 deletions
40
LibHTML/DOM/ParentNode.h
Normal file
40
LibHTML/DOM/ParentNode.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibHTML/DOM/Node.h>
|
||||
|
||||
class ParentNode : public Node {
|
||||
public:
|
||||
void append_child(Retained<Node>);
|
||||
|
||||
Node* first_child() { return m_first_child; }
|
||||
Node* last_child() { return m_last_child; }
|
||||
const Node* first_child() const { return m_first_child; }
|
||||
const Node* last_child() const { return m_last_child; }
|
||||
|
||||
template<typename F> void for_each_child(F) const;
|
||||
template<typename F> void for_each_child(F);
|
||||
|
||||
protected:
|
||||
explicit ParentNode(NodeType type)
|
||||
: Node(type)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
Node* m_first_child { nullptr };
|
||||
Node* m_last_child { nullptr };
|
||||
};
|
||||
|
||||
template<typename Callback>
|
||||
inline void ParentNode::for_each_child(Callback callback) const
|
||||
{
|
||||
for (auto* node = first_child(); node; node = node->next_sibling())
|
||||
callback(*node);
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
inline void ParentNode::for_each_child(Callback callback)
|
||||
{
|
||||
for (auto* node = first_child(); node; node = node->next_sibling())
|
||||
callback(*node);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue