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

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

Issue 2388193003: Always enqueue live regions from background tabs (Closed)
Patch Set: Remove obsolete helper. Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @fileoverview ChromeVox utilities for the automation extension API. 6 * @fileoverview ChromeVox utilities for the automation extension API.
7 */ 7 */
8 8
9 goog.provide('AutomationUtil'); 9 goog.provide('AutomationUtil');
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 AutomationUtil.isInSameTree = function(a, b) { 234 AutomationUtil.isInSameTree = function(a, b) {
235 if (!a || !b) 235 if (!a || !b)
236 return true; 236 return true;
237 237
238 // Given two non-desktop roots, consider them in the "same" tree. 238 // Given two non-desktop roots, consider them in the "same" tree.
239 return a.root === b.root || 239 return a.root === b.root ||
240 (a.root.role == b.root.role && a.root.role == RoleType.rootWebArea); 240 (a.root.role == b.root.role && a.root.role == RoleType.rootWebArea);
241 }; 241 };
242 242
243 /** 243 /**
244 * Determines whether the two given nodes come from the same webpage.
245 * @param {AutomationNode} a
246 * @param {AutomationNode} b
247 * @return {boolean}
248 */
249 AutomationUtil.isInSameWebpage = function(a, b) {
250 if (!a || !b)
251 return false;
252
253 a = a.root;
254 while (a && a.parent && AutomationUtil.isInSameTree(a.parent, a))
255 a = a.parent.root;
256
257 b = b.root;
258 while (b && b.parent && AutomationUtil.isInSameTree(b.parent, b))
259 b = b.parent.root;
260
261 return a == b;
262 };
263
264 /**
265 * Determines whether or not a node is or is the descendant of another node. 244 * Determines whether or not a node is or is the descendant of another node.
266 * @param {!AutomationNode} node 245 * @param {!AutomationNode} node
267 * @param {!AutomationNode} ancestor 246 * @param {!AutomationNode} ancestor
268 * @return {boolean} 247 * @return {boolean}
269 */ 248 */
270 AutomationUtil.isDescendantOf = function(node, ancestor) { 249 AutomationUtil.isDescendantOf = function(node, ancestor) {
271 var testNode = node; 250 var testNode = node;
272 while (testNode && testNode !== ancestor) 251 while (testNode && testNode !== ancestor)
273 testNode = testNode.parent; 252 testNode = testNode.parent;
274 return testNode === ancestor; 253 return testNode === ancestor;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 while (root && 291 while (root &&
313 root.parent && 292 root.parent &&
314 root.parent.root && 293 root.parent.root &&
315 root.parent.root.role != RoleType.desktop) { 294 root.parent.root.role != RoleType.desktop) {
316 root = root.parent.root; 295 root = root.parent.root;
317 } 296 }
318 return root; 297 return root;
319 }; 298 };
320 299
321 }); // goog.scope 300 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698