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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 case AX_ATTR_NAME_FROM: | 99 case AX_ATTR_NAME_FROM: |
100 case AX_ATTR_DESCRIPTION_FROM: | 100 case AX_ATTR_DESCRIPTION_FROM: |
101 case AX_ATTR_CHILD_TREE_ID: | 101 case AX_ATTR_CHILD_TREE_ID: |
102 case AX_ATTR_SET_SIZE: | 102 case AX_ATTR_SET_SIZE: |
103 case AX_ATTR_POS_IN_SET: | 103 case AX_ATTR_POS_IN_SET: |
104 case AX_ATTR_COLOR_VALUE: | 104 case AX_ATTR_COLOR_VALUE: |
105 case AX_ATTR_ARIA_CURRENT_STATE: | 105 case AX_ATTR_ARIA_CURRENT_STATE: |
106 case AX_ATTR_BACKGROUND_COLOR: | 106 case AX_ATTR_BACKGROUND_COLOR: |
107 case AX_ATTR_COLOR: | 107 case AX_ATTR_COLOR: |
108 case AX_ATTR_INVALID_STATE: | 108 case AX_ATTR_INVALID_STATE: |
| 109 case AX_ATTR_CHECKED_STATE: |
109 case AX_ATTR_TEXT_DIRECTION: | 110 case AX_ATTR_TEXT_DIRECTION: |
110 case AX_ATTR_TEXT_STYLE: | 111 case AX_ATTR_TEXT_STYLE: |
111 case AX_ATTR_ARIA_COL_COUNT: | 112 case AX_ATTR_ARIA_COL_COUNT: |
112 case AX_ATTR_ARIA_COL_INDEX: | 113 case AX_ATTR_ARIA_COL_INDEX: |
113 case AX_ATTR_ARIA_ROW_COUNT: | 114 case AX_ATTR_ARIA_ROW_COUNT: |
114 case AX_ATTR_ARIA_ROW_INDEX: | 115 case AX_ATTR_ARIA_ROW_INDEX: |
115 return false; | 116 return false; |
116 } | 117 } |
117 | 118 |
118 NOTREACHED(); | 119 NOTREACHED(); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 429 } |
429 | 430 |
430 std::string AXNodeData::ToString() const { | 431 std::string AXNodeData::ToString() const { |
431 std::string result; | 432 std::string result; |
432 | 433 |
433 result += "id=" + IntToString(id); | 434 result += "id=" + IntToString(id); |
434 result += " " + ui::ToString(role); | 435 result += " " + ui::ToString(role); |
435 | 436 |
436 if (state & (1 << AX_STATE_BUSY)) | 437 if (state & (1 << AX_STATE_BUSY)) |
437 result += " BUSY"; | 438 result += " BUSY"; |
438 if (state & (1 << AX_STATE_CHECKED)) | |
439 result += " CHECKED"; | |
440 if (state & (1 << AX_STATE_COLLAPSED)) | 439 if (state & (1 << AX_STATE_COLLAPSED)) |
441 result += " COLLAPSED"; | 440 result += " COLLAPSED"; |
442 if (state & (1 << AX_STATE_EDITABLE)) | 441 if (state & (1 << AX_STATE_EDITABLE)) |
443 result += " EDITABLE"; | 442 result += " EDITABLE"; |
444 if (state & (1 << AX_STATE_EXPANDED)) | 443 if (state & (1 << AX_STATE_EXPANDED)) |
445 result += " EXPANDED"; | 444 result += " EXPANDED"; |
446 if (state & (1 << AX_STATE_FOCUSABLE)) | 445 if (state & (1 << AX_STATE_FOCUSABLE)) |
447 result += " FOCUSABLE"; | 446 result += " FOCUSABLE"; |
448 if (state & (1 << AX_STATE_HASPOPUP)) | 447 if (state & (1 << AX_STATE_HASPOPUP)) |
449 result += " HASPOPUP"; | 448 result += " HASPOPUP"; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 result += " invalid_state=spelling"; | 697 result += " invalid_state=spelling"; |
699 break; | 698 break; |
700 case AX_INVALID_STATE_GRAMMAR: | 699 case AX_INVALID_STATE_GRAMMAR: |
701 result += " invalid_state=grammar"; | 700 result += " invalid_state=grammar"; |
702 break; | 701 break; |
703 case AX_INVALID_STATE_OTHER: | 702 case AX_INVALID_STATE_OTHER: |
704 result += " invalid_state=other"; | 703 result += " invalid_state=other"; |
705 break; | 704 break; |
706 } | 705 } |
707 break; | 706 break; |
| 707 case AX_ATTR_CHECKED_STATE: |
| 708 switch (int_attributes[i].second) { |
| 709 case AX_CHECKED_STATE_FALSE: |
| 710 result += " checked_state=false"; |
| 711 break; |
| 712 case AX_CHECKED_STATE_TRUE: |
| 713 result += " checked_state=true"; |
| 714 break; |
| 715 case AX_CHECKED_STATE_MIXED: |
| 716 result += " checked_state=mixed"; |
| 717 break; |
| 718 } |
| 719 break; |
708 case AX_INT_ATTRIBUTE_NONE: | 720 case AX_INT_ATTRIBUTE_NONE: |
709 break; | 721 break; |
710 } | 722 } |
711 } | 723 } |
712 | 724 |
713 for (size_t i = 0; i < string_attributes.size(); ++i) { | 725 for (size_t i = 0; i < string_attributes.size(); ++i) { |
714 std::string value = string_attributes[i].second; | 726 std::string value = string_attributes[i].second; |
715 switch (string_attributes[i].first) { | 727 switch (string_attributes[i].first) { |
716 case AX_ATTR_ACCESS_KEY: | 728 case AX_ATTR_ACCESS_KEY: |
717 result += " access_key=" + value; | 729 result += " access_key=" + value; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 result += " font_size=" + value; | 813 result += " font_size=" + value; |
802 break; | 814 break; |
803 case AX_FLOAT_ATTRIBUTE_NONE: | 815 case AX_FLOAT_ATTRIBUTE_NONE: |
804 break; | 816 break; |
805 } | 817 } |
806 } | 818 } |
807 | 819 |
808 for (size_t i = 0; i < bool_attributes.size(); ++i) { | 820 for (size_t i = 0; i < bool_attributes.size(); ++i) { |
809 std::string value = bool_attributes[i].second ? "true" : "false"; | 821 std::string value = bool_attributes[i].second ? "true" : "false"; |
810 switch (bool_attributes[i].first) { | 822 switch (bool_attributes[i].first) { |
811 case AX_ATTR_STATE_MIXED: | |
812 result += " mixed=" + value; | |
813 break; | |
814 case AX_ATTR_LIVE_ATOMIC: | 823 case AX_ATTR_LIVE_ATOMIC: |
815 result += " atomic=" + value; | 824 result += " atomic=" + value; |
816 break; | 825 break; |
817 case AX_ATTR_LIVE_BUSY: | 826 case AX_ATTR_LIVE_BUSY: |
818 result += " busy=" + value; | 827 result += " busy=" + value; |
819 break; | 828 break; |
820 case AX_ATTR_CONTAINER_LIVE_ATOMIC: | 829 case AX_ATTR_CONTAINER_LIVE_ATOMIC: |
821 result += " container_atomic=" + value; | 830 result += " container_atomic=" + value; |
822 break; | 831 break; |
823 case AX_ATTR_CONTAINER_LIVE_BUSY: | 832 case AX_ATTR_CONTAINER_LIVE_BUSY: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 } | 930 } |
922 } | 931 } |
923 | 932 |
924 if (!child_ids.empty()) | 933 if (!child_ids.empty()) |
925 result += " child_ids=" + IntVectorToString(child_ids); | 934 result += " child_ids=" + IntVectorToString(child_ids); |
926 | 935 |
927 return result; | 936 return result; |
928 } | 937 } |
929 | 938 |
930 } // namespace ui | 939 } // namespace ui |
OLD | NEW |