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

Unified 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: notifyAttributeChanged 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/test_runner/web_ax_object_proxy.cc
diff --git a/content/shell/test_runner/web_ax_object_proxy.cc b/content/shell/test_runner/web_ax_object_proxy.cc
index 1d4afdf09266dc2531c93619d677d72f9cd01188..11dd8541bf450c6d3e124a521c4deb3ef440d262 100644
--- a/content/shell/test_runner/web_ax_object_proxy.cc
+++ b/content/shell/test_runner/web_ax_object_proxy.cc
@@ -614,7 +614,15 @@ gin::ObjectTemplateBuilder WebAXObjectProxy::GetObjectTemplateBuilder(
.SetProperty("colorValue", &WebAXObjectProxy::ColorValue)
.SetProperty("fontFamily", &WebAXObjectProxy::FontFamily)
.SetProperty("fontSize", &WebAXObjectProxy::FontSize)
+ .SetProperty("autocomplete", &WebAXObjectProxy::Autocomplete)
+ .SetProperty("current", &WebAXObjectProxy::Current)
+ .SetProperty("invalid", &WebAXObjectProxy::Invalid)
+ .SetProperty("keyShortcuts", &WebAXObjectProxy::KeyShortcuts)
+ .SetProperty("live", &WebAXObjectProxy::Live)
.SetProperty("orientation", &WebAXObjectProxy::Orientation)
+ .SetProperty("relevant", &WebAXObjectProxy::Relevant)
+ .SetProperty("roleDescription", &WebAXObjectProxy::RoleDescription)
+ .SetProperty("sort", &WebAXObjectProxy::Sort)
.SetProperty("posInSet", &WebAXObjectProxy::PosInSet)
.SetProperty("setSize", &WebAXObjectProxy::SetSize)
.SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX)
@@ -1074,6 +1082,65 @@ float WebAXObjectProxy::FontSize() {
return accessibility_object_.fontSize();
}
+std::string WebAXObjectProxy::Autocomplete() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ return accessibility_object_.ariaAutoComplete().utf8();
+}
+
+std::string WebAXObjectProxy::Current() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ switch (accessibility_object_.ariaCurrentState()) {
+ case blink::WebAXAriaCurrentStateFalse:
+ return "false";
+ case blink::WebAXAriaCurrentStateTrue:
+ return "true";
+ case blink::WebAXAriaCurrentStatePage:
+ return "page";
+ case blink::WebAXAriaCurrentStateStep:
+ return "step";
+ case blink::WebAXAriaCurrentStateLocation:
+ return "location";
+ case blink::WebAXAriaCurrentStateDate:
+ return "date";
+ case blink::WebAXAriaCurrentStateTime:
+ return "time";
+ default:
+ return std::string();
+ }
+}
+
+std::string WebAXObjectProxy::Invalid() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ switch (accessibility_object_.invalidState()) {
+ case blink::WebAXInvalidStateFalse:
+ return "false";
+ case blink::WebAXInvalidStateTrue:
+ return "true";
+ case blink::WebAXInvalidStateSpelling:
+ return "spelling";
+ case blink::WebAXInvalidStateGrammar:
+ return "grammar";
+ case blink::WebAXInvalidStateOther:
+ return "other";
+ default:
+ return std::string();
+ }
+}
+
+std::string WebAXObjectProxy::KeyShortcuts() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ SparseAttributeAdapter attribute_adapter;
+ accessibility_object_.getSparseAXAttributes(attribute_adapter);
+ return attribute_adapter
+ .string_attributes[blink::WebAXStringAttribute::AriaKeyShortcuts]
+ .utf8();
+}
+
+std::string WebAXObjectProxy::Live() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ return accessibility_object_.liveRegionStatus().utf8();
+}
+
std::string WebAXObjectProxy::Orientation() {
accessibility_object_.updateLayoutAndCheckValidity();
if (accessibility_object_.orientation() == blink::WebAXOrientationVertical)
@@ -1085,6 +1152,34 @@ std::string WebAXObjectProxy::Orientation() {
return std::string();
}
+std::string WebAXObjectProxy::Relevant() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ return accessibility_object_.liveRegionRelevant().utf8();
+}
+
+std::string WebAXObjectProxy::RoleDescription() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ SparseAttributeAdapter attribute_adapter;
+ accessibility_object_.getSparseAXAttributes(attribute_adapter);
+ return attribute_adapter
+ .string_attributes[blink::WebAXStringAttribute::AriaRoleDescription]
+ .utf8();
+}
+
+std::string WebAXObjectProxy::Sort() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ switch (accessibility_object_.sortDirection()) {
+ case blink::WebAXSortDirectionAscending:
+ return "ascending";
+ case blink::WebAXSortDirectionDescending:
+ return "descending";
+ case blink::WebAXSortDirectionOther:
+ return "other";
+ default:
+ return std::string();
+ }
+}
+
int WebAXObjectProxy::PosInSet() {
accessibility_object_.updateLayoutAndCheckValidity();
return accessibility_object_.posInSet();

Powered by Google App Engine
This is Rietveld 408576698