Title: [106301] trunk
Revision
106301
Author
[email protected]
Date
2012-01-30 16:35:42 -0800 (Mon, 30 Jan 2012)

Log Message

single-file input elements should refuse multi-file drags
https://bugs.webkit.org/show_bug.cgi?id=25913

Patch by Rakesh KN <[email protected]> on 2012-01-30
Reviewed by Eric Seidel.

Refuse the multiple file drags onto a single file input element.

Source/WebCore:

No new tests: Covered by existing tests, updated the expected results.

* page/DragController.cpp:
(WebCore::DragController::tryDocumentDrag):
Setting the dragSession.numberOfItemsToBeAccepted to 0 so that drag operation is none if the
file input element under mouse is single input type and number of files dragged onto that
input element are more than 1.

LayoutTests:

* editing/pasteboard/file-input-files-access-expected.txt:
Expected result changed.
* editing/pasteboard/script-tests/file-input-files-access.js:
(runTest):
Removed the 'FIXME' debug and comment as it is not valid after this change.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106300 => 106301)


--- trunk/LayoutTests/ChangeLog	2012-01-31 00:29:02 UTC (rev 106300)
+++ trunk/LayoutTests/ChangeLog	2012-01-31 00:35:42 UTC (rev 106301)
@@ -1,3 +1,18 @@
+2012-01-30  Rakesh KN  <[email protected]>
+
+        single-file input elements should refuse multi-file drags
+        https://bugs.webkit.org/show_bug.cgi?id=25913
+
+        Reviewed by Eric Seidel.
+
+        Refuse the multiple file drags onto a single file input element.
+
+        * editing/pasteboard/file-input-files-access-expected.txt:
+        Expected result changed.
+        * editing/pasteboard/script-tests/file-input-files-access.js:
+        (runTest):
+        Removed the 'FIXME' debug and comment as it is not valid after this change.
+
 2012-01-30  Dana Jansens  <[email protected]>
 
         [chromium] Use region reported painted opaque for draw culling

Modified: trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt (106300 => 106301)


--- trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt	2012-01-31 00:29:02 UTC (rev 106300)
+++ trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt	2012-01-31 00:35:42 UTC (rev 106301)
@@ -22,17 +22,16 @@
 Dragging a directory onto an file input control:
 FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
 FAIL fileInput.files.length should be 0. Was 1.
-FIXME: Single-file input elements should refuse multi-file drags.  See https://bugs.webkit.org/show_bug.cgi?id=25913
 Dragging two files to a single-file input control:
-FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
-FAIL fileInput.files.length should be 0. Was 1.
+PASS fileInput.value is ""
+PASS fileInput.files.length is 0
 Dragging a file and a directory onto a single-file input control:
-FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
-FAIL fileInput.files.length should be 0. Was 1.
+PASS fileInput.value is ""
+PASS fileInput.files.length is 0
 FIXME:  elements should refuse drags including directories: https://bugs.webkit.org/show_bug.cgi?id=25879.  The page is given File objects corresponding to directories, but form submission will fail.
 Dragging a directory and a file onto a single-file input control:
-FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
-FAIL fileInput.files.length should be 0. Was 1.
+PASS fileInput.value is ""
+PASS fileInput.files.length is 0
 Dragging three files to a multi-file input control:
 PASS fileInput.value is "C:\\fakepath\\apple.gif"
 PASS fileInput.files.length is 3

Modified: trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js (106300 => 106301)


--- trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js	2012-01-31 00:29:02 UTC (rev 106300)
+++ trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js	2012-01-31 00:35:42 UTC (rev 106301)
@@ -89,9 +89,6 @@
     debug("Dragging a directory onto an file input control:");
     draggingPathsShouldResultInFiles(['resources/directory-for-dragging'], []);
 
-    // FIXME: Current behavior is to take the first file, but I expect that's
-    // confusing to the user.  We should change this to expect drag failure.
-    debug("FIXME: Single-file input elements should refuse multi-file drags.  See https://bugs.webkit.org/show_bug.cgi?id=25913")
     debug("Dragging two files to a single-file input control:")
     draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/mozilla.gif'], []);
 

Modified: trunk/Source/WebCore/ChangeLog (106300 => 106301)


--- trunk/Source/WebCore/ChangeLog	2012-01-31 00:29:02 UTC (rev 106300)
+++ trunk/Source/WebCore/ChangeLog	2012-01-31 00:35:42 UTC (rev 106301)
@@ -1,3 +1,20 @@
+2012-01-30  Rakesh KN  <[email protected]>
+
+        single-file input elements should refuse multi-file drags
+        https://bugs.webkit.org/show_bug.cgi?id=25913
+
+        Reviewed by Eric Seidel.
+
+        Refuse the multiple file drags onto a single file input element.
+
+        No new tests: Covered by existing tests, updated the expected results.
+
+        * page/DragController.cpp:
+        (WebCore::DragController::tryDocumentDrag):
+        Setting the dragSession.numberOfItemsToBeAccepted to 0 so that drag operation is none if the
+        file input element under mouse is single input type and number of files dragged onto that
+        input element are more than 1.
+
 2012-01-30  Dana Jansens  <[email protected]>
 
         [chromium] Use region reported painted opaque for draw culling

Modified: trunk/Source/WebCore/page/DragController.cpp (106300 => 106301)


--- trunk/Source/WebCore/page/DragController.cpp	2012-01-31 00:29:02 UTC (rev 106300)
+++ trunk/Source/WebCore/page/DragController.cpp	2012-01-31 00:35:42 UTC (rev 106301)
@@ -359,6 +359,8 @@
                 dragSession.numberOfItemsToBeAccepted = 0;
             else if (m_fileInputElementUnderMouse->multiple())
                 dragSession.numberOfItemsToBeAccepted = numberOfFiles;
+            else if (numberOfFiles > 1)
+                dragSession.numberOfItemsToBeAccepted = 0;
             else
                 dragSession.numberOfItemsToBeAccepted = 1;
             
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to