Index: ui/accessibility/ax_node_data.h |
diff --git a/ui/accessibility/ax_node_data.h b/ui/accessibility/ax_node_data.h |
index 1c5defb8b482a4d9897d9c9d2e45bd4b93305517..cd30fbb2c06ae7ce903c1d73a535cba3b2b1076d 100644 |
--- a/ui/accessibility/ax_node_data.h |
+++ b/ui/accessibility/ax_node_data.h |
@@ -20,159 +20,15 @@ namespace ui { |
// single web object, in a form that can be serialized and sent from |
// one process to another. |
struct AX_EXPORT AXNodeData { |
- // Additional optional attributes that can be optionally attached to |
- // a node. |
- enum StringAttribute { |
- // Document attributes. |
- ATTR_DOC_URL, |
- ATTR_DOC_TITLE, |
- ATTR_DOC_MIMETYPE, |
- ATTR_DOC_DOCTYPE, |
- |
- // Attributes that could apply to any node. |
- ATTR_ACCESS_KEY, |
- ATTR_ACTION, |
- ATTR_CONTAINER_LIVE_RELEVANT, |
- ATTR_CONTAINER_LIVE_STATUS, |
- ATTR_DESCRIPTION, |
- ATTR_DISPLAY, |
- ATTR_HELP, |
- ATTR_HTML_TAG, |
- ATTR_NAME, |
- ATTR_LIVE_RELEVANT, |
- ATTR_LIVE_STATUS, |
- ATTR_ROLE, |
- ATTR_SHORTCUT, |
- ATTR_URL, |
- ATTR_VALUE, |
- }; |
- |
- enum IntAttribute { |
- // Scrollable container attributes. |
- ATTR_SCROLL_X, |
- ATTR_SCROLL_X_MIN, |
- ATTR_SCROLL_X_MAX, |
- ATTR_SCROLL_Y, |
- ATTR_SCROLL_Y_MIN, |
- ATTR_SCROLL_Y_MAX, |
- |
- // Editable text attributes. |
- ATTR_TEXT_SEL_START, |
- ATTR_TEXT_SEL_END, |
- |
- // Table attributes. |
- ATTR_TABLE_ROW_COUNT, |
- ATTR_TABLE_COLUMN_COUNT, |
- ATTR_TABLE_HEADER_ID, |
- |
- // Table row attributes. |
- ATTR_TABLE_ROW_INDEX, |
- ATTR_TABLE_ROW_HEADER_ID, |
- |
- // Table column attributes. |
- ATTR_TABLE_COLUMN_INDEX, |
- ATTR_TABLE_COLUMN_HEADER_ID, |
- |
- // Table cell attributes. |
- ATTR_TABLE_CELL_COLUMN_INDEX, |
- ATTR_TABLE_CELL_COLUMN_SPAN, |
- ATTR_TABLE_CELL_ROW_INDEX, |
- ATTR_TABLE_CELL_ROW_SPAN, |
- |
- // Tree control attributes. |
- ATTR_HIERARCHICAL_LEVEL, |
- |
- // Relationships between this element and other elements. |
- ATTR_TITLE_UI_ELEMENT, |
- |
- // Color value for AX_ROLE_COLOR_WELL, each component is 0..255 |
- ATTR_COLOR_VALUE_RED, |
- ATTR_COLOR_VALUE_GREEN, |
- ATTR_COLOR_VALUE_BLUE, |
- |
- // Inline text attributes. |
- ATTR_TEXT_DIRECTION |
- }; |
- |
- enum FloatAttribute { |
- // Document attributes. |
- ATTR_DOC_LOADING_PROGRESS, |
- |
- // Range attributes. |
- ATTR_VALUE_FOR_RANGE, |
- ATTR_MIN_VALUE_FOR_RANGE, |
- ATTR_MAX_VALUE_FOR_RANGE, |
- }; |
- |
- enum BoolAttribute { |
- // Document attributes. |
- ATTR_DOC_LOADED, |
- |
- // True if a checkbox or radio button is in the "mixed" state. |
- ATTR_BUTTON_MIXED, |
- |
- // Live region attributes. |
- ATTR_CONTAINER_LIVE_ATOMIC, |
- ATTR_CONTAINER_LIVE_BUSY, |
- ATTR_LIVE_ATOMIC, |
- ATTR_LIVE_BUSY, |
- |
- // ARIA readonly flag. |
- ATTR_ARIA_READONLY, |
- |
- // Writeable attributes |
- ATTR_CAN_SET_VALUE, |
- |
- // If this is set, all of the other fields in this struct should |
- // be ignored and only the locations should change. |
- ATTR_UPDATE_LOCATION_ONLY, |
- |
- // Set on a canvas element if it has fallback content. |
- ATTR_CANVAS_HAS_FALLBACK, |
- }; |
- |
- enum IntListAttribute { |
- // Ids of nodes that are children of this node logically, but are |
- // not children of this node in the tree structure. As an example, |
- // a table cell is a child of a row, and an 'indirect' child of a |
- // column. |
- ATTR_INDIRECT_CHILD_IDS, |
- |
- // Character indices where line breaks occur. |
- ATTR_LINE_BREAKS, |
- |
- // For a table, the cell ids in row-major order, with duplicate entries |
- // when there's a rowspan or colspan, and with -1 for missing cells. |
- // There are always exactly rows * columns entries. |
- ATTR_CELL_IDS, |
- |
- // For a table, the unique cell ids in row-major order of their first |
- // occurrence. |
- ATTR_UNIQUE_CELL_IDS, |
- |
- // For inline text. This is the pixel position of the end of this |
- // character within the bounding rectangle of this object, in the |
- // direction given by ATTR_TEXT_DIRECTION. For example, for left-to-right |
- // text, the first offset is the right coordinate of the first character |
- // within the object's bounds, the second offset is the right coordinate |
- // of the second character, and so on. |
- ATTR_CHARACTER_OFFSETS, |
- |
- // For inline text. These int lists must be the same size; they represent |
- // the start and end character index of each word within this text. |
- ATTR_WORD_STARTS, |
- ATTR_WORD_ENDS, |
- }; |
- |
AXNodeData(); |
virtual ~AXNodeData(); |
- void AddStringAttribute(StringAttribute attribute, |
+ void AddStringAttribute(AXStringAttribute attribute, |
const std::string& value); |
- void AddIntAttribute(IntAttribute attribute, int value); |
- void AddFloatAttribute(FloatAttribute attribute, float value); |
- void AddBoolAttribute(BoolAttribute attribute, bool value); |
- void AddIntListAttribute(IntListAttribute attribute, |
+ void AddIntAttribute(AXIntAttribute attribute, int value); |
+ void AddFloatAttribute(AXFloatAttribute attribute, float value); |
+ void AddBoolAttribute(AXBoolAttribute attribute, bool value); |
+ void AddIntListAttribute(AXIntListAttribute attribute, |
const std::vector<int32>& value); |
// Convenience functions, mainly for writing unit tests. |
@@ -181,17 +37,20 @@ struct AX_EXPORT AXNodeData { |
// Equivalent to AddStringAttribute(ATTR_VALUE, value). |
void SetValue(std::string value); |
+ // Return a string representation of this data, for debugging. |
+ std::string ToString() const; |
+ |
// This is a simple serializable struct. All member variables should be |
// public and copyable. |
int32 id; |
AXRole role; |
uint32 state; |
gfx::Rect location; |
- std::vector<std::pair<StringAttribute, std::string> > string_attributes; |
- std::vector<std::pair<IntAttribute, int32> > int_attributes; |
- std::vector<std::pair<FloatAttribute, float> > float_attributes; |
- std::vector<std::pair<BoolAttribute, bool> > bool_attributes; |
- std::vector<std::pair<IntListAttribute, std::vector<int32> > > |
+ std::vector<std::pair<AXStringAttribute, std::string> > string_attributes; |
+ std::vector<std::pair<AXIntAttribute, int32> > int_attributes; |
+ std::vector<std::pair<AXFloatAttribute, float> > float_attributes; |
+ std::vector<std::pair<AXBoolAttribute, bool> > bool_attributes; |
+ std::vector<std::pair<AXIntListAttribute, std::vector<int32> > > |
intlist_attributes; |
std::vector<std::pair<std::string, std::string> > html_attributes; |
std::vector<int32> child_ids; |