Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2017 23:30:52 +0000 (23:30 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2017 23:30:52 +0000 (23:30 +0000)
commitbb582db3504d8ffad32e4d6d9b2ec868133dc877
tree356ee8285e9d75c3bc6cc09737f1cdfc15738d7b
parentb19dbd998d9204e85e71efe21a9d27c2fb8fe747
Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
https://bugs.webkit.org/show_bug.cgi?id=167942
<rdar://problem/30315079>

Reviewed by Tim Horton.

Source/WebCore:

Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
pasteboard as text and an image, respectively.

New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.

* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsCompatibleContent):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::read):

Tools:

Adds a new test case that simulates dragging from a source that only vends JPEG images or UTF8 plaintext into a
contenteditable area. An image element and the plain text content, respectively, should be inserted into the
contenteditable in these cases.

The DragSource and DragInfo are used to mock dragging into the WebView. There is no reliance on using mouse
events in this test, since we call the dragging delegate methods (draggingEntered:, draggingUpdated:, and
performDragOperation:) directly.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm: Added.
(+[FrameLoadCompletionListener listenerWithCompletionBlock:]):
(-[FrameLoadCompletionListener initWithCompletionBlock:]):
(-[FrameLoadCompletionListener webView:didFinishLoadForFrame:]):
(-[DragSource draggingSourceOperationMaskForLocal:]):
(-[DragInfo initWithImage:offset:pasteboard:source:destinationWindow:]):
(-[DragInfo lastMousePosition]):
(-[DragInfo setLastMousePosition:]):
(-[DragInfo draggingDestinationWindow]):
(-[DragInfo draggingSourceOperationMask]):
(-[DragInfo draggingLocation]):
(-[DragInfo draggedImageLocation]):
(-[DragInfo draggedImage]):
(-[DragInfo draggingPasteboard]):
(-[DragInfo draggingSource]):
(-[DragInfo draggingSequenceNumber]):
(-[DragInfo slideDraggedImageTo:]):
(-[DragInfo namesOfPromisedFilesDroppedAtDestination:]):
(-[DragInfo draggingFormation]):
(-[DragInfo setDraggingFormation:]):
(-[DragInfo animatesToDestination]):
(-[DragInfo setAnimatesToDestination:]):
(-[DragInfo numberOfValidItemsForDrop]):
(-[DragInfo setNumberOfValidItemsForDrop:]):
(-[DragInfo enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:]):
(-[DragInfo springLoadingHighlight]):
(-[DragInfo resetSpringLoading]):
(TestWebKitAPI::getTestImage):
(TestWebKitAPI::webViewAfterPerformingDragOperation):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/full-page-contenteditable.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/mac/DragDataMac.mm
Source/WebCore/platform/mac/PasteboardMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/mac/full-page-contenteditable.html [new file with mode: 0644]