mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-11 12:06:07 +00:00
LibWeb: Avoid unnecessary copies in StyleInvalidator
This commit is contained in:
parent
0c365fdfd3
commit
3013e74d3a
Notes:
sideshowbarker
2024-07-17 21:49:43 +09:00
Author: https://github.com/BenWiederhake
Commit: 3013e74d3a
Pull-request: https://github.com/SerenityOS/serenity/pull/11408
1 changed files with 3 additions and 3 deletions
|
@ -29,12 +29,12 @@ StyleInvalidator::~StyleInvalidator()
|
|||
return;
|
||||
auto& style_computer = m_document.style_computer();
|
||||
m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) {
|
||||
auto maybe_matching_rules_before = m_elements_and_matching_rules_before.get(&element);
|
||||
if (!maybe_matching_rules_before.has_value()) {
|
||||
auto matching_rules_before_iter = m_elements_and_matching_rules_before.find(&element);
|
||||
if (matching_rules_before_iter == m_elements_and_matching_rules_before.end()) {
|
||||
element.set_needs_style_update(true);
|
||||
return IterationDecision::Continue;
|
||||
}
|
||||
auto& matching_rules_before = maybe_matching_rules_before.value();
|
||||
auto& matching_rules_before = matching_rules_before_iter->value;
|
||||
auto matching_rules_after = style_computer.collect_matching_rules(element);
|
||||
if (matching_rules_before.size() != matching_rules_after.size()) {
|
||||
element.set_needs_style_update(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue