mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 13:17:35 +00:00
LibWeb: Avoid unnecessary copies in StyleInvalidator
This commit is contained in:
parent
0c365fdfd3
commit
3013e74d3a
1 changed files with 3 additions and 3 deletions
|
@ -29,12 +29,12 @@ StyleInvalidator::~StyleInvalidator()
|
||||||
return;
|
return;
|
||||||
auto& style_computer = m_document.style_computer();
|
auto& style_computer = m_document.style_computer();
|
||||||
m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) {
|
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);
|
auto matching_rules_before_iter = m_elements_and_matching_rules_before.find(&element);
|
||||||
if (!maybe_matching_rules_before.has_value()) {
|
if (matching_rules_before_iter == m_elements_and_matching_rules_before.end()) {
|
||||||
element.set_needs_style_update(true);
|
element.set_needs_style_update(true);
|
||||||
return IterationDecision::Continue;
|
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);
|
auto matching_rules_after = style_computer.collect_matching_rules(element);
|
||||||
if (matching_rules_before.size() != matching_rules_after.size()) {
|
if (matching_rules_before.size() != matching_rules_after.size()) {
|
||||||
element.set_needs_style_update(true);
|
element.set_needs_style_update(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue