Issue #1769 - Part 2: Implement JPEG-XL decoder and about:config and MIME plumbing.

Backported from Mozilla bug 1707590 whereever possible.
This commit is contained in:
Job Bautista 2022-06-19 15:40:33 +08:00 committed by roytam1
commit 51ea0e4f3a
15 changed files with 257 additions and 4 deletions

View file

@ -19,6 +19,9 @@
#include "nsICODecoder.h"
#include "nsIconDecoder.h"
#include "nsWebPDecoder.h"
#ifdef MOZ_JXL
# include "nsJXLDecoder.h"
#endif
namespace mozilla {
@ -77,6 +80,12 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
gfxPrefs::ImageWebPEnabled()) {
type = DecoderType::WEBP;
}
#ifdef MOZ_JXL
else if (!strcmp(aMimeType, IMAGE_JXL) &&
gfxPrefs::ImageJXLEnabled()) {
type = DecoderType::JXL;
}
#endif
return type;
}
@ -116,6 +125,11 @@ DecoderFactory::GetDecoder(DecoderType aType,
case DecoderType::WEBP:
decoder = new nsWebPDecoder(aImage);
break;
#ifdef MOZ_JXL
case DecoderType::JXL:
decoder = new nsJXLDecoder(aImage);
break;
#endif
default:
MOZ_ASSERT_UNREACHABLE("Unknown decoder type");
}