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 c7c743a06ec0ace7a36083c50d9394b148d2e37e..c45aac89bff43af8775689762ad4aab18924648f 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util.js |
@@ -276,4 +276,25 @@ AutomationUtil.isTraversalRoot = function(node) { |
} |
}; |
+/** |
+ * Determines whether the two given nodes come from the same webpage. |
+ * @param {AutomationNode} a |
+ * @param {AutomationNode} b |
+ * @return {boolean} |
+ */ |
+AutomationUtil.isInSameWebpage = function(a, b) { |
+ if (!a || !b) |
+ return false; |
+ |
+ a = a.root; |
+ while (a && a.parent && AutomationUtil.isInSameTree(a.parent, a)) |
+ a = a.parent.root; |
+ |
+ b = b.root; |
+ while (b && b.parent && AutomationUtil.isInSameTree(b.parent, b)) |
+ b = b.parent.root; |
+ |
+ return a == b; |
+}; |
+ |
}); // goog.scope |