0

Disable input context in password field.

This CL reverts https://chromium-review.googlesource.com/c/chromium/src/+/1351151
that removed the input context restriction from password field.
This is because it is normal for Mac OS X password input fields to
not allow dead keys or non ASCII input methods. There is also a
privacy risk if the composition candidate window shows your password
when the user is "composing" inside a password field.
I think we should just disable IMEs for password field until we
find a solution that allows dead keys but doesn't show any suggestion
or autocorrects words.

Bug: 1196101, 895434

Change-Id: I9b26090926368f4ee047ea1222dab93df822321e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2827360
Commit-Queue: Anupam Snigdha <snianu@microsoft.com>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873002}
This commit is contained in:
Anupam Snigdha
2021-04-15 19:47:44 +00:00
committed by Chromium LUCI CQ
parent 3825d94546
commit 6e20df72fc

@ -1848,11 +1848,17 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
}
// Each RenderWidgetHostViewCocoa has its own input context, but we return
// nil when the caret is in non-editable content to avoid making input methods
// do their work.
// nil when the caret is in non-editable content or password box to avoid
// making input methods do their work.
// We disable input method inside password field as it is normal for Mac OS X
// password input fields to not allow dead keys or non ASCII input methods.
// There is also a privacy risk if the composition candidate window shows your
// password when the user is "composing" inside a password field. See
// crbug.com/1196101 for more info.
- (NSTextInputContext*)inputContext {
switch (_textInputType) {
case ui::TEXT_INPUT_TYPE_NONE:
case ui::TEXT_INPUT_TYPE_PASSWORD:
return nil;
default:
return [super inputContext];