-
oliver authored
LayoutTests: Reviewed by Hyatt. Add test to verify files can be dragged to <input type="file"> * fast/forms/dragging-to-file-input-expected.txt: Added. * fast/forms/dragging-to-file-input.html: Added. WebCore: Reviewed by Hyatt. <rdar://problem/4728842> Can't drag-and-drop files onto <input type="file"> This patch allows a file to be dropped on to a file input field. There are a few changes for data handling and a few to allow the data to be threaded to the appropriate places. * page/DragController.cpp: (WebCore::asFileInput): When dropping a file onto a file input we may mouse over either the element itself, or the contained button element. This method returns the base element for the file input in either of these cases. (WebCore::DragController::tryDocumentDrag): Don't try to set the drag caret to a file input. (WebCore::DragController::concludeDrag): Handle dropping onto a file input element. (WebCore::DragController::canProcessDrag): We can now process a file being dragged onto a file input element. * platform/DragData.h: New accessors * platform/gdk/DragDataGdk.cpp: (WebCore::DragData::containsFiles): (WebCore::DragData::asFilenames): Link stubs. * platform/mac/DragDataMac.mm: (WebCore::DragData::containsFiles): (WebCore::DragData::asFilenames): Implement new accessors (WebCore::DragData::containsCompatibleContent): Update containsCompatibleContent to allow standalone files. * platform/qt/DragDataQt.cpp: (WebCore::DragData::containsFiles): (WebCore::DragData::asFilenames): Link stubs * rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::receiveDroppedFile): * rendering/RenderFileUploadControl.h: For security reasons we don't have an api to allow us to set a value directly on a file input -- attempts to do so are blocked. By adding a method to set the target through the render we bypass such restrictions, and ensure the renderer is updated correctly. WebKitTools: Reviewed by Hyatt. Add new api to DRT to allow us to test a file being dragged onto <input type="file"> * DumpRenderTree/DumpRenderTree.h: * DumpRenderTree/DumpRenderTree.m: (+[LayoutTestController isSelectorExcludedFromWebScript:]): (-[LayoutTestController addFileToPasteboardOnDrag]): (runTest): * DumpRenderTree/UIDelegate.m: (-[UIDelegate webView:dragImage:at:offset:event:pasteboard:source:slideBack:forView:]): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
52e744de