Commit b042a7e5 authored by paulmiller's avatar paulmiller Committed by Commit bot

A11y: Don't accounce password keystrokes twice

When typing passwords on Android, TalkBack first announces the letter
from the keyboard. When the letter is inserted into the password field,
there is an AX_EVENT_TEXT_CHANGED, and TalkBack annaunces the inserted
letter as "dot". Then after a delay, SecureTextTimer replaces the letter
with a dot, causing a second AX_EVENT_TEXT_CHANGED, and TalkBack
announces "dot" again. This suppresses the second AX_EVENT_TEXT_CHANGED.

BUG=716212

Review-Url: https://codereview.chromium.org/2846133002
Cr-Commit-Position: refs/heads/master@{#468393}
parent 2b18a942
......@@ -1783,7 +1783,8 @@ void LayoutText::SecureText(UChar mask) {
void LayoutText::SetText(PassRefPtr<StringImpl> text, bool force) {
DCHECK(text);
if (!force && Equal(text_.Impl(), text.Get()))
bool equal = Equal(text_.Impl(), text.Get());
if (equal && !force)
return;
SetTextInternal(std::move(text));
......@@ -1796,8 +1797,14 @@ void LayoutText::SetText(PassRefPtr<StringImpl> text, bool force) {
LayoutInvalidationReason::kTextChanged);
known_to_have_no_overflow_and_no_fallback_fonts_ = false;
if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache())
cache->TextChanged(this);
// Don't bother updating the AX tree if there's no change. Otherwise, when
// typing in password fields, we would announce each "dot" twice: once when a
// character is typed, and second when that character is hidden.
if (!equal) {
AXObjectCache* cache = GetDocument().ExistingAXObjectCache();
if (cache)
cache->TextChanged(this);
}
TextAutosizer* text_autosizer = GetDocument().GetTextAutosizer();
if (text_autosizer)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment