Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6c628b3ff9c4df5772477e8e085d6f0fad75f053
https://github.com/WebKit/WebKit/commit/6c628b3ff9c4df5772477e8e085d6f0fad75f053
Author: Wenson Hsieh <[email protected]>
Date: 2024-11-13 (Wed, 13 Nov 2024)
Changed paths:
M Source/WebCore/editing/cocoa/EditorCocoa.mm
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm
A Tools/TestWebKitAPI/Tests/WebKitCocoa/test.json
Log Message:
-----------
REGRESSION (iOS 17.4): Notes pastes text copied from a text document in
Safari as raw markup
https://bugs.webkit.org/show_bug.cgi?id=283093
rdar://124788252
Reviewed by Richard Robinson.
When copying selected text in webpages after iOS 17.4, we no longer directly
write rich text data to
the pasteboard — instead, we write web archive, HTML, and plain text to the
pasteboard and let
UIKit/UIFoundation automatically coerce to `NSAttributedString` or rich text
format, only if the
paste destination asks for it.
However, this is problematic in the case where the user is copying from a plain
text document,
because UIKit will end up treating the main resource of the web archive as a
plain text document as
well, and ultimately load an attributed string whose text is the raw markup of
the text document
(instead of just the plain text).
While it's possible to fix this by addressing this (and teaching UIFoundation
to load the web
archive properly), it's actually more efficient to elide this work altogether
in the case where
we're copying from a simple text document, by only writing plain text data to
the pasteboard in the
first place. This allows us to avoid spinning up `nsattributedstringagent` and
performing what is
(usually) a synchronous load of web content.
* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::writeSelectionToPasteboard):
(WebCore::Editor::writeSelection):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
(TEST(CopyHTML, CopySelectedTextInTextDocument)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/test.json: Added.
Add an API test to exercise this change, by selecting text in a JSON file
(loaded as plain text),
copying, and reading the copied contents as an attributed string.
Canonical link: https://commits.webkit.org/286583@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes