From 6d3361f077841ca701e287cd0caf5b5eee29ee29 Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Wed, 9 Jun 2021 21:31:13 +0200 Subject: [PATCH] LibWeb: Fix logic issue when parsing CSS custom properties With best wishes from De Morgan, this is the correct way to check whether the string isn't of the form "var(...)". --- Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp index edca46cf77..cd48a1b2a0 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp @@ -219,7 +219,7 @@ static bool takes_integer_value(CSS::PropertyID property_id) static StringView parse_custom_property_name(const StringView& value) { - if (!value.starts_with("var(") && !value.ends_with(")")) + if (!value.starts_with("var(") || !value.ends_with(")")) return {}; // FIXME: Allow for fallback auto first_comma_index = value.find_first_of(",");