| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js
|
| index d5d9956f345141a1a4dd2edde5f88132d37f01f4..16f7506bb8105264199e695126d823c3a9de0ab6 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js
|
| @@ -88,8 +88,12 @@ AutomationUtil.findNextSubtree = function(cur, dir) {
|
| while (cur) {
|
| var next = dir == Dir.BACKWARD ?
|
| cur.previousSibling : cur.nextSibling;
|
| + if (!AutomationUtil.isInSameTree(cur, next))
|
| + return null;
|
| if (next)
|
| return next;
|
| + if (!AutomationUtil.isInSameTree(cur, cur.parent))
|
| + return null;
|
| cur = cur.parent;
|
| }
|
| };
|
| @@ -164,6 +168,10 @@ AutomationUtil.getAncestors = function(node) {
|
| var candidate = node;
|
| while (candidate) {
|
| ret.push(candidate);
|
| +
|
| + if (!AutomationUtil.isInSameTree(candidate, candidate.parent))
|
| + break;
|
| +
|
| candidate = candidate.parent;
|
| }
|
| return ret.reverse();
|
| @@ -226,4 +234,17 @@ AutomationUtil.getDirection = function(nodeA, nodeB) {
|
| return divA.indexInParent <= divB.indexInParent ? Dir.FORWARD : Dir.BACKWARD;
|
| };
|
|
|
| +/**
|
| + * Determines whether the two given nodes come from the same tree source.
|
| + * @param {AutomationNode} a
|
| + * @param {AutomationNode} b
|
| + * @return {boolean}
|
| + */
|
| +AutomationUtil.isInSameTree = function(a, b) {
|
| + if (!a || !b)
|
| + return true;
|
| +
|
| + return a.root === b.root;
|
| +};
|
| +
|
| }); // goog.scope
|
|
|