Changeset 247804 in webkit
- Timestamp:
- Jul 24, 2019, 5:44:58 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r247793 r247804 1 2019-07-24 Priyanka Agarwal <pagarwal999@apple.com> 2 3 Allow Clients to Add Fields to the AutoFillContext Dictionary 4 https://bugs.webkit.org/show_bug.cgi?id=199326 5 rdar://problem/42816957 6 7 Reviewed by Wenson Hsieh. 8 9 * UIProcess/API/Cocoa/_WKInputDelegate.h: 10 Added function declaration for function which returns additional dictionary for autofillcontext 11 12 * UIProcess/ios/WKContentViewInteraction.h: 13 Created dictionary for additional autofillcontext 14 15 * UIProcess/ios/WKContentViewInteraction.mm: 16 (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): 17 Populating additional dictionary for autofillcontext 18 19 (-[WKContentView _autofillContext]): 20 Adding new dictionary to the returned autofillcontext 21 1 22 2019-07-24 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInputDelegate.h
r242339 r247804 56 56 - (BOOL)_webView:(WKWebView *)webView focusRequiresStrongPasswordAssistance:(id <_WKFocusedElementInfo>)info WK_API_AVAILABLE(ios(12.0)); 57 57 58 - (NSDictionary<id, NSString *> *)_webViewAdditionalContextForStrongPasswordAssistance:(WKWebView *)webView WK_API_AVAILABLE(ios(WK_IOS_TBA)); 59 58 60 - (BOOL)_webView:(WKWebView *)webView shouldRevealFocusOverlayForInputSession:(id <_WKFormInputSession>)inputSession WK_API_AVAILABLE(ios(12.0)); 59 61 - (CGFloat)_webView:(WKWebView *)webView focusedElementContextViewHeightForFittingSize:(CGSize)fittingSize inputSession:(id <_WKFormInputSession>)inputSession WK_API_AVAILABLE(ios(12.0)); -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r247746 r247804 356 356 CompletionHandler<void(WebCore::DOMPasteAccessResponse)> _domPasteRequestHandler; 357 357 BlockPtr<void(UIWKAutocorrectionContext *)> _pendingAutocorrectionContextHandler; 358 359 RetainPtr<NSDictionary> _additionalContextForStrongPasswordAssistance; 358 360 359 361 #if ENABLE(DATA_INTERACTION) -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r247746 r247804 850 850 851 851 _focusRequiresStrongPasswordAssistance = NO; 852 _additionalContextForStrongPasswordAssistance = nil; 852 853 _waitingForEditDragSnapshot = NO; 853 854 … … 5314 5315 5315 5316 _focusRequiresStrongPasswordAssistance = NO; 5317 _additionalContextForStrongPasswordAssistance = nil; 5316 5318 if ([inputDelegate respondsToSelector:@selector(_webView:focusRequiresStrongPasswordAssistance:)]) 5317 5319 _focusRequiresStrongPasswordAssistance = [inputDelegate _webView:_webView focusRequiresStrongPasswordAssistance:focusedElementInfo.get()]; 5320 5321 if ([inputDelegate respondsToSelector:@selector(_webViewAdditionalContextForStrongPasswordAssistance:)]) 5322 _additionalContextForStrongPasswordAssistance = [inputDelegate _webViewAdditionalContextForStrongPasswordAssistance:_webView]; 5323 else 5324 _additionalContextForStrongPasswordAssistance = @{ }; 5318 5325 5319 5326 bool delegateImplementsWillStartInputSession = [inputDelegate respondsToSelector:@selector(_webView:willStartInputSession:)]; … … 5404 5411 _inputPeripheral = nil; 5405 5412 _focusRequiresStrongPasswordAssistance = NO; 5413 _additionalContextForStrongPasswordAssistance = nil; 5406 5414 5407 5415 #if USE(UIKIT_KEYBOARD_ADDITIONS) … … 6778 6786 6779 6787 if (provideStrongPasswordAssistance) 6780 return @{ @"_automaticPasswordKeyboard" : @YES };6788 return @{ @"_automaticPasswordKeyboard" : @YES, @"strongPasswordAdditionalContext" : _additionalContextForStrongPasswordAssistance.get() }; 6781 6789 6782 6790 NSURL *platformURL = _focusedElementInformation.representingPageURL; -
trunk/Tools/ChangeLog
r247781 r247804 1 2019-07-24 Priyanka Agarwal <pagarwal999@apple.com> 2 3 Allow Clients to Add Fields to the AutoFillContext Dictionary. 4 https://bugs.webkit.org/show_bug.cgi?id=199326 5 rdar://problem/42816957 6 7 Reviewed by Wenson Hsieh. 8 9 * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: 10 (TestWebKitAPI::TEST): Created a test to check that the auto fill context 11 is being properly populated with additional context dictionary. 12 13 * TestWebKitAPI/Tests/ios/TestInputDelegate.h: 14 * TestWebKitAPI/Tests/ios/TestInputDelegate.mm: 15 (-[TestInputDelegate setWebViewAdditionalContextForStrongPasswordAssistanceHandler:]): Setting the handler for the function 16 which will populate the additional autofill context dictionary. 17 18 (-[TestInputDelegate webViewAdditionalContextForStrongPasswordAssistanceHandler]): Returns the handler for the function which 19 populates the additional autofill context dictionary. 20 21 (-[TestInputDelegate _webViewAdditionalContextForStrongPasswordAssistance:]): Function which populates the additional autofill 22 context dictionary. 23 24 (-[TestInputDelegate setFocusRequiresStrongPasswordAssistanceHandler:]): Setting the handler for the function which checks if the 25 input field requires strong password work. 26 27 (-[TestInputDelegate focusRequiresStrongPasswordAssistanceHandler]): Returns the handler for the function which checks if the 28 input field requires strong password work. 29 30 (-[TestInputDelegate _webView:focusRequiresStrongPasswordAssistance:]): Function which checks if the input field requires strong 31 password work. 32 1 33 2019-07-24 Zhifei Fang <zhifei_fang@apple.com> 2 34 -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r247398 r247804 528 528 } 529 529 530 TEST(KeyboardInputTests, TestWebViewAdditionalContextForStrongPasswordAssistance) 531 { 532 NSDictionary *expected = @{ @"strongPasswordAdditionalContext" : @"testUUID" }; 533 534 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 535 auto inputDelegate = adoptNS([[TestInputDelegate alloc] init]); 536 537 [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy { 538 return _WKFocusStartsInputSessionPolicyAllow; 539 }]; 540 541 [inputDelegate setWebViewAdditionalContextForStrongPasswordAssistanceHandler:[&] (WKWebView *) { 542 return expected; 543 }]; 544 545 [inputDelegate setFocusRequiresStrongPasswordAssistanceHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) { 546 return YES; 547 }]; 548 549 [webView _setInputDelegate:inputDelegate.get()]; 550 551 [webView synchronouslyLoadHTMLString:@"<input type='password' id='input'>"]; 552 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.getElementById('input').focus()"]; 553 554 NSDictionary *actual = [[webView textInputContentView] _autofillContext]; 555 EXPECT_TRUE([[actual allValues] containsObject:expected]); 556 } 557 530 558 } // namespace TestWebKitAPI 531 559 -
trunk/Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.h
r246924 r247804 38 38 @property (nonatomic, copy) void (^willStartInputSessionHandler)(WKWebView *, id <_WKFormInputSession>); 39 39 @property (nonatomic, copy) void (^didStartInputSessionHandler)(WKWebView *, id <_WKFormInputSession>); 40 @property (nonatomic, copy) NSDictionary<id, NSString *> * (^webViewAdditionalContextForStrongPasswordAssistanceHandler)(WKWebView *); 41 @property (nonatomic, copy) BOOL (^focusRequiresStrongPasswordAssistanceHandler)(WKWebView *, id <_WKFocusedElementInfo>); 40 42 @end 41 43 -
trunk/Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.mm
r246924 r247804 35 35 BlockPtr<void(WKWebView *, id <_WKFormInputSession>)> _willStartInputSessionHandler; 36 36 BlockPtr<void(WKWebView *, id <_WKFormInputSession>)> _didStartInputSessionHandler; 37 BlockPtr<NSDictionary<id, NSString *> *(WKWebView *)> _webViewAdditionalContextForStrongPasswordAssistanceHandler; 38 BlockPtr<BOOL(WKWebView *, id <_WKFocusedElementInfo>)> _focusRequiresStrongPasswordAssistanceHandler; 37 39 } 38 40 … … 84 86 } 85 87 88 - (void)setWebViewAdditionalContextForStrongPasswordAssistanceHandler:(NSDictionary<id, NSString *> * (^)(WKWebView *))webViewAdditionalContextForStrongPasswordAssistanceHandler 89 { 90 _webViewAdditionalContextForStrongPasswordAssistanceHandler = makeBlockPtr(webViewAdditionalContextForStrongPasswordAssistanceHandler); 91 } 92 93 - (NSDictionary<id, NSString *> * (^)(WKWebView *))webViewAdditionalContextForStrongPasswordAssistanceHandler 94 { 95 return _webViewAdditionalContextForStrongPasswordAssistanceHandler.get(); 96 } 97 98 - (NSDictionary<id, NSString *> *)_webViewAdditionalContextForStrongPasswordAssistance:(WKWebView *)webView 99 { 100 if (_webViewAdditionalContextForStrongPasswordAssistanceHandler) 101 return _webViewAdditionalContextForStrongPasswordAssistanceHandler(webView); 102 return @{ }; 103 } 104 105 - (void)setFocusRequiresStrongPasswordAssistanceHandler:(BOOL (^)(WKWebView *, id <_WKFocusedElementInfo>))handler 106 { 107 _focusRequiresStrongPasswordAssistanceHandler = makeBlockPtr(handler); 108 } 109 110 - (BOOL (^)(WKWebView *, id <_WKFocusedElementInfo>))focusRequiresStrongPasswordAssistanceHandler 111 { 112 return _focusRequiresStrongPasswordAssistanceHandler.get(); 113 } 114 115 - (BOOL)_webView:(WKWebView *)webView focusRequiresStrongPasswordAssistance:(id <_WKFocusedElementInfo>)info 116 { 117 if (_focusRequiresStrongPasswordAssistanceHandler) 118 return _focusRequiresStrongPasswordAssistanceHandler(webView, info); 119 return NO; 120 } 121 86 122 @end 87 123
Note:
See TracChangeset
for help on using the changeset viewer.