LibWeb: Note what's causing a style invalidation to happen

You can now build with STYLE_INVALIDATION_DEBUG and get a debug stream
of reasons why style invalidations are happening and where.

I've rewritten this code many times, so instead of throwing it away once
again, I figured we should at least have it behind a flag.
This commit is contained in:
Andreas Kling 2024-09-04 10:01:08 +02:00 committed by Andreas Kling
commit ddbfac38b0
Notes: github-actions[bot] 2024-09-08 07:46:37 +00:00
20 changed files with 92 additions and 38 deletions

View file

@ -875,7 +875,7 @@ void Element::set_shadow_root(JS::GCPtr<ShadowRoot> shadow_root)
m_shadow_root = move(shadow_root);
if (m_shadow_root)
m_shadow_root->set_host(this);
invalidate_style();
invalidate_style(StyleInvalidationReason::ElementSetShadowRoot);
}
CSS::CSSStyleDeclaration* Element::style_for_bindings()
@ -1930,7 +1930,7 @@ void Element::invalidate_style_after_attribute_change(FlyString const& attribute
(void)attribute_name;
// FIXME: This will need to become smarter when we implement the :has() selector.
invalidate_style();
invalidate_style(StyleInvalidationReason::ElementAttributeChange);
}
// https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion