mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
Ladybird: Don't ask Qt to decode SVG images for us
While it's nice to see <img src="foo.svg"> suddenly work in Ladybird after linking with the Qt SVG module, this is cheating. We should implement SVG-as-image ourselves instead of relying on 3rd party code to do it. :^)
This commit is contained in:
parent
eadef3e5c3
commit
af5d892a7e
1 changed files with 6 additions and 0 deletions
|
@ -72,6 +72,12 @@ Optional<Web::Platform::DecodedImage> ImageCodecPluginLadybird::decode_image(Rea
|
||||||
auto image = decode_image_with_libgfx(data);
|
auto image = decode_image_with_libgfx(data);
|
||||||
if (image.has_value())
|
if (image.has_value())
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
|
// NOTE: Even though Qt can decode SVG images for us, let's not do that.
|
||||||
|
// We should handle <img src="foo.svg"> ourselves instead of cheating by using Qt.
|
||||||
|
if (data.starts_with("<?xml"sv.bytes()) || data.starts_with("<svg"sv.bytes()))
|
||||||
|
return {};
|
||||||
|
|
||||||
return decode_image_with_qt(data);
|
return decode_image_with_qt(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue