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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Tree control attributes. | 82 // Tree control attributes. |
83 ATTR_HIERARCHICAL_LEVEL, | 83 ATTR_HIERARCHICAL_LEVEL, |
84 | 84 |
85 // Relationships between this element and other elements. | 85 // Relationships between this element and other elements. |
86 ATTR_TITLE_UI_ELEMENT, | 86 ATTR_TITLE_UI_ELEMENT, |
87 | 87 |
88 // Color value for WebKit::WebAXRoleColorWell, each component is 0..255 | 88 // Color value for WebKit::WebAXRoleColorWell, each component is 0..255 |
89 ATTR_COLOR_VALUE_RED, | 89 ATTR_COLOR_VALUE_RED, |
90 ATTR_COLOR_VALUE_GREEN, | 90 ATTR_COLOR_VALUE_GREEN, |
91 ATTR_COLOR_VALUE_BLUE | 91 ATTR_COLOR_VALUE_BLUE, |
| 92 |
| 93 // Inline text attributes. |
| 94 ATTR_TEXT_DIRECTION |
92 }; | 95 }; |
93 | 96 |
94 enum FloatAttribute { | 97 enum FloatAttribute { |
95 // Document attributes. | 98 // Document attributes. |
96 ATTR_DOC_LOADING_PROGRESS, | 99 ATTR_DOC_LOADING_PROGRESS, |
97 | 100 |
98 // Range attributes. | 101 // Range attributes. |
99 ATTR_VALUE_FOR_RANGE, | 102 ATTR_VALUE_FOR_RANGE, |
100 ATTR_MIN_VALUE_FOR_RANGE, | 103 ATTR_MIN_VALUE_FOR_RANGE, |
101 ATTR_MAX_VALUE_FOR_RANGE, | 104 ATTR_MAX_VALUE_FOR_RANGE, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Character indices where line breaks occur. | 141 // Character indices where line breaks occur. |
139 ATTR_LINE_BREAKS, | 142 ATTR_LINE_BREAKS, |
140 | 143 |
141 // For a table, the cell ids in row-major order, with duplicate entries | 144 // For a table, the cell ids in row-major order, with duplicate entries |
142 // when there's a rowspan or colspan, and with -1 for missing cells. | 145 // when there's a rowspan or colspan, and with -1 for missing cells. |
143 // There are always exactly rows * columns entries. | 146 // There are always exactly rows * columns entries. |
144 ATTR_CELL_IDS, | 147 ATTR_CELL_IDS, |
145 | 148 |
146 // For a table, the unique cell ids in row-major order of their first | 149 // For a table, the unique cell ids in row-major order of their first |
147 // occurrence. | 150 // occurrence. |
148 ATTR_UNIQUE_CELL_IDS | 151 ATTR_UNIQUE_CELL_IDS, |
| 152 |
| 153 // For inline text. This is the pixel position of the end of this |
| 154 // character within the bounding rectangle of this object, in the |
| 155 // direction given by ATTR_TEXT_DIRECTION. For example, for left-to-right |
| 156 // text, the first offset is the right coordinate of the first character |
| 157 // within the object's bounds, the second offset is the right coordinate |
| 158 // of the second character, and so on. |
| 159 ATTR_CHARACTER_OFFSETS, |
| 160 |
| 161 // For inline text. These int lists must be the same size; they represent |
| 162 // the start and end character index of each word within this text. |
| 163 ATTR_WORD_STARTS, |
| 164 ATTR_WORD_ENDS, |
149 }; | 165 }; |
150 | 166 |
151 AccessibilityNodeData(); | 167 AccessibilityNodeData(); |
152 virtual ~AccessibilityNodeData(); | 168 virtual ~AccessibilityNodeData(); |
153 | 169 |
154 void AddStringAttribute(StringAttribute attribute, | 170 void AddStringAttribute(StringAttribute attribute, |
155 const std::string& value); | 171 const std::string& value); |
156 void AddIntAttribute(IntAttribute attribute, int value); | 172 void AddIntAttribute(IntAttribute attribute, int value); |
157 void AddFloatAttribute(FloatAttribute attribute, float value); | 173 void AddFloatAttribute(FloatAttribute attribute, float value); |
158 void AddBoolAttribute(BoolAttribute attribute, bool value); | 174 void AddBoolAttribute(BoolAttribute attribute, bool value); |
159 void AddIntListAttribute(IntListAttribute attribute, | 175 void AddIntListAttribute(IntListAttribute attribute, |
160 const std::vector<int32>& value); | 176 const std::vector<int32>& value); |
161 | 177 |
162 // Convenience function, mainly for writing unit tests. | 178 // Convenience functions, mainly for writing unit tests. |
163 // Equivalent to AddStringAttribute(ATTR_NAME, name). | 179 // Equivalent to AddStringAttribute(ATTR_NAME, name). |
164 void SetName(std::string name); | 180 void SetName(std::string name); |
| 181 // Equivalent to AddStringAttribute(ATTR_VALUE, value). |
| 182 void SetValue(std::string value); |
165 | 183 |
166 #ifndef NDEBUG | 184 #ifndef NDEBUG |
167 virtual std::string DebugString(bool recursive) const; | 185 virtual std::string DebugString(bool recursive) const; |
168 #endif | 186 #endif |
169 | 187 |
170 // This is a simple serializable struct. All member variables should be | 188 // This is a simple serializable struct. All member variables should be |
171 // public and copyable. | 189 // public and copyable. |
172 int32 id; | 190 int32 id; |
173 WebKit::WebAXRole role; | 191 WebKit::WebAXRole role; |
174 uint32 state; | 192 uint32 state; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // build a tree of AccessibilityNodeDataTreeNode objects for easier | 224 // build a tree of AccessibilityNodeDataTreeNode objects for easier |
207 // testing and debugging, where each node contains its children. | 225 // testing and debugging, where each node contains its children. |
208 // The |dst| argument will become the root of the new tree. | 226 // The |dst| argument will become the root of the new tree. |
209 void MakeAccessibilityNodeDataTree( | 227 void MakeAccessibilityNodeDataTree( |
210 const std::vector<AccessibilityNodeData>& src, | 228 const std::vector<AccessibilityNodeData>& src, |
211 AccessibilityNodeDataTreeNode* dst); | 229 AccessibilityNodeDataTreeNode* dst); |
212 | 230 |
213 } // namespace content | 231 } // namespace content |
214 | 232 |
215 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ | 233 #endif // CONTENT_COMMON_ACCESSIBILITY_NODE_DATA_H_ |
OLD | NEW |