mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02: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:
Notes:
sideshowbarker
2024-07-17 19:45:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7e1bf4d300b
@@ -41,15 +41,11 @@ void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
|
||||
RefPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
if (type() == "hidden")
|
||||
return nullptr;
|
||||
|
||||
auto style = document().style_computer().compute_style(*this);
|
||||
if (style->display().is_none())
|
||||
return nullptr;
|
||||
|
||||
if (type().equals_ignoring_case("submit") || type().equals_ignoring_case("button"))
|
||||
return adopt_ref(*new Layout::ButtonBox(document(), *this, move(style)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user