Unable to paste text that was copied from a page into the universal search field
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jun 2017 16:58:13 +0000 (16:58 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jun 2017 16:58:13 +0000 (16:58 +0000)
commit446a573be1e2ac8b41e10eebc313754c8445d868
tree1edb44609f127a3cf74aa77f2aebf1c111a4990c
parented4c1ef10a06fb7d38c5a850e0f3ef69d1860e6d
Unable to paste text that was copied from a page into the universal search field
https://bugs.webkit.org/show_bug.cgi?id=173293
<rdar://problem/32440918>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Vend "public.utf8-plain-text" and "public.utf16-plain-text" as additional representations on the pasteboard when
copying both rich and plain web content in PlatformPasteboardIOS.mm. This is because UITextView no longer
supports pasting "public.text" as text in iOS 11.

Tests:
UIPasteboardTests.CopyPlainTextWritesConcreteTypes
UIPasteboardTests.CopyRichTextWritesConcreteTypes

* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::writePlainText):
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::write):

Source/WebKit2:

Add boilerplate SPI on WKPreferences to enable JavaScript access to copy and paste.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setJavaScriptCanAccessClipboard:]):
(-[WKPreferences _javaScriptCanAccessClipboard]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

Adds 2 new unit tests for copying plain and rich selected web content.
See WebCore and WebKit ChangeLogs for more detail.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/rich-and-plain-text.html: Added.
* TestWebKitAPI/Tests/ios/UIPasteboardTests.mm: Added.
(TestWebKitAPI::dataForPasteboardType):
(TestWebKitAPI::setUpWebViewForPasteboardTests):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/ios/PasteboardIOS.mm
Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/rich-and-plain-text.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm [new file with mode: 0644]