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

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js

Issue 2479593007: Expose images to accessibility (Closed)
Patch Set: A few more tests rebaselined. Created 4 years, 1 month 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: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
index 346ba920db95308cc57627a69cacd848d7c12334..9b3699c23603d73a400fe49e3b17c5e7c269db2f 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -446,6 +446,10 @@ Output.RULES = {
'$nameOrDescendants= ' +
'$if($hierarchicalLevel, @tag_h+$hierarchicalLevel, $role) $state'
},
+ image: {
+ speak: '$if($name, $name, $urlFilename) ' +
+ '$value $state $role $description',
+ },
inlineTextBox: {
speak: '$name='
},
@@ -1068,6 +1072,19 @@ Output.prototype = {
if (earcon)
options.annotation.push(earcon);
this.append_(buff, node.name, options);
+ } else if (token == 'urlFilename') {
+ options.annotation.push('name');
+ var url = node.url;
+ var filename = '';
+ if (url.substring(0, 4) != 'data') {
+ filename =
+ url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
+
+ // Hack to not speak the filename if it's ridiculously long.
+ if (filename.length >= 30)
+ filename = filename.substring(0, 16) + '...';
+ }
+ this.append_(buff, filename, options);
} else if (token == 'nameFromNode') {
if (chrome.automation.NameFromType[node.nameFrom] ==
'contents')

Powered by Google App Engine
This is Rietveld 408576698