mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-12-27 20:30:39 +00:00
#501: basic support (doesn't work yet, doesn't crash) from M1294490
This commit is contained in:
parent
09717d2708
commit
630d191905
@ -15,6 +15,7 @@ contract @mozilla.org/uriloader/content-handler;1?type=image/gif {5d0ce354-df01-
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/jpeg {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/jpg {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/png {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/webp {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/bmp {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/x-icon {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
contract @mozilla.org/uriloader/content-handler;1?type=image/vnd.microsoft.icon {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
|
@ -72,6 +72,7 @@ export:: $(export-preqs)
|
||||
-DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \
|
||||
-DMOZ_NATIVE_LIBEVENT=$(MOZ_NATIVE_LIBEVENT) \
|
||||
-DMOZ_NATIVE_LIBVPX=$(MOZ_NATIVE_LIBVPX) \
|
||||
-DMOZ_NATIVE_LIBWEBP=$(MOZ_NATIVE_LIBWEBP) \
|
||||
-DMOZ_NATIVE_ICU=$(MOZ_NATIVE_ICU) \
|
||||
$(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
|
||||
$(INSTALL) system_wrappers $(DIST)
|
||||
|
@ -301,6 +301,7 @@ OS_INCLUDES := \
|
||||
$(NSPR_CFLAGS) $(NSS_CFLAGS) \
|
||||
$(MOZ_JPEG_CFLAGS) \
|
||||
$(MOZ_PNG_CFLAGS) \
|
||||
$(MOZ_WEBP_CFLAGS) \
|
||||
$(MOZ_ZLIB_CFLAGS) \
|
||||
$(MOZ_PIXMAN_CFLAGS) \
|
||||
$(NULL)
|
||||
|
3
config/external/moz.build
vendored
3
config/external/moz.build
vendored
@ -36,6 +36,9 @@ if CONFIG['MOZ_WEBM_ENCODER']:
|
||||
if CONFIG['MOZ_VPX'] and not CONFIG['MOZ_NATIVE_LIBVPX']:
|
||||
external_dirs += ['media/libvpx']
|
||||
|
||||
if CONFIG['MOZ_WEBP'] and not CONFIG['MOZ_NATIVE_WEBP']:
|
||||
external_dirs += ['media/libwebp']
|
||||
|
||||
if not CONFIG['MOZ_NATIVE_PNG']:
|
||||
external_dirs += ['media/libpng']
|
||||
|
||||
|
90
configure.in
90
configure.in
@ -52,6 +52,7 @@ dnl Set the version number of the libs included with mozilla
|
||||
dnl ========================================================
|
||||
MOZJPEG=62
|
||||
MOZPNG=10619
|
||||
MOZWEBP=0x201
|
||||
NSPR_VERSION=4
|
||||
NSPR_MINVER=4.12
|
||||
NSS_VERSION=3
|
||||
@ -3667,6 +3668,82 @@ fi # SKIP_LIBRARY_CHECKS
|
||||
|
||||
AC_SUBST(MOZ_PNG_ARM_NEON)
|
||||
|
||||
dnl ========================================================
|
||||
dnl system WEBP Support
|
||||
dnl ========================================================
|
||||
MOZ_ARG_WITH_STRING(system-webp,
|
||||
[ --with-system-webp[=PFX]
|
||||
Use system libwebp [installed at prefix PFX]],
|
||||
WEBP_DIR=$withval)
|
||||
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
_SAVE_LDFLAGS=$LDFLAGS
|
||||
_SAVE_LIBS=$LIBS
|
||||
if test -n "${WEBP_DIR}" -a "${WEBP_DIR}" != "yes"; then
|
||||
CFLAGS="-I${WEBP_DIR}/include $CFLAGS"
|
||||
LDFLAGS="-L${WEBP_DIR}/lib $LDFLAGS"
|
||||
fi
|
||||
if test -z "$WEBP_DIR" -o "$WEBP_DIR" = no; then
|
||||
MOZ_NATIVE_WEBP=
|
||||
else
|
||||
AC_CHECK_LIB(webp, WebPGetDecoderVersion, [MOZ_NATIVE_WEBP=1 MOZ_WEBP_LIBS="-lwebp"],
|
||||
[MOZ_NATIVE_WEBP= MOZ_WEBP_CFLAGS= MOZ_WEBP_LIBS=])
|
||||
fi
|
||||
if test "$MOZ_NATIVE_WEBP" = 1; then
|
||||
AC_TRY_COMPILE([ #include <webp/decode.h> ],
|
||||
[ #if WEBP_DECODER_ABI_VERSION < $MOZWEBP
|
||||
#error "Insufficient libwebp decoder version ($MOZWEBP required)."
|
||||
#endif ],
|
||||
MOZ_NATIVE_WEBP=1,
|
||||
AC_MSG_ERROR([--with-system-webp requested but no working libwebp found]))
|
||||
fi
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
LIBS=$_SAVE_LIBS
|
||||
|
||||
if test "${WEBP_DIR}" -a -d "${WEBP_DIR}" -a "$MOZ_NATIVE_WEBP" = 1; then
|
||||
MOZ_WEBP_CFLAGS="-I${WEBP_DIR}/include"
|
||||
MOZ_WEBP_LIBS="-L${WEBP_DIR}/lib ${MOZ_WEBP_LIBS}"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl system WEBP Support
|
||||
dnl ========================================================
|
||||
MOZ_ARG_WITH_STRING(system-webp,
|
||||
[ --with-system-webp[=PFX]
|
||||
Use system libwebp [installed at prefix PFX]],
|
||||
WEBP_DIR=$withval)
|
||||
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
_SAVE_LDFLAGS=$LDFLAGS
|
||||
_SAVE_LIBS=$LIBS
|
||||
if test -n "${WEBP_DIR}" -a "${WEBP_DIR}" != "yes"; then
|
||||
CFLAGS="-I${WEBP_DIR}/include $CFLAGS"
|
||||
LDFLAGS="-L${WEBP_DIR}/lib $LDFLAGS"
|
||||
fi
|
||||
if test -z "$WEBP_DIR" -o "$WEBP_DIR" = no; then
|
||||
MOZ_NATIVE_WEBP=
|
||||
else
|
||||
AC_CHECK_LIB(webp, WebPGetDecoderVersion, [MOZ_NATIVE_WEBP=1 MOZ_WEBP_LIBS="-lwebp"],
|
||||
[MOZ_NATIVE_WEBP= MOZ_WEBP_CFLAGS= MOZ_WEBP_LIBS=])
|
||||
fi
|
||||
if test "$MOZ_NATIVE_WEBP" = 1; then
|
||||
AC_TRY_COMPILE([ #include <webp/decode.h> ],
|
||||
[ #if WEBP_DECODER_ABI_VERSION < $MOZWEBP
|
||||
#error "Insufficient libwebp decoder version ($MOZWEBP required)."
|
||||
#endif ],
|
||||
MOZ_NATIVE_WEBP=1,
|
||||
AC_MSG_ERROR([--with-system-webp requested but no working libwebp found]))
|
||||
fi
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
LIBS=$_SAVE_LIBS
|
||||
|
||||
if test "${WEBP_DIR}" -a -d "${WEBP_DIR}" -a "$MOZ_NATIVE_WEBP" = 1; then
|
||||
MOZ_WEBP_CFLAGS="-I${WEBP_DIR}/include"
|
||||
MOZ_WEBP_LIBS="-L${WEBP_DIR}/lib ${MOZ_WEBP_LIBS}"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl system HunSpell Support
|
||||
dnl ========================================================
|
||||
@ -3727,6 +3804,7 @@ MOZ_WAVE=1
|
||||
MOZ_SAMPLE_TYPE_FLOAT32=
|
||||
MOZ_SAMPLE_TYPE_S16=
|
||||
MOZ_WEBM=1
|
||||
MOZ_WEBP=1
|
||||
MOZ_GSTREAMER=
|
||||
MOZ_DIRECTSHOW=
|
||||
MOZ_WMF=
|
||||
@ -5451,6 +5529,14 @@ AC_SUBST(MOZ_NATIVE_LIBVPX)
|
||||
AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
|
||||
AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
|
||||
|
||||
if test "$MOZ_WEBP"; then
|
||||
AC_DEFINE(MOZ_WEBP)
|
||||
fi
|
||||
|
||||
if test "$MOZ_WEBP"; then
|
||||
AC_DEFINE(MOZ_WEBP)
|
||||
fi
|
||||
|
||||
if test "$MOZ_WEBM"; then
|
||||
if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
|
||||
MOZ_VORBIS=1
|
||||
@ -8926,6 +9012,7 @@ HOST_CXXFLAGS=`echo \
|
||||
|
||||
AC_SUBST(MOZ_NATIVE_JPEG)
|
||||
AC_SUBST(MOZ_NATIVE_PNG)
|
||||
AC_SUBST(MOZ_NATIVE_WEBP)
|
||||
AC_SUBST(MOZ_NATIVE_BZ2)
|
||||
|
||||
AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
|
||||
@ -8934,6 +9021,8 @@ AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
|
||||
AC_SUBST_LIST(MOZ_BZ2_LIBS)
|
||||
AC_SUBST_LIST(MOZ_PNG_CFLAGS)
|
||||
AC_SUBST_LIST(MOZ_PNG_LIBS)
|
||||
AC_SUBST(MOZ_WEBP_CFLAGS)
|
||||
AC_SUBST_LIST(MOZ_WEBP_LIBS)
|
||||
|
||||
if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
|
||||
export MOZ_NUWA_PROCESS
|
||||
@ -9031,6 +9120,7 @@ AC_SUBST(MOZ_WAVE)
|
||||
AC_SUBST(MOZ_VORBIS)
|
||||
AC_SUBST(MOZ_TREMOR)
|
||||
AC_SUBST(MOZ_WEBM)
|
||||
AC_SUBST(MOZ_WEBP)
|
||||
AC_SUBST(MOZ_WMF)
|
||||
AC_SUBST(MOZ_FFMPEG)
|
||||
AC_SUBST(MOZ_FMP4)
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsBMPDecoder.h"
|
||||
#include "nsICODecoder.h"
|
||||
#include "nsIconDecoder.h"
|
||||
#include "nsWEBPDecoder.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -62,6 +63,10 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
|
||||
// Icon
|
||||
} else if (!strcmp(aMimeType, IMAGE_ICON_MS)) {
|
||||
type = DecoderType::ICON;
|
||||
|
||||
// WEBP
|
||||
} else if (!strcmp(aMimeType, IMAGE_WEBP)) {
|
||||
type = DecoderType::WEBP;
|
||||
}
|
||||
|
||||
return type;
|
||||
@ -97,6 +102,9 @@ DecoderFactory::GetDecoder(DecoderType aType,
|
||||
case DecoderType::ICON:
|
||||
decoder = new nsIconDecoder(aImage);
|
||||
break;
|
||||
case DecoderType::WEBP:
|
||||
decoder = new nsWEBPDecoder(aImage);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown decoder type");
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ enum class DecoderType
|
||||
BMP,
|
||||
ICO,
|
||||
ICON,
|
||||
WEBP,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
|
@ -78,6 +78,7 @@ static const mozilla::Module::CategoryEntry kImageCategories[] = {
|
||||
{ "Gecko-Content-Viewers", IMAGE_ICON_MS, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_PNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_X_PNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_WEBP, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "content-sniffing-services", "@mozilla.org/image/loader;1", "@mozilla.org/image/loader;1" },
|
||||
{ nullptr }
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ UNIFIED_SOURCES += [
|
||||
'nsIconDecoder.cpp',
|
||||
'nsJPEGDecoder.cpp',
|
||||
'nsPNGDecoder.cpp',
|
||||
'nsWEBPDecoder.cpp',
|
||||
]
|
||||
|
||||
# Decoders need RasterImage.h
|
||||
|
@ -2585,6 +2585,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;
|
||||
|
@ -100,6 +100,7 @@
|
||||
#define IMAGE_XBM "image/x-xbitmap"
|
||||
#define IMAGE_XBM2 "image/x-xbm"
|
||||
#define IMAGE_XBM3 "image/xbm"
|
||||
#define IMAGE_WEBP "image/webp"
|
||||
#define IMAGE_ART "image/x-jg"
|
||||
#define IMAGE_TIFF "image/tiff"
|
||||
#define IMAGE_BMP "image/bmp"
|
||||
|
@ -221,6 +221,9 @@ if CONFIG['MOZ_NATIVE_JPEG']:
|
||||
if CONFIG['MOZ_NATIVE_PNG']:
|
||||
OS_LIBS += CONFIG['MOZ_PNG_LIBS']
|
||||
|
||||
if CONFIG['MOZ_NATIVE_WEBP']:
|
||||
OS_LIBS += CONFIG['MOZ_WEBP_LIBS']
|
||||
|
||||
if CONFIG['MOZ_NATIVE_HUNSPELL']:
|
||||
OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
|
||||
|
||||
|
@ -507,6 +507,9 @@ static nsDefaultMimeTypeEntry defaultMimeEntries [] =
|
||||
{ IMAGE_JPEG, "jpeg" },
|
||||
{ IMAGE_JPEG, "jpg" },
|
||||
{ IMAGE_SVG_XML, "svg" },
|
||||
#ifdef MOZ_WEBP
|
||||
{ IMAGE_WEBP, "webp" },
|
||||
#endif
|
||||
{ TEXT_HTML, "html" },
|
||||
{ TEXT_HTML, "htm" },
|
||||
{ APPLICATION_XPINSTALL, "xpi" },
|
||||
@ -584,6 +587,7 @@ static nsExtraMimeTypeEntry extraMimeEntries [] =
|
||||
{ IMAGE_TIFF, "tiff,tif", "TIFF Image" },
|
||||
{ IMAGE_XBM, "xbm", "XBM Image" },
|
||||
{ IMAGE_SVG_XML, "svg", "Scalable Vector Graphics" },
|
||||
{ IMAGE_WEBP, "webp", "WebP Image" },
|
||||
{ MESSAGE_RFC822, "eml", "RFC-822 data" },
|
||||
{ TEXT_PLAIN, "txt,text", "Text File" },
|
||||
{ TEXT_HTML, "html,htm,shtml,ehtml", "HyperText Markup Language" },
|
||||
|
Loading…
Reference in New Issue
Block a user