mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 22:29:13 +00:00
LibWeb: Fix mismatching Resource subclass types
This was a confusing bug: ImageStyleValue loaded its image resource as a Generic resource, while HTMLImageElement loaded as Image. This patch fixes the issue and adds an assertion to verify that we only share resources that have the same C++ client class type.
This commit is contained in:
@@ -293,13 +293,14 @@ ImageStyleValue::ImageStyleValue(const URL& url, Document& document)
|
||||
{
|
||||
LoadRequest request;
|
||||
request.set_url(url);
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Image, request));
|
||||
}
|
||||
|
||||
void ImageStyleValue::resource_did_load()
|
||||
{
|
||||
if (!m_document)
|
||||
return;
|
||||
// FIXME: Use the shared decoder from ImageResource!
|
||||
m_bitmap = Gfx::load_png_from_memory(resource()->encoded_data().data(), resource()->encoded_data().size());
|
||||
if (!m_bitmap)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user