зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689992: part 0) Factor `nsClipboard::IsImageType` out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D105277
This commit is contained in:
Родитель
2d8d6edee2
Коммит
373e080995
|
@ -34,6 +34,7 @@ class nsClipboard : public nsIClipboard {
|
|||
static NSDictionary* PasteboardDictFromTransferable(nsITransferable* aTransferable);
|
||||
// aPasteboardType is being retained and needs to be released by the caller.
|
||||
static bool IsStringType(const nsCString& aMIMEType, NSString** aPasteboardType);
|
||||
static bool IsImageType(const nsACString& aMIMEType);
|
||||
static NSString* WrapHtmlForSystemPasteboard(NSString* aString);
|
||||
static nsresult TransferableFromPasteboard(nsITransferable* aTransferable, NSPasteboard* pboard);
|
||||
|
||||
|
|
|
@ -505,9 +505,7 @@ NSDictionary* nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTran
|
|||
}
|
||||
[pasteboardOutputDict setObject:nativeData forKey:customType];
|
||||
}
|
||||
} else if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
|
||||
flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kGIFImageMime) ||
|
||||
flavorStr.EqualsLiteral(kNativeImageMime)) {
|
||||
} else if (nsClipboard::IsImageType(flavorStr)) {
|
||||
nsCOMPtr<nsISupports> transferSupports;
|
||||
rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(transferSupports));
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -656,6 +654,13 @@ bool nsClipboard::IsStringType(const nsCString& aMIMEType, NSString** aPasteboar
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
bool nsClipboard::IsImageType(const nsACString& aMIMEType) {
|
||||
return aMIMEType.EqualsLiteral(kPNGImageMime) || aMIMEType.EqualsLiteral(kJPEGImageMime) ||
|
||||
aMIMEType.EqualsLiteral(kJPGImageMime) || aMIMEType.EqualsLiteral(kGIFImageMime) ||
|
||||
aMIMEType.EqualsLiteral(kNativeImageMime);
|
||||
}
|
||||
|
||||
NSString* nsClipboard::WrapHtmlForSystemPasteboard(NSString* aString) {
|
||||
NSString* wrapped = [NSString
|
||||
stringWithFormat:@"<html>"
|
||||
|
|
Загрузка…
Ссылка в новой задаче