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

Unified Diff: chrome/browser/resources/chromeos/chromevox/common/description_util.js

Issue 1774743002: Fix some ChromeVox Closure compiler errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/common/description_util.js
diff --git a/chrome/browser/resources/chromeos/chromevox/common/description_util.js b/chrome/browser/resources/chromeos/chromevox/common/description_util.js
index d7bece47b98326280cc4cff73ed232f23388c00a..c6145fc0e8f5f4756f17ba3730172e1d0503884f 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/description_util.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/description_util.js
@@ -301,8 +301,8 @@ cvox.DescriptionUtil.getRawDescriptions_ = function(prevSel, sel) {
/**
* Returns the full descriptions of the child nodes that would be gotten by an
* object walker.
- * @param {?Element} prevnode The previous element if there is one.
- * @param {!Element} node The target element.
+ * @param {?Node} prevnode The previous element if there is one.
+ * @param {!Node} node The target element.
* @return {!Array<!cvox.NavDescription>} The descriptions.
*/
cvox.DescriptionUtil.getFullDescriptionsFromChildren =
@@ -330,21 +330,22 @@ cvox.DescriptionUtil.getFullDescriptionsFromChildren =
if (!curSel) {
return descriptions;
}
- node = cvox.DescriptionUtil.subWalker_.sync(curSel).start.node;
- curSel = cvox.CursorSelection.fromNode(node);
+ var newNode = cvox.DescriptionUtil.subWalker_.sync(curSel).start.node;
+ curSel = cvox.CursorSelection.fromNode(newNode);
if (!curSel) {
return descriptions;
}
- while (cvox.DomUtil.isDescendantOfNode(node, originalNode)) {
+ while (newNode && cvox.DomUtil.isDescendantOfNode(newNode, originalNode)) {
descriptions = descriptions.concat(
- cvox.DescriptionUtil.getFullDescriptionsFromChildren(prevnode, node));
+ cvox.DescriptionUtil.getFullDescriptionsFromChildren(
+ prevnode, newNode));
curSel = cvox.DescriptionUtil.subWalker_.next(curSel);
if (!curSel) {
break;
}
curSel = /** @type {!cvox.CursorSelection} */ (curSel);
- prevnode = node;
- node = curSel.start.node;
+ prevnode = newNode;
+ newNode = curSel.start.node;
}
return descriptions;
};
@@ -451,10 +452,13 @@ cvox.DescriptionUtil.shouldDescribeExit_ = function(ancestors) {
// TODO(sorge): Bad naming...this thing returns *multiple* descriptions.
/**
* Generates a description for a math node.
- * @param {!Node} node The given node.
+ * @param {Node} node The given node.
* @return {!Array<cvox.NavDescription>} A list of Navigation descriptions.
*/
cvox.DescriptionUtil.getMathDescription = function(node) {
+ if (!node) {
+ return [];
+ }
// TODO (sorge) This function should evantually be removed. Descriptions
// should come directly from the speech rule engine, taking information on
// verbosity etc. into account.

Powered by Google App Engine
This is Rietveld 408576698