-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 265870.476@safari-7616-branch (5cfdf9b). https://bugs.web…
…kit.org/show_bug.cgi?id=260864 [iOS] Keyboard should not learn autocorrections after revealing password in Gmail login flow https://bugs.webkit.org/show_bug.cgi?id=260864 rdar://111393742 Reviewed by Aditya Keerthi. When focusing and editing secure inputs (i.e. input type="password"), we set `isSecureTextEntry` on `UITextInputTraits` to `YES`, which disables autocorrection learning when the user types in this field, suppresses the keyboard in screen recordings, and more. However, some webpages (e.g. Gmail login) offer the ability to reveal the password as plain text as a convenience to the user — this typically works by changing the input type from `"password"` to just `"text"`. This currently causes all of the secure text entry behaviors to be disabled, which includes disabling correction learning; this is undesirable, since the password may be offered as an autocorrection candidate when editing in other plain text fields in the future, in non-secure contexts. Because the user opted to reveal the input, it doesn't really make sense to treat the input as fully secure (for instance, there's no reason to suppress keyboard visibility in screen recordings if the password text itself is fully visible). However, we need to (at least) prevent the keyboard from learning suggestions when typing in this field. To achieve this, we add a flag on `HTMLInputElement` to remember whether it was ever a password field; if so, we set the `-learnsCorrections` property on text input traits to `NO`. Test: AutocorrectionTests.DoNotLearnCorrectionsAfterChangingInputTypeFromPassword * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::runPostTypeUpdateTasks): Set `m_hasEverBeenPasswordField` here. * Source/WebCore/html/HTMLInputElement.h: (WebCore::HTMLInputElement::hasEverBeenPasswordField const): * Source/WebKit/Platform/spi/ios/UIKitSPI.h: * Source/WebKit/Shared/FocusedElementInformation.h: * Source/WebKit/Shared/FocusedElementInformation.serialization.in: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _updateTextInputTraits:]): Consult `hasEverBeenPasswordField` on the focused element information, and disable learning from corrections if it's set. * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: Propagate `hasEverBeenPasswordField` state to the UI process when focusing an input element. (WebKit::WebPage::focusedElementInformation): * Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm: Add an API test to exercise the change. * Tools/TestWebKitAPI/ios/UIKitSPI.h: Canonical link: https://commits.webkit.org/265870.476@safari-7616-branch
- Loading branch information
Showing
9 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters