Title: [228605] trunk/Source/WebKit
Revision
228605
Author
[email protected]
Date
2018-02-18 09:51:49 -0800 (Sun, 18 Feb 2018)

Log Message

Set the appropriate AutoFill context for suggested passwords.
https://bugs.webkit.org/show_bug.cgi?id=182718
<rdar://problem/36326863>

Patch by Reza Abbasian <[email protected]> on 2018-02-18
Reviewed by Wenson Hsieh and Tim Horton.

Before starting the input session, call the new delegate to query if AutoFill password suggestion assistance
is required for the focused element.

* UIProcess/API/Cocoa/_WKFormInputSession.h:
* UIProcess/API/Cocoa/_WKInputDelegate.h:
Introduce a new delegate to be called  before starting an input session to query if AutoFill password suggestion
assistance is required for the focused element.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession initWithContentView:focusedElementInfo:requiresStrongPasswordAssistance:]):
(-[WKFormInputSession requiresStrongPasswordAssistance]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
Call the delegate to find out if AutoFill suggested password assistance is required.
(-[WKContentView _stopAssistingNode]):
(-[WKContentView _autofillContext]): If the first responder is a password element and requires
assistance for AutoFill suggested password, set the appropriate AutoFill context.
(-[WKFormInputSession initWithContentView:focusedElementInfo:]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (228604 => 228605)


--- trunk/Source/WebKit/ChangeLog	2018-02-18 17:12:56 UTC (rev 228604)
+++ trunk/Source/WebKit/ChangeLog	2018-02-18 17:51:49 UTC (rev 228605)
@@ -1,3 +1,30 @@
+2018-02-18  Reza Abbasian  <[email protected]>
+
+        Set the appropriate AutoFill context for suggested passwords.
+        https://bugs.webkit.org/show_bug.cgi?id=182718
+        <rdar://problem/36326863>
+
+        Reviewed by Wenson Hsieh and Tim Horton.
+
+        Before starting the input session, call the new delegate to query if AutoFill password suggestion assistance
+        is required for the focused element.
+
+        * UIProcess/API/Cocoa/_WKFormInputSession.h:
+        * UIProcess/API/Cocoa/_WKInputDelegate.h:
+        Introduce a new delegate to be called  before starting an input session to query if AutoFill password suggestion
+        assistance is required for the focused element.
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKFormInputSession initWithContentView:focusedElementInfo:requiresStrongPasswordAssistance:]):
+        (-[WKFormInputSession requiresStrongPasswordAssistance]):
+        (-[WKContentView cleanupInteraction]):
+        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
+        Call the delegate to find out if AutoFill suggested password assistance is required.
+        (-[WKContentView _stopAssistingNode]):
+        (-[WKContentView _autofillContext]): If the first responder is a password element and requires
+        assistance for AutoFill suggested password, set the appropriate AutoFill context.
+        (-[WKFormInputSession initWithContentView:focusedElementInfo:]): Deleted.
+
 2018-02-17  Wenson Hsieh  <[email protected]>
 
         [Extra zoom mode] Form control values are stale after dismissing and representing input view controllers

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFormInputSession.h (228604 => 228605)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFormInputSession.h	2018-02-18 17:12:56 UTC (rev 228604)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFormInputSession.h	2018-02-18 17:51:49 UTC (rev 228605)
@@ -44,6 +44,7 @@
 @property (nonatomic, copy) NSArray<UITextSuggestion *> *suggestions WK_API_AVAILABLE(ios(10.0));
 @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));
 #endif
 
 @end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInputDelegate.h (228604 => 228605)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInputDelegate.h	2018-02-18 17:12:56 UTC (rev 228604)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInputDelegate.h	2018-02-18 17:51:49 UTC (rev 228605)
@@ -45,6 +45,7 @@
 - (BOOL)_webView:(WKWebView *)webView focusShouldStartInputSession:(id <_WKFocusedElementInfo>)info;
 - (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));
 #endif
 
 @end

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (228604 => 228605)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-02-18 17:12:56 UTC (rev 228604)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-02-18 17:51:49 UTC (rev 228605)
@@ -236,6 +236,8 @@
     BOOL _needsDeferredEndScrollingSelectionUpdate;
     BOOL _isChangingFocus;
 
