https://bugs.webkit.org/show_bug.cgi?id=183866
<rdar://problem/
38692256>
Reviewed by Tim Horton.
Add new SPI hooks to _WKInputDelegate allowing internal clients to provide a view that gives additional context
when editing form controls, on top of the default label or placeholder text displayed by WebKit. The height
delegate is invoked first, giving the client an opportunity to lay out the context view to fit the given size;
the actual view is then queried.
If the view changes, clients may tell WebKit to reload the context view via SPI on WKFormInputSession; this call
to reload is plumbed through to the currently presented list view controller (at the moment, this is only the
text input list view controller).
* UIProcess/API/Cocoa/_WKFormInputSession.h:
* UIProcess/API/Cocoa/_WKInputDelegate.h:
Add the new SPI hooks, described above.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession reloadFocusedElementContextView]):
Plumb the context view reload hook through WKContentView to WKTextInputListViewController.
(-[WKContentView setupInteraction]):
(-[WKContentView _stopAssistingNode]):
(-[WKContentView reloadContextViewForPresentedListViewController]):
(-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
Slight tweak to only reload text suggestions if we are not blurring the focused element. Without this extra
condition, the list view controller's inner table view would get reloaded when the form input session's text
suggestions are set to nil when the list view controller is dismissed, causing a visible stutter in the
dismissal animation of view controller.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229837
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-03-21 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ [Extra zoom mode] Add new SPI hooks for clients to vend an input session context view
+ https://bugs.webkit.org/show_bug.cgi?id=183866
+ <rdar://problem/38692256>
+
+ Reviewed by Tim Horton.
+
+ Add new SPI hooks to _WKInputDelegate allowing internal clients to provide a view that gives additional context
+ when editing form controls, on top of the default label or placeholder text displayed by WebKit. The height
+ delegate is invoked first, giving the client an opportunity to lay out the context view to fit the given size;
+ the actual view is then queried.
+
+ If the view changes, clients may tell WebKit to reload the context view via SPI on WKFormInputSession; this call
+ to reload is plumbed through to the currently presented list view controller (at the moment, this is only the
+ text input list view controller).
+
+ * UIProcess/API/Cocoa/_WKFormInputSession.h:
+ * UIProcess/API/Cocoa/_WKInputDelegate.h:
+
+ Add the new SPI hooks, described above.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKFormInputSession reloadFocusedElementContextView]):
+
+ Plumb the context view reload hook through WKContentView to WKTextInputListViewController.
+
+ (-[WKContentView setupInteraction]):
+ (-[WKContentView _stopAssistingNode]):
+ (-[WKContentView reloadContextViewForPresentedListViewController]):
+ (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
+
+ Slight tweak to only reload text suggestions if we are not blurring the focused element. Without this extra
+ condition, the list view controller's inner table view would get reloaded when the form input session's text
+ suggestions are set to nil when the list view controller is dismissed, causing a visible stutter in the
+ dismissal animation of view controller.
+
2018-03-21 Chris Dumez <cdumez@apple.com>
WebKitTestRunner crashed in com.apple.WebKit: WebKit::WebProcessPool::terminateServiceWorkerProcesses
@property (nonatomic) BOOL accessoryViewShouldNotShow WK_API_AVAILABLE(ios(10.0));
@property (nonatomic) BOOL forceSecureTextEntry WK_API_AVAILABLE(ios(10.0));
@property (nonatomic, readonly) BOOL requiresStrongPasswordAssistance WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+- (void)reloadFocusedElementContextView WK_API_AVAILABLE(ios(WK_IOS_TBA));
#endif
@end
- (void)_webView:(WKWebView *)webView accessoryViewCustomButtonTappedInFormInputSession:(id <_WKFormInputSession>)inputSession;
- (void)_webView:(WKWebView *)webView insertTextSuggestion:(UITextSuggestion *)suggestion inInputSession:(id <_WKFormInputSession>)inputSession WK_API_AVAILABLE(ios(10.0));
- (BOOL)_webView:(WKWebView *)webView focusRequiresStrongPasswordAssistance:(id <_WKFocusedElementInfo>)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+- (CGFloat)_webView:(WKWebView *)webView focusedElementContextViewHeightForFittingSize:(CGSize)fittingSize inputSession:(id <_WKFormInputSession>)inputSession WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (UIView *)_webView:(WKWebView *)webView focusedElementContextViewForInputSession:(id <_WKFormInputSession>)inputSession WK_API_AVAILABLE(ios(WK_IOS_TBA));
#endif
@end
BOOL _resigningFirstResponder;
BOOL _needsDeferredEndScrollingSelectionUpdate;
BOOL _isChangingFocus;
+ BOOL _isBlurringFocusedNode;
BOOL _focusRequiresStrongPasswordAssistance;
- (void)_didChangeDataInteractionCaretRect:(CGRect)previousRect currentRect:(CGRect)rect;
#endif
+- (void)reloadContextViewForPresentedListViewController;
+
@end
@interface WKContentView (WKTesting)
_contentView = nil;
}
+- (void)reloadFocusedElementContextView
+{
+ [_contentView reloadContextViewForPresentedListViewController];
+}
+
@end
@implementation WKFocusedElementInfo {
_showDebugTapHighlightsForFastClicking = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitShowFastClickDebugTapHighlights"];
_needsDeferredEndScrollingSelectionUpdate = NO;
_isChangingFocus = NO;
+ _isBlurringFocusedNode = NO;
}
- (void)cleanupInteraction
- (void)_stopAssistingNode
{
+ SetForScope<BOOL> isBlurringFocusedNodeForScope { _isBlurringFocusedNode, YES };
+
[_formInputSession invalidate];
_formInputSession = nil;
});
}
+- (void)reloadContextViewForPresentedListViewController
+{
+#if ENABLE(EXTRA_ZOOM_MODE)
+ [_textInputListViewController reloadContextView];
+#endif
+}
+
#if ENABLE(EXTRA_ZOOM_MODE)
- (void)dismissAllInputViewControllers
- (void)focusedFormControllerDidUpdateSuggestions:(WKFocusedFormControlViewController *)controller
{
- [_textInputListViewController reloadTextSuggestions];
+ if (!_isBlurringFocusedNode)
+ [_textInputListViewController reloadTextSuggestions];
}
#pragma mark - WKSelectMenuViewControllerDelegate