[chromium] Fix image drag out on Chromium
authordcheng@chromium.org <dcheng@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 00:47:28 +0000 (00:47 +0000)
committerdcheng@chromium.org <dcheng@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 00:47:28 +0000 (00:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79158

Reviewed by Tony Chang.

Source/WebKit/chromium:

We constructed the WebDragData::Item for dragging out an image but never added it to the
item list. This is normally covered by the fast/events/drag-image-filename.html layout test,
but the bug wasn't caught in the original patch since the implementations in Chrome and DRT
had diverged.

* src/WebDragData.cpp:
(WebKit::WebDragData::items):

Tools:

* DumpRenderTree/chromium/EventSender.cpp:
(EventSender::dumpFilenameBeingDragged):
(EventSender::beginDragWithFiles):
* DumpRenderTree/chromium/WebViewHost.cpp:
(addDRTFakeFileToDataObject):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108419 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebDragData.cpp
Tools/ChangeLog
Tools/DumpRenderTree/chromium/EventSender.cpp
Tools/DumpRenderTree/chromium/WebViewHost.cpp

index 7c1c940..800d0f0 100644 (file)
@@ -1,3 +1,18 @@
+2012-02-21  Daniel Cheng  <dcheng@chromium.org>
+
+        [chromium] Fix image drag out on Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=79158
+
+        Reviewed by Tony Chang.
+
+        We constructed the WebDragData::Item for dragging out an image but never added it to the
+        item list. This is normally covered by the fast/events/drag-image-filename.html layout test,
+        but the bug wasn't caught in the original patch since the implementations in Chrome and DRT
+        had diverged.
+
+        * src/WebDragData.cpp:
+        (WebKit::WebDragData::items):
+
 2012-02-21  David Grogan  <dgrogan@chromium.org>
 
         IndexedDB: webFrame isn't threadsafe, don't use it from a worker thread
index 5b8bfc4..378879a 100644 (file)
@@ -117,6 +117,7 @@ WebVector<WebDragData::Item> WebDragData::items() const
         item.storageType = Item::StorageTypeBinaryData;
         item.binaryData = m_private->fileContent();
         item.title = m_private->fileContentFilename();
+        itemList.append(item);
     }
     // We don't handle filenames here, since they are never used for dragging out.
     return itemList;
index 99a9d12..9787ac6 100644 (file)
@@ -1,3 +1,16 @@
+2012-02-21  Daniel Cheng  <dcheng@chromium.org>
+
+        [chromium] Fix image drag out on Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=79158
+
+        Reviewed by Tony Chang.
+
+        * DumpRenderTree/chromium/EventSender.cpp:
+        (EventSender::dumpFilenameBeingDragged):
+        (EventSender::beginDragWithFiles):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (addDRTFakeFileToDataObject):
+
 2012-02-21  Dirk Pranke  <dpranke@chromium.org>
 
         webkitpy: speed up hot filesystem_mock functions
index 9acc42d..cc73b2d 100644 (file)
@@ -354,7 +354,15 @@ void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask
 
 void EventSender::dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*)
 {
-    printf("Filename being dragged: %s\n", currentDragData.fileContentFilename().utf8().data());
+    WebString filename;
+    WebVector<WebDragData::Item> items = currentDragData.items();
+    for (size_t i = 0; i < items.size(); ++i) {
+        if (items[i].storageType == WebDragData::Item::StorageTypeBinaryData) {
+            filename = items[i].title;
+            break;
+        }
+    }
+    printf("Filename being dragged: %s\n", filename.utf8().data());
 }
 
 WebMouseEvent::Button EventSender::getButtonTypeFromButtonNumber(int buttonCode)
@@ -869,8 +877,12 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian
 {
     currentDragData.initialize();
     Vector<string> files = arguments[0].toStringVector();
-    for (size_t i = 0; i < files.size(); ++i)
-        currentDragData.appendToFilenames(webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i]));
+    for (size_t i = 0; i < files.size(); ++i) {
+        WebDragData::Item item;
+        item.storageType = WebDragData::Item::StorageTypeFilename;
+        item.filenameData = webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i]);
+        currentDragData.addItem(item);
+    }
     currentDragEffectsAllowed = WebKit::WebDragOperationCopy;
 
     // Provide a drag source.
index 0e4c83d..9220391 100644 (file)
@@ -137,7 +137,10 @@ static string descriptionSuitableForTestResult(const string& url)
 // dragging a file.
 static void addDRTFakeFileToDataObject(WebDragData* dragData)
 {
-    dragData->appendToFilenames(WebString::fromUTF8("DRTFakeFile"));
+    WebDragData::Item item;
+    item.storageType = WebDragData::Item::StorageTypeFilename;
+    item.filenameData = WebString::fromUTF8("DRTFakeFile");
+    dragData->addItem(item);
 }
 
 // Get a debugging string from a WebNavigationType.