Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Unified Diff: Source/core/page/DragController.cpp

Issue 720403002: Let input tag filter out non-native files in dropped data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/forms/FileInputTypeTest.cpp ('k') | Source/core/page/DragData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/DragController.cpp
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 9922972e925b2faf9ce06daf72a423bef758ea09..135421d9b2133df4663031efd3907738c331b9f7 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -385,16 +385,18 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse;
dragSession.numberOfItemsToBeAccepted = 0;
- unsigned numberOfFiles = dragData->numberOfFiles();
+ Vector<String> paths;
+ dragData->asFilePaths(paths);
+ const unsigned numberOfFiles = paths.size();
if (m_fileInputElementUnderMouse) {
if (m_fileInputElementUnderMouse->isDisabledFormControl())
dragSession.numberOfItemsToBeAccepted = 0;
else if (m_fileInputElementUnderMouse->multiple())
dragSession.numberOfItemsToBeAccepted = numberOfFiles;
- else if (numberOfFiles > 1)
- dragSession.numberOfItemsToBeAccepted = 0;
- else
+ else if (numberOfFiles == 1)
dragSession.numberOfItemsToBeAccepted = 1;
+ else
+ dragSession.numberOfItemsToBeAccepted = 0;
if (!dragSession.numberOfItemsToBeAccepted)
dragSession.operation = DragOperationNone;
« no previous file with comments | « Source/core/html/forms/FileInputTypeTest.cpp ('k') | Source/core/page/DragData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698