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

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

Issue 2132123002: Complete table support in ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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: chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
index a12746031dc1b2101ed3beaa8174a5a0da17b8e4..164dab8246699c3647e7f4a03f43596dce38e5b1 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
@@ -198,6 +198,7 @@ CommandHandler.onCommand = function(command) {
var dir = Dir.FORWARD;
var pred = null;
var predErrorMsg = undefined;
+ var rootPred = AutomationPredicate.root;
var speechProps = {};
switch (command) {
case 'nextCharacter':
@@ -466,6 +467,102 @@ CommandHandler.onCommand = function(command) {
return false;
}
break;
+ case 'fullyDescribe':
+ var o = new Output();
+ o.withContextFirst()
+ .withRichSpeechAndBraille(current, null, Output.EventType.NAVIGATE)
+ .go();
+ return false;
+
+ // Table commands.
+ case 'previousRow':
+ dir = Dir.BACKWARD;
+ var tableOpts = {row: true, dir: dir};
+ pred = AutomationPredicate.makeTableCellPredicate(
+ current.start.node, tableOpts);
+ predErrorMsg = 'no_cell_above';
+ rootPred = AutomationPredicate.table;
+ break;
+ case 'previousCol':
+ dir = Dir.BACKWARD;
+ var tableOpts = {col: true, dir: dir};
+ pred = AutomationPredicate.makeTableCellPredicate(
+ current.start.node, tableOpts);
+ predErrorMsg = 'no_cell_left';
+ rootPred = AutomationPredicate.row;
+ break;
+ case 'nextRow':
+ dir = Dir.FORWARD;
+ var tableOpts = {row: true, dir: dir};
+ pred = AutomationPredicate.makeTableCellPredicate(
+ current.start.node, tableOpts);
+ predErrorMsg = 'no_cell_below';
+ rootPred = AutomationPredicate.table;
+ break;
+ case 'nextCol':
+ dir = Dir.FORWARD;
+ var tableOpts = {col: true, dir: dir};
+ pred = AutomationPredicate.makeTableCellPredicate(
+ current.start.node, tableOpts);
+ predErrorMsg = 'no_cell_right';
+ rootPred = AutomationPredicate.row;
+ break;
+ case 'goToRowFirstCell':
+ case 'goToRowLastCell':
+ var node = current.start.node;
+ while (node && node.role != RoleType.row)
+ node = node.parent;
+ if (!node)
+ break;
+ var end = AutomationUtil.findNodePost(node,
+ command == 'goToRowLastCell' ? Dir.BACKWARD : Dir.FORWARD,
+ AutomationPredicate.leaf);
+ if (end)
+ current = cursors.Range.fromNode(end);
+ break;
+ case 'goToColFirstCell':
+ dir = Dir.FORWARD;
+ var node = current.start.node;
+ while (node && node.role != RoleType.table)
+ node = node.parent;
+ if (!node || !node.firstChild)
+ return false;
+ var tableOpts = {col: true, dir: dir, end: true};
+ pred = AutomationPredicate.makeTableCellPredicate(
+ current.start.node, tableOpts);
+ current = cursors.Range.fromNode(node.firstChild);
+ // Should not be outputted.
+ predErrorMsg = 'no_cell_above';
+ rootPred = AutomationPredicate.table;
+ break;
+ case 'goToColLastCell':
+ dir = Dir.BACKWARD;
+ var node = current.start.node;
+ while (node && node.role != RoleType.table)
+ node = node.parent;
+ if (!node || !node.lastChild)
+ return false;
+ var tableOpts = {col: true, dir: dir, end: true};
+ pred = AutomationPredicate.makeTableCellPredicate(
+ current.start.node, tableOpts);
+ current = cursors.Range.fromNode(node.lastChild);
+ // Should not be outputted.
+ predErrorMsg = 'no_cell_below';
+ rootPred = AutomationPredicate.table;
+ break;
+ case 'goToFirstCell':
+ case 'goToLastCell':
+ node = current.start.node;
+ while (node && node.role != RoleType.table)
+ node = node.parent;
+ if (!node)
+ break;
+ var end = AutomationUtil.findNodePost(node,
+ command == 'goToLastCell' ? Dir.BACKWARD : Dir.FORWARD,
+ AutomationPredicate.leaf);
+ if (end)
+ current = cursors.Range.fromNode(end);
+ break;
default:
return true;
}

Powered by Google App Engine
This is Rietveld 408576698