blob: e6d858868ab29b1f9e3a28fa1b9101e04d6024fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <LibHTML/Layout/LayoutNode.h>
LayoutNode::LayoutNode(const Node* node)
: m_node(node)
{
}
LayoutNode::~LayoutNode()
{
}
void LayoutNode::ref()
{
ASSERT(m_retain_count);
++m_retain_count;
}
void LayoutNode::deref()
{
ASSERT(m_retain_count);
if (!--m_retain_count)
delete this;
}
void LayoutNode::append_child(Retained<LayoutNode> node)
{
if (m_last_child)
m_last_child->set_next_sibling(node.ptr());
node->m_parent_node = this;
m_last_child = &node.leak_ref();
if (!m_first_child)
m_first_child = m_last_child;
}
void LayoutNode::layout()
{
for_each_child([](auto& child) {
child.layout();
});
}
|