-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The textarea element URL encodes pasteboard data #18902
Conversation
EWS run on previous version of this PR (hash 445969b) |
Why do we try to create a URL when copying text from an input field? |
Source/WTF/wtf/PlatformHave.h
Outdated
|| PLATFORM(VISION) \ | ||
|| (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 100000) \ | ||
|| (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 170000) | ||
#define HAVE_NEW_NSURL_PARSING 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using "new" in feature names is an anti-pattern. It will be old in no time, with a very misleading name.
Something like HAVE_NSURL_ENCODING_INVALID_CHARACTERS would seem better.
When copying any text, we try to see if it is a valid URL and if so, copy the URL representation as well as the plain text representation to the pasteboard, so that it can be pasted as either of those two types. |
445969b
to
7626c09
Compare
I think that this restates what we do, but does not explain why. Would anything break if we just removed this code? |
Yes; pasting it into Notes for example would make it be a hyperlink currently, but wouldn't do so if I removed the code |
It's not clear to me if automatically linkifying test from <textarea> is correct behavior. But I guess the more mysterious it is, the harder it is to change. |
https://bugs.webkit.org/show_bug.cgi?id=261936 rdar://116056298 Reviewed by Wenson Hsieh. In iOS 17 and aligned OS versions, `+[NSURL URLWithString:]` now percent-encodes invalid characters to help create a valid URL, where previously it would return `nil`. As a result of this new behavior, strings are now made representable as URLs more easily, and so their URL representations are added to the pasteboard with percent-encoded invalid characters. Fix by using the new `+[NSURL URLWithString:encodingInvalidCharacters:]` method, which restores pre-iOS 17 behavior. * Source/WTF/wtf/PlatformHave.h: * Source/WebCore/platform/ios/PlatformPasteboardIOS.mm: (WebCore::addRepresentationsForPlainText): * Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/269178@main
7626c09
to
a222530
Compare
Committed 269178@main (a222530): https://commits.webkit.org/269178@main Reviewed commits have been landed. Closing PR #18902 and removing active labels. |
a222530
7626c09
π iosπ§ͺ wpe-wk2π§ͺ api-macπ§ͺ ios-wk2-wptπ§ͺ api-iosπ tvπ§ͺ mac-AS-debug-wk2π watch