[webkit-changes] [WebKit/WebKit] fe7553: [iOS] Copying and pasting unnamed PDF data into Ma...

Wenson Hsieh noreply at github.com
Mon Oct 24 13:10:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fe7553ab3123ce571cdb1ee13372711954b8e741
      https://github.com/WebKit/WebKit/commit/fe7553ab3123ce571cdb1ee13372711954b8e741
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
    M Source/WebCore/Configurations/WebCore.xcconfig
    M Source/WebCore/platform/ios/PasteboardIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm

  Log Message:
  -----------
  [iOS] Copying and pasting unnamed PDF data into Mail compose should insert an attachment
https://bugs.webkit.org/show_bug.cgi?id=246894
rdar://96853551

Reviewed by Megan Gardner and Tim Horton.

For attachment element WebKit clients on iOS, when PDF data is written directly to the pasteboard
without either:

1. `-[NSItemProvider preferredPresentationStyle]` being set to Attachment.
2. A non-null `-[NSItemProvider suggestedName]`.

...we'll fail to read the PDF data as an attachment element upon pasting. However, copying and
pasting this same data into Notes successfully inserts a PDF attachment. To make our paste handling
consistent with Notes when attachments are enabled, we make all composite content (e.g.
presentations such as Keynote files and Powerpoints, EPUB files, and importantly PDFs) that isn't
one of the rich text types that we would otherwise insert as inline content (i.e. web archive data
and flattened or unflattened RTF formats) insert themselves as attachment elements.

Test: WKAttachmentTests.PasteRawUnnamedPDFData

* Source/WebCore/Configurations/WebCore.xcconfig:
* Source/WebCore/platform/ios/PasteboardIOS.mm:
(WebCore::shouldTreatAsAttachmentByDefault):
(WebCore::prefersAttachmentRepresentation):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:

Add an API test to exercise this change, by writing a PDF data blob directly to the pasteboard
without going through item providers or setting a file name.

Canonical link: https://commits.webkit.org/255932@main




More information about the webkit-changes mailing list