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