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

Side by Side Diff: content/shell/test_runner/web_ax_object_proxy.cc

Issue 2788523002: Finish all string attributes for Accessibility Object Model Phase 1. (Closed)
Patch Set: Test that checked works with true/false, not only 'true' and 'false' Created 3 years, 8 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 #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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen) 605 .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen)
606 .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed) 606 .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed)
607 .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup) 607 .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup)
608 .SetProperty("isValid", &WebAXObjectProxy::IsValid) 608 .SetProperty("isValid", &WebAXObjectProxy::IsValid)
609 .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly) 609 .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly)
610 .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor) 610 .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor)
611 .SetProperty("color", &WebAXObjectProxy::Color) 611 .SetProperty("color", &WebAXObjectProxy::Color)
612 .SetProperty("colorValue", &WebAXObjectProxy::ColorValue) 612 .SetProperty("colorValue", &WebAXObjectProxy::ColorValue)
613 .SetProperty("fontFamily", &WebAXObjectProxy::FontFamily) 613 .SetProperty("fontFamily", &WebAXObjectProxy::FontFamily)
614 .SetProperty("fontSize", &WebAXObjectProxy::FontSize) 614 .SetProperty("fontSize", &WebAXObjectProxy::FontSize)
615 .SetProperty("autocomplete", &WebAXObjectProxy::Autocomplete)
616 .SetProperty("current", &WebAXObjectProxy::Current)
617 .SetProperty("invalid", &WebAXObjectProxy::Invalid)
618 .SetProperty("keyShortcuts", &WebAXObjectProxy::KeyShortcuts)
619 .SetProperty("live", &WebAXObjectProxy::Live)
615 .SetProperty("orientation", &WebAXObjectProxy::Orientation) 620 .SetProperty("orientation", &WebAXObjectProxy::Orientation)
621 .SetProperty("relevant", &WebAXObjectProxy::Relevant)
622 .SetProperty("roleDescription", &WebAXObjectProxy::RoleDescription)
623 .SetProperty("sort", &WebAXObjectProxy::Sort)
616 .SetProperty("posInSet", &WebAXObjectProxy::PosInSet) 624 .SetProperty("posInSet", &WebAXObjectProxy::PosInSet)
617 .SetProperty("setSize", &WebAXObjectProxy::SetSize) 625 .SetProperty("setSize", &WebAXObjectProxy::SetSize)
618 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) 626 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX)
619 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) 627 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY)
620 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) 628 .SetProperty("rowCount", &WebAXObjectProxy::RowCount)
621 .SetProperty("rowHeadersCount", &WebAXObjectProxy::RowHeadersCount) 629 .SetProperty("rowHeadersCount", &WebAXObjectProxy::RowHeadersCount)
622 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) 630 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount)
623 .SetProperty("columnHeadersCount", &WebAXObjectProxy::ColumnHeadersCount) 631 .SetProperty("columnHeadersCount", &WebAXObjectProxy::ColumnHeadersCount)
624 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) 632 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable)
625 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed) 633 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed)
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 accessibility_object_.updateLayoutAndCheckValidity(); 1073 accessibility_object_.updateLayoutAndCheckValidity();
1066 std::string font_family(accessibility_object_.fontFamily().utf8()); 1074 std::string font_family(accessibility_object_.fontFamily().utf8());
1067 return font_family.insert(0, "AXFontFamily: "); 1075 return font_family.insert(0, "AXFontFamily: ");
1068 } 1076 }
1069 1077
1070 float WebAXObjectProxy::FontSize() { 1078 float WebAXObjectProxy::FontSize() {
1071 accessibility_object_.updateLayoutAndCheckValidity(); 1079 accessibility_object_.updateLayoutAndCheckValidity();
1072 return accessibility_object_.fontSize(); 1080 return accessibility_object_.fontSize();
1073 } 1081 }
1074 1082
1083 std::string WebAXObjectProxy::Autocomplete() {
1084 accessibility_object_.updateLayoutAndCheckValidity();
1085 return accessibility_object_.ariaAutoComplete().utf8();
1086 }
1087
1088 std::string WebAXObjectProxy::Current() {
1089 accessibility_object_.updateLayoutAndCheckValidity();
1090 switch (accessibility_object_.ariaCurrentState()) {
1091 case blink::WebAXAriaCurrentStateFalse:
1092 return "false";
1093 case blink::WebAXAriaCurrentStateTrue:
1094 return "true";
1095 case blink::WebAXAriaCurrentStatePage:
1096 return "page";
1097 case blink::WebAXAriaCurrentStateStep:
1098 return "step";
1099 case blink::WebAXAriaCurrentStateLocation:
esprehn 2017/04/04 06:22:30 It'd be really nice if you'd onion soup all this s
dmazzoni 2017/04/04 18:59:17 Sounds great. I threw a quick meeting on your cale
1100 return "location";
1101 case blink::WebAXAriaCurrentStateDate:
1102 return "date";
1103 case blink::WebAXAriaCurrentStateTime:
1104 return "time";
1105 default:
1106 return std::string();
1107 }
1108 }
1109
1110 std::string WebAXObjectProxy::Invalid() {
1111 accessibility_object_.updateLayoutAndCheckValidity();
1112 switch (accessibility_object_.invalidState()) {
1113 case blink::WebAXInvalidStateFalse:
1114 return "false";
1115 case blink::WebAXInvalidStateTrue:
1116 return "true";
1117 case blink::WebAXInvalidStateSpelling:
1118 return "spelling";
1119 case blink::WebAXInvalidStateGrammar:
1120 return "grammar";
1121 case blink::WebAXInvalidStateOther:
1122 return "other";
1123 default:
1124 return std::string();
1125 }
1126 }
1127
1128 std::string WebAXObjectProxy::KeyShortcuts() {
1129 accessibility_object_.updateLayoutAndCheckValidity();
1130 SparseAttributeAdapter attribute_adapter;
1131 accessibility_object_.getSparseAXAttributes(attribute_adapter);
1132 return attribute_adapter
1133 .string_attributes[blink::WebAXStringAttribute::AriaKeyShortcuts]
1134 .utf8();
1135 }
1136
1137 std::string WebAXObjectProxy::Live() {
1138 accessibility_object_.updateLayoutAndCheckValidity();
1139 return accessibility_object_.liveRegionStatus().utf8();
1140 }
1141
1075 std::string WebAXObjectProxy::Orientation() { 1142 std::string WebAXObjectProxy::Orientation() {
1076 accessibility_object_.updateLayoutAndCheckValidity(); 1143 accessibility_object_.updateLayoutAndCheckValidity();
1077 if (accessibility_object_.orientation() == blink::WebAXOrientationVertical) 1144 if (accessibility_object_.orientation() == blink::WebAXOrientationVertical)
1078 return "AXOrientation: AXVerticalOrientation"; 1145 return "AXOrientation: AXVerticalOrientation";
1079 else if (accessibility_object_.orientation() == 1146 else if (accessibility_object_.orientation() ==
1080 blink::WebAXOrientationHorizontal) 1147 blink::WebAXOrientationHorizontal)
1081 return "AXOrientation: AXHorizontalOrientation"; 1148 return "AXOrientation: AXHorizontalOrientation";
1082 1149
1083 return std::string(); 1150 return std::string();
1084 } 1151 }
1085 1152
1153 std::string WebAXObjectProxy::Relevant() {
1154 accessibility_object_.updateLayoutAndCheckValidity();
1155 return accessibility_object_.liveRegionRelevant().utf8();
1156 }
1157
1158 std::string WebAXObjectProxy::RoleDescription() {
1159 accessibility_object_.updateLayoutAndCheckValidity();
1160 SparseAttributeAdapter attribute_adapter;
1161 accessibility_object_.getSparseAXAttributes(attribute_adapter);
1162 return attribute_adapter
1163 .string_attributes[blink::WebAXStringAttribute::AriaRoleDescription]
1164 .utf8();
1165 }
1166
1167 std::string WebAXObjectProxy::Sort() {
1168 accessibility_object_.updateLayoutAndCheckValidity();
1169 switch (accessibility_object_.sortDirection()) {
1170 case blink::WebAXSortDirectionAscending:
1171 return "ascending";
1172 case blink::WebAXSortDirectionDescending:
1173 return "descending";
1174 case blink::WebAXSortDirectionOther:
1175 return "other";
1176 default:
1177 return std::string();
1178 }
1179 }
1180
1086 int WebAXObjectProxy::PosInSet() { 1181 int WebAXObjectProxy::PosInSet() {
1087 accessibility_object_.updateLayoutAndCheckValidity(); 1182 accessibility_object_.updateLayoutAndCheckValidity();
1088 return accessibility_object_.posInSet(); 1183 return accessibility_object_.posInSet();
1089 } 1184 }
1090 1185
1091 int WebAXObjectProxy::SetSize() { 1186 int WebAXObjectProxy::SetSize() {
1092 accessibility_object_.updateLayoutAndCheckValidity(); 1187 accessibility_object_.updateLayoutAndCheckValidity();
1093 return accessibility_object_.setSize(); 1188 return accessibility_object_.setSize();
1094 } 1189 }
1095 1190
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 v8::Local<v8::Value> value_handle = 1852 v8::Local<v8::Value> value_handle =
1758 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8(); 1853 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8();
1759 if (value_handle.IsEmpty()) 1854 if (value_handle.IsEmpty())
1760 return v8::Local<v8::Object>(); 1855 return v8::Local<v8::Object>();
1761 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); 1856 v8::Local<v8::Object> handle = value_handle->ToObject(isolate);
1762 elements_.Append(handle); 1857 elements_.Append(handle);
1763 return handle; 1858 return handle;
1764 } 1859 }
1765 1860
1766 } // namespace test_runner 1861 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698