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 #include "content/renderer/accessibility/blink_ax_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 void addBoolAttribute(blink::WebAXBoolAttribute attribute, | 79 void addBoolAttribute(blink::WebAXBoolAttribute attribute, |
80 bool value) override { | 80 bool value) override { |
81 NOTREACHED(); | 81 NOTREACHED(); |
82 } | 82 } |
83 | 83 |
84 void addStringAttribute(blink::WebAXStringAttribute attribute, | 84 void addStringAttribute(blink::WebAXStringAttribute attribute, |
85 const blink::WebString& value) override { | 85 const blink::WebString& value) override { |
86 switch (attribute) { | 86 switch (attribute) { |
87 case blink::WebAXStringAttribute::AriaKeyShortcuts: | 87 case blink::WebAXStringAttribute::AriaKeyShortcuts: |
88 // TODO(dmazzoni): implement aria-keyshortcuts. http://crbug.com/644766 | 88 dst_->AddStringAttribute(ui::AX_ATTR_KEY_SHORTCUTS, value.utf8()); |
89 break; | 89 break; |
90 case blink::WebAXStringAttribute::AriaRoleDescription: | 90 case blink::WebAXStringAttribute::AriaRoleDescription: |
91 // TODO(dmazzoni): implement aria-roledescription. | 91 dst_->AddStringAttribute(ui::AX_ATTR_ROLE_DESCRIPTION, value.utf8()); |
92 // http://crbug.com/644766 | |
93 break; | 92 break; |
94 default: | 93 default: |
95 NOTREACHED(); | 94 NOTREACHED(); |
96 } | 95 } |
97 } | 96 } |
98 | 97 |
99 void addObjectAttribute(blink::WebAXObjectAttribute attribute, | 98 void addObjectAttribute(blink::WebAXObjectAttribute attribute, |
100 const blink::WebAXObject& value) override { | 99 const blink::WebAXObject& value) override { |
101 switch (attribute) { | 100 switch (attribute) { |
102 case blink::WebAXObjectAttribute::AriaActiveDescendant: | 101 case blink::WebAXObjectAttribute::AriaActiveDescendant: |
103 dst_->AddIntAttribute(ui::AX_ATTR_ACTIVEDESCENDANT_ID, value.axID()); | 102 dst_->AddIntAttribute(ui::AX_ATTR_ACTIVEDESCENDANT_ID, value.axID()); |
104 break; | 103 break; |
105 case blink::WebAXObjectAttribute::AriaErrorMessage: | 104 case blink::WebAXObjectAttribute::AriaErrorMessage: |
106 // TODO(dmazzoni): implement aria-errormessage. | 105 dst_->AddIntAttribute(ui::AX_ATTR_ERRORMESSAGE_ID, value.axID()); |
107 // http://crbug.com/644766 | |
108 break; | 106 break; |
109 default: | 107 default: |
110 NOTREACHED(); | 108 NOTREACHED(); |
111 } | 109 } |
112 } | 110 } |
113 | 111 |
114 void addObjectVectorAttribute( | 112 void addObjectVectorAttribute( |
115 blink::WebAXObjectVectorAttribute attribute, | 113 blink::WebAXObjectVectorAttribute attribute, |
116 const blink::WebVector<WebAXObject>& value) override { | 114 const blink::WebVector<WebAXObject>& value) override { |
117 switch (attribute) { | 115 switch (attribute) { |
118 case blink::WebAXObjectVectorAttribute::AriaControls: | 116 case blink::WebAXObjectVectorAttribute::AriaControls: |
119 AddIntListAttributeFromWebObjects(ui::AX_ATTR_CONTROLS_IDS, value, | 117 AddIntListAttributeFromWebObjects(ui::AX_ATTR_CONTROLS_IDS, value, |
120 dst_); | 118 dst_); |
121 break; | 119 break; |
122 case blink::WebAXObjectVectorAttribute::AriaDetails: | 120 case blink::WebAXObjectVectorAttribute::AriaDetails: |
123 // TODO(dmazzoni): implement aria-details. http://crbug.com/644766 | 121 AddIntListAttributeFromWebObjects(ui::AX_ATTR_DETAILS_IDS, value, |
| 122 dst_); |
124 break; | 123 break; |
125 case blink::WebAXObjectVectorAttribute::AriaFlowTo: | 124 case blink::WebAXObjectVectorAttribute::AriaFlowTo: |
126 AddIntListAttributeFromWebObjects(ui::AX_ATTR_FLOWTO_IDS, value, dst_); | 125 AddIntListAttributeFromWebObjects(ui::AX_ATTR_FLOWTO_IDS, value, dst_); |
127 break; | 126 break; |
128 default: | 127 default: |
129 NOTREACHED(); | 128 NOTREACHED(); |
130 } | 129 } |
131 } | 130 } |
132 }; | 131 }; |
133 | 132 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 dst->role == ui::AX_ROLE_SCROLL_BAR || | 639 dst->role == ui::AX_ROLE_SCROLL_BAR || |
641 dst->role == ui::AX_ROLE_SLIDER || | 640 dst->role == ui::AX_ROLE_SLIDER || |
642 dst->role == ui::AX_ROLE_SPIN_BUTTON) { | 641 dst->role == ui::AX_ROLE_SPIN_BUTTON) { |
643 dst->AddFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, src.valueForRange()); | 642 dst->AddFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, src.valueForRange()); |
644 dst->AddFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, | 643 dst->AddFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
645 src.maxValueForRange()); | 644 src.maxValueForRange()); |
646 dst->AddFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, | 645 dst->AddFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, |
647 src.minValueForRange()); | 646 src.minValueForRange()); |
648 } | 647 } |
649 | 648 |
| 649 if (dst->role == ui::AX_ROLE_DIALOG || |
| 650 dst->role == ui::AX_ROLE_ALERT_DIALOG) { |
| 651 dst->AddBoolAttribute(ui::AX_ATTR_MODAL, src.isModal()); |
| 652 } |
| 653 |
650 if (dst->role == ui::AX_ROLE_ROOT_WEB_AREA) | 654 if (dst->role == ui::AX_ROLE_ROOT_WEB_AREA) |
651 dst->AddStringAttribute(ui::AX_ATTR_HTML_TAG, "#document"); | 655 dst->AddStringAttribute(ui::AX_ATTR_HTML_TAG, "#document"); |
652 | 656 |
653 if (dst->role == ui::AX_ROLE_TABLE) { | 657 if (dst->role == ui::AX_ROLE_TABLE) { |
654 int column_count = src.columnCount(); | 658 int column_count = src.columnCount(); |
655 int row_count = src.rowCount(); | 659 int row_count = src.rowCount(); |
656 if (column_count > 0 && row_count > 0) { | 660 if (column_count > 0 && row_count > 0) { |
657 std::set<int32_t> unique_cell_id_set; | 661 std::set<int32_t> unique_cell_id_set; |
658 std::vector<int32_t> cell_ids; | 662 std::vector<int32_t> cell_ids; |
659 std::vector<int32_t> unique_cell_ids; | 663 std::vector<int32_t> unique_cell_ids; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 return WebAXObject(); | 861 return WebAXObject(); |
858 | 862 |
859 WebDocument document = render_frame_->GetWebFrame()->document(); | 863 WebDocument document = render_frame_->GetWebFrame()->document(); |
860 if (!document.isNull()) | 864 if (!document.isNull()) |
861 return document.accessibilityObject(); | 865 return document.accessibilityObject(); |
862 | 866 |
863 return WebAXObject(); | 867 return WebAXObject(); |
864 } | 868 } |
865 | 869 |
866 } // namespace content | 870 } // namespace content |
OLD | NEW |