mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-13 11:16:53 +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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user