mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 18:25:07 +00:00
LibHTML: Start fleshing out a basic layout tree.
This commit is contained in:
parent
f8a86b5164
commit
8a0e21b22b
24 changed files with 338 additions and 18 deletions
33
LibHTML/LayoutNode.cpp
Normal file
33
LibHTML/LayoutNode.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <LibHTML/LayoutNode.h>
|
||||
|
||||
LayoutNode::LayoutNode(const Node* node)
|
||||
: m_node(node)
|
||||
{
|
||||
}
|
||||
|
||||
LayoutNode::~LayoutNode()
|
||||
{
|
||||
}
|
||||
|
||||
void LayoutNode::retain()
|
||||
{
|
||||
ASSERT(m_retain_count);
|
||||
++m_retain_count;
|
||||
}
|
||||
|
||||
void LayoutNode::release()
|
||||
{
|
||||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue