[Attachment Support] [WK2] Images copied from Mail message view paste with the wrong...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Aug 2018 16:45:24 +0000 (16:45 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Aug 2018 16:45:24 +0000 (16:45 +0000)
commit3bda47ab29a4b06e3bb28fa8331953ed444858e7
treefc34761126654a2204ac6299bc7efa99cbf53397
parent8dccf85f54358d5f1f1d62a8bb649d8d67681e23
[Attachment Support] [WK2] Images copied from Mail message view paste with the wrong file name in compose
https://bugs.webkit.org/show_bug.cgi?id=188957
<rdar://problem/43737715>

Reviewed by Darin Adler.

Source/WebCore:

Allow the alt attribute of a pasted image element to determine the name of an image attachment, rather than
using the source URL's last path component first. This is because in some clients, such as Mail, the source of
the image element is some nondescript UUID, and the alt text contains the real name of the image.

Test: WKAttachmentTests.PasteWebArchiveContainingImages

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::replaceRichContentWithAttachments):

Tools:

Add a new API test to verify that pasting a web archive containing several image elements with alt attributes
generates _WKAttachments whose names reflect those alt attributes.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(testGIFFileURL):
(testGIFData):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm