LibWeb: Delete unreachable code in Node::invalidate_style()

`if (invalidation_set.needs_invalidate_whole_subtree())` branch in the
end of the function was always false.
This commit is contained in:
Aliaksandr Kalenik 2025-07-15 19:01:26 +02:00 committed by Alexander Kalenik
parent c1ece2b4ed
commit 6ddc582551
Notes: github-actions[bot] 2025-07-15 22:32:49 +00:00

View file

@ -508,53 +508,33 @@ void Node::invalidate_style(StyleInvalidationReason reason, Vector<CSS::Invalida
} }
auto invalidation_set = document().style_computer().invalidation_set_for_properties(properties); auto invalidation_set = document().style_computer().invalidation_set_for_properties(properties);
if (options.invalidate_self)
invalidation_set.set_needs_invalidate_self();
if (invalidation_set.is_empty())
return;
if (invalidation_set.needs_invalidate_self()) {
set_needs_style_update(true);
}
if (invalidation_set.needs_invalidate_whole_subtree()) { if (invalidation_set.needs_invalidate_whole_subtree()) {
invalidate_style(reason); invalidate_style(reason);
return; return;
} }
if (options.invalidate_self || invalidation_set.needs_invalidate_self()) {
set_needs_style_update(true);
}
if (!invalidation_set.has_properties() && !options.invalidate_elements_that_use_css_custom_properties) { if (!invalidation_set.has_properties() && !options.invalidate_elements_that_use_css_custom_properties) {
return; return;
} }
auto invalidate_entire_subtree = [&](Node& subtree_root) { for_each_shadow_including_inclusive_descendant([&](Node& node) {
subtree_root.for_each_shadow_including_inclusive_descendant([&](Node& node) { if (!node.is_element())
if (!node.is_element())
return TraversalDecision::Continue;
auto& element = static_cast<Element&>(node);
bool needs_style_recalculation = false;
if (invalidation_set.needs_invalidate_whole_subtree()) {
VERIFY_NOT_REACHED();
}
if (element.includes_properties_from_invalidation_set(invalidation_set)) {
needs_style_recalculation = true;
} else if (options.invalidate_elements_that_use_css_custom_properties && element.style_uses_css_custom_properties()) {
needs_style_recalculation = true;
}
if (needs_style_recalculation)
element.set_needs_style_update(true);
return TraversalDecision::Continue; return TraversalDecision::Continue;
}); auto& element = static_cast<Element&>(node);
}; bool needs_style_recalculation = false;
if (element.includes_properties_from_invalidation_set(invalidation_set)) {
invalidate_entire_subtree(*this); needs_style_recalculation = true;
} else if (options.invalidate_elements_that_use_css_custom_properties && element.style_uses_css_custom_properties()) {
if (invalidation_set.needs_invalidate_whole_subtree()) { needs_style_recalculation = true;
for (auto* sibling = next_sibling(); sibling; sibling = sibling->next_sibling()) {
if (sibling->is_element())
invalidate_entire_subtree(*sibling);
} }
} if (needs_style_recalculation)
element.set_needs_style_update(true);
return TraversalDecision::Continue;
});
} }
String Node::child_text_content() const String Node::child_text_content() const