1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

LibWeb: Ignore non-URL values for background-image for now

This commit is contained in:
Andreas Kling 2020-10-09 21:27:01 +02:00
parent 7c4fb2b804
commit 0aa74074dd

View file

@ -398,10 +398,6 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
if (!value.is_string()) if (!value.is_string())
continue; continue;
auto string = value.to_string(); 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); set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundImage, value, document);
} }
return; return;
@ -411,6 +407,10 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
if (!value.is_string()) if (!value.is_string())
return; return;
auto string = value.to_string(); 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); auto url = string.substring_view(4, string.length() - 5);
if (url.length() >= 2 && url.starts_with('"') && url.ends_with('"')) if (url.length() >= 2 && url.starts_with('"') && url.ends_with('"'))
url = url.substring_view(1, url.length() - 2); url = url.substring_view(1, url.length() - 2);