Title: [229067] trunk/Source/WebKit
- Revision
- 229067
- Author
- [email protected]
- Date
- 2018-02-27 12:14:01 -0800 (Tue, 27 Feb 2018)
Log Message
Make it possible to set suggestions in extra zoom mode.
https://bugs.webkit.org/show_bug.cgi?id=183154
<rdar://problem/35227450>
Patch by Yongjun Zhang <[email protected]> on 2018-02-27
Reviewed by Tim Horton.
In extra zoom mode, when presenting WKFocusedFormControlViewController, make it the inputDelegate for
WKContentView. This is needed to ensure we can capture/cache the suggestions when _WKInputSession's
suggestions is updated. Later, when we present WKTextInputViewController, we can pass the cached
suggestions.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView presentFocusedFormControlViewController:]): Set _focusedFormControlViewController as
the inputDelegate for WKContentView.
(-[WKContentView dismissFocusedFormControlViewController:]): Null the inputDelegate on dismissal.
(-[WKContentView presentTextInputViewController:]): Pass the suggestions from WKFocusedFormControlViewController to
WKTextInputViewController when the latter is presented.
(-[WKContentView textInputController:didCommitText:]): Call the new delegate method textInputController:didCommitText:withSuggestion:.
(-[WKContentView textInputController:didCommitText:withSuggestion:]): When a suggestions is selected, insert the
suggestion which will notify the client.
(-[WKContentView focusedFormControllerDidUpdateSuggestions:]): Called when the suggestion is updated after the input
view controller is presented.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (229066 => 229067)
--- trunk/Source/WebKit/ChangeLog 2018-02-27 18:21:14 UTC (rev 229066)
+++ trunk/Source/WebKit/ChangeLog 2018-02-27 20:14:01 UTC (rev 229067)
@@ -1,3 +1,28 @@
+2018-02-27 Yongjun Zhang <[email protected]>
+
+ Make it possible to set suggestions in extra zoom mode.
+ https://bugs.webkit.org/show_bug.cgi?id=183154
+ <rdar://problem/35227450>
+
+ Reviewed by Tim Horton.
+
+ In extra zoom mode, when presenting WKFocusedFormControlViewController, make it the inputDelegate for
+ WKContentView. This is needed to ensure we can capture/cache the suggestions when _WKInputSession's
+ suggestions is updated. Later, when we present WKTextInputViewController, we can pass the cached
+ suggestions.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView presentFocusedFormControlViewController:]): Set _focusedFormControlViewController as
+ the inputDelegate for WKContentView.
+ (-[WKContentView dismissFocusedFormControlViewController:]): Null the inputDelegate on dismissal.
+ (-[WKContentView presentTextInputViewController:]): Pass the suggestions from WKFocusedFormControlViewController to
+ WKTextInputViewController when the latter is presented.
+ (-[WKContentView textInputController:didCommitText:]): Call the new delegate method textInputController:didCommitText:withSuggestion:.
+ (-[WKContentView textInputController:didCommitText:withSuggestion:]): When a suggestions is selected, insert the
+ suggestion which will notify the client.
+ (-[WKContentView focusedFormControllerDidUpdateSuggestions:]): Called when the suggestion is updated after the input
+ view controller is presented.
+
2018-02-27 Tim Horton <[email protected]>
Stop using deprecated CADisplay SPI
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (229066 => 229067)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-02-27 18:21:14 UTC (rev 229066)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-02-27 20:14:01 UTC (rev 229067)
@@ -4208,6 +4208,7 @@
_focusedFormControlViewController = adoptNS([[WKFocusedFormControlViewController alloc] init]);
[_focusedFormControlViewController setDelegate:self];
[[UIViewController _viewControllerForFullScreenPresentationFromView:self] presentViewController:_focusedFormControlViewController.get() animated:animated completion:nil];
+ [self setInputDelegate:_focusedFormControlViewController.get()];
}
- (void)dismissNumberPadViewController:(BOOL)animated
@@ -4226,6 +4227,7 @@
[_focusedFormControlViewController dismissViewControllerAnimated:animated completion:nil];
_focusedFormControlViewController = nil;
+ [self setInputDelegate:nil];
}
- (void)presentNumberPadViewController:(BOOL)animated
@@ -4273,6 +4275,8 @@
_textInputViewController = adoptNS([[WKTextInputViewController alloc] initWithText:_assistedNodeInformation.value textSuggestions:@[ ]]);
[_textInputViewController setDelegate:self];
[_focusedFormControlViewController presentViewController:_textInputViewController.get() animated:animated completion:nil];
+
+ [_textInputViewController setSuggestions:[_focusedFormControlViewController suggestions]];
}
- (void)dismissTextInputViewController:(BOOL)animated
@@ -4286,8 +4290,16 @@
- (void)textInputController:(WKTextFormControlViewController *)controller didCommitText:(NSString *)text
{
- _page->setTextAsync(text);
+ [self textInputController:controller didCommitText:text withSuggestion:nil];
+}
+- (void)textInputController:(WKTextFormControlViewController *)controller didCommitText:(NSString *)text withSuggestion:(UITextSuggestion *)suggestion
+{
+ if (suggestion)
+ [self insertTextSuggestion:suggestion];
+ else
+ _page->setTextAsync(text);
+
if (![self actionNameForFocusedFormControlController:_focusedFormControlViewController.get()] && !_assistedNodeInformation.hasNextNode && !_assistedNodeInformation.hasPreviousNode) {
// In this case, there's no point in collapsing down to the form control focus UI because there's nothing the user could potentially do
// besides dismiss the UI, so we just automatically dismiss the focused form control UI.
@@ -4371,6 +4383,11 @@
return _assistedNodeInformation.hasPreviousNode;
}
+- (void)focusedFormControllerDidUpdateSuggestions:(WKFocusedFormControlViewController *)controller
+{
+ [_textInputViewController setSuggestions:controller.suggestions];
+}
+
#pragma mark - WKSelectMenuViewControllerDelegate
- (void)selectMenu:(WKSelectMenuViewController *)selectMenu didSelectItemAtIndex:(NSUInteger)index
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes