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

Unified Diff: ui/accessibility/ax_node_data.cc

Issue 1130733006: Adds color, font size, text direction and text styles to the accessibility tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt at exposing style info to the native APIs. Created 5 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
« no previous file with comments | « ui/accessibility/ax_enums.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_node_data.cc
diff --git a/ui/accessibility/ax_node_data.cc b/ui/accessibility/ax_node_data.cc
index 99ff3321bdd784c13970f4058333f6b3f64708e2..7f5ad70a1711428d9084798ac2a4aa6207765772 100644
--- a/ui/accessibility/ax_node_data.cc
+++ b/ui/accessibility/ax_node_data.cc
@@ -8,6 +8,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
using base::DoubleToString;
@@ -210,36 +211,52 @@ std::string AXNodeData::ToString() const {
case AX_ATTR_ACTIVEDESCENDANT_ID:
result += " activedescendant=" + value;
break;
- case AX_ATTR_COLOR_VALUE_RED:
- result += " color_value_red=" + value;
- break;
- case AX_ATTR_COLOR_VALUE_GREEN:
- result += " color_value_green=" + value;
- break;
- case AX_ATTR_COLOR_VALUE_BLUE:
- result += " color_value_blue=" + value;
- break;
case AX_ATTR_TREE_ID:
result += " tree_id=" + value;
break;
case AX_ATTR_CHILD_TREE_ID:
result += " child_tree_id=" + value;
break;
+ case AX_ATTR_COLOR_VALUE:
+ result += base::StringPrintf(" color_value=&%X",
+ int_attributes[i].second);
+ break;
+ case AX_ATTR_BACKGROUND_COLOR:
+ result += base::StringPrintf(" background_color=&%X",
+ int_attributes[i].second);
+ break;
+ case AX_ATTR_COLOR:
+ result += base::StringPrintf(" color=&%X", int_attributes[i].second);
+ break;
case AX_ATTR_TEXT_DIRECTION:
switch (int_attributes[i].second) {
- case AX_TEXT_DIRECTION_LR:
- default:
- result += " text_direction=lr";
+ case AX_TEXT_DIRECTION_LTR:
+ result += " text_direction=ltr";
+ break;
+ case AX_TEXT_DIRECTION_RTL:
+ result += " text_direction=rtl";
break;
- case AX_TEXT_DIRECTION_RL:
- result += " text_direction=rl";
+ case AX_TEXT_DIRECTION_TTB:
+ result += " text_direction=ttb";
break;
- case AX_TEXT_DIRECTION_TB:
- result += " text_direction=tb";
+ case AX_TEXT_DIRECTION_BTT:
+ result += " text_direction=btt";
break;
- case AX_TEXT_DIRECTION_BT:
- result += " text_direction=bt";
+ }
+ case AX_ATTR_TEXT_STYLE: {
+ unsigned int text_style = int_attributes[i].second;
+ if (text_style == AX_TEXT_STYLE_NONE)
break;
+ std::string text_style_value(" text_style=");
+ if (text_style & AX_TEXT_STYLE_BOLD)
+ text_style_value += "bold,";
+ if (text_style & AX_TEXT_STYLE_ITALIC)
+ text_style_value += "italic,";
+ if (text_style & AX_TEXT_STYLE_UNDERLINE)
+ text_style_value += "underline,";
+ if (text_style & AX_TEXT_STYLE_LINE_THROUGH)
+ text_style_value += "line-through,";
+ result += text_style_value.substr(0, text_style_value.size() - 1);;
}
break;
case AX_ATTR_SET_SIZE:
@@ -367,6 +384,9 @@ std::string AXNodeData::ToString() const {
case AX_ATTR_MIN_VALUE_FOR_RANGE:
result += " min_value=" + value;
break;
+ case AX_ATTR_FONT_SIZE:
+ result += " font_size=" + value;
+ break;
case AX_FLOAT_ATTRIBUTE_NONE:
break;
}
« no previous file with comments | « ui/accessibility/ax_enums.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698