Fix for bug 38716 & bug 38715. Do not kill the dragdrop event when is not a flavor supported by the editfield. R=brade

This commit is contained in:
ducarroz%netscape.com 2000-06-20 01:01:49 +00:00
Родитель 3e761a55a8
Коммит 140cfeb5f3
2 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -816,6 +816,26 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if ( htmlEditor )
{
nsresult rv;
NS_WITH_SERVICE(nsIDragService, dragService, "component://netscape/widget/dragservice", &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDragSession> dragSession(do_QueryInterface(dragService));
if (dragSession)
{
PRBool flavorSupported = PR_FALSE;
dragSession->IsDataFlavorSupported(kUnicodeMime, &flavorSupported);
if ( !flavorSupported )
dragSession->IsDataFlavorSupported(kHTMLMime, &flavorSupported);
if ( !flavorSupported )
dragSession->IsDataFlavorSupported(kFileMime, &flavorSupported);
if ( !flavorSupported )
dragSession->IsDataFlavorSupported(kJPEGImageMime, &flavorSupported);
if (! flavorSupported )
return NS_OK;
}
//some day we want to use another way to stop this from bubbling.
aMouseEvent->PreventBubble();
aMouseEvent->PreventDefault();

Просмотреть файл

@ -816,6 +816,26 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if ( htmlEditor )
{
nsresult rv;
NS_WITH_SERVICE(nsIDragService, dragService, "component://netscape/widget/dragservice", &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDragSession> dragSession(do_QueryInterface(dragService));
if (dragSession)
{
PRBool flavorSupported = PR_FALSE;
dragSession->IsDataFlavorSupported(kUnicodeMime, &flavorSupported);
if ( !flavorSupported )
dragSession->IsDataFlavorSupported(kHTMLMime, &flavorSupported);
if ( !flavorSupported )
dragSession->IsDataFlavorSupported(kFileMime, &flavorSupported);
if ( !flavorSupported )
dragSession->IsDataFlavorSupported(kJPEGImageMime, &flavorSupported);
if (! flavorSupported )
return NS_OK;
}
//some day we want to use another way to stop this from bubbling.
aMouseEvent->PreventBubble();
aMouseEvent->PreventDefault();