1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:17:35 +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:
Andreas Kling 2020-06-05 23:32:23 +02:00
parent 3337365000
commit 5dc8c4a24c
5 changed files with 13 additions and 3 deletions

View file

@ -54,6 +54,9 @@ public:
protected:
ImageResource* resource() { return static_cast<ImageResource*>(ResourceClient::resource()); }
const ImageResource* resource() const { return static_cast<const ImageResource*>(ResourceClient::resource()); }
private:
virtual Resource::Type client_type() const override { return Resource::Type::Image; }
};
}