Title: [121319] trunk
Revision
121319
Author
commit-qu...@webkit.org
Date
2012-06-26 21:22:47 -0700 (Tue, 26 Jun 2012)

Log Message

DragData::asFilenames should not push same file names to result in Windows.
https://bugs.webkit.org/show_bug.cgi?id=79861

Patch by Xueqing Huang <huangxueq...@baidu.com> on 2012-06-26
Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test: platform/win/fast/forms/file/drag-and-drop-files.html

* platform/win/DragDataWin.cpp:
(WebCore::DragData::asFilenames):

LayoutTests:

* platform/win/fast/forms/file/drag-and-drop-files-expected.txt: Added.
* platform/win/fast/forms/file/drag-and-drop-files.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121318 => 121319)


--- trunk/LayoutTests/ChangeLog	2012-06-27 04:03:04 UTC (rev 121318)
+++ trunk/LayoutTests/ChangeLog	2012-06-27 04:22:47 UTC (rev 121319)
@@ -1,3 +1,13 @@
+2012-06-26  Xueqing Huang  <huangxueq...@baidu.com>
+
+        DragData::asFilenames should not push same file names to result in Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=79861
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/win/fast/forms/file/drag-and-drop-files-expected.txt: Added.
+        * platform/win/fast/forms/file/drag-and-drop-files.html: Added.
+
 2012-06-26  Ryosuke Niwa  <rn...@webkit.org>
 
         Rebaseline after r121286 and r121290.

Added: trunk/LayoutTests/platform/win/fast/forms/file/drag-and-drop-files-expected.txt (0 => 121319)


--- trunk/LayoutTests/platform/win/fast/forms/file/drag-and-drop-files-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/forms/file/drag-and-drop-files-expected.txt	2012-06-27 04:22:47 UTC (rev 121319)
@@ -0,0 +1,12 @@
+Tests drag multi-files into <input type='file'>, and check the files name were correct.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fileInput.files[0].name is 'got-file-upload-0.html'
+PASS fileInput.files[1].name is 'got-file-upload-1.html'
+PASS fileInput.files[2].name is 'got-file-upload-2.html'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/win/fast/forms/file/drag-and-drop-files.html (0 => 121319)


--- trunk/LayoutTests/platform/win/fast/forms/file/drag-and-drop-files.html	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/forms/file/drag-and-drop-files.html	2012-06-27 04:22:47 UTC (rev 121319)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body>
+<input id="fileInput" type="file" multiple="true" _onchange_="displayFiles()"></input>
+<script src=""
+<script>
+description("Tests drag multi-files into &lt;input type='file'&gt;, and check the files name were correct.");
+
+if (window.eventSender) {
+    var inputElement = document.getElementById("fileInput"); 
+    var fileRect = inputElement.getClientRects()[0];
+    var targetX = fileRect.left + fileRect.width / 2;
+    var targetY = fileRect.top + fileRect.height / 2;
+    eventSender.beginDragWithFiles(['got-file-upload-0.html', 'got-file-upload-1.html', 'got-file-upload-2.html']);
+    eventSender.mouseMoveTo(targetX, targetY);
+    eventSender.mouseUp();
+}
+
+function displayFiles()
+{
+    var input = document.getElementById("fileInput");
+    shouldBe("fileInput.files[0].name", "'got-file-upload-0.html'");
+    shouldBe("fileInput.files[1].name", "'got-file-upload-1.html'");
+    shouldBe("fileInput.files[2].name", "'got-file-upload-2.html'");
+}
+</script>
+<script src=""
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (121318 => 121319)


--- trunk/Source/WebCore/ChangeLog	2012-06-27 04:03:04 UTC (rev 121318)
+++ trunk/Source/WebCore/ChangeLog	2012-06-27 04:22:47 UTC (rev 121319)
@@ -1,3 +1,15 @@
+2012-06-26  Xueqing Huang  <huangxueq...@baidu.com>
+
+        DragData::asFilenames should not push same file names to result in Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=79861
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test: platform/win/fast/forms/file/drag-and-drop-files.html 
+
+        * platform/win/DragDataWin.cpp:
+        (WebCore::DragData::asFilenames):
+
 2012-06-26  Geoffrey Garen  <gga...@apple.com>
 
         Reduced (but did not eliminate) use of "berzerker GC"

Modified: trunk/Source/WebCore/platform/win/DragDataWin.cpp (121318 => 121319)


--- trunk/Source/WebCore/platform/win/DragDataWin.cpp	2012-06-27 04:03:04 UTC (rev 121318)
+++ trunk/Source/WebCore/platform/win/DragDataWin.cpp	2012-06-27 04:22:47 UTC (rev 121319)
@@ -140,17 +140,17 @@
         STGMEDIUM medium;
         if (FAILED(m_platformDragData->GetData(cfHDropFormat(), &medium)))
             return;
+       
+        HDROP hdrop = reinterpret_cast<HDROP>(GlobalLock(medium.hGlobal)); 
         
-        HDROP hdrop = (HDROP)GlobalLock(medium.hGlobal);
-        
         if (!hdrop)
             return;
 
         const unsigned numFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, 0, 0);
         for (unsigned i = 0; i < numFiles; i++) {
-            if (!DragQueryFileW(hdrop, 0, filename, WTF_ARRAY_LENGTH(filename)))
+            if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
                 continue;
-            result.append((UChar*)filename);
+            result.append(static_cast<UChar*>(filename)); 
         }
 
         // Free up memory from drag
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to