Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ | 5 #ifndef CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ |
| 6 #define CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ | 6 #define CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 | 184 |
| 185 // Attributes that could apply to any node. | 185 // Attributes that could apply to any node. |
| 186 ATTR_ACCESS_KEY, | 186 ATTR_ACCESS_KEY, |
| 187 ATTR_ACTION, | 187 ATTR_ACTION, |
| 188 ATTR_CONTAINER_LIVE_RELEVANT, | 188 ATTR_CONTAINER_LIVE_RELEVANT, |
| 189 ATTR_CONTAINER_LIVE_STATUS, | 189 ATTR_CONTAINER_LIVE_STATUS, |
| 190 ATTR_DESCRIPTION, | 190 ATTR_DESCRIPTION, |
| 191 ATTR_DISPLAY, | 191 ATTR_DISPLAY, |
| 192 ATTR_HELP, | 192 ATTR_HELP, |
| 193 ATTR_HTML_TAG, | 193 ATTR_HTML_TAG, |
| 194 ATTR_NAME, | |
| 194 ATTR_LIVE_RELEVANT, | 195 ATTR_LIVE_RELEVANT, |
| 195 ATTR_LIVE_STATUS, | 196 ATTR_LIVE_STATUS, |
| 196 ATTR_ROLE, | 197 ATTR_ROLE, |
| 197 ATTR_SHORTCUT, | 198 ATTR_SHORTCUT, |
| 198 ATTR_URL, | 199 ATTR_URL, |
| 200 ATTR_VALUE, | |
| 199 }; | 201 }; |
| 200 | 202 |
| 201 enum IntAttribute { | 203 enum IntAttribute { |
| 202 // Scrollable container attributes. | 204 // Scrollable container attributes. |
| 203 ATTR_SCROLL_X, | 205 ATTR_SCROLL_X, |
| 204 ATTR_SCROLL_X_MIN, | 206 ATTR_SCROLL_X_MIN, |
| 205 ATTR_SCROLL_X_MAX, | 207 ATTR_SCROLL_X_MAX, |
| 206 ATTR_SCROLL_Y, | 208 ATTR_SCROLL_Y, |
| 207 ATTR_SCROLL_Y_MIN, | 209 ATTR_SCROLL_Y_MIN, |
| 208 ATTR_SCROLL_Y_MAX, | 210 ATTR_SCROLL_Y_MAX, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 ATTR_ARIA_READONLY, | 271 ATTR_ARIA_READONLY, |
| 270 | 272 |
| 271 // Writeable attributes | 273 // Writeable attributes |
| 272 ATTR_CAN_SET_VALUE, | 274 ATTR_CAN_SET_VALUE, |
| 273 | 275 |
| 274 // If this is set, all of the other fields in this struct should | 276 // If this is set, all of the other fields in this struct should |
| 275 // be ignored and only the locations should change. | 277 // be ignored and only the locations should change. |
| 276 ATTR_UPDATE_LOCATION_ONLY, | 278 ATTR_UPDATE_LOCATION_ONLY, |
| 277 }; | 279 }; |
| 278 | 280 |
| 281 enum IntListAttribute { | |
| 282 // Ids of nodes that are children of this node logically, but are | |
| 283 // not children of this node in the tree structure. As an example, | |
| 284 // a table cell is a child of a row, and an 'indirect' child of a | |
| 285 // column. | |
| 286 ATTR_INDIRECT_CHILD_IDS, | |
| 287 | |
| 288 // Character indices where line breaks occur. | |
| 289 ATTR_LINE_BREAKS, | |
| 290 | |
| 291 // For a table, the cell ids in row-major order, with duplicate entries | |
| 292 // when there's a rowspan or colspan, and with -1 for missing cells. | |
| 293 // There are always exactly rows * columns entries. | |
| 294 ATTR_CELL_IDS, | |
| 295 | |
| 296 // For a table, the unique cell ids in row-major order of their first | |
| 297 // occurrence. | |
| 298 ATTR_UNIQUE_CELL_IDS | |
| 299 }; | |
| 300 | |
| 279 AccessibilityNodeData(); | 301 AccessibilityNodeData(); |
| 280 virtual ~AccessibilityNodeData(); | 302 virtual ~AccessibilityNodeData(); |
| 281 | 303 |
| 304 void AddStringAttribute(StringAttribute attribute, | |
| 305 const std::string& value); | |
| 306 void AddIntAttribute(IntAttribute attribute, int value); | |
| 307 void AddFloatAttribute(FloatAttribute attribute, float value); | |
| 308 void AddBoolAttribute(BoolAttribute attribute, bool value); | |
| 309 void AddIntListAttribute(IntListAttribute attribute, | |
| 310 const std::vector<int32>& value); | |
| 311 | |
| 312 void SetName(std::string name); | |
|
aboxhall
2013/08/07 20:22:06
This is only used in testing, right?
dmazzoni
2013/08/07 20:23:40
Yes.
aboxhall
2013/08/07 20:25:17
Is that worth a comment?
| |
| 313 | |
| 282 #ifndef NDEBUG | 314 #ifndef NDEBUG |
| 283 virtual std::string DebugString(bool recursive) const; | 315 virtual std::string DebugString(bool recursive) const; |
| 284 #endif | 316 #endif |
| 285 | 317 |
| 286 // This is a simple serializable struct. All member variables should be | 318 // This is a simple serializable struct. All member variables should be |
| 287 // public and copyable. | 319 // public and copyable. |
| 288 int32 id; | 320 int32 id; |
| 289 string16 name; | |
| 290 string16 value; | |
| 291 Role role; | 321 Role role; |
| 292 uint32 state; | 322 uint32 state; |
| 293 gfx::Rect location; | 323 gfx::Rect location; |
| 294 std::map<StringAttribute, string16> string_attributes; | 324 std::vector<std::pair<StringAttribute, std::string> > string_attributes; |
| 295 std::map<IntAttribute, int32> int_attributes; | 325 std::vector<std::pair<IntAttribute, int32> > int_attributes; |
| 296 std::map<FloatAttribute, float> float_attributes; | 326 std::vector<std::pair<FloatAttribute, float> > float_attributes; |
| 297 std::map<BoolAttribute, bool> bool_attributes; | 327 std::vector<std::pair<BoolAttribute, bool> > bool_attributes; |
| 328 std::vector<std::pair<IntListAttribute, std::vector<int32> > > | |
| 329 intlist_attributes; | |
| 330 std::vector<std::pair<std::string, std::string> > html_attributes; | |
| 298 std::vector<int32> child_ids; | 331 std::vector<int32> child_ids; |
| 299 std::vector<int32> indirect_child_ids; | |
| 300 std::vector<std::pair<string16, string16> > html_attributes; | |
| 301 std::vector<int32> line_breaks; | |
| 302 | |
| 303 // For a table, the cell ids in row-major order, with duplicate entries | |
| 304 // when there's a rowspan or colspan, and with -1 for missing cells. | |
| 305 // There are always exactly rows * columns entries. | |
| 306 std::vector<int32> cell_ids; | |
| 307 | |
| 308 // For a table, the unique cell ids in row-major order of their first | |
| 309 // occurrence. | |
| 310 std::vector<int32> unique_cell_ids; | |
| 311 }; | 332 }; |
| 312 | 333 |
| 313 // For testing and debugging only: this subclass of AccessibilityNodeData | 334 // For testing and debugging only: this subclass of AccessibilityNodeData |
| 314 // is used to represent a whole tree of accessibility nodes, where each | 335 // is used to represent a whole tree of accessibility nodes, where each |
| 315 // node owns its children. This makes it easy to print the tree structure | 336 // node owns its children. This makes it easy to print the tree structure |
| 316 // or search it recursively. | 337 // or search it recursively. |
| 317 struct CONTENT_EXPORT AccessibilityNodeDataTreeNode | 338 struct CONTENT_EXPORT AccessibilityNodeDataTreeNode |
| 318 : public AccessibilityNodeData { | 339 : public AccessibilityNodeData { |
| 319 AccessibilityNodeDataTreeNode(); | 340 AccessibilityNodeDataTreeNode(); |
| 320 virtual ~AccessibilityNodeDataTreeNode(); | 341 virtual ~AccessibilityNodeDataTreeNode(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 333 // build a tree of AccessibilityNodeDataTreeNode objects for easier | 354 // build a tree of AccessibilityNodeDataTreeNode objects for easier |
| 334 // testing and debugging, where each node contains its children. | 355 // testing and debugging, where each node contains its children. |
| 335 // The |dst| argument will become the root of the new tree. | 356 // The |dst| argument will become the root of the new tree. |
| 336 void MakeAccessibilityNodeDataTree( | 357 void MakeAccessibilityNodeDataTree( |
| 337 const std::vector<AccessibilityNodeData>& src, | 358 const std::vector<AccessibilityNodeData>& src, |
| 338 AccessibilityNodeDataTreeNode* dst); | 359 AccessibilityNodeDataTreeNode* dst); |
| 339 | 360 |
| 340 } // namespace content | 361 } // namespace content |
| 341 | 362 |
| 342 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ | 363 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ |
| OLD | NEW |