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

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

Issue 2559343002: Allow tree walker to escape roots (Closed)
Patch Set: Update the test. Created 4 years 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js
index ad7a57c031e27f72d51a47c84f46a80bdc65b957..f947a066c4d1a248288fda4c48dcef89f11e5023 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js
@@ -178,7 +178,8 @@ AutomationTreeWalker.prototype = {
var searchNode = node;
while (searchNode) {
- // We have crossed out of the initial node's subtree.
+ // We have crossed out of the initial node's subtree for either a
+ // sibling or parent move.
if (searchNode == this.initialNode_)
this.phase_ = AutomationTreeWalkerPhase.OTHER;
@@ -186,7 +187,16 @@ AutomationTreeWalker.prototype = {
this.node_ = searchNode.nextSibling;
return;
}
- if (searchNode.parent && this.rootPred_(searchNode.parent))
+
+ // Update the phase based on the parent if needed since we may exit below.
+ if (searchNode.parent == this.initialNode_)
+ this.phase_ = AutomationTreeWalkerPhase.OTHER;
+
+ // Exit if we encounter a root-like node and are not searching descendants
+ // of the initial node.
+ if (searchNode.parent &&
+ this.rootPred_(searchNode.parent) &&
+ this.phase_ != AutomationTreeWalkerPhase.DESCENDANT)
break;
searchNode = searchNode.parent;
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698