+    BOOL _focusRequiresStrongPasswordAssistance;
+
 #if ENABLE(DATA_INTERACTION)
     WebKit::DragDropInteractionState _dragDropInteractionState;
     RetainPtr<UIDragInteraction> _dragInteraction;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (228604 => 228605)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-02-18 17:12:56 UTC (rev 228604)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-02-18 17:51:49 UTC (rev 228605)
@@ -276,7 +276,7 @@
 
 @interface WKFormInputSession : NSObject <_WKFormInputSession>
 
-- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo;
+- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo requiresStrongPasswordAssistance:(BOOL)requiresStrongPasswordAssistance;
 - (void)invalidate;
 
 @end
@@ -288,9 +288,10 @@
     RetainPtr<NSArray<UITextSuggestion *>> _suggestions;
     BOOL _accessoryViewShouldNotShow;
     BOOL _forceSecureTextEntry;
+    BOOL _requiresStrongPasswordAssistance;
 }
 
-- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo
+- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo requiresStrongPasswordAssistance:(BOOL)requiresStrongPasswordAssistance
 {
     if (!(self = [super init]))
         return nil;
@@ -297,6 +298,7 @@
 
     _contentView = view;
     _focusedElementInfo = elementInfo;
+    _requiresStrongPasswordAssistance = requiresStrongPasswordAssistance;
 
     return self;
 }
@@ -385,6 +387,11 @@
     [suggestionDelegate setSuggestions:suggestions];
 }
 
+- (BOOL)requiresStrongPasswordAssistance
+{
+    return _requiresStrongPasswordAssistance;
+}
+
 - (void)invalidate
 {
     id <UITextInputSuggestionDelegate> suggestionDelegate = (id <UITextInputSuggestionDelegate>)_contentView.inputDelegate;
@@ -660,6 +667,8 @@
     [_highlightView removeFromSuperview];
     _outstandingPositionInformationRequest = std::nullopt;
 
+    _focusRequiresStrongPasswordAssistance = NO;
+
     if (_interactionViewsContainerView) {
         [self.layer removeObserver:self forKeyPath:@"transform"];
         [_interactionViewsContainerView removeFromSuperview];
@@ -4022,6 +4031,10 @@
     if (_assistedNodeInformation.elementType == information.elementType && _assistedNodeInformation.elementRect == information.elementRect)
         return;
 
+    _focusRequiresStrongPasswordAssistance = NO;
+    if ([inputDelegate respondsToSelector:@selector(_webView:focusRequiresStrongPasswordAssistance:)])
+        _focusRequiresStrongPasswordAssistance = [inputDelegate _webView:_webView focusRequiresStrongPasswordAssistance:focusedElementInfo.get()];
+
     BOOL editableChanged = [self setIsEditable:YES];
     _assistedNodeInformation = information;
     _inputPeripheral = nil;
@@ -4065,7 +4078,7 @@
     [_inputPeripheral beginEditing];
 
     if ([inputDelegate respondsToSelector:@selector(_webView:didStartInputSession:)]) {
-        _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get()]);
+        _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get() requiresStrongPasswordAssistance:_focusRequiresStrongPasswordAssistance]);
         [inputDelegate _webView:_webView didStartInputSession:_formInputSession.get()];
     }
     
@@ -4081,6 +4094,7 @@
 
     _assistedNodeInformation.elementType = InputType::None;
     _inputPeripheral = nil;
+    _focusRequiresStrongPasswordAssistance = NO;
 
     [self _stopAssistingKeyboard];
     [_formAccessoryView hideAutoFillButton];
@@ -5105,14 +5119,18 @@
 
 - (NSDictionary *)_autofillContext
 {
-    if (_assistedNodeInformation.elementType == InputType::None || !_assistedNodeInformation.acceptsAutofilledLoginCredentials)
+    BOOL provideStrongPasswordAssistance = _focusRequiresStrongPasswordAssistance && _assistedNodeInformation.elementType == InputType::Password;
+    if (_assistedNodeInformation.elementType == InputType::None || (!_assistedNodeInformation.acceptsAutofilledLoginCredentials && !provideStrongPasswordAssistance))
         return nil;
 
+    if (provideStrongPasswordAssistance)
+        return @{ @"_automaticPasswordKeyboard" : @YES };
+
     NSURL *platformURL = _assistedNodeInformation.representingPageURL;
-    if (!platformURL)
-        return nil;
+    if (platformURL)
+        return @{ @"_WebViewURL" : platformURL };
 
-    return @{ @"_WebViewURL" : platformURL };
+    return nil;
 }
 
 #pragma mark - UIDragInteractionDelegate
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to