mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:18:12 +00:00
LibWeb: Don't compute style *again* for elements in Layout::TreeBuilder
TreeBuilder wasn't taking advantage of the fact that we already have computed style cached on each DOM::Element by the time we're constructing a layout tree. So instead of using the cached style, we recomputed it from scratch for every element. This was done because invalidation was broken in many places, but now that it's more or less trustworthy, stop recomputing style on the fly in TreeBuilder and use what the preceding style update pass gave us instead. This basically cuts style computation work in half. :^)
This commit is contained in:
parent
1881761d0f
commit
b8ee4dfda8
1 changed files with 2 additions and 2 deletions
|
@ -101,10 +101,10 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
|
|||
if (is<DOM::Element>(dom_node)) {
|
||||
auto& element = static_cast<DOM::Element&>(dom_node);
|
||||
element.clear_pseudo_element_nodes({});
|
||||
style = style_computer.compute_style(element);
|
||||
VERIFY(!element.needs_style_update());
|
||||
style = element.computed_css_values();
|
||||
if (style->display().is_none())
|
||||
return;
|
||||
element.set_computed_css_values(style);
|
||||
layout_node = element.create_layout_node(*style);
|
||||
} else if (is<DOM::Document>(dom_node)) {
|
||||
style = style_computer.create_document_style();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue