[webkit-changes] [WebKit/WebKit] 9d02a0: [macOS] Web Share API allows rich format parsing o...

Aditya Keerthi noreply at github.com
Fri Sep 20 20:00:14 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d02a05149e9f13b0c26e71abe9a1371f71fbbc8
      https://github.com/WebKit/WebKit/commit/9d02a05149e9f13b0c26e71abe9a1371f71fbbc8
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-09-20 (Fri, 20 Sep 2024)

  Changed paths:
    M Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.h
    M Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.mm
    M Source/WebCore/PAL/pal/spi/cocoa/LinkPresentationSPI.h
    M Source/WebKit/Platform/spi/mac/AppKitSPI.h
    M Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm

  Log Message:
  -----------
  [macOS] Web Share API allows rich format parsing outside the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=276980
rdar://125008361

Reviewed by Tim Horton and Abrar Rahman Protyasha.

Similar to iOS, the macOS Share Sheet displays a rich preview of the content
being shared. Web content can trigger this flow using the Web Share API, which
sends IPC with share data.

Rich previews effectively have two types:
1. For site URLs, a preview of an image supplied by the site.
2. For file URLs, a preview of the file.

The format parsing happens as a direct result of providing URLs to the Share
Sheet, via metadata fetch/display in LinkPresentation.

Fix by supplying placeholder metadata to the Share Sheet, which elides metadata
fetch (and format parsing). This approach is already taken on iOS.

* Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.h:
* Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.mm:
* Source/WebCore/PAL/pal/spi/cocoa/LinkPresentationSPI.h:
* Source/WebKit/Platform/spi/mac/AppKitSPI.h:
* Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm:
(typeIdentifierForFileURL):
(placeholderMetadataWithURLAndTitle):
(sizeForFileURL):
(nameForFileURLWithTypeIdentifier):
(placeholderMetadataWithFileURL):
(-[WKShareSheetFileItemProvider activityViewController:dataTypeIdentifierForActivityType:]):
(-[WKShareSheetURLItemProvider initWithURL:title:]):
(appendFilesAsShareableURLs):
(-[WKShareSheet presentWithParameters:inRect:completionHandler:]):

For website URLs, supply metadata containing the URL and title. The lack of an
image will result in the Share Sheet simply displaying a fallback SF symbol.

For file URLs, construct file metadata so that a document icon, file type and
file size information can still be displayed. The thumbnail is omitted to avoid
parsing images.

Originally-landed-as: 280938.112 at safari-7619-branch (a4ee0aa2e3ed). rdar://136108946
Canonical link: https://commits.webkit.org/284026@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list