From 3013e74d3a9f0b6804e16e6b83f4f5a6f44cd569 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Fri, 24 Dec 2021 21:38:33 +0100 Subject: [PATCH] LibWeb: Avoid unnecessary copies in StyleInvalidator --- Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp b/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp index 0fc2d4ffcd..0d0bd93137 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp @@ -29,12 +29,12 @@ StyleInvalidator::~StyleInvalidator() return; auto& style_computer = m_document.style_computer(); m_document.for_each_in_inclusive_subtree_of_type([&](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);