Bug 609284 - Support drag and drop local files from sources which use text/uri-list. r=enn
authorJan Horak <jhorak@redhat.com>
Mon, 01 Jul 2013 11:24:42 -0400
changeset 137031 357ca015db90
parent 137030 0ec0cda67e41
child 137032 31f741b111e0
push id30353
push userryanvm@gmail.com
push date2013-07-01 15:30 +0000
treeherdermozilla-inbound@357ca015db90 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs609284
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 609284 - Support drag and drop local files from sources which use text/uri-list. r=enn
widget/gtk2/nsDragService.cpp
--- a/widget/gtk2/nsDragService.cpp
+++ b/widget/gtk2/nsDragService.cpp
@@ -713,16 +713,20 @@ nsDragService::GetData(nsITransferable *
             else {
                 PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = false\n"));
 
                 // Dragging and dropping from the file manager would cause us 
                 // to parse the source text as a nsIFile URL.
                 if ( strcmp(flavorStr, kFileMime) == 0 ) {
                     gdkFlavor = gdk_atom_intern(kTextMime, FALSE);
                     GetTargetDragData(gdkFlavor);
+                    if (!mTargetDragData) {
+                        gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE);
+                        GetTargetDragData(gdkFlavor);
+                    }
                     if (mTargetDragData) {
                         const char* text = static_cast<char*>(mTargetDragData);
                         PRUnichar* convertedText = nullptr;
                         int32_t convertedTextLen = 0;
 
                         GetTextUriListItem(text, mTargetDragDataLen, aItemIndex,
                                            &convertedText, &convertedTextLen);
 
@@ -992,17 +996,18 @@ nsDragService::IsDataFlavorSupported(con
         if (name && (strcmp(name, aDataFlavor) == 0)) {
             PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n"));
             *_retval = true;
         }
         // check for automatic text/uri-list -> text/x-moz-url mapping
         if (!*_retval && 
             name &&
             (strcmp(name, gTextUriListType) == 0) &&
-            (strcmp(aDataFlavor, kURLMime) == 0)) {
+            (strcmp(aDataFlavor, kURLMime) == 0 ||
+             strcmp(aDataFlavor, kFileMime) == 0)) {
             PR_LOG(sDragLm, PR_LOG_DEBUG,
                    ("good! ( it's text/uri-list and \
                    we're checking against text/x-moz-url )\n"));
             *_retval = true;
         }
         // check for automatic _NETSCAPE_URL -> text/x-moz-url mapping
         if (!*_retval && 
             name &&