mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +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:
parent
3451673ac8
commit
7e1bf4d300
31 changed files with 48 additions and 91 deletions
|
@ -130,15 +130,10 @@ bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensit
|
|||
});
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> Element::create_layout_node()
|
||||
RefPtr<Layout::Node> Element::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
auto style = document().style_computer().compute_style(*this);
|
||||
const_cast<Element&>(*this).m_specified_css_values = style;
|
||||
auto display = style->display();
|
||||
|
||||
if (display.is_none())
|
||||
return nullptr;
|
||||
|
||||
if (local_name() == "noscript" && document().is_scripting_enabled())
|
||||
return nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue