blob: f66ef64fff030b0c5bae0bf5c2239759b797e2c4 (
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
|
#include <LibHTML/Layout/LayoutBlock.h>
#include <LibHTML/Layout/LayoutNode.h>
#include <LibHTML/CSS/StyledNode.h>
LayoutNode::LayoutNode(const Node* node, const StyledNode* styled_node)
: m_node(node)
, m_styled_node(styled_node)
{
}
LayoutNode::~LayoutNode()
{
}
void LayoutNode::layout()
{
for_each_child([](auto& child) {
child.layout();
});
}
const LayoutBlock* LayoutNode::containing_block() const
{
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
if (ancestor->is_block())
return static_cast<const LayoutBlock*>(ancestor);
}
return nullptr;
}
|