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

Unified Diff: content/browser/accessibility/accessibility_tree_formatter_blink.cc

Issue 2799413002: Views a11y: Add AXNodeData.actions bitfield to indicate supported actions by UI. (Closed)
Patch Set: Fix tests broken from rebase. Created 3 years, 7 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/browser/accessibility/accessibility_tree_formatter_blink.cc
diff --git a/content/browser/accessibility/accessibility_tree_formatter_blink.cc b/content/browser/accessibility/accessibility_tree_formatter_blink.cc
index a028cff57caf4677229a7e4cad06df6037a355e3..ad862ccf8abdf2029e5a95d7577fa2ab9472c9ac 100644
--- a/content/browser/accessibility/accessibility_tree_formatter_blink.cc
+++ b/content/browser/accessibility/accessibility_tree_formatter_blink.cc
@@ -5,6 +5,7 @@
#include <stddef.h>
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "content/browser/accessibility/accessibility_tree_formatter_blink.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
@@ -134,6 +135,16 @@ void AccessibilityTreeFormatterBlink::AddProperties(
dict->Set(ui::ToString(attr), value_list);
}
}
+
+ std::vector<std::string> actions_strings;
+ for (int action_index = ui::AX_ACTION_NONE + 1;
+ action_index <= ui::AX_ACTION_LAST; ++action_index) {
+ auto action = static_cast<ui::AXAction>(action_index);
+ if (node.HasAction(action))
+ actions_strings.push_back(ui::ToString(action));
+ }
+ if (!actions_strings.empty())
+ dict->SetString("actions", base::JoinString(actions_strings, ","));
}
base::string16 AccessibilityTreeFormatterBlink::ToString(
@@ -262,6 +273,13 @@ base::string16 AccessibilityTreeFormatterBlink::ToString(
WriteAttribute(false, attr_string, &line);
}
+ std::string string_value;
+ if (dict.GetString("actions", &string_value)) {
+ WriteAttribute(false,
+ base::StringPrintf("%s=%s", "actions", string_value.c_str()),
+ &line);
+ }
+
return line;
}

Powered by Google App Engine
This is Rietveld 408576698