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

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

Issue 302243002: Revert 274063 "Revert of Properly prioritize the sources of an a..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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
« no previous file with comments | « no previous file | trunk/src/content/test/data/accessibility/button-name-calc-expected-android.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/content/browser/accessibility/browser_accessibility_android.cc
===================================================================
--- trunk/src/content/browser/accessibility/browser_accessibility_android.cc (revision 274087)
+++ trunk/src/content/browser/accessibility/browser_accessibility_android.cc (working copy)
@@ -268,12 +268,29 @@
return base::string16();
}
+ // See comment in browser_accessibility_win.cc for details.
+ // The difference here is that we can only expose one accessible
+ // name on Android, not 2 or 3 like on Windows or Mac.
+ //
+ // The basic rule is: prefer description (aria-labelledby or aria-label),
+ // then help (title), then name (inner text), then value (control value).
+ // However, if title_elem_id is set, that means there's a label element
+ // supplying the name and then name takes precedence over help.
+ // TODO(dmazzoni): clean this up by providing more granular labels in
+ // Blink, making the platform-specific mapping to accessible text simpler.
base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION);
+ base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP);
+ int title_elem_id = GetIntAttribute(
+ ui::AX_ATTR_TITLE_UI_ELEMENT);
base::string16 text;
- if (!name().empty())
+ if (!description.empty())
+ text = description;
+ else if (title_elem_id && !name().empty())
text = base::UTF8ToUTF16(name());
- else if (!description.empty())
- text = description;
+ else if (!help.empty())
+ text = help;
+ else if (!name().empty())
+ text = base::UTF8ToUTF16(name());
else if (!value().empty())
text = base::UTF8ToUTF16(value());
« no previous file with comments | « no previous file | trunk/src/content/test/data/accessibility/button-name-calc-expected-android.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698