[webkit-changes] [WebKit/WebKit] 85f7fd: [iOS] Stop using `-[NSURL _title]` and `-[NSURL _s...
Wenson Hsieh
noreply at github.com
Mon Oct 2 13:54:41 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 85f7fd9f6b7de860eac958c608b33b6a076a31b1
https://github.com/WebKit/WebKit/commit/85f7fd9f6b7de860eac958c608b33b6a076a31b1
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-10-02 (Mon, 02 Oct 2023)
Changed paths:
M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
M Source/WebCore/PAL/pal/PlatformMac.cmake
A Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.h
A Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.mm
A Source/WebCore/PAL/pal/spi/cocoa/LinkPresentationSPI.h
M Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h
M Source/WebCore/SourcesCocoa.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/platform/cocoa/NSURLUtilities.h
A Source/WebCore/platform/cocoa/NSURLUtilities.mm
M Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h
M Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
R Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h
M Source/WebKit/Platform/spi/ios/UIKitSPI.h
M Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
Log Message:
-----------
[iOS] Stop using `-[NSURL _title]` and `-[NSURL _setTitle:]` when possible
https://bugs.webkit.org/show_bug.cgi?id=262471
rdar://115803976
Reviewed by Tim Horton and Abrar Rahman Protyasha.
Remove uses of both `-[NSURL _setTitle:]` and `-[NSURL _title]`, in the case where
`HAVE(LINK_PRESENTATION_CHANGE_FOR_RADAR_115801517)` is set. Instead, take advantange of the fact
that LinkPresentation's `LPLinkMetadata` now sets `NSURL`'s `_title` when calling `-setTitle:`,
after the changes in rdar://115801517. Similarly, LinkPresentation also returns the `NSURL`'s
`_title` property in the case where no title is explicitly set, so we can simply set an NSURL and
then use `-[LPLinkMetadata title]` in place of calling `-_title` directly.
I verified that the following API tests (which exercise WebKit's ability to set and consume NSURL's
`_title`) continue to pass after this refactoring:
• ActionSheetTests.CopyImageElementWithHREFAndTitle
• ActionSheetTests.CopyImageElementWithHREF
• DragAndDropTests.LinkToInput
• DragAndDropTests.ExternalSourceTitledNSURL
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/PlatformMac.cmake:
* Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.h: Copied from Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h.
* Source/WebCore/PAL/pal/cocoa/LinkPresentationSoftLink.mm: Copied from Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h.
Add a LinkPresentation soft linking header, with `LPLinkMetadata` and `LPMetadataProvider`.
* Source/WebCore/PAL/pal/spi/cocoa/LinkPresentationSPI.h: Copied from Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h.
Move this SPI header from WebKit into WebCore.
* Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h:
Remove now-unnecessary SPI declarations for `-_title` and `-_setTitle:`.
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/cocoa/NSURLUtilities.h: Copied from Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h.
* Source/WebCore/platform/cocoa/NSURLUtilities.mm: Renamed from Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h.
(-[NSURL _web_setTitle:]):
(-[NSURL _web_title]):
Add category helper methods to call `_title` and `_setTitle:` on an NSURL.
* Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
* Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::write):
(WebCore::PlatformPasteboard::readURL const):
Switch from using `-_setTitle:` and `-_title` to `-_web_setTitle:` and `-_web_title`, respectively.
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm:
Adopt the new category helpers here as well. Note that in the case where we're adding a
`WKShareSheetURLItemProvider`, we can just pass in a `title` and `NSURL`, since LinkPresentation
now sets the `NSURL`'s title after rdar://115801517.
(-[WKShareSheetFileItemProvider initWithURL:]):
(-[WKShareSheetURLItemProvider initWithURL:title:]):
(-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
(-[WKShareSheetURLItemProvider initWithURL:]): Deleted.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/268744@main
More information about the webkit-changes
mailing list