LibWeb: Compute pseudo-element style when computing element style

Previously, pseudo-elements had their style computed while the layout
tree was being built. Instead, do so inside Element::recompute_style(),
using the same invalidation mechanism that the element itself uses.

This also has the effect of invalidating the layout much less often.
This commit is contained in:
Sam Atkins 2024-07-30 15:55:21 +01:00 committed by Alexander Kalenik
commit 3abd3ef5e2
Notes: github-actions[bot] 2024-07-31 10:16:35 +00:00
3 changed files with 54 additions and 28 deletions

View file

@ -191,9 +191,8 @@ void TreeBuilder::insert_node_into_inline_or_block_ancestor(Layout::Node& node,
void TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element, CSS::Selector::PseudoElement::Type pseudo_element, AppendOrPrepend mode)
{
auto& document = element.document();
auto& style_computer = document.style_computer();
auto pseudo_element_style = style_computer.compute_pseudo_element_style_if_needed(element, pseudo_element);
auto pseudo_element_style = element.pseudo_element_computed_css_values(pseudo_element);
if (!pseudo_element_style)
return;