Title: [273202] trunk
Revision
273202
Author
wenson_hs...@apple.com
Date
2021-02-20 10:17:33 -0800 (Sat, 20 Feb 2021)

Log Message

Unreviewed, reverting r273115.

Breaks autocorrect without the accompanying change in
rdar://problem/74211293

Reverted changeset:

"Unconditionally return information in _autofillContext SPI
when a field is focused"
https://bugs.webkit.org/show_bug.cgi?id=221828
https://commits.webkit.org/r273115

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273201 => 273202)


--- trunk/Source/WebKit/ChangeLog	2021-02-20 18:13:36 UTC (rev 273201)
+++ trunk/Source/WebKit/ChangeLog	2021-02-20 18:17:33 UTC (rev 273202)
@@ -1,3 +1,17 @@
+2021-02-20  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Unreviewed, reverting r273115.
+
+        Breaks autocorrect without the accompanying change in
+        rdar://problem/74211293
+
+        Reverted changeset:
+
+        "Unconditionally return information in _autofillContext SPI
+        when a field is focused"
+        https://bugs.webkit.org/show_bug.cgi?id=221828
+        https://commits.webkit.org/r273115
+
 2021-02-20  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, fix regression from r273194 that was spotted by Darin Adler after landing.

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (273201 => 273202)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-02-20 18:13:36 UTC (rev 273201)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-02-20 18:17:33 UTC (rev 273202)
@@ -8117,23 +8117,18 @@
 
 - (NSDictionary *)_autofillContext
 {
-    if (!self._hasFocusedElement)
+    BOOL provideStrongPasswordAssistance = _focusRequiresStrongPasswordAssistance && _focusedElementInformation.elementType == WebKit::InputType::Password;
+    if (!self._hasFocusedElement || (!_focusedElementInformation.acceptsAutofilledLoginCredentials && !provideStrongPasswordAssistance))
         return nil;
 
-    auto context = adoptNS([[NSMutableDictionary alloc] init]);
-    context.get()[@"_WKAutofillContextVersion"] = @(2);
+    if (provideStrongPasswordAssistance)
+        return @{ @"_automaticPasswordKeyboard" : @YES, @"strongPasswordAdditionalContext" : _additionalContextForStrongPasswordAssistance.get() };
 
-    if (_focusRequiresStrongPasswordAssistance && _focusedElementInformation.elementType == WebKit::InputType::Password) {
-        context.get()[@"_automaticPasswordKeyboard"] = @YES;
-        context.get()[@"strongPasswordAdditionalContext"] = _additionalContextForStrongPasswordAssistance.get();
-    } else if (_focusedElementInformation.acceptsAutofilledLoginCredentials)
-        context.get()[@"_acceptsLoginCredentials"] = @YES;
-
     NSURL *platformURL = _focusedElementInformation.representingPageURL;
     if (platformURL)
-        context.get()[@"_WebViewURL"] = platformURL;
+        return @{ @"_WebViewURL" : platformURL };
 
-    return context.autorelease();
+    return nil;
 }
 
 - (BOOL)supportsImagePaste

Modified: trunk/Tools/ChangeLog (273201 => 273202)


--- trunk/Tools/ChangeLog	2021-02-20 18:13:36 UTC (rev 273201)
+++ trunk/Tools/ChangeLog	2021-02-20 18:17:33 UTC (rev 273202)
@@ -1,3 +1,17 @@
+2021-02-20  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Unreviewed, reverting r273115.
+
+        Breaks autocorrect without the accompanying change in
+        rdar://problem/74211293
+
+        Reverted changeset:
+
+        "Unconditionally return information in _autofillContext SPI
+        when a field is focused"
+        https://bugs.webkit.org/show_bug.cgi?id=221828
+        https://commits.webkit.org/r273115
+
 2021-02-20  Aakash Jain  <aakash_j...@apple.com>
 
         Revert r272384 [Python-3] Change shebang in git-webkit

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (273201 => 273202)


--- trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm	2021-02-20 18:13:36 UTC (rev 273201)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm	2021-02-20 18:17:33 UTC (rev 273202)
@@ -689,7 +689,6 @@
 
     NSDictionary *actual = [[webView textInputContentView] _autofillContext];
     EXPECT_TRUE([[actual allValues] containsObject:expected]);
-    EXPECT_TRUE([actual[@"_automaticPasswordKeyboard"] boolValue]);
 }
 
 TEST(KeyboardInputTests, TestWebViewAccessoryDoneDuringStrongPasswordAssistance)

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm (273201 => 273202)


--- trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm	2021-02-20 18:13:36 UTC (rev 273201)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm	2021-02-20 18:17:33 UTC (rev 273202)
@@ -66,16 +66,14 @@
     return (AutoFillInputView *)self.textInputContentView;
 }
 
-- (BOOL)acceptsAutoFillLoginCredentials
+- (BOOL)textInputHasAutoFillContext
 {
-    auto context = self._autofillInputView._autofillContext;
-    if (!context)
+    NSURL *url = "" objectForKey:@"_WebViewURL"];
+    if (![url isKindOfClass:[NSURL class]])
         return NO;
 
-    NSURL *url = ""
-    EXPECT_TRUE([url isKindOfClass:NSURL.class]);
     EXPECT_WK_STREQ([self stringByEvaluatingJavaScript:@"document.URL"], url.absoluteString);
-    return [context[@"_acceptsLoginCredentials"] boolValue];
+    return YES;
 }
 
 @end
@@ -87,10 +85,10 @@
     auto webView = adoptNS([[AutoFillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input id='password' type='password'>"];
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"user.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
     [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion];
@@ -98,7 +96,7 @@
     EXPECT_WK_STREQ("famos", [webView stringByEvaluatingJavaScript:@"password.value"]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"];
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 }
 
 TEST(WKWebViewAutoFillTests, UsernameAndPasswordFieldSeparatedByRadioButton)
@@ -106,10 +104,10 @@
     auto webView = adoptNS([[AutoFillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input type='radio' name='radio_button' value='radio'><input id='password' type='password'>"];
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"user.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
     [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion];
@@ -118,7 +116,7 @@
     EXPECT_WK_STREQ("famos", [webView stringByEvaluatingJavaScript:@"password.value"]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"];
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 }
 
 TEST(WKWebViewAutoFillTests, TwoTextFields)
@@ -126,10 +124,10 @@
     auto webView = adoptNS([[AutoFillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadHTMLString:@"<input id='text1' type='email'><input id='text2' type='text'>"];
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"text1.focus()"];
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"text2.focus()"];
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 }
 
 TEST(WKWebViewAutoFillTests, StandalonePasswordField)
@@ -137,7 +135,7 @@
     auto webView = adoptNS([[AutoFillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadHTMLString:@"<input id='password' type='password'>"];
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
     [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion];
@@ -145,7 +143,7 @@
     EXPECT_WK_STREQ("famos", [webView stringByEvaluatingJavaScript:@"password.value"]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"];
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 }
 
 TEST(WKWebViewAutoFillTests, StandaloneTextField)
@@ -153,7 +151,7 @@
     auto webView = adoptNS([[AutoFillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadHTMLString:@"<input id='textfield' type='text'>"];
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"textfield.focus()"];
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 }
 
 TEST(WKWebViewAutoFillTests, AccountCreationPage)
@@ -161,13 +159,13 @@
     auto webView = adoptNS([[AutoFillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input id='password' type='password'><input id='confirm_password' type='password'>"];
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"user.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 
     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"confirm_password.focus()"];
-    EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_TRUE([webView textInputHasAutoFillContext]);
 }
 
 static BOOL overrideIsInHardwareKeyboardMode()
@@ -189,7 +187,7 @@
     [webView stringByEvaluatingJavaScript:@"user.focus()"];
     Util::run(&done);
 
-    EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
+    EXPECT_FALSE([webView textInputHasAutoFillContext]);
 }
 
 #if PLATFORM(WATCHOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to