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

Side by Side Diff: chrome/common/extensions/api/automation.idl

Issue 1155183006: Reimplement automation API on top of C++-backed AXTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_faster_2
Patch Set: Rebase Created 5 years, 6 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 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 // The <code>chrome.automation</code> API allows developers to access the 5 // The <code>chrome.automation</code> API allows developers to access the
6 // automation (accessibility) tree for the browser. The tree resembles the DOM 6 // automation (accessibility) tree for the browser. The tree resembles the DOM
7 // tree, but only exposes the <em>semantic</em> structure of a page. It can be 7 // tree, but only exposes the <em>semantic</em> structure of a page. It can be
8 // used to programmatically interact with a page by examining names, roles, and 8 // used to programmatically interact with a page by examining names, roles, and
9 // states, listening for events, and performing actions on nodes. 9 // states, listening for events, and performing actions on nodes.
10 [nocompile] namespace automation { 10 [nocompile] namespace automation {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 [nocompile, noinline_doc] dictionary AutomationNode { 310 [nocompile, noinline_doc] dictionary AutomationNode {
311 // The root node of the tree containing this AutomationNode. 311 // The root node of the tree containing this AutomationNode.
312 AutomationNode root; 312 AutomationNode root;
313 313
314 // Whether this AutomationNode is root node. 314 // Whether this AutomationNode is root node.
315 boolean isRootNode; 315 boolean isRootNode;
316 316
317 // The role of this node. 317 // The role of this node.
318 automation.RoleType role; 318 automation.RoleType role;
319 319
320 // TODO(aboxhall): expose states as mixins instead
321
322 // The $(ref:automation.StateType)s describing this node. 320 // The $(ref:automation.StateType)s describing this node.
323 object state; 321 object state;
324 322
325 // The rendered location (as a bounding box) of this node within the frame. 323 // The rendered location (as a bounding box) of this node within the frame.
326 automation.Rect location; 324 automation.Rect location;
327 325
328 // The purpose of the node, other than the role, if any. 326 // The purpose of the node, other than the role, if any.
329 DOMString description; 327 DOMString description;
330 328
331 // The help text for the node, if any. 329 // The help text for the node, if any.
(...skipping 30 matching lines...) Expand all
362 // one. See 360 // one. See
363 // <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto" > 361 // <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto" >
364 // <code>aria-flowto</code></a>. 362 // <code>aria-flowto</code></a>.
365 AutomationNode[] flowTo; 363 AutomationNode[] flowTo;
366 364
367 // The nodes, if any, which form a label for this element. Generally, the 365 // The nodes, if any, which form a label for this element. Generally, the
368 // text from these elements will also be exposed as the element's accessible 366 // text from these elements will also be exposed as the element's accessible
369 // name, via the $(ref:automation.AutomationNode.name) attribute. 367 // name, via the $(ref:automation.AutomationNode.name) attribute.
370 AutomationNode[] labelledBy; 368 AutomationNode[] labelledBy;
371 369
372 // The nodes, if any, which are to be considered children of this node but
373 // are not children in the DOM tree.
374 AutomationNode[] owns;
375
376 // TODO(aboxhall): Make this private?
377
378 // A collection of this node's other attributes.
379 object? attributes;
380
381 // The index of this node in its parent node's list of children. If this is
382 // the root node, this will be undefined.
383 long? indexInParent;
384
385 AutomationNode[] children;
386 AutomationNode parent;
387 AutomationNode firstChild;
388 AutomationNode lastChild;
389 AutomationNode previousSibling;
390 AutomationNode nextSibling;
391
392 // Does the default action based on this node's role. This is generally
393 // the same action that would result from clicking the node such as
394 // expanding a treeitem, toggling a checkbox, selecting a radiobutton,
395 // or activating a button.
396 static void doDefault();
397
398 // Places focus on this node.
399 static void focus();
400
401 // Scrolls this node to make it visible.
402 static void makeVisible();
403
404 // Sets selection within a text field.
405 static void setSelection(long startIndex, long endIndex);
406
407 // Shows the context menu resulting from a right click on this node.
408 static void showContextMenu();
409
410 // Adds a listener for the given event type and event phase.
411 static void addEventListener(
412 EventType eventType, AutomationListener listener, boolean capture);
413
414 // Removes a listener for the given event type and event phase.
415 static void removeEventListener(
416 EventType eventType, AutomationListener listener, boolean capture);
417
418 // Gets the first node in this node's subtree which matches the given CSS
419 // selector and is within the same DOM context.
420 //
421 // If this node doesn't correspond directly with an HTML node in the DOM,
422 // querySelector will be run on this node's nearest HTML node ancestor. Note
423 // that this may result in the query returning a node which is not a
424 // descendant of this node.
425 //
426 // If the selector matches a node which doesn't directly correspond to an
427 // automation node (for example an element within an ARIA widget, where the
428 // ARIA widget forms one node of the automation tree, or an element which
429 // is hidden from accessibility via hiding it using CSS or using
430 // aria-hidden), this will return the nearest ancestor which does correspond
431 // to an automation node.
432 static void domQuerySelector(DOMString selector, QueryCallback callback);
433
434 // Finds the first AutomationNode in this node's subtree which matches the
435 // given search parameters.
436 static AutomationNode find(FindParams params);
437
438 // Finds all the AutomationNodes in this node's subtree which matches the
439 // given search parameters.
440 static AutomationNode[] findAll(FindParams params);
441
442 // Returns whether this node matches the given $(ref:automation.FindParams).
443 static boolean matches(FindParams params);
444 };
445
446 dictionary ActiveDescendantMixin {
447 // The node referred to by <code>aria-activedescendant</code>, where 370 // The node referred to by <code>aria-activedescendant</code>, where
448 // applicable 371 // applicable
449 AutomationNode activedescendant; 372 AutomationNode activedescendant;
450 };
451 373
452 // Attributes which are mixed in to an AutomationNode if it is a link. 374 //
453 dictionary LinkMixins { 375 // Link attributes.
454 // TODO(aboxhall): Add visited state 376 //
455 377
456 // The URL that this link will navigate to. 378 // The URL that this link will navigate to.
457 DOMString url; 379 DOMString url;
458 };
459 380
460 // Attributes which are mixed in to an AutomationNode if it is a document. 381 //
461 dictionary DocumentMixins { 382 // Document attributes.
383 //
384
462 // The URL of this document. 385 // The URL of this document.
463 DOMString docUrl; 386 DOMString docUrl;
464 387
465 // The title of this document. 388 // The title of this document.
466 DOMString docTitle; 389 DOMString docTitle;
467 390
468 // Whether this document has finished loading. 391 // Whether this document has finished loading.
469 boolean docLoaded; 392 boolean docLoaded;
470 393
471 // The proportion (out of 1.0) that this doc has completed loading. 394 // The proportion (out of 1.0) that this doc has completed loading.
472 double docLoadingProgress; 395 double docLoadingProgress;
473 };
474 396
475 // TODO(aboxhall): document ScrollableMixins (e.g. what is scrollXMin? is it 397 //
476 // ever not 0?) 398 // Scrollable container attributes.
399 //
477 400
478 // Attributes which are mixed in to an AutomationNode if it is scrollable.
479 dictionary ScrollableMixins {
480 long scrollX; 401 long scrollX;
aboxhall 2015/06/11 17:42:45 One thing we were trying to avoid with mixins was
dmazzoni 2015/06/11 19:09:12 Rather than mixins, I think we could bundle attrib
aboxhall 2015/06/11 22:22:34 Sorry, missed this in my responses earlier. Sure,
dmazzoni 2015/06/12 17:51:36 I'll send out a proposal for just one set of attri
481 long scrollXMin; 402 long scrollXMin;
482 long scrollXMax; 403 long scrollXMax;
483 long scrollY; 404 long scrollY;
484 long scrollYMin; 405 long scrollYMin;
485 long scrollYMax; 406 long scrollYMax;
486 };
487 407
488 // Attributes which are mixed in to an AutomationNode if it is editable text. 408 //
489 dictionary EditableTextMixins { 409 // Editable text field attributes.
410 //
411
490 // The character index of the start of the selection within this editable 412 // The character index of the start of the selection within this editable
491 // text element; -1 if no selection. 413 // text element; -1 if no selection.
492 long textSelStart; 414 long textSelStart;
493 415
494 // The character index of the end of the selection within this editable 416 // The character index of the end of the selection within this editable
495 // text element; -1 if no selection. 417 // text element; -1 if no selection.
496 long textSelEnd; 418 long textSelEnd;
497 419
498 // The input type, like email or number. 420 // The input type, like email or number.
499 DOMString textInputType; 421 DOMString textInputType;
500 };
501 422
502 // Attributes which are mixed in to an AutomationNode if it is a range. 423 //
503 dictionary RangeMixins { 424 // Range attributes.
425 //
426
504 // The current value for this range. 427 // The current value for this range.
505 double valueForRange; 428 double valueForRange;
506 429
507 // The minimum possible value for this range. 430 // The minimum possible value for this range.
508 double minValueForRange; 431 double minValueForRange;
509 432
510 // The maximum possible value for this range. 433 // The maximum possible value for this range.
511 double maxValueForRange; 434 double maxValueForRange;
512 };
513 435
514 // TODO(aboxhall): live region mixins. 436 //
437 // Table attributes.
438 //
515 439
516 // Attributes which are mixed in to an AutomationNode if it is a table.
517 dictionary TableMixins {
518 // The number of rows in this table. 440 // The number of rows in this table.
519 long tableRowCount; 441 long tableRowCount;
520 442
521 // The number of columns in this table. 443 // The number of columns in this table.
522 long tableColumnCount; 444 long tableColumnCount;
523 };
524 445
525 // Attributes which are mixed in to an AutomationNode if it is a table cell. 446 //
526 dictionary TableCellMixins { 447 // Table cell attributes.
448 //
449
527 // The zero-based index of the column that this cell is in. 450 // The zero-based index of the column that this cell is in.
528 long tableCellColumnIndex; 451 long tableCellColumnIndex;
529 452
530 // The number of columns that this cell spans (default is 1). 453 // The number of columns that this cell spans (default is 1).
531 long tableCellColumnSpan; 454 long tableCellColumnSpan;
532 455
533 // The zero-based index of the row that this cell is in. 456 // The zero-based index of the row that this cell is in.
534 long tableCellRowIndex; 457 long tableCellRowIndex;
535 458
536 // The number of rows that this cell spans (default is 1). 459 // The number of rows that this cell spans (default is 1).
537 long tableCellRowSpan; 460 long tableCellRowSpan;
461
462 //
463 // Walking the tree.
464 //
465
466 AutomationNode[] children;
467 AutomationNode parent;
468 AutomationNode firstChild;
469 AutomationNode lastChild;
470 AutomationNode previousSibling;
471 AutomationNode nextSibling;
472
473 // The index of this node in its parent node's list of children. If this is
474 // the root node, this will be undefined.
475 long? indexInParent;
476
477 //
478 // Actions.
479 //
480
481 // Does the default action based on this node's role. This is generally
482 // the same action that would result from clicking the node such as
483 // expanding a treeitem, toggling a checkbox, selecting a radiobutton,
484 // or activating a button.
485 static void doDefault();
486
487 // Places focus on this node.
488 static void focus();
489
490 // Scrolls this node to make it visible.
491 static void makeVisible();
492
493 // Sets selection within a text field.
494 static void setSelection(long startIndex, long endIndex);
495
496 // Adds a listener for the given event type and event phase.
497 static void addEventListener(
498 EventType eventType, AutomationListener listener, boolean capture);
499
500 // Removes a listener for the given event type and event phase.
501 static void removeEventListener(
502 EventType eventType, AutomationListener listener, boolean capture);
503
504 // Gets the first node in this node's subtree which matches the given CSS
505 // selector and is within the same DOM context.
506 //
507 // If this node doesn't correspond directly with an HTML node in the DOM,
508 // querySelector will be run on this node's nearest HTML node ancestor. Note
509 // that this may result in the query returning a node which is not a
510 // descendant of this node.
511 //
512 // If the selector matches a node which doesn't directly correspond to an
513 // automation node (for example an element within an ARIA widget, where the
514 // ARIA widget forms one node of the automation tree, or an element which
515 // is hidden from accessibility via hiding it using CSS or using
516 // aria-hidden), this will return the nearest ancestor which does correspond
517 // to an automation node.
518 static void domQuerySelector(DOMString selector, QueryCallback callback);
519
520 // Finds the first AutomationNode in this node's subtree which matches the
521 // given search parameters.
522 static AutomationNode find(FindParams params);
523
524 // Finds all the AutomationNodes in this node's subtree which matches the
525 // given search parameters.
526 static AutomationNode[] findAll(FindParams params);
527
528 // Returns whether this node matches the given $(ref:automation.FindParams).
529 static boolean matches(FindParams params);
538 }; 530 };
539 531
540 // Called when the <code>AutomationNode</code> for the page is available. 532 // Called when the <code>AutomationNode</code> for the page is available.
541 callback RootCallback = void(AutomationNode rootNode); 533 callback RootCallback = void(AutomationNode rootNode);
542 534
543 interface Functions { 535 interface Functions {
544 // Get the automation tree for the tab with the given tabId, or the current 536 // Get the automation tree for the tab with the given tabId, or the current
545 // tab if no tabID is given, enabling automation if necessary. Returns a 537 // tab if no tabID is given, enabling automation if necessary. Returns a
546 // tree with a placeholder root node; listen for the "loadComplete" event to 538 // tree with a placeholder root node; listen for the "loadComplete" event to
547 // get a notification that the tree has fully loaded (the previous root node 539 // get a notification that the tree has fully loaded (the previous root node
548 // reference will stop working at or before this point). 540 // reference will stop working at or before this point).
549 [nocompile] static void getTree(optional long tabId, RootCallback callback); 541 [nocompile] static void getTree(optional long tabId, RootCallback callback);
550 542
551 // Get the automation tree for the whole desktop which consists of all on 543 // Get the automation tree for the whole desktop which consists of all on
552 // screen views. Note this API is currently only supported on Chrome OS. 544 // screen views. Note this API is currently only supported on Chrome OS.
553 [nocompile] static void getDesktop(RootCallback callback); 545 [nocompile] static void getDesktop(RootCallback callback);
554 546
555 // Add a tree change observer. Tree change observers are static/global, they 547 // Add a tree change observer. Tree change observers are static/global, they
556 // listen to changes across all trees. 548 // listen to changes across all trees.
557 [nocompile] static void addTreeChangeObserver( 549 [nocompile] static void addTreeChangeObserver(
558 TreeChangeObserver observer); 550 TreeChangeObserver observer);
559 551
560 // Remove a tree change observer. 552 // Remove a tree change observer.
561 [nocompile] static void removeTreeChangeObserver( 553 [nocompile] static void removeTreeChangeObserver(
562 TreeChangeObserver observer); 554 TreeChangeObserver observer);
563 }; 555 };
564 }; 556 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698