mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +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:
parent
3337365000
commit
5dc8c4a24c
5 changed files with 13 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue