mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 15:02:56 +00:00
LibWeb/CSS: Fetch ImageStyleValue images closer to spec
We now don't absolutize the URL during parsing, keeping it as a CSS::URL object which we then pass to the "fetch an external image for a stylesheet" algorithm. Our version of this algorithm is a bit ad-hoc, in order to make use of SharedResourceRequest. To try and reduce duplication, I've pulled all of fetch_a_style_resource() into a static function, apart from the "actually do the fetch" step.
This commit is contained in:
parent
9f00425dad
commit
c224644bed
Notes:
github-actions[bot]
2025-04-15 09:30:29 +00:00
Author: https://github.com/AtkinsSJ
Commit: c224644bed
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4319
5 changed files with 120 additions and 57 deletions
|
@ -2013,13 +2013,10 @@ RefPtr<AbstractImageStyleValue> Parser::parse_image_value(TokenStream<ComponentV
|
|||
if (url.has_value()) {
|
||||
// If the value is a 'url(..)' parse as image, but if it is just a reference 'url(#xx)', leave it alone,
|
||||
// so we can parse as URL further on. These URLs are used as references inside SVG documents for masks.
|
||||
// FIXME: Remove this special case once mask-image accepts `<image>`.
|
||||
if (!url->url().starts_with('#')) {
|
||||
// FIXME: Stop completing the URL here
|
||||
auto completed_url = complete_url(url->url());
|
||||
if (completed_url.has_value()) {
|
||||
tokens.discard_a_mark();
|
||||
return ImageStyleValue::create(completed_url.release_value());
|
||||
}
|
||||
tokens.discard_a_mark();
|
||||
return ImageStyleValue::create(url.release_value());
|
||||
}
|
||||
tokens.restore_a_mark();
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue