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

Side by Side Diff: chrome/browser/resources/chromeos/switch_access/tree_walker.js

Issue 2818503002: Improved isInteresting heuristic, made more AutomationNodes focusable (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Class to move to the appropriate node in the accessibility tree. 6 * Class to move to the appropriate node in the accessibility tree.
7 * 7 *
8 * @constructor 8 * @constructor
9 */ 9 */
10 function AutomationTreeWalker() {}; 10 function AutomationTreeWalker() {};
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }, 113 },
114 114
115 /** 115 /**
116 * Returns true if |node| is interesting. 116 * Returns true if |node| is interesting.
117 * 117 *
118 * @param {!chrome.automation.AutomationNode} node 118 * @param {!chrome.automation.AutomationNode} node
119 * @return {boolean|undefined} 119 * @return {boolean|undefined}
120 * @private 120 * @private
121 */ 121 */
122 isInteresting_: function(node) { 122 isInteresting_: function(node) {
123 return node.state && node.state.focusable; 123 let loc = node.location;
124 let parent = node.parent;
125 let role = node.role;
126 let state = node.state;
127
128 // Skip things that are offscreen
129 if (state.offscreen || loc.top < 0 || loc.left < 0)
130 return false;
131
132 if (parent) {
133 // crbug.com/710559
134 // Work around for browser tabs
135 if (role === chrome.automation.RoleType.TAB
136 && parent.role === chrome.automation.RoleType.TAB_LIST)
David Tseng 2017/04/12 17:37:46 Note that these roles can occur in web pages as we
elichtenberg 2017/04/12 20:11:04 Done.
137 return true;
138 }
139
140 // The general rule that applies to everything.
141 return state.focusable;
124 }, 142 },
125 143
126 /** 144 /**
127 * Return the next sibling of |node| if it has one. 145 * Return the next sibling of |node| if it has one.
128 * 146 *
129 * @param {chrome.automation.AutomationNode} node 147 * @param {chrome.automation.AutomationNode} node
130 * @return {chrome.automation.AutomationNode} 148 * @return {chrome.automation.AutomationNode}
131 */ 149 */
132 debugMoveToNext: function(node) { 150 debugMoveToNext: function(node) {
133 if (!node) 151 if (!node)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 let parent = node.parent; 214 let parent = node.parent;
197 if (parent) { 215 if (parent) {
198 return parent; 216 return parent;
199 } else { 217 } else {
200 console.log('Node has no parent'); 218 console.log('Node has no parent');
201 console.log('\n'); 219 console.log('\n');
202 return null; 220 return null;
203 } 221 }
204 } 222 }
205 }; 223 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698