Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2846133002: A11y: Don't accounce password keystrokes twice (Closed)
Patch Set: add comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index ca9647b0cbf9d4ccd0fe27939ad72f3b4707baff..4f9ec92340c8e311dbf4507b0559ab0e7bf8c9b2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698