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/shell/test_runner/web_ax_object_proxy.h" | 5 #include "content/shell/test_runner/web_ax_object_proxy.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen) | 607 .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen) |
608 .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed) | 608 .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed) |
609 .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup) | 609 .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup) |
610 .SetProperty("isValid", &WebAXObjectProxy::IsValid) | 610 .SetProperty("isValid", &WebAXObjectProxy::IsValid) |
611 .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly) | 611 .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly) |
612 .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor) | 612 .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor) |
613 .SetProperty("color", &WebAXObjectProxy::Color) | 613 .SetProperty("color", &WebAXObjectProxy::Color) |
614 .SetProperty("colorValue", &WebAXObjectProxy::ColorValue) | 614 .SetProperty("colorValue", &WebAXObjectProxy::ColorValue) |
615 .SetProperty("fontFamily", &WebAXObjectProxy::FontFamily) | 615 .SetProperty("fontFamily", &WebAXObjectProxy::FontFamily) |
616 .SetProperty("fontSize", &WebAXObjectProxy::FontSize) | 616 .SetProperty("fontSize", &WebAXObjectProxy::FontSize) |
| 617 .SetProperty("autocomplete", &WebAXObjectProxy::Autocomplete) |
| 618 .SetProperty("current", &WebAXObjectProxy::Current) |
| 619 .SetProperty("invalid", &WebAXObjectProxy::Invalid) |
| 620 .SetProperty("keyShortcuts", &WebAXObjectProxy::KeyShortcuts) |
| 621 .SetProperty("live", &WebAXObjectProxy::Live) |
617 .SetProperty("orientation", &WebAXObjectProxy::Orientation) | 622 .SetProperty("orientation", &WebAXObjectProxy::Orientation) |
| 623 .SetProperty("relevant", &WebAXObjectProxy::Relevant) |
| 624 .SetProperty("roleDescription", &WebAXObjectProxy::RoleDescription) |
| 625 .SetProperty("sort", &WebAXObjectProxy::Sort) |
618 .SetProperty("posInSet", &WebAXObjectProxy::PosInSet) | 626 .SetProperty("posInSet", &WebAXObjectProxy::PosInSet) |
619 .SetProperty("setSize", &WebAXObjectProxy::SetSize) | 627 .SetProperty("setSize", &WebAXObjectProxy::SetSize) |
620 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) | 628 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) |
621 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) | 629 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) |
622 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) | 630 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) |
623 .SetProperty("rowHeadersCount", &WebAXObjectProxy::RowHeadersCount) | 631 .SetProperty("rowHeadersCount", &WebAXObjectProxy::RowHeadersCount) |
624 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) | 632 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) |
625 .SetProperty("columnHeadersCount", &WebAXObjectProxy::ColumnHeadersCount) | 633 .SetProperty("columnHeadersCount", &WebAXObjectProxy::ColumnHeadersCount) |
626 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) | 634 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) |
627 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed) | 635 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed) |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 accessibility_object_.updateLayoutAndCheckValidity(); | 1075 accessibility_object_.updateLayoutAndCheckValidity(); |
1068 std::string font_family(accessibility_object_.fontFamily().utf8()); | 1076 std::string font_family(accessibility_object_.fontFamily().utf8()); |
1069 return font_family.insert(0, "AXFontFamily: "); | 1077 return font_family.insert(0, "AXFontFamily: "); |
1070 } | 1078 } |
1071 | 1079 |
1072 float WebAXObjectProxy::FontSize() { | 1080 float WebAXObjectProxy::FontSize() { |
1073 accessibility_object_.updateLayoutAndCheckValidity(); | 1081 accessibility_object_.updateLayoutAndCheckValidity(); |
1074 return accessibility_object_.fontSize(); | 1082 return accessibility_object_.fontSize(); |
1075 } | 1083 } |
1076 | 1084 |
| 1085 std::string WebAXObjectProxy::Autocomplete() { |
| 1086 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1087 return accessibility_object_.ariaAutoComplete().utf8(); |
| 1088 } |
| 1089 |
| 1090 std::string WebAXObjectProxy::Current() { |
| 1091 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1092 switch (accessibility_object_.ariaCurrentState()) { |
| 1093 case blink::WebAXAriaCurrentStateFalse: |
| 1094 return "false"; |
| 1095 case blink::WebAXAriaCurrentStateTrue: |
| 1096 return "true"; |
| 1097 case blink::WebAXAriaCurrentStatePage: |
| 1098 return "page"; |
| 1099 case blink::WebAXAriaCurrentStateStep: |
| 1100 return "step"; |
| 1101 case blink::WebAXAriaCurrentStateLocation: |
| 1102 return "location"; |
| 1103 case blink::WebAXAriaCurrentStateDate: |
| 1104 return "date"; |
| 1105 case blink::WebAXAriaCurrentStateTime: |
| 1106 return "time"; |
| 1107 default: |
| 1108 return std::string(); |
| 1109 } |
| 1110 } |
| 1111 |
| 1112 std::string WebAXObjectProxy::Invalid() { |
| 1113 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1114 switch (accessibility_object_.invalidState()) { |
| 1115 case blink::WebAXInvalidStateFalse: |
| 1116 return "false"; |
| 1117 case blink::WebAXInvalidStateTrue: |
| 1118 return "true"; |
| 1119 case blink::WebAXInvalidStateSpelling: |
| 1120 return "spelling"; |
| 1121 case blink::WebAXInvalidStateGrammar: |
| 1122 return "grammar"; |
| 1123 case blink::WebAXInvalidStateOther: |
| 1124 return "other"; |
| 1125 default: |
| 1126 return std::string(); |
| 1127 } |
| 1128 } |
| 1129 |
| 1130 std::string WebAXObjectProxy::KeyShortcuts() { |
| 1131 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1132 SparseAttributeAdapter attribute_adapter; |
| 1133 accessibility_object_.getSparseAXAttributes(attribute_adapter); |
| 1134 return attribute_adapter |
| 1135 .string_attributes[blink::WebAXStringAttribute::AriaKeyShortcuts] |
| 1136 .utf8(); |
| 1137 } |
| 1138 |
| 1139 std::string WebAXObjectProxy::Live() { |
| 1140 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1141 return accessibility_object_.liveRegionStatus().utf8(); |
| 1142 } |
| 1143 |
1077 std::string WebAXObjectProxy::Orientation() { | 1144 std::string WebAXObjectProxy::Orientation() { |
1078 accessibility_object_.updateLayoutAndCheckValidity(); | 1145 accessibility_object_.updateLayoutAndCheckValidity(); |
1079 if (accessibility_object_.orientation() == blink::WebAXOrientationVertical) | 1146 if (accessibility_object_.orientation() == blink::WebAXOrientationVertical) |
1080 return "AXOrientation: AXVerticalOrientation"; | 1147 return "AXOrientation: AXVerticalOrientation"; |
1081 else if (accessibility_object_.orientation() == | 1148 else if (accessibility_object_.orientation() == |
1082 blink::WebAXOrientationHorizontal) | 1149 blink::WebAXOrientationHorizontal) |
1083 return "AXOrientation: AXHorizontalOrientation"; | 1150 return "AXOrientation: AXHorizontalOrientation"; |
1084 | 1151 |
1085 return std::string(); | 1152 return std::string(); |
1086 } | 1153 } |
1087 | 1154 |
| 1155 std::string WebAXObjectProxy::Relevant() { |
| 1156 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1157 return accessibility_object_.liveRegionRelevant().utf8(); |
| 1158 } |
| 1159 |
| 1160 std::string WebAXObjectProxy::RoleDescription() { |
| 1161 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1162 SparseAttributeAdapter attribute_adapter; |
| 1163 accessibility_object_.getSparseAXAttributes(attribute_adapter); |
| 1164 return attribute_adapter |
| 1165 .string_attributes[blink::WebAXStringAttribute::AriaRoleDescription] |
| 1166 .utf8(); |
| 1167 } |
| 1168 |
| 1169 std::string WebAXObjectProxy::Sort() { |
| 1170 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1171 switch (accessibility_object_.sortDirection()) { |
| 1172 case blink::WebAXSortDirectionAscending: |
| 1173 return "ascending"; |
| 1174 case blink::WebAXSortDirectionDescending: |
| 1175 return "descending"; |
| 1176 case blink::WebAXSortDirectionOther: |
| 1177 return "other"; |
| 1178 default: |
| 1179 return std::string(); |
| 1180 } |
| 1181 } |
| 1182 |
1088 int WebAXObjectProxy::PosInSet() { | 1183 int WebAXObjectProxy::PosInSet() { |
1089 accessibility_object_.updateLayoutAndCheckValidity(); | 1184 accessibility_object_.updateLayoutAndCheckValidity(); |
1090 return accessibility_object_.posInSet(); | 1185 return accessibility_object_.posInSet(); |
1091 } | 1186 } |
1092 | 1187 |
1093 int WebAXObjectProxy::SetSize() { | 1188 int WebAXObjectProxy::SetSize() { |
1094 accessibility_object_.updateLayoutAndCheckValidity(); | 1189 accessibility_object_.updateLayoutAndCheckValidity(); |
1095 return accessibility_object_.setSize(); | 1190 return accessibility_object_.setSize(); |
1096 } | 1191 } |
1097 | 1192 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 v8::Local<v8::Value> value_handle = | 1854 v8::Local<v8::Value> value_handle = |
1760 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8(); | 1855 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8(); |
1761 if (value_handle.IsEmpty()) | 1856 if (value_handle.IsEmpty()) |
1762 return v8::Local<v8::Object>(); | 1857 return v8::Local<v8::Object>(); |
1763 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); | 1858 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); |
1764 elements_.Append(handle); | 1859 elements_.Append(handle); |
1765 return handle; | 1860 return handle; |
1766 } | 1861 } |
1767 | 1862 |
1768 } // namespace test_runner | 1863 } // namespace test_runner |
OLD | NEW |