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

Unified Diff: content/browser/accessibility/browser_accessibility_android.cc

Issue 2881723002: Fix TalkBack feedback for password fields in Android O (Closed)
Patch Set: Address feedback Created 3 years, 7 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
Index: content/browser/accessibility/browser_accessibility_android.cc
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc
index 8028085036e6dae75f7e02b7a38457ee83836385..ac6841e92acc6bceab3d90904382895e0556a7cd 100644
--- a/content/browser/accessibility/browser_accessibility_android.cc
+++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -77,9 +77,16 @@ base::string16 BrowserAccessibilityAndroid::GetValue() const {
// Optionally replace entered password text with bullet characters
// based on a user preference.
if (IsPassword()) {
- bool should_expose = static_cast<BrowserAccessibilityManagerAndroid*>(
- manager())->ShouldExposePasswordText();
- if (!should_expose) {
+ auto* manager =
+ static_cast<BrowserAccessibilityManagerAndroid*>(this->manager());
+ if (manager->ShouldRespectDisplayedPasswordText()) {
+ // In the Chrome accessibility tree, the value of a password node is
+ // unobscured. However, if ShouldRespectDisplayedPasswordText() returns
+ // true we should try to expose whatever's actually visually displayed,
+ // whether that's the actual password or dots or whatever. To do this
+ // we rely on the password field's shadow dom.
+ value = base::UTF8ToUTF16(ComputeAccessibleNameFromDescendants());
+ } else if (!manager->ShouldExposePasswordText()) {
value = base::string16(value.size(), ui::kSecurePasswordBullet);
}
}

Powered by Google App Engine
This is Rietveld 408576698