single-file input elements should refuse multi-file drags

https://bugs.webkit.org/show_bug.cgi?id=25913

Patch by Rakesh KN <rakesh.kn@motorola.com> 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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 429f925f
2012-01-30 Rakesh KN <rakesh.kn@motorola.com>
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 <danakj@chromium.org>
[chromium] Use region reported painted opaque for draw culling
......@@ -22,17 +22,16 @@ PASS fileInput.files[0].fileSize is 1476
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
......
......@@ -89,9 +89,6 @@ function runTest()
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'], []);
......
2012-01-30 Rakesh KN <rakesh.kn@motorola.com>
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 <danakj@chromium.org>
[chromium] Use region reported painted opaque for draw culling
......@@ -359,6 +359,8 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
dragSession.numberOfItemsToBeAccepted = 0;
else if (m_fileInputElementUnderMouse->multiple())
dragSession.numberOfItemsToBeAccepted = numberOfFiles;
else if (numberOfFiles > 1)
dragSession.numberOfItemsToBeAccepted = 0;
else
dragSession.numberOfItemsToBeAccepted = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment