From 0aa74074dde088ab4ff38d4898a33e0f67b6d418 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 9 Oct 2020 21:27:01 +0200 Subject: [PATCH] LibWeb: Ignore non-URL values for background-image for now --- Libraries/LibWeb/CSS/StyleResolver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/CSS/StyleResolver.cpp b/Libraries/LibWeb/CSS/StyleResolver.cpp index 2d3f083b7e..96627a6cc4 100644 --- a/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -398,10 +398,6 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope if (!value.is_string()) continue; auto string = value.to_string(); - if (!string.starts_with("url(")) - continue; - if (!string.ends_with(')')) - continue; set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundImage, value, document); } return; @@ -411,6 +407,10 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope if (!value.is_string()) return; auto string = value.to_string(); + if (!string.starts_with("url(")) + return; + if (!string.ends_with(')')) + return; auto url = string.substring_view(4, string.length() - 5); if (url.length() >= 2 && url.starts_with('"') && url.ends_with('"')) url = url.substring_view(1, url.length() - 2);