Changeset 228605 in webkit


Ignore:
Timestamp:
Feb 18, 2018 9:51:49 AM (6 years ago)
Author:
commit-queue@webkit.org
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 <rabbasian@apple.com> 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.

Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r228602 r228605  
     12018-02-18  Reza Abbasian  <rabbasian@apple.com>
     2
     3        Set the appropriate AutoFill context for suggested passwords.
     4        https://bugs.webkit.org/show_bug.cgi?id=182718
     5        <rdar://problem/36326863>
     6
     7        Reviewed by Wenson Hsieh and Tim Horton.
     8
     9        Before starting the input session, call the new delegate to query if AutoFill password suggestion assistance
     10        is required for the focused element.
     11
     12        * UIProcess/API/Cocoa/_WKFormInputSession.h:
     13        * UIProcess/API/Cocoa/_WKInputDelegate.h:
     14        Introduce a new delegate to be called  before starting an input session to query if AutoFill password suggestion
     15        assistance is required for the focused element.
     16        * UIProcess/ios/WKContentViewInteraction.h:
     17        * UIProcess/ios/WKContentViewInteraction.mm:
     18        (-[WKFormInputSession initWithContentView:focusedElementInfo:requiresStrongPasswordAssistance:]):
     19        (-[WKFormInputSession requiresStrongPasswordAssistance]):
     20        (-[WKContentView cleanupInteraction]):
     21        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
     22        Call the delegate to find out if AutoFill suggested password assistance is required.
     23        (-[WKContentView _stopAssistingNode]):
     24        (-[WKContentView _autofillContext]): If the first responder is a password element and requires
     25        assistance for AutoFill suggested password, set the appropriate AutoFill context.
     26        (-[WKFormInputSession initWithContentView:focusedElementInfo:]): Deleted.
     27
    1282018-02-17  Wenson Hsieh  <wenson_hsieh@apple.com>
    229
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFormInputSession.h

    r205559 r228605  
    4545@property (nonatomic) BOOL accessoryViewShouldNotShow WK_API_AVAILABLE(ios(10.0));
    4646@property (nonatomic) BOOL forceSecureTextEntry WK_API_AVAILABLE(ios(10.0));
     47@property (nonatomic, readonly) BOOL requiresStrongPasswordAssistance WK_API_AVAILABLE(ios(WK_IOS_TBA));
    4748#endif
    4849
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInputDelegate.h

    r206084 r228605  
    4646- (void)_webView:(WKWebView *)webView accessoryViewCustomButtonTappedInFormInputSession:(id <_WKFormInputSession>)inputSession;
    4747- (void)_webView:(WKWebView *)webView insertTextSuggestion:(UITextSuggestion *)suggestion inInputSession:(id <_WKFormInputSession>)inputSession WK_API_AVAILABLE(ios(10.0));
     48- (BOOL)_webView:(WKWebView *)webView focusRequiresStrongPasswordAssistance:(id <_WKFocusedElementInfo>)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
    4849#endif
    4950
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r228557 r228605  
    237237    BOOL _isChangingFocus;
    238238
     239    BOOL _focusRequiresStrongPasswordAssistance;
     240
    239241#if ENABLE(DATA_INTERACTION)
    240242    WebKit::DragDropInteractionState _dragDropInteractionState;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r228602 r228605  
    277277@interface WKFormInputSession : NSObject <_WKFormInputSession>
    278278
    279 - (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo;
     279- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo requiresStrongPasswordAssistance:(BOOL)requiresStrongPasswordAssistance;
    280280- (void)invalidate;
    281281
     
    289289    BOOL _accessoryViewShouldNotShow;
    290290    BOOL _forceSecureTextEntry;
    291 }
    292 
    293 - (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo
     291    BOOL _requiresStrongPasswordAssistance;
     292}
     293
     294- (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo requiresStrongPasswordAssistance:(BOOL)requiresStrongPasswordAssistance
    294295{
    295296    if (!(self = [super init]))
     
    298299    _contentView = view;
    299300    _focusedElementInfo = elementInfo;
     301    _requiresStrongPasswordAssistance = requiresStrongPasswordAssistance;
    300302
    301303    return self;
     
    384386    _suggestions = adoptNS([suggestions copy]);
    385387    [suggestionDelegate setSuggestions:suggestions];
     388}
     389
     390- (BOOL)requiresStrongPasswordAssistance
     391{
     392    return _requiresStrongPasswordAssistance;
    386393}
    387394
     
    660667    [_highlightView removeFromSuperview];
    661668    _outstandingPositionInformationRequest = std::nullopt;
     669
     670    _focusRequiresStrongPasswordAssistance = NO;
    662671
    663672    if (_interactionViewsContainerView) {
     
    40234032        return;
    40244033
     4034    _focusRequiresStrongPasswordAssistance = NO;
     4035    if ([inputDelegate respondsToSelector:@selector(_webView:focusRequiresStrongPasswordAssistance:)])
     4036        _focusRequiresStrongPasswordAssistance = [inputDelegate _webView:_webView focusRequiresStrongPasswordAssistance:focusedElementInfo.get()];
     4037
    40254038    BOOL editableChanged = [self setIsEditable:YES];
    40264039    _assistedNodeInformation = information;
     
    40664079
    40674080    if ([inputDelegate respondsToSelector:@selector(_webView:didStartInputSession:)]) {
    4068         _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get()]);
     4081        _formInputSession = adoptNS([[WKFormInputSession alloc] initWithContentView:self focusedElementInfo:focusedElementInfo.get() requiresStrongPasswordAssistance:_focusRequiresStrongPasswordAssistance]);
    40694082        [inputDelegate _webView:_webView didStartInputSession:_formInputSession.get()];
    40704083    }
     
    40824095    _assistedNodeInformation.elementType = InputType::None;
    40834096    _inputPeripheral = nil;
     4097    _focusRequiresStrongPasswordAssistance = NO;
    40844098
    40854099    [self _stopAssistingKeyboard];
     
    51065120- (NSDictionary *)_autofillContext
    51075121{
    5108     if (_assistedNodeInformation.elementType == InputType::None || !_assistedNodeInformation.acceptsAutofilledLoginCredentials)
     5122    BOOL provideStrongPasswordAssistance = _focusRequiresStrongPasswordAssistance && _assistedNodeInformation.elementType == InputType::Password;
     5123    if (_assistedNodeInformation.elementType == InputType::None || (!_assistedNodeInformation.acceptsAutofilledLoginCredentials && !provideStrongPasswordAssistance))
    51095124        return nil;
    51105125
     5126    if (provideStrongPasswordAssistance)
     5127        return @{ @"_automaticPasswordKeyboard" : @YES };
     5128
    51115129    NSURL *platformURL = _assistedNodeInformation.representingPageURL;
    5112     if (!platformURL)
    5113         return nil;
    5114 
    5115     return @{ @"_WebViewURL" : platformURL };
     5130    if (platformURL)
     5131        return @{ @"_WebViewURL" : platformURL };
     5132
     5133    return nil;
    51165134}
    51175135
Note: See TracChangeset for help on using the changeset viewer.