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:
Andreas Kling 2023-05-07 06:43:22 +02:00
parent eadef3e5c3
commit af5d892a7e

View file

@ -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);
} }