зеркало из https://github.com/mozilla/pjs.git
fix a d&d bug introduced in the transferable interface merging and add a SetCanDrop at the point of the drop for MacOS.
This commit is contained in:
Родитель
d39a38bda4
Коммит
1ce155f6fa
|
@ -1093,15 +1093,13 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
|
||||||
rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull,
|
rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull,
|
||||||
nsITransferable::GetIID(),
|
nsITransferable::GetIID(),
|
||||||
(void**) getter_AddRefs(trans));
|
(void**) getter_AddRefs(trans));
|
||||||
if (NS_OK == rv) {
|
if ( NS_SUCCEEDED(rv) && trans ) {
|
||||||
// Add the text Flavor to the transferable,
|
// Add the text Flavor to the transferable,
|
||||||
// because that is the only type of data we are looking for at the moment
|
// because that is the only type of data we are looking for at the moment
|
||||||
nsAutoString textMime(kTextMime);
|
nsAutoString textMime(kTextMime);
|
||||||
trans->AddDataFlavor(&textMime);
|
trans->AddDataFlavor(&textMime);
|
||||||
//genericTrans->AddDataFlavor(mImageDataFlavor);
|
//genericTrans->AddDataFlavor(mImageDataFlavor);
|
||||||
|
|
||||||
// Query to get the standard interface that the drag service knows about
|
|
||||||
nsCOMPtr<nsITransferable> trans (do_QueryInterface(trans));
|
|
||||||
if (trans) {
|
if (trans) {
|
||||||
|
|
||||||
// Fill the transferable with our requested data flavor
|
// Fill the transferable with our requested data flavor
|
||||||
|
@ -1117,6 +1115,7 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
|
||||||
if (str) {
|
if (str) {
|
||||||
stuffToPaste.SetString(str, len);
|
stuffToPaste.SetString(str, len);
|
||||||
mEditor->InsertText(stuffToPaste);
|
mEditor->InsertText(stuffToPaste);
|
||||||
|
dragSession->SetCanDrop(PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX This is where image support might go
|
// XXX This is where image support might go
|
||||||
|
|
|
@ -1093,15 +1093,13 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
|
||||||
rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull,
|
rv = nsComponentManager::CreateInstance(kCTransferableCID, nsnull,
|
||||||
nsITransferable::GetIID(),
|
nsITransferable::GetIID(),
|
||||||
(void**) getter_AddRefs(trans));
|
(void**) getter_AddRefs(trans));
|
||||||
if (NS_OK == rv) {
|
if ( NS_SUCCEEDED(rv) && trans ) {
|
||||||
// Add the text Flavor to the transferable,
|
// Add the text Flavor to the transferable,
|
||||||
// because that is the only type of data we are looking for at the moment
|
// because that is the only type of data we are looking for at the moment
|
||||||
nsAutoString textMime(kTextMime);
|
nsAutoString textMime(kTextMime);
|
||||||
trans->AddDataFlavor(&textMime);
|
trans->AddDataFlavor(&textMime);
|
||||||
//genericTrans->AddDataFlavor(mImageDataFlavor);
|
//genericTrans->AddDataFlavor(mImageDataFlavor);
|
||||||
|
|
||||||
// Query to get the standard interface that the drag service knows about
|
|
||||||
nsCOMPtr<nsITransferable> trans (do_QueryInterface(trans));
|
|
||||||
if (trans) {
|
if (trans) {
|
||||||
|
|
||||||
// Fill the transferable with our requested data flavor
|
// Fill the transferable with our requested data flavor
|
||||||
|
@ -1117,6 +1115,7 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
|
||||||
if (str) {
|
if (str) {
|
||||||
stuffToPaste.SetString(str, len);
|
stuffToPaste.SetString(str, len);
|
||||||
mEditor->InsertText(stuffToPaste);
|
mEditor->InsertText(stuffToPaste);
|
||||||
|
dragSession->SetCanDrop(PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX This is where image support might go
|
// XXX This is where image support might go
|
||||||
|
|
Загрузка…
Ссылка в новой задаче