Changeset 198046 in webkit
- Timestamp:
- Mar 11, 2016, 2:13:42 PM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r198041 r198046 1 2016-03-11 Chelsea Pugh <cpugh@apple.com> 2 3 [iOS] Allow clients to specify text suggestions to be used for a form input session 4 https://bugs.webkit.org/show_bug.cgi?id=155343 5 6 Reviewed by Dan Bernstein. 7 8 * UIProcess/API/Cocoa/_WKFormInputSession.h: 9 * UIProcess/API/Cocoa/_WKInputDelegate.h: 10 * UIProcess/ios/WKContentViewInteraction.mm: 11 (-[WKFormInputSession suggestions]): Add a getter for suggestions. 12 (-[WKFormInputSession setSuggestions:]): Add a setter, which calls setSuggestions with our suggestions on the input delegate. 13 (-[WKContentView insertTextSuggestion:]): Call _webView:insertTextSuggestion:inInputSession: on our input delegate so clients know 14 a text suggestion was tapped. 15 1 16 2016-03-11 Anders Carlsson <andersca@apple.com> 2 17 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKFormInputSession.h
r191535 r198046 31 31 #import <WebKit/_WKFocusedElementInfo.h> 32 32 33 @class UITextSuggestion; 34 33 35 @protocol _WKFormInputSession <NSObject> 34 36 … … 40 42 @property (nonatomic, copy) NSString *accessoryViewCustomButtonTitle; 41 43 @property (nonatomic, strong) UIView *customInputView WK_AVAILABLE(NA, WK_IOS_TBA); 44 @property (nonatomic, copy) NSArray<UITextSuggestion *> *suggestions WK_AVAILABLE(NA, WK_IOS_TBA); 42 45 #endif 43 46 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKInputDelegate.h
r191228 r198046 30 30 #import <Foundation/Foundation.h> 31 31 32 @class UITextSuggestion; 32 33 @class WKWebView; 33 34 @protocol _WKFocusedElementInfo; … … 46 47 - (BOOL)_webView:(WKWebView *)webView hasSuggestionsForCurrentStringInInputSession:(id <_WKFormInputSession>)inputSession; 47 48 - (NSArray *)_webView:(WKWebView *)webView suggestionsForString:(NSString *)string inInputSession:(id <_WKFormInputSession>)inputSession; 49 - (void)_webView:(WKWebView *)webView insertTextSuggestion:(UITextSuggestion *)suggestion inInputSession:(id <_WKFormInputSession>)inputSession WK_AVAILABLE(NA, WK_IOS_TBA); 48 50 #endif 49 51 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r198033 r198046 261 261 RetainPtr<WKFocusedElementInfo> _focusedElementInfo; 262 262 RetainPtr<UIView> _customInputView; 263 RetainPtr<NSArray<UITextSuggestion *>> _suggestions; 263 264 } 264 265 … … 317 318 _customInputView = customInputView; 318 319 [_contentView reloadInputViews]; 320 } 321 322 - (NSArray<UITextSuggestion *> *)suggestions 323 { 324 return _suggestions.get(); 325 } 326 327 - (void)setSuggestions:(NSArray<UITextSuggestion *> *)suggestions 328 { 329 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000 330 id <UITextInputSuggestionDelegate> suggestionDelegate = (id <UITextInputSuggestionDelegate>)_contentView.inputDelegate; 331 _suggestions = adoptNS([suggestions copy]); 332 // FIXME 25102224: Remove this dispatch_after once race condition causing keyboard suggestions to overwrite 333 // the suggestions being set is resolved 334 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(20 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{ 335 [suggestionDelegate setSuggestions:suggestions]; 336 }); 337 #endif 319 338 } 320 339 … … 2604 2623 [self.inputDelegate selectionDidChange:self]; 2605 2624 } 2625 2626 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000 2627 - (void)insertTextSuggestion:(UITextSuggestion *)textSuggestion 2628 { 2629 id <_WKInputDelegate> inputDelegate = [_webView _inputDelegate]; 2630 if ([inputDelegate respondsToSelector:@selector(_webView:insertTextSuggestion:inInputSession:)]) 2631 [inputDelegate _webView:_webView insertTextSuggestion:textSuggestion inInputSession:_formInputSession.get()]; 2632 } 2633 #endif 2606 2634 2607 2635 - (NSString *)textInRange:(UITextRange *)range
Note:
See TracChangeset
for help on using the changeset viewer.