[iOS] Cmd-C doesn't copy text from WKWebView
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Jun 2017 22:28:25 +0000 (22:28 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Jun 2017 22:28:25 +0000 (22:28 +0000)
commitd3c581bf17910886ba390cfa4c5c76af84cd221d
treece6e68546eb66c26d0d734af894576baba752307
parent31c0c242cf855ad85080568905e27dea76f266a2
[iOS] Cmd-C doesn't copy text from WKWebView
https://bugs.webkit.org/show_bug.cgi?id=173277
<rdar://problem/32396742>

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _lookupForWebView:]):
(-[WKContentView _shareForWebView:]):
(-[WKContentView _addShortcutForWebView:]):
(-[WKContentView _promptForReplaceForWebView:]):
(-[WKContentView _transliterateChineseForWebView:]):
(-[WKContentView _reanalyzeForWebView:]):
(-[WKContentView replaceForWebView:]):
(-[WKContentView canPerformAction:withSender:]):
(-[WKContentView copyForWebView:]):
(-[WKContentView cutForWebView:]):
(-[WKContentView pasteForWebView:]):
(-[WKContentView selectForWebView:]):
(-[WKContentView selectAllForWebView:]):
(-[WKContentView toggleBoldfaceForWebView:]):
(-[WKContentView toggleItalicsForWebView:]):
(-[WKContentView toggleUnderlineForWebView:]):
(-[WKContentView _showTextStyleOptionsForWebView:]):
(-[WKContentView _defineForWebView:]):
(-[WKContentView _arrowKeyForWebView:]):
(-[WKContentView _lookup:]): Deleted.
(-[WKContentView _share:]): Deleted.
(-[WKContentView _addShortcut:]): Deleted.
(-[WKContentView _promptForReplace:]): Deleted.
(-[WKContentView _transliterateChinese:]): Deleted.
(-[WKContentView _reanalyze:]): Deleted.
(-[WKContentView replace:]): Deleted.
(-[WKContentView copy:]): Deleted.
(-[WKContentView cut:]): Deleted.
(-[WKContentView paste:]): Deleted.
(-[WKContentView select:]): Deleted.
(-[WKContentView selectAll:]): Deleted.
(-[WKContentView toggleBoldface:]): Deleted.
(-[WKContentView toggleItalics:]): Deleted.
(-[WKContentView toggleUnderline:]): Deleted.
(-[WKContentView _showTextStyleOptions:]): Deleted.
(-[WKContentView _define:]): Deleted.
(-[WKContentView _arrowKey:]): Deleted.
Similar to what r211897 did for canPerformAction, and other patches
have done for other selectors, forward methods for standard editing
commands from WKContentView up to WKWebView, and back down to WKContentView.

This is necessary because these are not treated as normal
responder-chain-respecting methods, so they do not bubble up the view tree.

In 211897, WKContentView (who is usually first responder and thus receives
the actions) stopped claiming to be able to perform these actions, depending
on this non-existent bubbling behavior to keep them working.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tests/WebKit2Cocoa/WKContentViewEditingActions.mm:
Add a test ensuring that -copy on WKContentView will cause text to be copied.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm [new file with mode: 0644]