mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02:00
LibWeb: Delay document load event for image-set() candidate fetches
ImageSetStyleValue::set_style_sheet() previously stored the style sheet on itself but didn't propagate to its candidate images. As a result, candidates were never registered as pending image resources, so their fetches didn't start until layout time and didn't delay the document's load event. This caused css-image-set-background-type.html to be flaky: under load, the screenshot could be captured before the selected SVG candidate had finished decoding, producing an empty box instead of the expected color. Propagate set_style_sheet() to each candidate image whose type() filter does not exclude it, mirroring StyleValueList and ShorthandStyleValue. The candidates now register themselves as pending so SharedResourceRequest's load event delayer correctly delays the load event until decoding completes.
This commit is contained in:
committed by
Alexander Kalenik
parent
03d1b37354
commit
0749a65a78
Notes:
github-actions[bot]
2026-04-26 16:34:13 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/0749a65a78e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9117
@@ -229,6 +229,15 @@ void ImageSetStyleValue::set_style_sheet(GC::Ptr<CSSStyleSheet> style_sheet)
|
||||
{
|
||||
Base::set_style_sheet(style_sheet);
|
||||
m_style_sheet = style_sheet;
|
||||
|
||||
// Propagate the style sheet to candidate images whose type() filter does not exclude them. This ensures the
|
||||
// candidate images register themselves as pending image resources on the style sheet, so their fetches start when
|
||||
// the style sheet is associated with the document, properly delaying the document's load event.
|
||||
for (auto const& option : m_options) {
|
||||
if (option.type.has_value() && !HTML::is_supported_image_type(*option.type))
|
||||
continue;
|
||||
const_cast<AbstractImageStyleValue&>(*option.image).set_style_sheet(style_sheet);
|
||||
}
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue const> ImageSetStyleValue::absolutized(ComputationContext const& context) const
|
||||
|
||||
Reference in New Issue
Block a user