mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 852053 - Support WBMP on FirefoxOS only. r=joe
This commit is contained in:
parent
5a6f3aa1f9
commit
5cc5056451
@ -55,3 +55,4 @@ MOZ_TOOLKIT_SEARCH=
|
||||
MOZ_PLACES=
|
||||
MOZ_B2G=1
|
||||
MOZ_FOLD_LIBS=1
|
||||
MOZ_WBMP=1
|
||||
|
@ -8525,6 +8525,12 @@ if test -n "$MOZ_CAPTIVEDETECT"; then
|
||||
AC_DEFINE(MOZ_CAPTIVEDETECT)
|
||||
fi
|
||||
|
||||
dnl Build WBMP decoder if required
|
||||
AC_SUBST(MOZ_WBMP)
|
||||
if test -n "$MOZ_WBMP"; then
|
||||
AC_DEFINE(MOZ_WBMP)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
|
||||
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
|
||||
|
@ -81,7 +81,9 @@ 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" },
|
||||
#ifdef MOZ_WBMP
|
||||
{ "Gecko-Content-Viewers", IMAGE_WBMP, "@mozilla.org/content/document-loader-factory;1" },
|
||||
#endif
|
||||
{ "content-sniffing-services", "@mozilla.org/image/loader;1", "@mozilla.org/image/loader;1" },
|
||||
{ NULL }
|
||||
};
|
||||
|
@ -21,9 +21,12 @@ endif # !_MSC_VER
|
||||
|
||||
CPPSRCS = nsPNGDecoder.cpp nsJPEGDecoder.cpp nsGIFDecoder2.cpp \
|
||||
nsBMPDecoder.cpp nsICODecoder.cpp nsIconDecoder.cpp \
|
||||
nsWBMPDecoder.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_WBMP
|
||||
CPPSRCS += nsWBMPDecoder.cpp
|
||||
endif
|
||||
|
||||
CSRCS = iccjpeg.c \
|
||||
$(NULL)
|
||||
|
||||
|
@ -86,9 +86,11 @@ Image::GetDecoderType(const char *aMimeType)
|
||||
else if (!strcmp(aMimeType, IMAGE_ICON_MS))
|
||||
rv = eDecoderType_icon;
|
||||
|
||||
#ifdef MOZ_WBMP
|
||||
// WBMP
|
||||
else if (!strcmp(aMimeType, IMAGE_WBMP))
|
||||
rv = eDecoderType_wbmp;
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -31,7 +31,10 @@
|
||||
#include "nsBMPDecoder.h"
|
||||
#include "nsICODecoder.h"
|
||||
#include "nsIconDecoder.h"
|
||||
|
||||
#ifdef MOZ_WBMP
|
||||
#include "nsWBMPDecoder.h"
|
||||
#endif
|
||||
|
||||
#include "gfxContext.h"
|
||||
|
||||
@ -2592,9 +2595,11 @@ RasterImage::InitDecoder(bool aDoSizeDecode, bool aIsSynchronous /* = false */)
|
||||
case eDecoderType_icon:
|
||||
mDecoder = new nsIconDecoder(*this);
|
||||
break;
|
||||
#ifdef MOZ_WBMP
|
||||
case eDecoderType_wbmp:
|
||||
mDecoder = new nsWBMPDecoder(*this);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
NS_ABORT_IF_FALSE(0, "Shouldn't get here!");
|
||||
}
|
||||
|
@ -2046,6 +2046,7 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
|
||||
aContentType.AssignLiteral(IMAGE_ICO);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WBMP
|
||||
// A well-defined type 0 WBMP file starts with an "0000 0000b" byte followed
|
||||
// by an "0xx0 0000b" byte (x = don't care).
|
||||
else if (aLength >= 2 && (static_cast<unsigned char>(aContents[0]) == 0x00 &&
|
||||
@ -2053,6 +2054,7 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
|
||||
{
|
||||
aContentType.AssignLiteral(IMAGE_WBMP);
|
||||
}
|
||||
#endif
|
||||
|
||||
else {
|
||||
/* none of the above? I give up */
|
||||
|
@ -725,6 +725,17 @@ imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt,
|
||||
LOG_MSG(GetImgLog(), "imgRequest::OnDataAvailable", "Got content type from the channel");
|
||||
}
|
||||
|
||||
#ifdef MOZ_WBMP
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Only support WBMP in privileged app and certified app, do not support in browser app.
|
||||
if (newType.EqualsLiteral(IMAGE_WBMP) &&
|
||||
(!mLoadingPrincipal || mLoadingPrincipal->GetAppStatus() < nsIPrincipal::APP_STATUS_PRIVILEGED)) {
|
||||
this->Cancel(NS_ERROR_FAILURE);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If we're a regular image and this is the first call to OnDataAvailable,
|
||||
// this will always be true. If we've resniffed our MIME type (i.e. we're a
|
||||
// multipart/x-mixed-replace image), we have to be able to switch our image
|
||||
|
@ -47,4 +47,4 @@ include color-management/reftest.list
|
||||
skip-if(Android||B2G) include encoders-lossless/reftest.list # bug 783621
|
||||
|
||||
# WBMP tests
|
||||
skip-if(Android) include wbmp/reftest.list
|
||||
#skip-if(!B2G) include wbmp/reftest.list # bug 852053
|
||||
|
@ -478,7 +478,9 @@ static nsExtraMimeTypeEntry extraMimeEntries [] =
|
||||
{ IMAGE_PNG, "png", "PNG Image" },
|
||||
{ IMAGE_TIFF, "tiff,tif", "TIFF Image" },
|
||||
{ IMAGE_XBM, "xbm", "XBM Image" },
|
||||
#ifdef MOZ_WBMP
|
||||
{ IMAGE_WBMP, "wbmp", "WBMP Image" },
|
||||
#endif
|
||||
{ "image/svg+xml", "svg", "Scalable Vector Graphics" },
|
||||
{ MESSAGE_RFC822, "eml", "RFC-822 data" },
|
||||
{ TEXT_PLAIN, "txt,text", "Text File" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user