[iOS] Refactor some logic for inserting pasted or dropped virtual card files as attac...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Apr 2019 16:45:25 +0000 (16:45 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Apr 2019 16:45:25 +0000 (16:45 +0000)
commitb18fb173e01dcde1952caa03814bca31654b5273
tree9ee9a60feabd108d8cc3f5cadce7a00fbd6415a7
parent29eff69741a6ddd7842b0b392d458834e3eaf53a
[iOS] Refactor some logic for inserting pasted or dropped virtual card files as attachment elements
https://bugs.webkit.org/show_bug.cgi?id=196435
Work towards <rdar://problem/48573098>

Reviewed by Darin Adler.

Refactor some existing codepaths on iOS for inserting VCard files as attachment elements. Instead of using a
separate readVirtualContactFile method for converting a vcard file or data into an attachment element (possibly
accompanied by a link), use the existing readFilePaths WebContentReader method.

To handle links which may accompany the attachment element, add a helper method in PasteboardIOS that reads a
titled URL prior to inserting an attachment element, in the case of pasting or dropping a VCF.

This means we no longer need to handle attachment reading in readPasteboardWebContentDataForType, so we can
simply bail before reading "public.vcard" here and defer to reading other data types.

Covered by existing API tests in WKAttachmentTests and DragAndDropTestsIOS.

* editing/WebContentReader.h:
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::WebContentReader::readVirtualContactFile): Deleted.
* platform/Pasteboard.h:
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::readPasteboardWebContentDataForType):
(WebCore::readURLAlongsideAttachmentIfNecessary):
(WebCore::prefersAttachmentRepresentation):
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::readRespectingUTIFidelities):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/WebContentReader.h
Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
Source/WebCore/platform/Pasteboard.h
Source/WebCore/platform/ios/PasteboardIOS.mm