From 1ce155f6fab624b8770f32c3b94f2e38b1752073 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Fri, 14 May 1999 18:44:28 +0000 Subject: [PATCH] fix a d&d bug introduced in the transferable interface merging and add a SetCanDrop at the point of the drop for MacOS. --- editor/base/nsEditorEventListeners.cpp | 5 ++--- editor/libeditor/text/nsEditorEventListeners.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/editor/base/nsEditorEventListeners.cpp b/editor/base/nsEditorEventListeners.cpp index f24b0583dcd..767f055cac4 100644 --- a/editor/base/nsEditorEventListeners.cpp +++ b/editor/base/nsEditorEventListeners.cpp @@ -1093,15 +1093,13 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent) rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull, nsITransferable::GetIID(), (void**) getter_AddRefs(trans)); - if (NS_OK == rv) { + if ( NS_SUCCEEDED(rv) && trans ) { // Add the text Flavor to the transferable, // because that is the only type of data we are looking for at the moment nsAutoString textMime(kTextMime); trans->AddDataFlavor(&textMime); //genericTrans->AddDataFlavor(mImageDataFlavor); - // Query to get the standard interface that the drag service knows about - nsCOMPtr trans (do_QueryInterface(trans)); if (trans) { // Fill the transferable with our requested data flavor @@ -1117,6 +1115,7 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent) if (str) { stuffToPaste.SetString(str, len); mEditor->InsertText(stuffToPaste); + dragSession->SetCanDrop(PR_TRUE); } // XXX This is where image support might go diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp index f24b0583dcd..767f055cac4 100644 --- a/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/editor/libeditor/text/nsEditorEventListeners.cpp @@ -1093,15 +1093,13 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent) rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull, nsITransferable::GetIID(), (void**) getter_AddRefs(trans)); - if (NS_OK == rv) { + if ( NS_SUCCEEDED(rv) && trans ) { // Add the text Flavor to the transferable, // because that is the only type of data we are looking for at the moment nsAutoString textMime(kTextMime); trans->AddDataFlavor(&textMime); //genericTrans->AddDataFlavor(mImageDataFlavor); - // Query to get the standard interface that the drag service knows about - nsCOMPtr trans (do_QueryInterface(trans)); if (trans) { // Fill the transferable with our requested data flavor @@ -1117,6 +1115,7 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent) if (str) { stuffToPaste.SetString(str, len); mEditor->InsertText(stuffToPaste); + dragSession->SetCanDrop(PR_TRUE); } // XXX This is where image support might go