Backout changeset 125438dda903 (bug 761051) because of Bq bustage

This commit is contained in:
Ehsan Akhgari 2012-06-07 19:49:37 -04:00
parent 97c0ab79ca
commit 3010661bb0
10 changed files with 21 additions and 45 deletions

View File

@ -1002,7 +1002,6 @@ NS_IMETHODIMP nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransfera
{
case 0: // prefer JPEG over PNG over GIF encoding
(*aTransferable)->AddDataFlavor(kJPEGImageMime);
(*aTransferable)->AddDataFlavor(kJPGImageMime);
(*aTransferable)->AddDataFlavor(kPNGImageMime);
(*aTransferable)->AddDataFlavor(kGIFImageMime);
break;
@ -1010,13 +1009,11 @@ NS_IMETHODIMP nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransfera
default:
(*aTransferable)->AddDataFlavor(kPNGImageMime);
(*aTransferable)->AddDataFlavor(kJPEGImageMime);
(*aTransferable)->AddDataFlavor(kJPGImageMime);
(*aTransferable)->AddDataFlavor(kGIFImageMime);
break;
case 2: // prefer GIF over JPEG over PNG encoding
(*aTransferable)->AddDataFlavor(kGIFImageMime);
(*aTransferable)->AddDataFlavor(kJPEGImageMime);
(*aTransferable)->AddDataFlavor(kJPGImageMime);
(*aTransferable)->AddDataFlavor(kPNGImageMime);
break;
}
@ -1238,7 +1235,6 @@ nsresult nsHTMLEditor::InsertObject(const char* aType, nsISupports* aObject, boo
}
if (0 == nsCRT::strcmp(type, kJPEGImageMime) ||
0 == nsCRT::strcmp(type, kJPGImageMime) ||
0 == nsCRT::strcmp(type, kPNGImageMime) ||
0 == nsCRT::strcmp(type, kGIFImageMime) ||
insertAsImage)
@ -1308,7 +1304,6 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
if (0 == nsCRT::strcmp(bestFlavor, kFileMime) ||
0 == nsCRT::strcmp(bestFlavor, kJPEGImageMime) ||
0 == nsCRT::strcmp(bestFlavor, kJPGImageMime) ||
0 == nsCRT::strcmp(bestFlavor, kPNGImageMime) ||
0 == nsCRT::strcmp(bestFlavor, kGIFImageMime)) {
rv = InsertObject(bestFlavor, genericDataObj, isSafe,
@ -1408,7 +1403,6 @@ nsresult nsHTMLEditor::InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
if (!isText) {
if (type.EqualsLiteral(kFileMime) ||
type.EqualsLiteral(kJPEGImageMime) ||
type.EqualsLiteral(kJPGImageMime) ||
type.EqualsLiteral(kPNGImageMime) ||
type.EqualsLiteral(kGIFImageMime)) {
nsCOMPtr<nsIVariant> variant;
@ -1630,8 +1624,8 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(PRInt32 aSelectionType)
static const char* textEditorFlavors[] = { kUnicodeMime };
static const char* textHtmlEditorFlavors[] = { kUnicodeMime, kHTMLMime,
kJPEGImageMime, kJPGImageMime,
kPNGImageMime, kGIFImageMime };
kJPEGImageMime, kPNGImageMime,
kGIFImageMime };
NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, bool *aCanPaste)
{

View File

@ -165,7 +165,6 @@ nsClipboard::TransferableFromPasteboard(nsITransferable *aTransferable, NSPasteb
break;
}
else if (flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime) ||
flavorStr.EqualsLiteral(kPNGImageMime) ||
flavorStr.EqualsLiteral(kGIFImageMime)) {
// Figure out if there's data on the pasteboard we can grab (sanity check)
@ -180,8 +179,7 @@ nsClipboard::TransferableFromPasteboard(nsITransferable *aTransferable, NSPasteb
// Figure out what type we're converting to
CFStringRef outputType = NULL;
if (flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime))
if (flavorStr.EqualsLiteral(kJPEGImageMime))
outputType = CFSTR("public.jpeg");
else if (flavorStr.EqualsLiteral(kPNGImageMime))
outputType = CFSTR("public.png");
@ -341,7 +339,6 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
break;
}
} else if (!strcmp(aFlavorList[i], kJPEGImageMime) ||
!strcmp(aFlavorList[i], kJPGImageMime) ||
!strcmp(aFlavorList[i], kPNGImageMime) ||
!strcmp(aFlavorList[i], kGIFImageMime)) {
NSString* availableType = [generalPBoard availableTypeFromArray:
@ -413,8 +410,7 @@ nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable)
nsMemory::Free(data);
}
else if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kGIFImageMime) ||
flavorStr.EqualsLiteral(kNativeImageMime)) {
flavorStr.EqualsLiteral(kGIFImageMime) || flavorStr.EqualsLiteral(kNativeImageMime)) {
PRUint32 dataSize = 0;
nsCOMPtr<nsISupports> transferSupports;
aTransferable->GetTransferData(flavorStr, getter_AddRefs(transferSupports), &dataSize);

View File

@ -426,7 +426,7 @@ nsDragService::GetData(nsITransferable* aTransferable, PRUint32 aItemIndex)
// in is accomplished with a file path drag instead of the image data itself.
/*
if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kGIFImageMime)) {
flavorStr.EqualsLiteral(kGIFImageMime)) {
}
*/

View File

@ -207,7 +207,6 @@ nsClipboard::SetData(nsITransferable *aTransferable,
if (flavorStr.EqualsLiteral(kNativeImageMime) ||
flavorStr.EqualsLiteral(kPNGImageMime) ||
flavorStr.EqualsLiteral(kJPEGImageMime) ||
flavorStr.EqualsLiteral(kJPGImageMime) ||
flavorStr.EqualsLiteral(kGIFImageMime)) {
// don't bother adding image targets twice
if (!imagesAdded) {
@ -315,16 +314,12 @@ nsClipboard::GetData(nsITransferable *aTransferable, PRInt32 aWhichClipboard)
// For images, we must wrap the data in an nsIInputStream then return instead of break,
// because that code below won't help us.
if (!strcmp(flavorStr, kJPEGImageMime) ||
!strcmp(flavorStr, kJPGImageMime) ||
!strcmp(flavorStr, kPNGImageMime) ||
!strcmp(flavorStr, kGIFImageMime)) {
// Emulate support for image/jpg
if (!strcmp(flavorStr, kJPGImageMime)) {
flavorStr.Assign(kJPEGImageMime);
}
GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
if (!strcmp(flavorStr, kJPEGImageMime) || !strcmp(flavorStr, kPNGImageMime) || !strcmp(flavorStr, kGIFImageMime)) {
GdkAtom atom;
if (!strcmp(flavorStr, kJPEGImageMime)) // This is image/jpg, but X only understands image/jpeg
atom = gdk_atom_intern("image/jpeg", FALSE);
else
atom = gdk_atom_intern(flavorStr, FALSE);
GtkSelectionData *selectionData = wait_for_contents(clipboard, atom);
if (!selectionData)
@ -446,9 +441,8 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
if (!strcmp(atom_name, aFlavorList[i]))
*_retval = true;
// X clipboard supports image/jpeg, but we want to emulate support
// for image/jpg as well
if (!strcmp(aFlavorList[i], kJPGImageMime) && !strcmp(atom_name, kJPEGImageMime))
// X clipboard wants image/jpeg, not image/jpg
if (!strcmp(aFlavorList[i], kJPEGImageMime) && !strcmp(atom_name, "image/jpeg"))
*_retval = true;
g_free(atom_name);
@ -570,7 +564,7 @@ nsClipboard::SelectionGetEvent(GtkClipboard *aClipboard,
if (gtk_targets_include_image(&aSelectionData->target, 1, TRUE)) {
// Look through our transfer data for the image
static const char* const imageMimeTypes[] = {
kNativeImageMime, kPNGImageMime, kJPEGImageMime, kJPGImageMime, kGIFImageMime };
kNativeImageMime, kPNGImageMime, kJPEGImageMime, kGIFImageMime };
nsCOMPtr<nsISupports> item;
PRUint32 len;
nsCOMPtr<nsISupportsInterfacePointer> ptrPrimitive;

View File

@ -19,8 +19,7 @@
#define kHTMLMime "text/html"
#define kAOLMailMime "AOLMAIL"
#define kPNGImageMime "image/png"
#define kJPEGImageMime "image/jpeg"
#define kJPGImageMime "image/jpg"
#define kJPEGImageMime "image/jpg"
#define kGIFImageMime "image/gif"
#define kFileMime "application/x-moz-file"

View File

@ -34,7 +34,6 @@ nsClipboard::nsClipboard() : nsBaseClipboard()
RegisterClipboardFormat(kAOLMailMime);
RegisterClipboardFormat(kPNGImageMime);
RegisterClipboardFormat(kJPEGImageMime);
RegisterClipboardFormat(kJPGImageMime);
RegisterClipboardFormat(kGIFImageMime);
RegisterClipboardFormat(kFileMime);
RegisterClipboardFormat(kURLMime);
@ -139,7 +138,7 @@ bool nsClipboard::GetClipboardDataByID(PRUint32 aFormatID, const char *aFlavor)
{
if (aFormatID == CF_BITMAP)
{
if (!strcmp( aFlavor, kJPEGImageMime ) || !strcmp( aFlavor, kJPGImageMime ))
if (!strcmp( aFlavor, kJPEGImageMime ))
{
// OS2TODO Convert bitmap to jpg
#ifdef DEBUG

View File

@ -153,13 +153,12 @@ nsClipboard::SetNativeClipboardData( nsITransferable *aTransferable,
&& (!strcmp(flavorStr.get(), kNativeImageMime)
|| !strcmp(flavorStr.get(), kPNGImageMime)
|| !strcmp(flavorStr.get(), kJPEGImageMime)
|| !strcmp(flavorStr.get(), kJPGImageMime)
|| !strcmp(flavorStr.get(), kGIFImageMime))
)
{
// Look through our transfer data for the image
static const char* const imageMimeTypes[] = {
kNativeImageMime, kPNGImageMime, kJPEGImageMime, kJPGImageMime, kGIFImageMime };
kNativeImageMime, kPNGImageMime, kJPEGImageMime, kGIFImageMime };
nsCOMPtr<nsISupportsInterfacePointer> ptrPrimitive;
for (PRUint32 i = 0; !ptrPrimitive && i < ArrayLength(imageMimeTypes); i++)
{
@ -324,7 +323,6 @@ nsClipboard::GetNativeClipboardData(nsITransferable *aTransferable,
// Image?
if (( !strcmp(flavorStr.get(), kJPEGImageMime)
|| !strcmp(flavorStr.get(), kJPGImageMime)
|| !strcmp(flavorStr.get(), kPNGImageMime)
|| !strcmp(flavorStr.get(), kGIFImageMime))
&& mimeData->hasImage())
@ -336,7 +334,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable *aTransferable,
// Lets set the image format
QByteArray imageFormat;
if (!strcmp(flavorStr.get(), kJPEGImageMime) || !strcmp(flavorStr.get(), kJPGImageMime)
if (!strcmp(flavorStr.get(), kJPEGImageMime))
imageFormat = "jpeg";
else if (!strcmp(flavorStr.get(), kPNGImageMime))
imageFormat = "png";

View File

@ -84,7 +84,6 @@ function runTests(aCBSvc)
{
runImageClipboardTests(aCBSvc, "image/png");
runImageClipboardTests(aCBSvc, "image/jpg");
runImageClipboardTests(aCBSvc, "image/jpeg");
SimpleTest.finish();
}

View File

@ -76,10 +76,9 @@ UINT nsClipboard::GetFormat(const char* aMimeStr)
else if (strcmp(aMimeStr, kUnicodeMime) == 0)
format = CF_UNICODETEXT;
else if (strcmp(aMimeStr, kJPEGImageMime) == 0 ||
strcmp(aMimeStr, kJPGImageMime) == 0 ||
strcmp(aMimeStr, kPNGImageMime) == 0)
format = CF_DIB;
else if (strcmp(aMimeStr, kFileMime) == 0 ||
else if (strcmp(aMimeStr, kFileMime) == 0 ||
strcmp(aMimeStr, kFilePromiseMime) == 0)
format = CF_HDROP;
else if (strcmp(aMimeStr, kNativeHTMLMime) == 0)
@ -187,8 +186,7 @@ nsresult nsClipboard::SetupNativeDataObject(nsITransferable * aTransferable, IDa
dObj->AddDataFlavor(kURLMime, &shortcutFE);
}
else if ( strcmp(flavorStr, kPNGImageMime) == 0 || strcmp(flavorStr, kJPEGImageMime) == 0 ||
strcmp(flavorStr, kJPGImageMime) == 0 || strcmp(flavorStr, kGIFImageMime) == 0 ||
strcmp(flavorStr, kNativeImageMime) == 0 ) {
strcmp(flavorStr, kGIFImageMime) == 0 || strcmp(flavorStr, kNativeImageMime) == 0 ) {
// if we're an image, register the native bitmap flavor
FORMATETC imageFE;
SET_FORMATETC(imageFE, CF_DIB, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
@ -627,7 +625,6 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject,
nsMemory::Free(data);
}
else if ( strcmp(flavorStr, kJPEGImageMime) == 0 ||
strcmp(flavorStr, kJPGImageMime) == 0 ||
strcmp(flavorStr, kPNGImageMime) == 0) {
nsIInputStream * imageStream = reinterpret_cast<nsIInputStream*>(data);
genericDataWrapper = do_QueryInterface(imageStream);

View File

@ -201,7 +201,7 @@ nsImageFromClipboard ::GetEncodedImageStream (unsigned char * aClipboardData, co
nsCAutoString encoderCID(NS_LITERAL_CSTRING("@mozilla.org/image/encoder;2?type="));
// Map image/jpg to image/jpeg (which is how the encoder is registered).
if (strcmp(aMIMEFormat, kJPGImageMime) == 0)
if (strcmp(aMIMEFormat, kJPEGImageMime) == 0)
encoderCID.Append("image/jpeg");
else
encoderCID.Append(aMIMEFormat);