зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1254980 - Ensure that text/html is still written to the clipboard. r=enndeakin
This commit is contained in:
Родитель
9b4df5f594
Коммит
f372a0eb94
|
@ -88,7 +88,7 @@ nsClipboard::Observe(nsISupports *aSubject, const char *aTopic,
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
UINT nsClipboard::GetFormat(const char* aMimeStr)
|
||||
UINT nsClipboard::GetFormat(const char* aMimeStr, bool aMapHTMLMime)
|
||||
{
|
||||
UINT format;
|
||||
|
||||
|
@ -106,7 +106,7 @@ UINT nsClipboard::GetFormat(const char* aMimeStr)
|
|||
strcmp(aMimeStr, kFilePromiseMime) == 0)
|
||||
format = CF_HDROP;
|
||||
else if (strcmp(aMimeStr, kNativeHTMLMime) == 0 ||
|
||||
strcmp(aMimeStr, kHTMLMime) == 0)
|
||||
aMapHTMLMime && strcmp(aMimeStr, kHTMLMime) == 0)
|
||||
format = CF_HTML;
|
||||
else
|
||||
format = ::RegisterClipboardFormatW(NS_ConvertASCIItoUTF16(aMimeStr).get());
|
||||
|
@ -169,7 +169,9 @@ nsresult nsClipboard::SetupNativeDataObject(nsITransferable * aTransferable, IDa
|
|||
if ( currentFlavor ) {
|
||||
nsXPIDLCString flavorStr;
|
||||
currentFlavor->ToString(getter_Copies(flavorStr));
|
||||
UINT format = GetFormat(flavorStr);
|
||||
// When putting data onto the clipboard, we want to maintain kHTMLMime
|
||||
// ("text/html") and not map it to CF_HTML here since this will be done below.
|
||||
UINT format = GetFormat(flavorStr, false);
|
||||
|
||||
// Now tell the native IDataObject about both our mime type and
|
||||
// the native data format
|
||||
|
|
|
@ -51,7 +51,13 @@ public:
|
|||
static nsresult GetNativeDataOffClipboard(nsIWidget * aWindow, UINT aIndex, UINT aFormat, void ** aData, uint32_t * aLen);
|
||||
static nsresult GetNativeDataOffClipboard(IDataObject * aDataObject, UINT aIndex, UINT aFormat, const char * aMIMEImageFormat, void ** aData, uint32_t * aLen);
|
||||
static nsresult GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLen);
|
||||
static UINT GetFormat(const char* aMimeStr);
|
||||
|
||||
// This function returns the internal Windows clipboard format identifier
|
||||
// for a given Mime string. The default is to map kHTMLMime ("text/html")
|
||||
// to the clipboard format CF_HTML ("HTLM Format"), but it can also be
|
||||
// registered as clipboard format "text/html" to support previous versions
|
||||
// of Gecko.
|
||||
static UINT GetFormat(const char* aMimeStr, bool aMapHTMLMime = true);
|
||||
|
||||
static UINT CF_HTML;
|
||||
|
||||
|
|
|
@ -541,14 +541,6 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, bool *_retval)
|
|||
if (mDataObject->QueryGetData(&fe) == S_OK)
|
||||
*_retval = true; // found it!
|
||||
}
|
||||
else if (strcmp(aDataFlavor, kHTMLMime) == 0) {
|
||||
// If the client wants html, maybe it's in "HTML Format".
|
||||
format = nsClipboard::GetFormat(kHTMLMime);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1,
|
||||
TYMED_HGLOBAL);
|
||||
if (mDataObject->QueryGetData(&fe) == S_OK)
|
||||
*_retval = true; // found it!
|
||||
}
|
||||
} // else try again
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче