|
| 1 | +2018-01-11 Wenson Hsieh < [email protected]> |
| 2 | + |
| 3 | + [Attachment Support] Support dragging attachment elements out as files on iOS |
| 4 | + https://bugs.webkit.org/show_bug.cgi?id=181199 |
| 5 | + <rdar://problem/36299316> |
| 6 | + |
| 7 | + Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro. |
| 8 | + |
| 9 | + Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles) |
| 10 | + from attachment elements on iOS for Mail. See below for more detail. |
| 11 | + |
| 12 | + Tests: WKAttachmentTestsIOS.DragAttachmentInsertedAsData |
| 13 | + WKAttachmentTestsIOS.DragAttachmentInsertedAsFile |
| 14 | + |
| 15 | + * page/DragController.cpp: |
| 16 | + (WebCore::DragController::platformContentTypeForBlobType const): |
| 17 | + (WebCore::DragController::dragAttachmentElement): |
| 18 | + * page/DragController.h: |
| 19 | + * page/mac/DragControllerMac.mm: |
| 20 | + (WebCore::DragController::platformContentTypeForBlobType const): |
| 21 | + |
| 22 | + Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this |
| 23 | + converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume. |
| 24 | + |
| 25 | + * platform/ios/WebItemProviderPasteboard.h: |
| 26 | + * platform/ios/WebItemProviderPasteboard.mm: |
| 27 | + |
| 28 | + Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item |
| 29 | + provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting- |
| 30 | + conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider |
| 31 | + pasteboard currently checks to see whether the info contains an object or a type and data. |
| 32 | + |
| 33 | + This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects |
| 34 | + that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are |
| 35 | + three implementations below. |
| 36 | + |
| 37 | + (-[WebItemProviderDataRegistrar initWithData:type:]): |
| 38 | + (-[WebItemProviderDataRegistrar typeIdentifier]): |
| 39 | + (-[WebItemProviderDataRegistrar data]): |
| 40 | + (-[WebItemProviderDataRegistrar typeIdentifierForClient]): |
| 41 | + (-[WebItemProviderDataRegistrar dataForClient]): |
| 42 | + (-[WebItemProviderDataRegistrar registerItemProvider:]): |
| 43 | + (-[WebItemProviderDataRegistrar description]): |
| 44 | + |
| 45 | + A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a |
| 46 | + WebItemProviderRegistrationInfo with both a type and data, but no representing object. |
| 47 | + |
| 48 | + (-[WebItemProviderWritableObjectRegistrar initWithObject:]): |
| 49 | + (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]): |
| 50 | + (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]): |
| 51 | + (-[WebItemProviderWritableObjectRegistrar description]): |
| 52 | + |
| 53 | + The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This |
| 54 | + replaces a WebItemProviderRegistrationInfo with only a representing object. |
| 55 | + |
| 56 | + (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]): |
| 57 | + (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]): |
| 58 | + (-[WebItemProviderPromisedFileRegistrar description]): |
| 59 | + (-[WebItemProviderRegistrationInfoList addData:forType:]): |
| 60 | + (-[WebItemProviderRegistrationInfoList addRepresentingObject:]): |
| 61 | + (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]): |
| 62 | + |
| 63 | + Helper methods to add new registrars to a registration info list. |
| 64 | + |
| 65 | + (-[WebItemProviderRegistrationInfoList itemAtIndex:]): |
| 66 | + (-[WebItemProviderRegistrationInfoList enumerateItems:]): |
| 67 | + (-[WebItemProviderRegistrationInfoList itemProvider]): |
| 68 | + (-[WebItemProviderRegistrationInfoList description]): |
| 69 | + (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted. |
| 70 | + (-[WebItemProviderRegistrationInfo representingObject]): Deleted. |
| 71 | + (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted. |
| 72 | + |
1 | 73 | 2018-01-11 Michael Saboff < [email protected]>
|
2 | 74 |
|
3 | 75 | Add a DOM gadget for Spectre testing
|
|
0 commit comments