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

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

Issue 880063002: Ensure WebView notifies desktop automation on creation, destruction, and change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for start. Created 5 years, 11 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/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..c12054dc0ac98f9739c1f2b41a9d102739cac192 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;
};
+ /**
dmazzoni 2015/01/28 23:05:21 nit: indentation
David Tseng 2015/01/29 00:33:51 Done.
+ * 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

Powered by Google App Engine
This is Rietveld 408576698