mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Allow url("foo") and url('foo') in CSS background-image values
This is very hackish and will be fixed by writing a proper CSS parser.
This commit is contained in:
parent
0306ada1ff
commit
365703e3f3
Notes:
sideshowbarker
2024-07-19 05:41:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/365703e3f3c
1 changed files with 5 additions and 0 deletions
|
@ -354,6 +354,11 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
|||
if (!string.ends_with(')'))
|
||||
continue;
|
||||
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);
|
||||
else if (url.length() >= 2 && url.starts_with('\'') && url.ends_with('\''))
|
||||
url = url.substring_view(1, url.length() - 2);
|
||||
|
||||
auto background_image_value = ImageStyleValue::create(document.complete_url(url), document);
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, move(background_image_value));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue