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

Unified Diff: components/test_runner/web_ax_object_proxy.cc

Issue 2589273002: Add sparse accessibility attribute interface to Blink (Closed)
Patch Set: Address feedback Created 3 years, 11 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
« no previous file with comments | « no previous file | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/web_ax_object_proxy.cc
diff --git a/components/test_runner/web_ax_object_proxy.cc b/components/test_runner/web_ax_object_proxy.cc
index a2728a98ba25fefe2342170342191ac6a29491c6..21174b3a31457eaffb78b10b71541ee4093709cd 100644
--- a/components/test_runner/web_ax_object_proxy.cc
+++ b/components/test_runner/web_ax_object_proxy.cc
@@ -512,6 +512,41 @@ class AttributesCollector {
DISALLOW_COPY_AND_ASSIGN(AttributesCollector);
};
+class SparseAttributeAdapter : public blink::WebAXSparseAttributeClient {
+ public:
+ SparseAttributeAdapter() {}
+ ~SparseAttributeAdapter() override {}
+
+ std::map<blink::WebAXBoolAttribute, bool> bool_attributes;
+ std::map<blink::WebAXStringAttribute, blink::WebString> string_attributes;
+ std::map<blink::WebAXObjectAttribute, blink::WebAXObject> object_attributes;
+ std::map<blink::WebAXObjectVectorAttribute,
+ blink::WebVector<blink::WebAXObject>>
+ object_vector_attributes;
+
+ private:
+ void addBoolAttribute(blink::WebAXBoolAttribute attribute,
+ bool value) override {
+ bool_attributes[attribute] = value;
+ }
+
+ void addStringAttribute(blink::WebAXStringAttribute attribute,
+ const blink::WebString& value) override {
+ string_attributes[attribute] = value;
+ }
+
+ void addObjectAttribute(blink::WebAXObjectAttribute attribute,
+ const blink::WebAXObject& value) override {
+ object_attributes[attribute] = value;
+ }
+
+ void addObjectVectorAttribute(
+ blink::WebAXObjectVectorAttribute attribute,
+ const blink::WebVector<blink::WebAXObject>& value) override {
+ object_vector_attributes[attribute] = value;
+ }
+};
+
} // namespace
gin::WrapperInfo WebAXObjectProxy::kWrapperInfo = {
@@ -1100,11 +1135,13 @@ bool WebAXObjectProxy::IsButtonStateMixed() {
}
v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex(
- unsigned index)
-{
+ unsigned index) {
accessibility_object_.updateLayoutAndCheckValidity();
- blink::WebVector<blink::WebAXObject> elements;
- accessibility_object_.ariaControls(elements);
+ SparseAttributeAdapter attribute_adapter;
+ accessibility_object_.getSparseAXAttributes(attribute_adapter);
+ blink::WebVector<blink::WebAXObject> elements =
+ attribute_adapter.object_vector_attributes
+ [blink::WebAXObjectVectorAttribute::AriaControls];
size_t elementCount = elements.size();
if (index >= elementCount)
return v8::Local<v8::Object>();
@@ -1113,11 +1150,13 @@ v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex(
}
v8::Local<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex(
- unsigned index)
-{
+ unsigned index) {
accessibility_object_.updateLayoutAndCheckValidity();
- blink::WebVector<blink::WebAXObject> elements;
- accessibility_object_.ariaFlowTo(elements);
+ SparseAttributeAdapter attribute_adapter;
+ accessibility_object_.getSparseAXAttributes(attribute_adapter);
+ blink::WebVector<blink::WebAXObject> elements =
+ attribute_adapter.object_vector_attributes
+ [blink::WebAXObjectVectorAttribute::AriaFlowTo];
size_t elementCount = elements.size();
if (index >= elementCount)
return v8::Local<v8::Object>();
« no previous file with comments | « no previous file | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698