Skip to content

Conversation

whsieh
Copy link
Member

@whsieh whsieh commented Jan 5, 2024

cb14ef5

[iOS] Write web archive data using the `com.apple.webarchive` UTI when copying/dragging
https://bugs.webkit.org/show_bug.cgi?id=267131
rdar://120545471

Reviewed by Aditya Keerthi.

Publish `com.apple.webarchive` alongside the legacy `Apple Web Archive pasteboard type` when writing
web archive data to the pasteboard when copying or dragging, so that the system can automatically
coerce from web archive data (which may include attachments) to `NSAttributedString`, RTF, or flat
RTFD if needed.

Note that landing this change no longer requires rdar://46830277 to be fixed after the (more recent)
UIKit changes in rdar://116051491, because writing `com.apple.webarchive` data now additionally
registers "derived" types for `public.rtf` and `com.apple.flat-rtfd`. This ensures that Messages
won't prefer pasting text copied in Safari as a `.webarchive` file over plain text in the entry
view.

* Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::write):
* Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:

Additionally rebaseline an API test, to reflect the fact that we should now register
`com.apple.webarchive` when dragging.

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

a83158d

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv-sim
✅ 🛠 🧪 merge ✅ 🛠 watch
✅ 🛠 watch-sim

@whsieh whsieh self-assigned this Jan 5, 2024
@whsieh whsieh added the HTML Editing For bugs in HTML editing support (including designMode and contentEditable). label Jan 5, 2024
@whsieh
Copy link
Member Author

whsieh commented Jan 5, 2024

Thanks for the review!

(It looks like the failing API test, RequiresUserActionForPlaybackTest.DoesNotRequireUserActionForMediaPlayback, is unrelated)

@whsieh whsieh added the merge-queue Applied to send a pull request to merge-queue label Jan 5, 2024
…n copying/dragging

https://bugs.webkit.org/show_bug.cgi?id=267131
rdar://120545471

Reviewed by Aditya Keerthi.

Publish `com.apple.webarchive` alongside the legacy `Apple Web Archive pasteboard type` when writing
web archive data to the pasteboard when copying or dragging, so that the system can automatically
coerce from web archive data (which may include attachments) to `NSAttributedString`, RTF, or flat
RTFD if needed.

Note that landing this change no longer requires rdar://46830277 to be fixed after the (more recent)
UIKit changes in rdar://116051491, because writing `com.apple.webarchive` data now additionally
registers "derived" types for `public.rtf` and `com.apple.flat-rtfd`. This ensures that Messages
won't prefer pasting text copied in Safari as a `.webarchive` file over plain text in the entry
view.

* Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::write):
* Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:

Additionally rebaseline an API test, to reflect the fact that we should now register
`com.apple.webarchive` when dragging.

Canonical link: https://commits.webkit.org/272697@main
@webkit-commit-queue
Copy link
Collaborator

Committed 272697@main (cb14ef5): https://commits.webkit.org/272697@main

Reviewed commits have been landed. Closing PR #22435 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit cb14ef5 into WebKit:main Jan 5, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HTML Editing For bugs in HTML editing support (including designMode and contentEditable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants