mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Skip tree traversal if invalidation set doesn't have properties
This allows us to skip unnecessary tree traversal to mark style for recalculation when invalidation set only has `InvalidateSelf`.
This commit is contained in:
parent
80ccb12a12
commit
9bb5e70f5a
Notes:
github-actions[bot]
2025-07-14 07:33:15 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 9bb5e70f5a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5427
Reviewed-by: https://github.com/gmta ✅
2 changed files with 7 additions and 2 deletions
|
@ -51,6 +51,7 @@ public:
|
|||
void set_needs_invalidate_pseudo_class(PseudoClass pseudo_class) { m_properties.set({ Property::Type::PseudoClass, pseudo_class }); }
|
||||
|
||||
bool is_empty() const;
|
||||
bool has_properties() const { return !m_properties.is_empty(); }
|
||||
void for_each_property(Function<IterationDecision(Property const&)> const& callback) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -516,13 +516,17 @@ void Node::invalidate_style(StyleInvalidationReason reason, Vector<CSS::Invalida
|
|||
if (invalidation_set.is_empty())
|
||||
return;
|
||||
|
||||
if (invalidation_set.needs_invalidate_self()) {
|
||||
set_needs_style_update(true);
|
||||
}
|
||||
|
||||
if (invalidation_set.needs_invalidate_whole_subtree()) {
|
||||
invalidate_style(reason);
|
||||
return;
|
||||
}
|
||||
|
||||
if (invalidation_set.needs_invalidate_self()) {
|
||||
set_needs_style_update(true);
|
||||
if (!invalidation_set.has_properties() && !options.invalidate_elements_that_use_css_custom_properties) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto invalidate_entire_subtree = [&](Node& subtree_root) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue