Bug 1231480 - Don't pretend we provide image/gif from clipboard on b2g, r=fabrice

This commit is contained in:
Michael Layzell 2015-12-09 14:18:41 -05:00
parent 602fb24d03
commit 978c966f25

View File

@ -120,13 +120,12 @@ nsClipboard::SetData(nsITransferable *aTransferable,
(flavorStr.EqualsLiteral(kNativeImageMime) || (flavorStr.EqualsLiteral(kNativeImageMime) ||
flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kPNGImageMime) ||
flavorStr.EqualsLiteral(kJPEGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kJPGImageMime))) {
flavorStr.EqualsLiteral(kGIFImageMime))) { // image/[png|jpeg|jpg] or application/x-moz-nativeimage
// image/[png|jpeg|jpg|gif] or application/x-moz-nativeimage
// Look through our transfer data for the image. // Look through our transfer data for the image.
static const char* const imageMimeTypes[] = { static const char* const imageMimeTypes[] = {
kNativeImageMime, kPNGImageMime, kJPEGImageMime, kJPGImageMime, kGIFImageMime }; kNativeImageMime, kPNGImageMime, kJPEGImageMime, kJPGImageMime };
nsCOMPtr<nsISupportsInterfacePointer> imgPtr; nsCOMPtr<nsISupportsInterfacePointer> imgPtr;
for (uint32_t i = 0; !imgPtr && i < ArrayLength(imageMimeTypes); ++i) { for (uint32_t i = 0; !imgPtr && i < ArrayLength(imageMimeTypes); ++i) {
@ -259,11 +258,10 @@ nsClipboard::GetData(nsITransferable *aTransferable,
break; break;
} }
// image/[png|jpeg|jpg|gif] // image/[png|jpeg|jpg]
if ((flavorStr.EqualsLiteral(kPNGImageMime) || if ((flavorStr.EqualsLiteral(kPNGImageMime) ||
flavorStr.EqualsLiteral(kJPEGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kJPGImageMime)) &&
flavorStr.EqualsLiteral(kGIFImageMime)) &&
mClipboard->HasImage() ) { mClipboard->HasImage() ) {
// Get image buffer from clipboard. // Get image buffer from clipboard.
RefPtr<gfx::DataSourceSurface> image = mClipboard->GetImage(); RefPtr<gfx::DataSourceSurface> image = mClipboard->GetImage();
@ -328,8 +326,7 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList,
*aHasType = true; *aHasType = true;
} else if (!strcmp(flavor, kJPEGImageMime) || } else if (!strcmp(flavor, kJPEGImageMime) ||
!strcmp(flavor, kJPGImageMime) || !strcmp(flavor, kJPGImageMime) ||
!strcmp(flavor, kPNGImageMime) || !strcmp(flavor, kPNGImageMime)) {
!strcmp(flavor, kGIFImageMime)) {
// We will encode the image into any format you want, so we don't // We will encode the image into any format you want, so we don't
// need to check each specific format // need to check each specific format
if (mClipboard->HasImage()) { if (mClipboard->HasImage()) {