mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Add WebP content sniffing code.
This commit is contained in:
parent
9121db73a2
commit
8b0dd2f40b
3 changed files with 90 additions and 0 deletions
|
|
@ -2558,6 +2558,11 @@ imgLoader::GetMimeTypeFromContent(const char* aContents,
|
|||
!memcmp(aContents, "\000\000\002\000", 4))) {
|
||||
aContentType.AssignLiteral(IMAGE_ICO);
|
||||
|
||||
// WebPs always begin with RIFF, a 32-bit length, and WEBP.
|
||||
} else if (aLength >= 12 && !memcmp(aContents, "RIFF", 4) &&
|
||||
!memcmp(aContents + 8, "WEBP", 4)) {
|
||||
aContentType.AssignLiteral(IMAGE_WEBP);
|
||||
|
||||
} else {
|
||||
/* none of the above? I give up */
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue