| Index: content/browser/accessibility/accessibility_tree_formatter_win.cc
|
| diff --git a/content/browser/accessibility/accessibility_tree_formatter_win.cc b/content/browser/accessibility/accessibility_tree_formatter_win.cc
|
| index c79984613a399b0b7df38140d19c7c1698e8bc9f..acb299c2d908ff2dd10ce5b8c0c62e39f589bd6d 100644
|
| --- a/content/browser/accessibility/accessibility_tree_formatter_win.cc
|
| +++ b/content/browser/accessibility/accessibility_tree_formatter_win.cc
|
| @@ -54,36 +54,35 @@ AccessibilityTreeFormatterWin::AccessibilityTreeFormatterWin() {
|
| AccessibilityTreeFormatterWin::~AccessibilityTreeFormatterWin() {
|
| }
|
|
|
| -const char* ALL_ATTRIBUTES[] = {
|
| - "name",
|
| - "value",
|
| - "states",
|
| - "attributes",
|
| - "role_name",
|
| - "ia2_hypertext",
|
| - "currentValue",
|
| - "minimumValue",
|
| - "maximumValue",
|
| - "description",
|
| - "default_action",
|
| - "keyboard_shortcut",
|
| - "location",
|
| - "size",
|
| - "index_in_parent",
|
| - "n_relations",
|
| - "group_level",
|
| - "similar_items_in_group",
|
| - "position_in_group",
|
| - "table_rows",
|
| - "table_columns",
|
| - "row_index",
|
| - "column_index",
|
| - "n_characters",
|
| - "caret_offset",
|
| - "n_selections",
|
| - "selection_start",
|
| - "selection_end"
|
| -};
|
| +const char* ALL_ATTRIBUTES[] = {"name",
|
| + "value",
|
| + "states",
|
| + "attributes",
|
| + "text_attributes",
|
| + "role_name",
|
| + "ia2_hypertext",
|
| + "currentValue",
|
| + "minimumValue",
|
| + "maximumValue",
|
| + "description",
|
| + "default_action",
|
| + "keyboard_shortcut",
|
| + "location",
|
| + "size",
|
| + "index_in_parent",
|
| + "n_relations",
|
| + "group_level",
|
| + "similar_items_in_group",
|
| + "position_in_group",
|
| + "table_rows",
|
| + "table_columns",
|
| + "row_index",
|
| + "column_index",
|
| + "n_characters",
|
| + "caret_offset",
|
| + "n_selections",
|
| + "selection_start",
|
| + "selection_end"};
|
|
|
| namespace {
|
|
|
| @@ -190,17 +189,29 @@ void AccessibilityTreeFormatterWin::AddProperties(
|
|
|
| IAccessibleStateToStringVector(ia_state, &state_strings);
|
| IAccessible2StateToStringVector(ax_object->ia2_state(), &state_strings);
|
| - base::ListValue* states = new base::ListValue;
|
| - for (const auto& state_string : state_strings)
|
| + scoped_ptr<base::ListValue> states(new base::ListValue());
|
| + for (const base::string16& state_string : state_strings)
|
| states->AppendString(base::UTF16ToUTF8(state_string));
|
| - dict->Set("states", states);
|
| + dict->Set("states", std::move(states));
|
|
|
| const std::vector<base::string16>& ia2_attributes =
|
| ax_object->ia2_attributes();
|
| - base::ListValue* attributes = new base::ListValue;
|
| - for (const auto& ia2_attribute : ia2_attributes)
|
| + scoped_ptr<base::ListValue> attributes(new base::ListValue());
|
| + for (const base::string16& ia2_attribute : ia2_attributes)
|
| attributes->AppendString(base::UTF16ToUTF8(ia2_attribute));
|
| - dict->Set("attributes", attributes);
|
| + dict->Set("attributes", std::move(attributes));
|
| +
|
| + ax_object->ComputeStylesIfNeeded();
|
| + const std::map<int, std::vector<base::string16>>& ia2_text_attributes =
|
| + ax_object->offset_to_text_attributes();
|
| + scoped_ptr<base::ListValue> text_attributes(new base::ListValue());
|
| + for (const auto& style_span : ia2_text_attributes) {
|
| + int start_offset = style_span.first;
|
| + text_attributes->AppendString("offset:" + base::IntToString(start_offset));
|
| + for (const base::string16& text_attribute : style_span.second)
|
| + text_attributes->AppendString(base::UTF16ToUTF8(text_attribute));
|
| + }
|
| + dict->Set("text_attributes", std::move(text_attributes));
|
|
|
| dict->SetString("role_name", ax_object->role_name());
|
| dict->SetString("ia2_hypertext", GetIA2Hypertext(*ax_object));
|
|
|