From c1100a7c734014302bb69bcc1a93b5eadb7c1e84 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 17 Jun 2026 12:39:45 +0100 Subject: [PATCH] LibWeb: Simplify property validity check in `parse_anchor_size()` --- Libraries/LibWeb/CSS/Parser/ValueParsing.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp index f6527aad43..daaab95329 100644 --- a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp @@ -799,16 +799,10 @@ RefPtr Parser::parse_anchor_size(TokenStream& // FIXME: position-anchor // FIXME: position-area }; - bool valid_property_context = false; - for (auto& value_context : m_value_context) { - if (!value_context.has()) - continue; - if (!allowed_property_ids.contains_slow(value_context.get())) { - valid_property_context = false; - break; - } - valid_property_context = true; - } + auto property_context = m_value_context.last_matching([](ValueParsingContext const& it) { + return it.has(); + }); + bool valid_property_context = property_context.has_value() && allowed_property_ids.contains_slow(property_context->get()); if (!valid_property_context) return {};