OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ui/accessibility/ax_node_data.h" | 5 #include "ui/accessibility/ax_node_data.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 case AX_ATTR_NAME_FROM: | 100 case AX_ATTR_NAME_FROM: |
101 case AX_ATTR_DESCRIPTION_FROM: | 101 case AX_ATTR_DESCRIPTION_FROM: |
102 case AX_ATTR_CHILD_TREE_ID: | 102 case AX_ATTR_CHILD_TREE_ID: |
103 case AX_ATTR_SET_SIZE: | 103 case AX_ATTR_SET_SIZE: |
104 case AX_ATTR_POS_IN_SET: | 104 case AX_ATTR_POS_IN_SET: |
105 case AX_ATTR_COLOR_VALUE: | 105 case AX_ATTR_COLOR_VALUE: |
106 case AX_ATTR_ARIA_CURRENT_STATE: | 106 case AX_ATTR_ARIA_CURRENT_STATE: |
107 case AX_ATTR_BACKGROUND_COLOR: | 107 case AX_ATTR_BACKGROUND_COLOR: |
108 case AX_ATTR_COLOR: | 108 case AX_ATTR_COLOR: |
109 case AX_ATTR_INVALID_STATE: | 109 case AX_ATTR_INVALID_STATE: |
| 110 case AX_ATTR_CHECKED_STATE: |
110 case AX_ATTR_TEXT_DIRECTION: | 111 case AX_ATTR_TEXT_DIRECTION: |
111 case AX_ATTR_TEXT_STYLE: | 112 case AX_ATTR_TEXT_STYLE: |
112 case AX_ATTR_ARIA_COL_COUNT: | 113 case AX_ATTR_ARIA_COL_COUNT: |
113 case AX_ATTR_ARIA_COL_INDEX: | 114 case AX_ATTR_ARIA_COL_INDEX: |
114 case AX_ATTR_ARIA_ROW_COUNT: | 115 case AX_ATTR_ARIA_ROW_COUNT: |
115 case AX_ATTR_ARIA_ROW_INDEX: | 116 case AX_ATTR_ARIA_ROW_INDEX: |
116 return false; | 117 return false; |
117 } | 118 } |
118 | 119 |
119 NOTREACHED(); | 120 NOTREACHED(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 } | 431 } |
431 | 432 |
432 std::string AXNodeData::ToString() const { | 433 std::string AXNodeData::ToString() const { |
433 std::string result; | 434 std::string result; |
434 | 435 |
435 result += "id=" + IntToString(id); | 436 result += "id=" + IntToString(id); |
436 result += " " + ui::ToString(role); | 437 result += " " + ui::ToString(role); |
437 | 438 |
438 if (state & (1 << AX_STATE_BUSY)) | 439 if (state & (1 << AX_STATE_BUSY)) |
439 result += " BUSY"; | 440 result += " BUSY"; |
440 if (state & (1 << AX_STATE_CHECKED)) | |
441 result += " CHECKED"; | |
442 if (state & (1 << AX_STATE_COLLAPSED)) | 441 if (state & (1 << AX_STATE_COLLAPSED)) |
443 result += " COLLAPSED"; | 442 result += " COLLAPSED"; |
444 if (state & (1 << AX_STATE_EDITABLE)) | 443 if (state & (1 << AX_STATE_EDITABLE)) |
445 result += " EDITABLE"; | 444 result += " EDITABLE"; |
446 if (state & (1 << AX_STATE_EXPANDED)) | 445 if (state & (1 << AX_STATE_EXPANDED)) |
447 result += " EXPANDED"; | 446 result += " EXPANDED"; |
448 if (state & (1 << AX_STATE_FOCUSABLE)) | 447 if (state & (1 << AX_STATE_FOCUSABLE)) |
449 result += " FOCUSABLE"; | 448 result += " FOCUSABLE"; |
450 if (state & (1 << AX_STATE_HASPOPUP)) | 449 if (state & (1 << AX_STATE_HASPOPUP)) |
451 result += " HASPOPUP"; | 450 result += " HASPOPUP"; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 result += " invalid_state=spelling"; | 702 result += " invalid_state=spelling"; |
704 break; | 703 break; |
705 case AX_INVALID_STATE_GRAMMAR: | 704 case AX_INVALID_STATE_GRAMMAR: |
706 result += " invalid_state=grammar"; | 705 result += " invalid_state=grammar"; |
707 break; | 706 break; |
708 case AX_INVALID_STATE_OTHER: | 707 case AX_INVALID_STATE_OTHER: |
709 result += " invalid_state=other"; | 708 result += " invalid_state=other"; |
710 break; | 709 break; |
711 } | 710 } |
712 break; | 711 break; |
| 712 case AX_ATTR_CHECKED_STATE: |
| 713 switch (int_attributes[i].second) { |
| 714 case AX_CHECKED_STATE_FALSE: |
| 715 result += " checked_state=false"; |
| 716 break; |
| 717 case AX_CHECKED_STATE_TRUE: |
| 718 result += " checked_state=true"; |
| 719 break; |
| 720 case AX_CHECKED_STATE_MIXED: |
| 721 result += " checked_state=mixed"; |
| 722 break; |
| 723 } |
| 724 break; |
713 case AX_INT_ATTRIBUTE_NONE: | 725 case AX_INT_ATTRIBUTE_NONE: |
714 break; | 726 break; |
715 } | 727 } |
716 } | 728 } |
717 | 729 |
718 for (size_t i = 0; i < string_attributes.size(); ++i) { | 730 for (size_t i = 0; i < string_attributes.size(); ++i) { |
719 std::string value = string_attributes[i].second; | 731 std::string value = string_attributes[i].second; |
720 switch (string_attributes[i].first) { | 732 switch (string_attributes[i].first) { |
721 case AX_ATTR_ACCESS_KEY: | 733 case AX_ATTR_ACCESS_KEY: |
722 result += " access_key=" + value; | 734 result += " access_key=" + value; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 result += " font_size=" + value; | 821 result += " font_size=" + value; |
810 break; | 822 break; |
811 case AX_FLOAT_ATTRIBUTE_NONE: | 823 case AX_FLOAT_ATTRIBUTE_NONE: |
812 break; | 824 break; |
813 } | 825 } |
814 } | 826 } |
815 | 827 |
816 for (size_t i = 0; i < bool_attributes.size(); ++i) { | 828 for (size_t i = 0; i < bool_attributes.size(); ++i) { |
817 std::string value = bool_attributes[i].second ? "true" : "false"; | 829 std::string value = bool_attributes[i].second ? "true" : "false"; |
818 switch (bool_attributes[i].first) { | 830 switch (bool_attributes[i].first) { |
819 case AX_ATTR_STATE_MIXED: | |
820 result += " mixed=" + value; | |
821 break; | |
822 case AX_ATTR_LIVE_ATOMIC: | 831 case AX_ATTR_LIVE_ATOMIC: |
823 result += " atomic=" + value; | 832 result += " atomic=" + value; |
824 break; | 833 break; |
825 case AX_ATTR_LIVE_BUSY: | 834 case AX_ATTR_LIVE_BUSY: |
826 result += " busy=" + value; | 835 result += " busy=" + value; |
827 break; | 836 break; |
828 case AX_ATTR_CONTAINER_LIVE_ATOMIC: | 837 case AX_ATTR_CONTAINER_LIVE_ATOMIC: |
829 result += " container_atomic=" + value; | 838 result += " container_atomic=" + value; |
830 break; | 839 break; |
831 case AX_ATTR_CONTAINER_LIVE_BUSY: | 840 case AX_ATTR_CONTAINER_LIVE_BUSY: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 } | 941 } |
933 } | 942 } |
934 | 943 |
935 if (!child_ids.empty()) | 944 if (!child_ids.empty()) |
936 result += " child_ids=" + IntVectorToString(child_ids); | 945 result += " child_ids=" + IntVectorToString(child_ids); |
937 | 946 |
938 return result; | 947 return result; |
939 } | 948 } |
940 | 949 |
941 } // namespace ui | 950 } // namespace ui |
OLD | NEW |