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

Side by Side Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 1413423003: Move some AX attrs from AXNodeData to AXTreeData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 var AutomationEvent = require('automationEvent').AutomationEvent; 5 var AutomationEvent = require('automationEvent').AutomationEvent;
6 var automationInternal = 6 var automationInternal =
7 require('binding').Binding.create('automationInternal').generate(); 7 require('binding').Binding.create('automationInternal').generate();
8 var IsInteractPermitted = 8 var IsInteractPermitted =
9 requireNative('automationInternal').IsInteractPermitted; 9 requireNative('automationInternal').IsInteractPermitted;
10 10
11 /** 11 /**
12 * @param {number} axTreeID The id of the accessibility tree. 12 * @param {number} axTreeID The id of the accessibility tree.
13 * @return {?number} The id of the root node. 13 * @return {?number} The id of the root node.
14 */ 14 */
15 var GetRootID = requireNative('automationInternal').GetRootID; 15 var GetRootID = requireNative('automationInternal').GetRootID;
16 16
17 /** 17 /**
18 * @param {number} axTreeID The id of the accessibility tree. 18 * @param {number} axTreeID The id of the accessibility tree.
19 * @return {?string} The title of the document.
20 */
21 var GetDocTitle = requireNative('automationInternal').GetDocTitle;
22
23 /**
24 * @param {number} axTreeID The id of the accessibility tree.
25 * @return {?string} The url of the document.
26 */
27 var GetDocURL = requireNative('automationInternal').GetDocURL;
28
29 /**
30 * @param {number} axTreeID The id of the accessibility tree.
31 * @return {?boolean} True if the document has finished loading.
32 */
33 var GetDocLoaded = requireNative('automationInternal').GetDocLoaded;
34
35 /**
36 * @param {number} axTreeID The id of the accessibility tree.
37 * @return {?number} The loading progress, from 0.0 to 1.0 (fully loaded).
38 */
39 var GetDocLoadingProgress =
40 requireNative('automationInternal').GetDocLoadingProgress;
41
42 /**
43 * @param {number} axTreeID The id of the accessibility tree.
44 * @return {?number} The ID of the selection anchor object.
45 */
46 var GetAnchorObjectID = requireNative('automationInternal').GetAnchorObjectID;
47
48 /**
49 * @param {number} axTreeID The id of the accessibility tree.
50 * @return {?number} The selection anchor offset.
51 */
52 var GetAnchorOffset = requireNative('automationInternal').GetAnchorOffset;
53
54 /**
55 * @param {number} axTreeID The id of the accessibility tree.
56 * @return {?number} The ID of the selection focus object.
57 */
58 var GetFocusObjectID = requireNative('automationInternal').GetFocusObjectID;
59
60 /**
61 * @param {number} axTreeID The id of the accessibility tree.
62 * @return {?number} The selection focus offset.
63 */
64 var GetFocusOffset = requireNative('automationInternal').GetFocusOffset;
65
66 /**
67 * @param {number} axTreeID The id of the accessibility tree.
19 * @param {number} nodeID The id of a node. 68 * @param {number} nodeID The id of a node.
20 * @return {?number} The id of the node's parent, or undefined if it's the 69 * @return {?number} The id of the node's parent, or undefined if it's the
21 * root of its tree or if the tree or node wasn't found. 70 * root of its tree or if the tree or node wasn't found.
22 */ 71 */
23 var GetParentID = requireNative('automationInternal').GetParentID; 72 var GetParentID = requireNative('automationInternal').GetParentID;
24 73
25 /** 74 /**
26 * @param {number} axTreeID The id of the accessibility tree. 75 * @param {number} axTreeID The id of the accessibility tree.
27 * @param {number} nodeID The id of a node. 76 * @param {number} nodeID The id of a node.
28 * @return {?number} The number of children of the node, or undefined if 77 * @return {?number} The number of children of the node, or undefined if
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 551
503 var stringAttributes = [ 552 var stringAttributes = [
504 'accessKey', 553 'accessKey',
505 'action', 554 'action',
506 'ariaInvalidValue', 555 'ariaInvalidValue',
507 'autoComplete', 556 'autoComplete',
508 'containerLiveRelevant', 557 'containerLiveRelevant',
509 'containerLiveStatus', 558 'containerLiveStatus',
510 'description', 559 'description',
511 'display', 560 'display',
512 'docDoctype',
513 'docMimetype',
514 'docTitle',
515 'docUrl',
516 'dropeffect', 561 'dropeffect',
517 'help', 562 'help',
518 'htmlTag', 563 'htmlTag',
519 'liveRelevant', 564 'liveRelevant',
520 'liveStatus', 565 'liveStatus',
521 'name', 566 'name',
522 'placeholder', 567 'placeholder',
523 'shortcut', 568 'shortcut',
524 'textInputType', 569 'textInputType',
525 'url', 570 'url',
526 'value']; 571 'value'];
527 572
528 var boolAttributes = [ 573 var boolAttributes = [
529 'ariaReadonly', 574 'ariaReadonly',
530 'buttonMixed', 575 'buttonMixed',
531 'canSetValue', 576 'canSetValue',
532 'canvasHasFallback', 577 'canvasHasFallback',
533 'containerLiveAtomic', 578 'containerLiveAtomic',
534 'containerLiveBusy', 579 'containerLiveBusy',
535 'docLoaded',
536 'grabbed', 580 'grabbed',
537 'isAxTreeHost', 581 'isAxTreeHost',
538 'liveAtomic', 582 'liveAtomic',
539 'liveBusy', 583 'liveBusy',
540 'updateLocationOnly']; 584 'updateLocationOnly'];
541 585
542 var intAttributes = [ 586 var intAttributes = [
543 'anchorOffset',
544 'backgroundColor', 587 'backgroundColor',
545 'color', 588 'color',
546 'colorValue', 589 'colorValue',
547 'focusOffset',
548 'hierarchicalLevel', 590 'hierarchicalLevel',
549 'invalidState', 591 'invalidState',
550 'posInSet', 592 'posInSet',
551 'scrollX', 593 'scrollX',
552 'scrollXMax', 594 'scrollXMax',
553 'scrollXMin', 595 'scrollXMin',
554 'scrollY', 596 'scrollY',
555 'scrollYMax', 597 'scrollYMax',
556 'scrollYMin', 598 'scrollYMin',
557 'setSize', 599 'setSize',
558 'sortDirection', 600 'sortDirection',
559 'tableCellColumnIndex', 601 'tableCellColumnIndex',
560 'tableCellColumnSpan', 602 'tableCellColumnSpan',
561 'tableCellRowIndex', 603 'tableCellRowIndex',
562 'tableCellRowSpan', 604 'tableCellRowSpan',
563 'tableColumnCount', 605 'tableColumnCount',
564 'tableColumnIndex', 606 'tableColumnIndex',
565 'tableRowCount', 607 'tableRowCount',
566 'tableRowIndex', 608 'tableRowIndex',
567 'textDirection', 609 'textDirection',
568 'textSelEnd', 610 'textSelEnd',
569 'textSelStart', 611 'textSelStart',
570 'textStyle']; 612 'textStyle'];
571 613
572 var nodeRefAttributes = [ 614 var nodeRefAttributes = [
573 ['activedescendantId', 'activedescendant'], 615 ['activedescendantId', 'activedescendant'],
574 ['anchorObjectId', 'anchorObject'],
575 ['focusObjectId', 'focusObject'],
576 ['tableColumnHeaderId', 'tableColumnHeader'], 616 ['tableColumnHeaderId', 'tableColumnHeader'],
577 ['tableHeaderId', 'tableHeader'], 617 ['tableHeaderId', 'tableHeader'],
578 ['tableRowHeaderId', 'tableRowHeader'], 618 ['tableRowHeaderId', 'tableRowHeader'],
579 ['titleUiElement', 'titleUIElement']]; 619 ['titleUiElement', 'titleUIElement']];
580 620
581 var intListAttributes = [ 621 var intListAttributes = [
582 'characterOffsets', 622 'characterOffsets',
583 'lineBreaks', 623 'lineBreaks',
584 'wordEnds', 624 'wordEnds',
585 'wordStarts']; 625 'wordStarts'];
586 626
587 var nodeRefListAttributes = [ 627 var nodeRefListAttributes = [
588 ['cellIds', 'cells'], 628 ['cellIds', 'cells'],
589 ['controlsIds', 'controls'], 629 ['controlsIds', 'controls'],
590 ['describedbyIds', 'describedBy'], 630 ['describedbyIds', 'describedBy'],
591 ['flowtoIds', 'flowTo'], 631 ['flowtoIds', 'flowTo'],
592 ['labelledbyIds', 'labelledBy'], 632 ['labelledbyIds', 'labelledBy'],
593 ['uniqueCellIds', 'uniqueCells']]; 633 ['uniqueCellIds', 'uniqueCells']];
594 634
595 var floatAttributes = [ 635 var floatAttributes = [
596 'docLoadingProgress',
597 'valueForRange', 636 'valueForRange',
598 'minValueForRange', 637 'minValueForRange',
599 'maxValueForRange', 638 'maxValueForRange',
600 'fontSize']; 639 'fontSize'];
601 640
602 var htmlAttributes = [ 641 var htmlAttributes = [
603 ['type', 'inputType']]; 642 ['type', 'inputType']];
604 643
605 var publicAttributes = []; 644 var publicAttributes = [];
606 645
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 var result = GetRootID(this.treeID); 807 var result = GetRootID(this.treeID);
769 808
770 // Don't return undefined, because the id is often passed directly 809 // Don't return undefined, because the id is often passed directly
771 // as an argument to a native binding that expects only a valid number. 810 // as an argument to a native binding that expects only a valid number.
772 if (result === undefined) 811 if (result === undefined)
773 return -1; 812 return -1;
774 813
775 return result; 814 return result;
776 }, 815 },
777 816
817 get docUrl() {
818 return GetDocURL(this.treeID);
819 },
820
821 get docTitle() {
822 return GetDocTitle(this.treeID);
823 },
824
825 get docLoaded() {
826 return GetDocLoaded(this.treeID);
827 },
828
829 get docLoadingProgress() {
830 return GetDocLoadingProgress(this.treeID);
831 },
832
833 get anchorObject() {
834 var id = GetAnchorObjectID(this.treeID);
835 if (id && id != -1)
836 return this.get(id);
837 else
838 return undefined;
839 },
840
841 get anchorOffset() {
842 var id = GetAnchorObjectID(this.treeID);
843 if (id && id != -1)
844 return GetAnchorOffset(this.treeID);
845 },
846
847 get focusObject() {
848 var id = GetFocusObjectID(this.treeID);
849 if (id && id != -1)
850 return this.get(id);
851 else
852 return undefined;
853 },
854
855 get focusOffset() {
856 var id = GetFocusObjectID(this.treeID);
857 if (id && id != -1)
858 return GetFocusOffset(this.treeID);
859 },
860
778 get: function(id) { 861 get: function(id) {
779 if (id == undefined) 862 if (id == undefined)
780 return undefined; 863 return undefined;
781 864
782 if (id == this.id) 865 if (id == this.id)
783 return this.wrapper; 866 return this.wrapper;
784 867
785 var obj = this.axNodeDataCache_[id]; 868 var obj = this.axNodeDataCache_[id];
786 if (obj) 869 if (obj)
787 return obj; 870 return obj;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 'nextSibling', 945 'nextSibling',
863 'isRootNode', 946 'isRootNode',
864 'role', 947 'role',
865 'state', 948 'state',
866 'location', 949 'location',
867 'indexInParent', 950 'indexInParent',
868 'root']) }); 951 'root']) });
869 952
870 var AutomationRootNode = utils.expose('AutomationRootNode', 953 var AutomationRootNode = utils.expose('AutomationRootNode',
871 AutomationRootNodeImpl, 954 AutomationRootNodeImpl,
872 { superclass: AutomationNode }); 955 { superclass: AutomationNode,
956 readonly: ['docTitle',
957 'docUrl',
958 'docLoaded',
959 'docLoadingProgress',
960 'anchorObject',
961 'anchorOffset',
962 'focusObject',
963 'focusOffset'] });
873 964
874 AutomationRootNode.get = function(treeID) { 965 AutomationRootNode.get = function(treeID) {
875 return AutomationRootNodeImpl.get(treeID); 966 return AutomationRootNodeImpl.get(treeID);
876 } 967 }
877 968
878 AutomationRootNode.getOrCreate = function(treeID) { 969 AutomationRootNode.getOrCreate = function(treeID) {
879 return AutomationRootNodeImpl.getOrCreate(treeID); 970 return AutomationRootNodeImpl.getOrCreate(treeID);
880 } 971 }
881 972
882 AutomationRootNode.destroy = function(treeID) { 973 AutomationRootNode.destroy = function(treeID) {
883 AutomationRootNodeImpl.destroy(treeID); 974 AutomationRootNodeImpl.destroy(treeID);
884 } 975 }
885 976
886 exports.AutomationNode = AutomationNode; 977 exports.AutomationNode = AutomationNode;
887 exports.AutomationRootNode = AutomationRootNode; 978 exports.AutomationRootNode = AutomationRootNode;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698