1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:27:35 +00:00

LibHTML: Create anonymous blocks around inline children of blocks.

This commit is contained in:
Andreas Kling 2019-07-08 17:42:23 +02:00
parent 2caec95d30
commit fc127eb769
9 changed files with 33 additions and 17 deletions

View file

@ -1,8 +1,8 @@
#include <LibHTML/DOM/Element.h>
#include <LibHTML/Layout/LayoutBlock.h>
LayoutBlock::LayoutBlock(const Node& node, const StyledNode& styled_node)
: LayoutNode(&node, styled_node)
LayoutBlock::LayoutBlock(const Node* node, const StyledNode* styled_node)
: LayoutNode(node, styled_node)
{
}
@ -10,6 +10,14 @@ LayoutBlock::~LayoutBlock()
{
}
LayoutNode& LayoutBlock::inline_wrapper()
{
if (!last_child() || !last_child()->is_block()) {
append_child(adopt(*new LayoutBlock(nullptr, nullptr)));
}
return *last_child();
}
void LayoutBlock::layout()
{
compute_width();