This bug tracks the work required to retrieve the context for autocorrection and IME on iOS.
Created attachment 220361 [details] Patch
Comment on attachment 220361 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=220361&action=review > Source/WebKit2/UIProcess/AutoCorrectionCallback.h:118 > +private: > + > + AutocorrectionContextCallback(void* context, CallbackFunction callback) Exra newline. > Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm:1643 > + WKAutocorrectionContext *context =[[WKAutocorrectionContext alloc] init]; Missing space after the =. > Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm:1652 > + if (beforeText && [beforeText length]) > + context.contextBeforeSelection = [beforeText copy]; > + if (selectedText && [selectedText length]) > + context.selectedText = [selectedText copy]; > + if (markedText && [markedText length]) > + context.markedText = [markedText copy]; > + if (afterText && [afterText length]) > + context.contextAfterSelection = [afterText copy]; I think calling length when the NSString is nil is fine, no need to nil check them. > Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:725 > +static void computeAutocorrectionContext(Frame& frame, String& contextBefore, String& markedText, String& selectedText, String& contextAfter, NSRange& selectedRangeInMarkedText) Is this all new code or is it a version of something elsewhere? If it is kind of duplicated, can we move this down into WebCore/? > Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:792 > + NSRange selectedRangeInMarkedText; I don't see a great reason to use NSRange here. Can we just use a pair of uint64_ts?
Thanks for the review. I'll address your comments. > Is this all new code or is it a version of something elsewhere? If it is kind of duplicated, can we move this down into WebCore/? This is all new code. > > > Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:792 > > + NSRange selectedRangeInMarkedText; > > I don't see a great reason to use NSRange here. Can we just use a pair of uint64_ts?. Sure.
Committed 161358.