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

Unified Diff: content/common/accessibility_node_data.h

Issue 21269002: Make AccessibilityNodeData more compact. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile Created 7 years, 5 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/common/accessibility_node_data.h
diff --git a/content/common/accessibility_node_data.h b/content/common/accessibility_node_data.h
index e4a206fc1f2889590a2f6816e6992189dbb003d9..8de9f8f6297b5fdcd9eb33f7289206fa0a99c2c6 100644
--- a/content/common/accessibility_node_data.h
+++ b/content/common/accessibility_node_data.h
@@ -191,11 +191,13 @@ struct CONTENT_EXPORT AccessibilityNodeData {
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 {
@@ -276,9 +278,39 @@ struct CONTENT_EXPORT AccessibilityNodeData {
ATTR_UPDATE_LOCATION_ONLY,
};
+ 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
+ };
+
AccessibilityNodeData();
virtual ~AccessibilityNodeData();
+ void AddStringAttribute(StringAttribute 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,
+ const std::vector<int32>& value);
+
+ void SetName(std::string name);
+
#ifndef NDEBUG
virtual std::string DebugString(bool recursive) const;
#endif
@@ -286,28 +318,17 @@ struct CONTENT_EXPORT AccessibilityNodeData {
// This is a simple serializable struct. All member variables should be
// public and copyable.
int32 id;
- string16 name;
- string16 value;
Role role;
uint32 state;
gfx::Rect location;
- std::map<StringAttribute, string16> string_attributes;
- std::map<IntAttribute, int32> int_attributes;
- std::map<FloatAttribute, float> float_attributes;
- std::map<BoolAttribute, bool> bool_attributes;
+ 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> > >
+ intlist_attributes;
+ std::vector<std::pair<std::string, std::string> > html_attributes;
std::vector<int32> child_ids;
- std::vector<int32> indirect_child_ids;
- std::vector<std::pair<string16, string16> > html_attributes;
- std::vector<int32> 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.
- std::vector<int32> cell_ids;
-
- // For a table, the unique cell ids in row-major order of their first
- // occurrence.
- std::vector<int32> unique_cell_ids;
};
// For testing and debugging only: this subclass of AccessibilityNodeData

Powered by Google App Engine
This is Rietveld 408576698