mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibHTML: Start fleshing out block layout.
The basic idea of block layout is: width, then children based on width, then height based on height of children.
This commit is contained in:
parent
f1a0e8b8e6
commit
22fec1a250
5 changed files with 32 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
#include <LibHTML/Layout/LayoutNode.h>
|
||||
|
||||
LayoutNode::LayoutNode(const Node* node)
|
||||
|
@ -15,3 +16,12 @@ void LayoutNode::layout()
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue