Changeset 218144 in webkit
- Timestamp:
- Jun 12, 2017, 3:28:25 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (modified) (2 diffs)
-
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (modified) (2 diffs)
-
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (modified) (14 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentViewEditingActions.mm (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r218138 r218144 1 2017-06-12 Tim Horton <timothy_horton@apple.com> 2 3 [iOS] Cmd-C doesn't copy text from WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=173277 5 <rdar://problem/32396742> 6 7 Reviewed by Dan Bernstein. 8 9 * UIProcess/API/Cocoa/WKWebView.mm: 10 * UIProcess/API/Cocoa/WKWebViewInternal.h: 11 * UIProcess/ios/WKContentViewInteraction.h: 12 * UIProcess/ios/WKContentViewInteraction.mm: 13 (-[WKContentView _lookupForWebView:]): 14 (-[WKContentView _shareForWebView:]): 15 (-[WKContentView _addShortcutForWebView:]): 16 (-[WKContentView _promptForReplaceForWebView:]): 17 (-[WKContentView _transliterateChineseForWebView:]): 18 (-[WKContentView _reanalyzeForWebView:]): 19 (-[WKContentView replaceForWebView:]): 20 (-[WKContentView canPerformAction:withSender:]): 21 (-[WKContentView copyForWebView:]): 22 (-[WKContentView cutForWebView:]): 23 (-[WKContentView pasteForWebView:]): 24 (-[WKContentView selectForWebView:]): 25 (-[WKContentView selectAllForWebView:]): 26 (-[WKContentView toggleBoldfaceForWebView:]): 27 (-[WKContentView toggleItalicsForWebView:]): 28 (-[WKContentView toggleUnderlineForWebView:]): 29 (-[WKContentView _showTextStyleOptionsForWebView:]): 30 (-[WKContentView _defineForWebView:]): 31 (-[WKContentView _arrowKeyForWebView:]): 32 (-[WKContentView _lookup:]): Deleted. 33 (-[WKContentView _share:]): Deleted. 34 (-[WKContentView _addShortcut:]): Deleted. 35 (-[WKContentView _promptForReplace:]): Deleted. 36 (-[WKContentView _transliterateChinese:]): Deleted. 37 (-[WKContentView _reanalyze:]): Deleted. 38 (-[WKContentView replace:]): Deleted. 39 (-[WKContentView copy:]): Deleted. 40 (-[WKContentView cut:]): Deleted. 41 (-[WKContentView paste:]): Deleted. 42 (-[WKContentView select:]): Deleted. 43 (-[WKContentView selectAll:]): Deleted. 44 (-[WKContentView toggleBoldface:]): Deleted. 45 (-[WKContentView toggleItalics:]): Deleted. 46 (-[WKContentView toggleUnderline:]): Deleted. 47 (-[WKContentView _showTextStyleOptions:]): Deleted. 48 (-[WKContentView _define:]): Deleted. 49 (-[WKContentView _arrowKey:]): Deleted. 50 Similar to what r211897 did for canPerformAction, and other patches 51 have done for other selectors, forward methods for standard editing 52 commands from WKContentView up to WKWebView, and back down to WKContentView. 53 54 This is necessary because these are not treated as normal 55 responder-chain-respecting methods, so they do not bubble up the view tree. 56 57 In 211897, WKContentView (who is usually first responder and thus receives 58 the actions) stopped claiming to be able to perform these actions, depending 59 on this non-existent bubbling behavior to keep them working. 60 1 61 2017-06-12 Chris Dumez <cdumez@apple.com> 2 62 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r217956 r218144 1150 1150 } 1151 1151 1152 #define FOR_EACH_WKCONTENTVIEW_ACTION(M) \1153 M(_addShortcut) \1154 M(_arrowKey) \1155 M(_define) \1156 M(_lookup) \1157 M(_promptForReplace) \1158 M(_reanalyze) \1159 M(_share) \1160 M(_showTextStyleOptions) \1161 M(_transliterateChinese) \1162 M(copy) \1163 M(cut) \1164 M(paste) \1165 M(replace) \1166 M(select) \1167 M(selectAll) \1168 M(toggleBoldface) \1169 M(toggleItalics) \1170 M(toggleUnderline) \1171 1172 1152 #define FORWARD_ACTION_TO_WKCONTENTVIEW(_action) \ 1173 1153 - (void)_action:(id)sender \ 1174 1154 { \ 1175 1155 if (self.usesStandardContentView) \ 1176 [_contentView _action :sender]; \1156 [_contentView _action ## ForWebView:sender]; \ 1177 1157 } 1178 1158 … … 1193 1173 return [super canPerformAction:action withSender:sender]; 1194 1174 } 1195 1196 #undef FOR_EACH_WKCONTENTVIEW_ACTION1197 1175 1198 1176 static inline CGFloat floorToDevicePixel(CGFloat input, float deviceScaleFactor) -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
r216794 r218144 122 122 - (void)_didChangeAvoidsUnsafeArea:(BOOL)avoidsUnsafeArea; 123 123 124 - (void)_addShortcut:(id)sender; 125 - (void)_arrowKey:(id)sender; 126 - (void)_define:(id)sender; 127 - (void)_lookup:(id)sender; 128 - (void)_reanalyze:(id)sender; 129 - (void)_share:(id)sender; 130 - (void)_showTextStyleOptions:(id)sender; 131 - (void)_promptForReplace:(id)sender; 132 - (void)_transliterateChinese:(id)sender; 133 - (void)replace:(id)sender; 134 124 135 @property (nonatomic, readonly) WKPasswordView *_passwordView; 125 136 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r217580 r218144 90 90 typedef std::pair<WebKit::InteractionInformationRequest, InteractionInformationCallback> InteractionInformationRequestAndCallback; 91 91 92 #define FOR_EACH_WKCONTENTVIEW_ACTION(M) \ 93 M(_addShortcut) \ 94 M(_arrowKey) \ 95 M(_define) \ 96 M(_lookup) \ 97 M(_promptForReplace) \ 98 M(_reanalyze) \ 99 M(_share) \ 100 M(_showTextStyleOptions) \ 101 M(_transliterateChinese) \ 102 M(copy) \ 103 M(cut) \ 104 M(paste) \ 105 M(replace) \ 106 M(select) \ 107 M(selectAll) \ 108 M(toggleBoldface) \ 109 M(toggleItalics) \ 110 M(toggleUnderline) 111 92 112 namespace WebKit { 93 113 … … 237 257 - (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender; 238 258 239 - (void)_addShortcut:(id)sender; 240 - (void)_arrowKey:(id)sender; 241 - (void)_define:(id)sender; 242 - (void)_lookup:(id)sender; 243 - (void)_reanalyze:(id)sender; 244 - (void)_share:(id)sender; 245 - (void)_showTextStyleOptions:(id)sender; 246 - (void)_promptForReplace:(id)sender; 247 - (void)_transliterateChinese:(id)sender; 248 - (void)replace:(id)sender; 259 #define DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW(_action) \ 260 - (void)_action ## ForWebView:(id)sender; 261 FOR_EACH_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) 262 #undef DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW 249 263 250 264 #if ENABLE(TOUCH_EVENTS) -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r217580 r218144 1903 1903 } 1904 1904 1905 - (void)_lookup:(id)sender 1905 #define FORWARD_ACTION_TO_WKWEBVIEW(_action) \ 1906 - (void)_action:(id)sender \ 1907 { \ 1908 [_webView _action:sender]; \ 1909 } 1910 1911 FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKWEBVIEW) 1912 1913 #undef FORWARD_ACTION_TO_WKWEBVIEW 1914 1915 - (void)_lookupForWebView:(id)sender 1906 1916 { 1907 1917 RetainPtr<WKContentView> view = self; … … 1923 1933 } 1924 1934 1925 - (void)_share :(id)sender1935 - (void)_shareForWebView:(id)sender 1926 1936 { 1927 1937 RetainPtr<WKContentView> view = self; … … 1941 1951 } 1942 1952 1943 - (void)_addShortcut :(id)sender1953 - (void)_addShortcutForWebView:(id)sender 1944 1954 { 1945 1955 if (_textSelectionAssistant) … … 1969 1979 } 1970 1980 1971 - (void)_promptForReplace :(id)sender1981 - (void)_promptForReplaceForWebView:(id)sender 1972 1982 { 1973 1983 const auto& wordAtSelection = _page->editorState().postLayoutData().wordAtSelection; … … 1978 1988 } 1979 1989 1980 - (void)_transliterateChinese :(id)sender1990 - (void)_transliterateChineseForWebView:(id)sender 1981 1991 { 1982 1992 [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection]; 1983 1993 } 1984 1994 1985 - (void)_reanalyze :(id)sender1995 - (void)_reanalyzeForWebView:(id)sender 1986 1996 { 1987 1997 [_textSelectionAssistant scheduleReanalysis]; 1988 1998 } 1989 1999 1990 - (void)replace :(id)sender2000 - (void)replaceForWebView:(id)sender 1991 2001 { 1992 2002 [[UIKeyboardImpl sharedInstance] replaceText:sender]; … … 2031 2041 - (BOOL)canPerformAction:(SEL)action withSender:(id)sender 2032 2042 { 2033 return NO;2043 return [_webView canPerformAction:action withSender:sender]; 2034 2044 } 2035 2045 … … 2167 2177 } 2168 2178 2169 - (void)copy :(id)sender2179 - (void)copyForWebView:(id)sender 2170 2180 { 2171 2181 _page->executeEditCommand(ASCIILiteral("copy")); 2172 2182 } 2173 2183 2174 - (void)cut :(id)sender2184 - (void)cutForWebView:(id)sender 2175 2185 { 2176 2186 _page->executeEditCommand(ASCIILiteral("cut")); 2177 2187 } 2178 2188 2179 - (void)paste :(id)sender2189 - (void)pasteForWebView:(id)sender 2180 2190 { 2181 2191 _page->executeEditCommand(ASCIILiteral("paste")); 2182 2192 } 2183 2193 2184 - (void)select :(id)sender2194 - (void)selectForWebView:(id)sender 2185 2195 { 2186 2196 [_textSelectionAssistant selectWord]; … … 2189 2199 } 2190 2200 2191 - (void)selectAll :(id)sender2201 - (void)selectAllForWebView:(id)sender 2192 2202 { 2193 2203 [_textSelectionAssistant selectAll:sender]; … … 2195 2205 } 2196 2206 2197 - (void)toggleBoldface :(id)sender2207 - (void)toggleBoldfaceForWebView:(id)sender 2198 2208 { 2199 2209 if (!_page->editorState().isContentRichlyEditable) … … 2203 2213 } 2204 2214 2205 - (void)toggleItalics :(id)sender2215 - (void)toggleItalicsForWebView:(id)sender 2206 2216 { 2207 2217 if (!_page->editorState().isContentRichlyEditable) … … 2211 2221 } 2212 2222 2213 - (void)toggleUnderline :(id)sender2223 - (void)toggleUnderlineForWebView:(id)sender 2214 2224 { 2215 2225 if (!_page->editorState().isContentRichlyEditable) … … 2219 2229 } 2220 2230 2221 - (void)_showTextStyleOptions :(id)sender2231 - (void)_showTextStyleOptionsForWebView:(id)sender 2222 2232 { 2223 2233 _showingTextStyleOptions = YES; … … 2234 2244 } 2235 2245 2236 - (void)_define :(id)sender2246 - (void)_defineForWebView:(id)sender 2237 2247 { 2238 2248 if ([[getMCProfileConnectionClass() sharedConnection] effectiveBoolValueForSetting:MCFeatureDefinitionLookupAllowed] == MCRestrictedBoolExplicitNo) … … 2830 2840 } 2831 2841 2832 - (void)_arrowKey :(id)sender2842 - (void)_arrowKeyForWebView:(id)sender 2833 2843 { 2834 2844 UIKeyCommand* command = sender; -
trunk/Tools/ChangeLog
r218129 r218144 1 2017-06-12 Tim Horton <timothy_horton@apple.com> 2 3 [iOS] Cmd-C doesn't copy text from WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=173277 5 <rdar://problem/32396742> 6 7 Reviewed by Dan Bernstein. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * Tests/WebKit2Cocoa/WKContentViewEditingActions.mm: 11 Add a test ensuring that -copy on WKContentView will cause text to be copied. 12 1 13 2017-06-12 Jiewen Tan <jiewen_tan@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r217867 r218144 68 68 2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */; }; 69 69 2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; }; 70 2D838B1F1EEF3A5C009B980E /* WKContentViewEditingActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */; }; 70 71 2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */; }; 71 72 2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */; }; … … 1000 1001 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; }; 1001 1002 2D8104CB1BEC13E70020DA46 /* FindInPage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindInPage.mm; sourceTree = "<group>"; }; 1003 2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentViewEditingActions.mm; sourceTree = "<group>"; }; 1002 1004 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShrinkToFit.mm; sourceTree = "<group>"; }; 1003 1005 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InteractionDeadlockAfterCrash.mm; sourceTree = "<group>"; }; … … 1804 1806 5C9E56841DF9143D00C9EE33 /* WebsitePolicies.mm */, 1805 1807 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */, 1808 2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */, 1806 1809 51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */, 1807 1810 375E0E151D66674400EFEC2C /* WKNSNumber.mm */, … … 2914 2917 46397B951DC2C850009A78AE /* DOMNode.mm in Sources */, 2915 2918 5198A2401EA7E59F008910B7 /* InitialWarmedProcessUsed.mm in Sources */, 2919 2D838B1F1EEF3A5C009B980E /* WKContentViewEditingActions.mm in Sources */, 2916 2920 7CCE7EBC1A411A7E00447C4C /* DOMNodeFromJSObject.mm in Sources */, 2917 2921 7CCE7EBD1A411A7E00447C4C /* DOMRangeOfString.mm in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.