Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 926918ec35d91e1c20a16e5e43ce483fc06e3bad https://github.com/WebKit/WebKit/commit/926918ec35d91e1c20a16e5e43ce483fc06e3bad Author: Aditya Keerthi <akeer...@apple.com> Date: 2024-05-01 (Wed, 01 May 2024)
Changed paths: M Source/WebCore/editing/cocoa/AutofillElements.cpp M Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm Log Message: ----------- [iOS] Unable to autofill username-only pages in WKWebView https://bugs.webkit.org/show_bug.cgi?id=273538 rdar://126970887 Reviewed by Wenson Hsieh and Abrar Rahman Protyasha. As a result of UIKit / AutoFillUI changes in iOS 17.4, username autofill is now displayed as a suggestion in the keyboard candidates bar on pages that separate out their username and password fields, like yahoo.com. Previously, this autofill flow was only available to pages that contained both a username and password field together. However, the introduction of standalone username support was a consequence of other feature work, and never explicitly tested in WKWebView. Due to the way autofill text suggestions are set up in WebKit, attempting to autofill a standalone username field, simply drops the content. Specifically, `AutofillElements::computeAutofillElements` returns `std::nullopt` if no password field is present. This means that when a username is autofilled using `-[WKContentView insertTextSuggestion:]` and `WebPageProxy::autofillLoginCredentials`, the data is simply dropped by an early return in `WebPage::autofillLoginCredentials`. Fix by updating `AutofillElements::computeAutofillElements` to handle the username-only case. * Source/WebCore/editing/cocoa/AutofillElements.cpp: (WebCore::AutofillElements::computeAutofillElements): Support for autofilling specific fields is already present in `AutofillElements::autofill`, which null checks each individual autofill element, including the username field. However, this method currently returns no elements in the case where only a username field is present. Update to return the username field in the case where the `autocomplete` value is "username". This restriction corresponds to the specification of `UITextContentTypeUsername` on the UI process side. * Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm: (TestWebKitAPI::TEST(WKWebViewAutoFillTests, StandaloneUsernameField)): Canonical link: https://commits.webkit.org/278215@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes