diff options
Diffstat (limited to 'chromium/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js')
-rw-r--r-- | chromium/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js b/chromium/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js index 4275a1ccae1..d4e18bd88f1 100644 --- a/chromium/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js +++ b/chromium/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js @@ -95,6 +95,8 @@ AutomationUtil.findNextSubtree = function(cur, dir) { if (!AutomationUtil.isInSameTree(cur, cur.parent)) return null; cur = cur.parent; + if (AutomationUtil.isTraversalRoot_(cur)) + return null; } }; @@ -113,8 +115,10 @@ AutomationUtil.findNextNode = function(cur, dir, pred) { return null; cur = next; next = AutomationUtil.findNodePre(next, dir, pred); - if (next && AutomationPredicate.shouldIgnoreLeaf(next)) + if (next && AutomationPredicate.shouldIgnoreLeaf(next)) { + cur = next; next = null; + } } while (!next); return next; }; @@ -249,4 +253,23 @@ AutomationUtil.isInSameTree = function(a, b) { return a.root === b.root; }; +/** + * Returns whether the given node should not be crossed when performing + * traversals up the ancestry chain. + * @param {AutomationNode} node + * @return {boolean} + * @private + */ +AutomationUtil.isTraversalRoot_ = function(node) { + switch (node.role) { + case 'dialog': + case 'window': + return true; + case 'toolbar': + return node.root.role == 'desktop'; + default: + return false; + } +}; + }); // goog.scope |