1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-13 21:02:06 +00:00

LibHTML: Let the layout tree own the style tree.

Each layout node is now constructed with an owning back-pointer to the style
tree node that originated it.
This commit is contained in:
Andreas Kling 2019-07-03 07:19:29 +02:00
parent e9ab282cfd
commit c7cf6f00fc
11 changed files with 21 additions and 17 deletions

View file

@ -61,14 +61,14 @@ void Frame::layout()
auto create_layout_node = [](const StyledNode& styled_node) -> RefPtr<LayoutNode> {
if (styled_node.node() && styled_node.node()->is_document())
return adopt(*new LayoutDocument(static_cast<const Document&>(*styled_node.node())));
return adopt(*new LayoutDocument(static_cast<const Document&>(*styled_node.node()), styled_node));
switch (styled_node.display()) {
case Display::None:
return nullptr;
case Display::Block:
return adopt(*new LayoutBlock(*styled_node.node()));
return adopt(*new LayoutBlock(*styled_node.node(), styled_node));
case Display::Inline:
return adopt(*new LayoutInline(*styled_node.node()));
return adopt(*new LayoutInline(*styled_node.node(), styled_node));
default:
ASSERT_NOT_REACHED();
}