mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibWeb: Compute element style in Layout::TreeBuilder
Instead of making each Layout::Node compute style for itself, we now compute it in TreeBuilder before even calling create_layout_node(). For non-element DOM nodes, we create the style and layout tree node in TreeBuilder. This allows us to move create_layout_node() from DOM::Node to DOM::Element.
This commit is contained in:
@@ -47,11 +47,8 @@ void HTMLCanvasElement::set_height(unsigned value)
|
||||
set_attribute(HTML::AttributeNames::height, String::number(value));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node()
|
||||
RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
auto style = document().style_computer().compute_style(*this);
|
||||
if (style->display().is_none())
|
||||
return nullptr;
|
||||
return adopt_ref(*new Layout::CanvasBox(document(), *this, move(style)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user