OLD | NEW |
---|---|
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 * This node's text (name) changed. | 256 * This node's text (name) changed. |
257 */ | 257 */ |
258 textChanged, | 258 textChanged, |
259 | 259 |
260 /** | 260 /** |
261 * This node was removed. | 261 * This node was removed. |
262 */ | 262 */ |
263 nodeRemoved | 263 nodeRemoved |
264 }; | 264 }; |
265 | 265 |
266 // Where the node's name is from. | |
267 enum NameFromType { | |
268 uninitialized, | |
269 attribute, | |
270 contents, | |
271 placeholder, | |
272 related_element, | |
273 value | |
274 }; | |
275 | |
266 dictionary Rect { | 276 dictionary Rect { |
267 long left; | 277 long left; |
268 long top; | 278 long top; |
269 long width; | 279 long width; |
270 long height; | 280 long height; |
271 }; | 281 }; |
272 | 282 |
273 // Arguments for the find() and findAll() methods. | 283 // Arguments for the find() and findAll() methods. |
274 [nocompile, noinline_doc] dictionary FindParams { | 284 [nocompile, noinline_doc] dictionary FindParams { |
275 RoleType? role; | 285 RoleType? role; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 textMarkerChanges, | 361 textMarkerChanges, |
352 allTreeChanges | 362 allTreeChanges |
353 }; | 363 }; |
354 | 364 |
355 // A listener for changes on the <code>AutomationNode</code> tree. | 365 // A listener for changes on the <code>AutomationNode</code> tree. |
356 callback TreeChangeObserver = void(TreeChange treeChange); | 366 callback TreeChangeObserver = void(TreeChange treeChange); |
357 | 367 |
358 // A single node in an Automation tree. | 368 // A single node in an Automation tree. |
359 [nocompile, noinline_doc] dictionary AutomationNode { | 369 [nocompile, noinline_doc] dictionary AutomationNode { |
360 // The root node of the tree containing this AutomationNode. | 370 // The root node of the tree containing this AutomationNode. |
361 AutomationNode root; | 371 AutomationNode? root; |
362 | 372 |
363 // Whether this AutomationNode is a root node. | 373 // Whether this AutomationNode is a root node. |
364 boolean isRootNode; | 374 boolean isRootNode; |
365 | 375 |
366 // The role of this node. | 376 // The role of this node. |
367 automation.RoleType role; | 377 RoleType? role; |
368 | 378 |
369 // The $(ref:automation.StateType)s describing this node. | 379 // The $(ref:automation.StateType)s describing this node. |
370 object state; | 380 // <jsexterns>@type {Object<chrome.automation.StateType, boolean>} |
Devlin
2017/01/12 17:28:47
This is kind of unfortunate... Maybe we should int
dmazzoni
2017/01/12 17:44:16
FWIW, the *other* instance of idl_parser in the co
| |
381 // </jsexterns> | |
382 object? state; | |
371 | 383 |
372 // The rendered location (as a bounding box) of this node in global | 384 // The rendered location (as a bounding box) of this node in global |
373 // screen coordinates. | 385 // screen coordinates. |
374 automation.Rect location; | 386 Rect? location; |
375 | 387 |
376 // Computes the bounding box of a subrange of this node in global screen | 388 // Computes the bounding box of a subrange of this node in global screen |
377 // coordinates. Returns the same as |location| if range information | 389 // coordinates. Returns the same as |location| if range information |
378 // is not available. The start and end indices are zero-based offsets | 390 // is not available. The start and end indices are zero-based offsets |
379 // into the node's "name" string attribute. | 391 // into the node's "name" string attribute. |
380 static automation.Rect boundsForRange(long startIndex, long endIndex); | 392 static Rect boundsForRange(long startIndex, long endIndex); |
381 | 393 |
382 // The purpose of the node, other than the role, if any. | 394 // The purpose of the node, other than the role, if any. |
383 DOMString description; | 395 DOMString? description; |
384 | 396 |
385 // The help text for the node, if any. | 397 // The placeholder for this text field, if any. |
386 DOMString help; | 398 DOMString? placeholder; |
387 | 399 |
388 // The accessible name for this node, via the | 400 // The accessible name for this node, via the |
389 // <a href="http://www.w3.org/TR/wai-aria/roles#namecalculation"> | 401 // <a href="http://www.w3.org/TR/wai-aria/roles#namecalculation"> |
390 // Accessible Name Calculation</a> process. | 402 // Accessible Name Calculation</a> process. |
391 DOMString name; | 403 DOMString? name; |
404 | |
405 // The source of the name. | |
406 NameFromType? nameFrom; | |
392 | 407 |
393 // The value for this node: for example the <code>value</code> attribute of | 408 // The value for this node: for example the <code>value</code> attribute of |
394 // an <code><input> element. | 409 // an <code><input> element. |
395 DOMString value; | 410 DOMString? value; |
396 | 411 |
397 // The HTML tag for this element, if this node is an HTML element. | 412 // The HTML tag for this element, if this node is an HTML element. |
398 DOMString htmlTag; | 413 DOMString? htmlTag; |
399 | 414 |
400 // The level of a heading or tree item. | 415 // The level of a heading or tree item. |
401 long hierarchicalLevel; | 416 long? hierarchicalLevel; |
402 | 417 |
403 // The start and end index of each word in an inline text box. | 418 // The start and end index of each word in an inline text box. |
404 long[] wordStarts; | 419 long[]? wordStarts; |
405 long[] wordEnds; | 420 long[]? wordEnds; |
406 | 421 |
407 // The nodes, if any, which this node is specified to control via | 422 // The nodes, if any, which this node is specified to control via |
408 // <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-control s"> | 423 // <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-control s"> |
409 // <code>aria-controls</code></a>. | 424 // <code>aria-controls</code></a>. |
410 AutomationNode[] controls; | 425 AutomationNode[]? controls; |
411 | 426 |
412 // The nodes, if any, which form a description for this node. | 427 // The nodes, if any, which form a description for this node. |
413 AutomationNode[] describedBy; | 428 AutomationNode[]? describedBy; |
414 | 429 |
415 // The nodes, if any, which may optionally be navigated to after this | 430 // The nodes, if any, which may optionally be navigated to after this |
416 // one. See | 431 // one. See |
417 // <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto" > | 432 // <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto" > |
418 // <code>aria-flowto</code></a>. | 433 // <code>aria-flowto</code></a>. |
419 AutomationNode[] flowTo; | 434 AutomationNode[]? flowTo; |
420 | 435 |
421 // The nodes, if any, which form a label for this element. Generally, the | 436 // The nodes, if any, which form a label for this element. Generally, the |
422 // text from these elements will also be exposed as the element's accessible | 437 // text from these elements will also be exposed as the element's accessible |
423 // name, via the $(ref:automation.AutomationNode.name) attribute. | 438 // name, via the $(ref:automation.AutomationNode.name) attribute. |
424 AutomationNode[] labelledBy; | 439 AutomationNode[]? labelledBy; |
425 | 440 |
426 // The node referred to by <code>aria-activedescendant</code>, where | 441 // The node referred to by <code>aria-activedescendant</code>, where |
427 // applicable | 442 // applicable |
428 AutomationNode activedescendant; | 443 AutomationNode? activeDescendant; |
429 | 444 |
430 // | 445 // |
431 // Link attributes. | 446 // Link attributes. |
432 // | 447 // |
433 | 448 |
434 // The URL that this link will navigate to. | 449 // The URL that this link will navigate to. |
435 DOMString url; | 450 DOMString? url; |
436 | 451 |
437 // | 452 // |
438 // Document attributes. | 453 // Document attributes. |
439 // | 454 // |
440 | 455 |
441 // The URL of this document. | 456 // The URL of this document. |
442 DOMString docUrl; | 457 DOMString? docUrl; |
443 | 458 |
444 // The title of this document. | 459 // The title of this document. |
445 DOMString docTitle; | 460 DOMString? docTitle; |
446 | 461 |
447 // Whether this document has finished loading. | 462 // Whether this document has finished loading. |
448 boolean docLoaded; | 463 boolean? docLoaded; |
449 | 464 |
450 // The proportion (out of 1.0) that this doc has completed loading. | 465 // The proportion (out of 1.0) that this doc has completed loading. |
451 double docLoadingProgress; | 466 double? docLoadingProgress; |
452 | 467 |
453 // | 468 // |
454 // Scrollable container attributes. | 469 // Scrollable container attributes. |
455 // | 470 // |
456 | 471 |
457 long scrollX; | 472 long? scrollX; |
458 long scrollXMin; | 473 long? scrollXMin; |
459 long scrollXMax; | 474 long? scrollXMax; |
460 long scrollY; | 475 long? scrollY; |
461 long scrollYMin; | 476 long? scrollYMin; |
462 long scrollYMax; | 477 long? scrollYMax; |
463 | 478 |
464 // | 479 // |
465 // Editable text field attributes. | 480 // Editable text field attributes. |
466 // | 481 // |
467 | 482 |
468 // The character index of the start of the selection within this editable | 483 // The character index of the start of the selection within this editable |
469 // text element; -1 if no selection. | 484 // text element; -1 if no selection. |
470 long textSelStart; | 485 long? textSelStart; |
471 | 486 |
472 // The character index of the end of the selection within this editable | 487 // The character index of the end of the selection within this editable |
473 // text element; -1 if no selection. | 488 // text element; -1 if no selection. |
474 long textSelEnd; | 489 long? textSelEnd; |
475 | 490 |
476 // The input type, like email or number. | 491 // The input type, like email or number. |
477 DOMString textInputType; | 492 DOMString? textInputType; |
493 | |
494 // An array of indexes of the break between lines in editable text. | |
495 // <jsexterns>@type {Array<number>}</jsexterns> | |
Devlin
2017/01/12 17:28:47
Why can't we just do
double[]? lineBreaks;
?
Simi
dmazzoni
2017/01/13 21:22:52
Done.
| |
496 object? lineBreaks; | |
497 | |
498 // An array of indexes of the start position of each text marker. | |
499 // <jsexterns>@type {Array<number>}</jsexterns> | |
500 object? markerStarts; | |
501 | |
502 // An array of indexes of the end position of each text marker. | |
503 // <jsexterns>@type {Array<number>}</jsexterns> | |
504 object? markerEnds; | |
505 | |
506 // An array of numerical types indicating the type of each text marker, | |
507 // such as a spelling error. | |
508 // <jsexterns>@type {Array<number>}</jsexterns> | |
509 object? markerTypes; | |
478 | 510 |
479 // | 511 // |
480 // Tree selection attributes (available on root nodes only) | 512 // Tree selection attributes (available on root nodes only) |
481 // | 513 // |
482 | 514 |
483 // The anchor node of the tree selection, if any. | 515 // The anchor node of the tree selection, if any. |
484 AutomationNode? anchorObject; | 516 AutomationNode? anchorObject; |
485 // The anchor offset of the tree selection, if any. | 517 // The anchor offset of the tree selection, if any. |
486 long? anchorOffset; | 518 long? anchorOffset; |
519 // The affinity of the tree selection anchor, if any. | |
520 DOMString? anchorAffinity; | |
487 // The focus node of the tree selection, if any. | 521 // The focus node of the tree selection, if any. |
488 AutomationNode? focusObject; | 522 AutomationNode? focusObject; |
489 // The focus offset of the tree selection, if any. | 523 // The focus offset of the tree selection, if any. |
490 long? focusOffset; | 524 long? focusOffset; |
525 // The affinity of the tree selection focus, if any. | |
526 DOMString? focusAffinity; | |
491 | 527 |
492 // | 528 // |
493 // Range attributes. | 529 // Range attributes. |
494 // | 530 // |
495 | 531 |
496 // The current value for this range. | 532 // The current value for this range. |
497 double valueForRange; | 533 double? valueForRange; |
498 | 534 |
499 // The minimum possible value for this range. | 535 // The minimum possible value for this range. |
500 double minValueForRange; | 536 double? minValueForRange; |
501 | 537 |
502 // The maximum possible value for this range. | 538 // The maximum possible value for this range. |
503 double maxValueForRange; | 539 double? maxValueForRange; |
540 | |
541 // | |
542 // List attributes. | |
543 // | |
544 | |
545 // The 1-based index of an item in a set. | |
546 long? posInSet; | |
547 | |
548 // The number of items in a set; | |
549 long? setSize; | |
504 | 550 |
505 // | 551 // |
506 // Table attributes. | 552 // Table attributes. |
507 // | 553 // |
508 | 554 |
509 // The number of rows in this table. | 555 // The number of rows in this table. |
510 long tableRowCount; | 556 long? tableRowCount; |
511 | 557 |
512 // The number of columns in this table. | 558 // The number of columns in this table. |
513 long tableColumnCount; | 559 long? tableColumnCount; |
514 | 560 |
515 // | 561 // |
516 // Table cell attributes. | 562 // Table cell attributes. |
517 // | 563 // |
518 | 564 |
519 // The zero-based index of the column that this cell is in. | 565 // The zero-based index of the column that this cell is in. |
520 long tableCellColumnIndex; | 566 long? tableCellColumnIndex; |
521 | 567 |
522 // The number of columns that this cell spans (default is 1). | 568 // The number of columns that this cell spans (default is 1). |
523 long tableCellColumnSpan; | 569 long? tableCellColumnSpan; |
524 | 570 |
525 // The zero-based index of the row that this cell is in. | 571 // The zero-based index of the row that this cell is in. |
526 long tableCellRowIndex; | 572 long? tableCellRowIndex; |
527 | 573 |
528 // The number of rows that this cell spans (default is 1). | 574 // The number of rows that this cell spans (default is 1). |
529 long tableCellRowSpan; | 575 long? tableCellRowSpan; |
576 | |
577 // The corresponding column header for this cell. | |
578 AutomationNode? tableColumnHeader; | |
579 | |
580 // The corresponding row header for this cell. | |
581 AutomationNode? tableRowHeader; | |
530 | 582 |
531 // | 583 // |
532 // Live region attributes. | 584 // Live region attributes. |
533 // | 585 // |
534 | 586 |
535 // The type of region if this is the root of a live region. | 587 // The type of region if this is the root of a live region. |
536 // Possible values are 'polite' and 'assertive'. | 588 // Possible values are 'polite' and 'assertive'. |
537 DOMString liveStatus; | 589 DOMString? liveStatus; |
538 | 590 |
539 // The value of aria-relevant for a live region. | 591 // The value of aria-relevant for a live region. |
540 DOMString liveRelevant; | 592 DOMString? liveRelevant; |
541 | 593 |
542 // The value of aria-atomic for a live region. | 594 // The value of aria-atomic for a live region. |
543 boolean liveAtomic; | 595 boolean? liveAtomic; |
544 | 596 |
545 // The value of aria-busy for a live region. | 597 // The value of aria-busy for a live region. |
546 boolean liveBusy; | 598 boolean? liveBusy; |
547 | 599 |
548 // The type of live region if this node is inside a live region. | 600 // The type of live region if this node is inside a live region. |
549 DOMString containerLiveStatus; | 601 DOMString? containerLiveStatus; |
550 | 602 |
551 // The value of aria-relevant if this node is inside a live region. | 603 // The value of aria-relevant if this node is inside a live region. |
552 DOMString containerLiveRelevant; | 604 DOMString? containerLiveRelevant; |
553 | 605 |
554 // The value of aria-atomic if this node is inside a live region. | 606 // The value of aria-atomic if this node is inside a live region. |
555 boolean containerLiveAtomic; | 607 boolean? containerLiveAtomic; |
556 | 608 |
557 // The value of aria-busy if this node is inside a live region. | 609 // The value of aria-busy if this node is inside a live region. |
558 boolean containerLiveBusy; | 610 boolean? containerLiveBusy; |
611 | |
612 // | |
613 // Miscellaneous attributes. | |
614 // | |
615 | |
616 // A map containing all HTML attributes and their values | |
617 // <jsexterns>@type {Object<string>}</jsexterns> | |
618 object? htmlAttributes; | |
619 | |
620 // The input type of a text field, such as "text" or "email". | |
621 DOMString? inputType; | |
622 | |
623 // The key that activates this widget. | |
624 DOMString? accessKey; | |
625 | |
626 // The value of the aria-invalid attribute, indicating the error type. | |
627 DOMString? ariaInvalidValue; | |
628 | |
629 // The value of the aria-readonly attribute, if applicable. | |
630 boolean? ariaReadonly; | |
631 | |
632 // The CSS display attribute for this node, if applicable. | |
633 DOMString? display; | |
634 | |
635 // A data url with the contents of this object's image or thumbnail. | |
636 DOMString? imageDataUrl; | |
637 | |
638 // The language code for this subtree. | |
639 DOMString? language; | |
640 | |
641 // If a checkbox or toggle button is in the mixed state. | |
642 boolean? buttonMixed; | |
643 | |
644 // The RGBA foreground color of this subtree, as an integer. | |
645 long? color; | |
646 | |
647 // The RGBA background color of this subtree, as an integer. | |
648 long? backgroundColor; | |
649 | |
650 // The RGBA color of an input element whose value is a color. | |
651 long? colorValue; | |
559 | 652 |
560 // | 653 // |
561 // Walking the tree. | 654 // Walking the tree. |
562 // | 655 // |
563 | 656 |
564 AutomationNode[] children; | 657 AutomationNode[] children; |
565 AutomationNode parent; | 658 AutomationNode? parent; |
566 AutomationNode firstChild; | 659 AutomationNode? firstChild; |
567 AutomationNode lastChild; | 660 AutomationNode? lastChild; |
568 AutomationNode previousSibling; | 661 AutomationNode? previousSibling; |
569 AutomationNode nextSibling; | 662 AutomationNode? nextSibling; |
663 AutomationNode? nextOnLine; | |
664 AutomationNode? previousOnLine; | |
570 | 665 |
571 // The index of this node in its parent node's list of children. If this is | 666 // The index of this node in its parent node's list of children. If this is |
572 // the root node, this will be undefined. | 667 // the root node, this will be undefined. |
573 long? indexInParent; | 668 long? indexInParent; |
574 | 669 |
575 // | 670 // |
576 // Actions. | 671 // Actions. |
577 // | 672 // |
578 | 673 |
579 // Does the default action based on this node's role. This is generally | 674 // Does the default action based on this node's role. This is generally |
(...skipping 13 matching lines...) Expand all Loading... | |
593 // Scrolls this node to make it visible. | 688 // Scrolls this node to make it visible. |
594 static void makeVisible(); | 689 static void makeVisible(); |
595 | 690 |
596 // Sets selection within a text field. | 691 // Sets selection within a text field. |
597 static void setSelection(long startIndex, long endIndex); | 692 static void setSelection(long startIndex, long endIndex); |
598 | 693 |
599 // Clears focus and sets this node as the starting point for the next | 694 // Clears focus and sets this node as the starting point for the next |
600 // time the user presses Tab or Shift+Tab. | 695 // time the user presses Tab or Shift+Tab. |
601 static void setSequentialFocusNavigationStartingPoint(); | 696 static void setSequentialFocusNavigationStartingPoint(); |
602 | 697 |
698 // Show the context menu for this element, as if the user right-clicked. | |
699 static void showContextMenu(); | |
700 | |
701 // Resume playing any media within this tree. | |
702 static void resumeMedia(); | |
703 | |
704 // Start ducking any media within this tree. | |
705 static void startDuckingMedia(); | |
706 | |
707 // Stop ducking any media within this tree. | |
708 static void stopDuckingMedia(); | |
709 | |
710 // Suspend any media playing within this tree. | |
711 static void suspendMedia(); | |
712 | |
603 // Adds a listener for the given event type and event phase. | 713 // Adds a listener for the given event type and event phase. |
604 static void addEventListener( | 714 static void addEventListener( |
605 EventType eventType, AutomationListener listener, boolean capture); | 715 EventType eventType, AutomationListener listener, boolean capture); |
606 | 716 |
607 // Removes a listener for the given event type and event phase. | 717 // Removes a listener for the given event type and event phase. |
608 static void removeEventListener( | 718 static void removeEventListener( |
609 EventType eventType, AutomationListener listener, boolean capture); | 719 EventType eventType, AutomationListener listener, boolean capture); |
610 | 720 |
611 // Gets the first node in this node's subtree which matches the given CSS | 721 // Gets the first node in this node's subtree which matches the given CSS |
612 // selector and is within the same DOM context. | 722 // selector and is within the same DOM context. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 // Everything in the tree between the two node/offset pairs gets included | 784 // Everything in the tree between the two node/offset pairs gets included |
675 // in the selection. The anchor is where the user started the selection, | 785 // in the selection. The anchor is where the user started the selection, |
676 // while the focus is the point at which the selection gets extended | 786 // while the focus is the point at which the selection gets extended |
677 // e.g. when dragging with a mouse or using the keyboard. For nodes with | 787 // e.g. when dragging with a mouse or using the keyboard. For nodes with |
678 // the role staticText, the offset gives the character offset within | 788 // the role staticText, the offset gives the character offset within |
679 // the value where the selection starts or ends, respectively. | 789 // the value where the selection starts or ends, respectively. |
680 [nocompile] static void setDocumentSelection( | 790 [nocompile] static void setDocumentSelection( |
681 SetDocumentSelectionParams params); | 791 SetDocumentSelectionParams params); |
682 }; | 792 }; |
683 }; | 793 }; |
OLD | NEW |