Changeset 106301 in webkit


Ignore:
Timestamp:
Jan 30, 2012 4:35:42 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106300 r106301  
     12012-01-30  Rakesh KN  <rakesh.kn@motorola.com>
     2
     3        single-file input elements should refuse multi-file drags
     4        https://bugs.webkit.org/show_bug.cgi?id=25913
     5
     6        Reviewed by Eric Seidel.
     7
     8        Refuse the multiple file drags onto a single file input element.
     9
     10        * editing/pasteboard/file-input-files-access-expected.txt:
     11        Expected result changed.
     12        * editing/pasteboard/script-tests/file-input-files-access.js:
     13        (runTest):
     14        Removed the 'FIXME' debug and comment as it is not valid after this change.
     15
    1162012-01-30  Dana Jansens  <danakj@chromium.org>
    217
  • trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt

    r74510 r106301  
    2323FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
    2424FAIL fileInput.files.length should be 0. Was 1.
    25 FIXME: Single-file input elements should refuse multi-file drags.  See https://bugs.webkit.org/show_bug.cgi?id=25913
    2625Dragging two files to a single-file input control:
    27 FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
    28 FAIL fileInput.files.length should be 0. Was 1.
     26PASS fileInput.value is ""
     27PASS fileInput.files.length is 0
    2928Dragging a file and a directory onto a single-file input control:
    30 FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
    31 FAIL fileInput.files.length should be 0. Was 1.
     29PASS fileInput.value is ""
     30PASS fileInput.files.length is 0
    3231FIXME:  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.
    3332Dragging a directory and a file onto a single-file input control:
    34 FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
    35 FAIL fileInput.files.length should be 0. Was 1.
     33PASS fileInput.value is ""
     34PASS fileInput.files.length is 0
    3635Dragging three files to a multi-file input control:
    3736PASS fileInput.value is "C:\\fakepath\\apple.gif"
  • trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js

    r99108 r106301  
    9090    draggingPathsShouldResultInFiles(['resources/directory-for-dragging'], []);
    9191
    92     // FIXME: Current behavior is to take the first file, but I expect that's
    93     // confusing to the user.  We should change this to expect drag failure.
    94     debug("FIXME: Single-file input elements should refuse multi-file drags.  See https://bugs.webkit.org/show_bug.cgi?id=25913")
    9592    debug("Dragging two files to a single-file input control:")
    9693    draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/mozilla.gif'], []);
  • trunk/Source/WebCore/ChangeLog

    r106300 r106301  
     12012-01-30  Rakesh KN  <rakesh.kn@motorola.com>
     2
     3        single-file input elements should refuse multi-file drags
     4        https://bugs.webkit.org/show_bug.cgi?id=25913
     5
     6        Reviewed by Eric Seidel.
     7
     8        Refuse the multiple file drags onto a single file input element.
     9
     10        No new tests: Covered by existing tests, updated the expected results.
     11
     12        * page/DragController.cpp:
     13        (WebCore::DragController::tryDocumentDrag):
     14        Setting the dragSession.numberOfItemsToBeAccepted to 0 so that drag operation is none if the
     15        file input element under mouse is single input type and number of files dragged onto that
     16        input element are more than 1.
     17
    1182012-01-30  Dana Jansens  <danakj@chromium.org>
    219
  • trunk/Source/WebCore/page/DragController.cpp

    r106247 r106301  
    360360            else if (m_fileInputElementUnderMouse->multiple())
    361361                dragSession.numberOfItemsToBeAccepted = numberOfFiles;
     362            else if (numberOfFiles > 1)
     363                dragSession.numberOfItemsToBeAccepted = 0;
    362364            else
    363365                dragSession.numberOfItemsToBeAccepted = 1;
Note: See TracChangeset for help on using the changeset viewer.