| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/accessibility/ax_enums.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 | |
| 9 namespace ui { | |
| 10 | |
| 11 std::string ToString(AXEvent enum_param) { | |
| 12 switch (enum_param) { | |
| 13 case AX_EVENT_ACTIVEDESCENDANTCHANGED: | |
| 14 return "activedescendantchanged"; | |
| 15 case AX_EVENT_ALERT: | |
| 16 return "alert"; | |
| 17 case AX_EVENT_ARIA_ATTRIBUTE_CHANGED: | |
| 18 return "ariaAttributeChanged"; | |
| 19 case AX_EVENT_AUTOCORRECTION_OCCURED: | |
| 20 return "autocorrectionOccured"; | |
| 21 case AX_EVENT_BLUR: | |
| 22 return "blur"; | |
| 23 case AX_EVENT_CHECKED_STATE_CHANGED: | |
| 24 return "checkedStateChanged"; | |
| 25 case AX_EVENT_CHILDREN_CHANGED: | |
| 26 return "childrenChanged"; | |
| 27 case AX_EVENT_FOCUS: | |
| 28 return "focus"; | |
| 29 case AX_EVENT_HIDE: | |
| 30 return "hide"; | |
| 31 case AX_EVENT_HOVER: | |
| 32 return "hover"; | |
| 33 case AX_EVENT_INVALID_STATUS_CHANGED: | |
| 34 return "invalidStatusChanged"; | |
| 35 case AX_EVENT_LAYOUT_COMPLETE: | |
| 36 return "layoutComplete"; | |
| 37 case AX_EVENT_LIVE_REGION_CHANGED: | |
| 38 return "liveRegionChanged"; | |
| 39 case AX_EVENT_LOAD_COMPLETE: | |
| 40 return "loadComplete"; | |
| 41 case AX_EVENT_LOCATION_CHANGED: | |
| 42 return "locationChanged"; | |
| 43 case AX_EVENT_MENU_END: | |
| 44 return "menuEnd"; | |
| 45 case AX_EVENT_MENU_LIST_ITEM_SELECTED: | |
| 46 return "menuListItemSelected"; | |
| 47 case AX_EVENT_MENU_LIST_VALUE_CHANGED: | |
| 48 return "menuListValueChanged"; | |
| 49 case AX_EVENT_MENU_POPUP_END: | |
| 50 return "menuPopupEnd"; | |
| 51 case AX_EVENT_MENU_POPUP_START: | |
| 52 return "menuPopupStart"; | |
| 53 case AX_EVENT_MENU_START: | |
| 54 return "menuStart"; | |
| 55 case AX_EVENT_ROW_COLLAPSED: | |
| 56 return "rowCollapsed"; | |
| 57 case AX_EVENT_ROW_COUNT_CHANGED: | |
| 58 return "rowCountChanged"; | |
| 59 case AX_EVENT_ROW_EXPANDED: | |
| 60 return "rowExpanded"; | |
| 61 case AX_EVENT_SCROLL_POSITION_CHANGED: | |
| 62 return "scrollPositionChanged"; | |
| 63 case AX_EVENT_SCROLLED_TO_ANCHOR: | |
| 64 return "scrolledToAnchor"; | |
| 65 case AX_EVENT_SELECTED_CHILDREN_CHANGED: | |
| 66 return "selectedChildrenChanged"; | |
| 67 case AX_EVENT_SELECTION: | |
| 68 return "selection"; | |
| 69 case AX_EVENT_SELECTION_ADD: | |
| 70 return "selectionAdd"; | |
| 71 case AX_EVENT_SELECTION_REMOVE: | |
| 72 return "selectionRemove"; | |
| 73 case AX_EVENT_SHOW: | |
| 74 return "show"; | |
| 75 case AX_EVENT_TEXT_CHANGED: | |
| 76 return "textChanged"; | |
| 77 case AX_EVENT_TEXT_SELECTION_CHANGED: | |
| 78 return "textSelectionChanged"; | |
| 79 case AX_EVENT_VALUE_CHANGED: | |
| 80 return "valueChanged"; | |
| 81 case AX_EVENT_NONE: | |
| 82 return ""; | |
| 83 } | |
| 84 NOTREACHED(); | |
| 85 return ""; | |
| 86 } | |
| 87 | |
| 88 AXEvent ParseAXEvent(const std::string& enum_string) { | |
| 89 if (enum_string == "activedescendantchanged") | |
| 90 return AX_EVENT_ACTIVEDESCENDANTCHANGED; | |
| 91 if (enum_string == "alert") return AX_EVENT_ALERT; | |
| 92 if (enum_string == "aria_attribute_changed") | |
| 93 return AX_EVENT_ARIA_ATTRIBUTE_CHANGED; | |
| 94 if (enum_string == "autocorrection_occured") | |
| 95 return AX_EVENT_AUTOCORRECTION_OCCURED; | |
| 96 if (enum_string == "blur") return AX_EVENT_BLUR; | |
| 97 if (enum_string == "checked_state_changed") | |
| 98 return AX_EVENT_CHECKED_STATE_CHANGED; | |
| 99 if (enum_string == "children_changed") return AX_EVENT_CHILDREN_CHANGED; | |
| 100 if (enum_string == "focus") return AX_EVENT_FOCUS; | |
| 101 if (enum_string == "hide") return AX_EVENT_HIDE; | |
| 102 if (enum_string == "hover") return AX_EVENT_HOVER; | |
| 103 if (enum_string == "invalid_status_changed") | |
| 104 return AX_EVENT_INVALID_STATUS_CHANGED; | |
| 105 if (enum_string == "layout_complete") return AX_EVENT_LAYOUT_COMPLETE; | |
| 106 if (enum_string == "live_region_changed") return AX_EVENT_LIVE_REGION_CHANGED; | |
| 107 if (enum_string == "load_complete") return AX_EVENT_LOAD_COMPLETE; | |
| 108 if (enum_string == "location_changed") return AX_EVENT_LOCATION_CHANGED; | |
| 109 if (enum_string == "menu_end") return AX_EVENT_MENU_END; | |
| 110 if (enum_string == "menu_list_item_selected") | |
| 111 return AX_EVENT_MENU_LIST_ITEM_SELECTED; | |
| 112 if (enum_string == "menu_list_value_changed") | |
| 113 return AX_EVENT_MENU_LIST_VALUE_CHANGED; | |
| 114 if (enum_string == "menu_popup_end") return AX_EVENT_MENU_POPUP_END; | |
| 115 if (enum_string == "menu_popup_start") return AX_EVENT_MENU_POPUP_START; | |
| 116 if (enum_string == "menu_start") return AX_EVENT_MENU_START; | |
| 117 if (enum_string == "row_collapsed") return AX_EVENT_ROW_COLLAPSED; | |
| 118 if (enum_string == "row_count_changed") return AX_EVENT_ROW_COUNT_CHANGED; | |
| 119 if (enum_string == "row_expanded") return AX_EVENT_ROW_EXPANDED; | |
| 120 if (enum_string == "scroll_position_changed") | |
| 121 return AX_EVENT_SCROLL_POSITION_CHANGED; | |
| 122 if (enum_string == "scrolled_to_anchor") return AX_EVENT_SCROLLED_TO_ANCHOR; | |
| 123 if (enum_string == "selected_children_changed") | |
| 124 return AX_EVENT_SELECTED_CHILDREN_CHANGED; | |
| 125 if (enum_string == "selection") return AX_EVENT_SELECTION; | |
| 126 if (enum_string == "selection_add") return AX_EVENT_SELECTION_ADD; | |
| 127 if (enum_string == "selection_remove") return AX_EVENT_SELECTION_REMOVE; | |
| 128 if (enum_string == "show") return AX_EVENT_SHOW; | |
| 129 if (enum_string == "text_changed") return AX_EVENT_TEXT_CHANGED; | |
| 130 if (enum_string == "text_selection_changed") | |
| 131 return AX_EVENT_TEXT_SELECTION_CHANGED; | |
| 132 if (enum_string == "value_changed") return AX_EVENT_VALUE_CHANGED; | |
| 133 return AX_EVENT_NONE; | |
| 134 } | |
| 135 | |
| 136 std::string ToString(AXRole enum_param) { | |
| 137 switch (enum_param) { | |
| 138 case AX_ROLE_ALERT_DIALOG: | |
| 139 return "alertDialog"; | |
| 140 case AX_ROLE_ALERT: | |
| 141 return "alert"; | |
| 142 case AX_ROLE_ANNOTATION: | |
| 143 return "annotation"; | |
| 144 case AX_ROLE_APPLICATION: | |
| 145 return "application"; | |
| 146 case AX_ROLE_ARTICLE: | |
| 147 return "article"; | |
| 148 case AX_ROLE_BANNER: | |
| 149 return "banner"; | |
| 150 case AX_ROLE_BROWSER: | |
| 151 return "browser"; | |
| 152 case AX_ROLE_BUSY_INDICATOR: | |
| 153 return "busyIndicator"; | |
| 154 case AX_ROLE_BUTTON: | |
| 155 return "button"; | |
| 156 case AX_ROLE_BUTTON_DROP_DOWN: | |
| 157 return "buttonDropDown"; | |
| 158 case AX_ROLE_CANVAS: | |
| 159 return "canvas"; | |
| 160 case AX_ROLE_CELL: | |
| 161 return "cell"; | |
| 162 case AX_ROLE_CHECK_BOX: | |
| 163 return "checkBox"; | |
| 164 case AX_ROLE_CLIENT: | |
| 165 return "client"; | |
| 166 case AX_ROLE_COLOR_WELL: | |
| 167 return "colorWell"; | |
| 168 case AX_ROLE_COLUMN_HEADER: | |
| 169 return "columnHeader"; | |
| 170 case AX_ROLE_COLUMN: | |
| 171 return "column"; | |
| 172 case AX_ROLE_COMBO_BOX: | |
| 173 return "comboBox"; | |
| 174 case AX_ROLE_COMPLEMENTARY: | |
| 175 return "complementary"; | |
| 176 case AX_ROLE_CONTENT_INFO: | |
| 177 return "contentInfo"; | |
| 178 case AX_ROLE_DATE: | |
| 179 return "date"; | |
| 180 case AX_ROLE_DATE_TIME: | |
| 181 return "dateTime"; | |
| 182 case AX_ROLE_DEFINITION: | |
| 183 return "definition"; | |
| 184 case AX_ROLE_DESCRIPTION_LIST_DETAIL: | |
| 185 return "descriptionListDetail"; | |
| 186 case AX_ROLE_DESCRIPTION_LIST: | |
| 187 return "descriptionList"; | |
| 188 case AX_ROLE_DESCRIPTION_LIST_TERM: | |
| 189 return "descriptionListTerm"; | |
| 190 case AX_ROLE_DESKTOP: | |
| 191 return "desktop"; | |
| 192 case AX_ROLE_DETAILS: | |
| 193 return "details"; | |
| 194 case AX_ROLE_DIALOG: | |
| 195 return "dialog"; | |
| 196 case AX_ROLE_DIRECTORY: | |
| 197 return "directory"; | |
| 198 case AX_ROLE_DISCLOSURE_TRIANGLE: | |
| 199 return "disclosureTriangle"; | |
| 200 case AX_ROLE_DIV: | |
| 201 return "div"; | |
| 202 case AX_ROLE_DOCUMENT: | |
| 203 return "document"; | |
| 204 case AX_ROLE_DRAWER: | |
| 205 return "drawer"; | |
| 206 case AX_ROLE_EDITABLE_TEXT: | |
| 207 return "editableText"; | |
| 208 case AX_ROLE_EMBEDDED_OBJECT: | |
| 209 return "embeddedObject"; | |
| 210 case AX_ROLE_FIGCAPTION: | |
| 211 return "figcaption"; | |
| 212 case AX_ROLE_FIGURE: | |
| 213 return "figure"; | |
| 214 case AX_ROLE_FOOTER: | |
| 215 return "footer"; | |
| 216 case AX_ROLE_FORM: | |
| 217 return "form"; | |
| 218 case AX_ROLE_GRID: | |
| 219 return "grid"; | |
| 220 case AX_ROLE_GROUP: | |
| 221 return "group"; | |
| 222 case AX_ROLE_GROW_AREA: | |
| 223 return "growArea"; | |
| 224 case AX_ROLE_HEADING: | |
| 225 return "heading"; | |
| 226 case AX_ROLE_HELP_TAG: | |
| 227 return "helpTag"; | |
| 228 case AX_ROLE_HORIZONTAL_RULE: | |
| 229 return "horizontalRule"; | |
| 230 case AX_ROLE_IFRAME: | |
| 231 return "iframe"; | |
| 232 case AX_ROLE_IGNORED: | |
| 233 return "ignored"; | |
| 234 case AX_ROLE_IMAGE_MAP_LINK: | |
| 235 return "imageMapLink"; | |
| 236 case AX_ROLE_IMAGE_MAP: | |
| 237 return "imageMap"; | |
| 238 case AX_ROLE_IMAGE: | |
| 239 return "image"; | |
| 240 case AX_ROLE_INCREMENTOR: | |
| 241 return "incrementor"; | |
| 242 case AX_ROLE_INLINE_TEXT_BOX: | |
| 243 return "inlineTextBox"; | |
| 244 case AX_ROLE_LABEL_TEXT: | |
| 245 return "labelText"; | |
| 246 case AX_ROLE_LEGEND: | |
| 247 return "legend"; | |
| 248 case AX_ROLE_LINK: | |
| 249 return "link"; | |
| 250 case AX_ROLE_LIST_BOX_OPTION: | |
| 251 return "listBoxOption"; | |
| 252 case AX_ROLE_LIST_BOX: | |
| 253 return "listBox"; | |
| 254 case AX_ROLE_LIST_ITEM: | |
| 255 return "listItem"; | |
| 256 case AX_ROLE_LIST_MARKER: | |
| 257 return "listMarker"; | |
| 258 case AX_ROLE_LIST: | |
| 259 return "list"; | |
| 260 case AX_ROLE_LOCATION_BAR: | |
| 261 return "locationBar"; | |
| 262 case AX_ROLE_LOG: | |
| 263 return "log"; | |
| 264 case AX_ROLE_MAIN: | |
| 265 return "main"; | |
| 266 case AX_ROLE_MARQUEE: | |
| 267 return "marquee"; | |
| 268 case AX_ROLE_MATH_ELEMENT: | |
| 269 return "mathElement"; | |
| 270 case AX_ROLE_MATH: | |
| 271 return "math"; | |
| 272 case AX_ROLE_MATTE: | |
| 273 return "matte"; | |
| 274 case AX_ROLE_MENU_BAR: | |
| 275 return "menuBar"; | |
| 276 case AX_ROLE_MENU_BUTTON: | |
| 277 return "menuButton"; | |
| 278 case AX_ROLE_MENU_ITEM: | |
| 279 return "menuItem"; | |
| 280 case AX_ROLE_MENU_ITEM_CHECK_BOX: | |
| 281 return "menuItemCheckBox"; | |
| 282 case AX_ROLE_MENU_ITEM_RADIO: | |
| 283 return "menuItemRadio"; | |
| 284 case AX_ROLE_MENU_LIST_OPTION: | |
| 285 return "menuListOption"; | |
| 286 case AX_ROLE_MENU_LIST_POPUP: | |
| 287 return "menuListPopup"; | |
| 288 case AX_ROLE_MENU: | |
| 289 return "menu"; | |
| 290 case AX_ROLE_METER: | |
| 291 return "meter"; | |
| 292 case AX_ROLE_NAVIGATION: | |
| 293 return "navigation"; | |
| 294 case AX_ROLE_NOTE: | |
| 295 return "note"; | |
| 296 case AX_ROLE_OUTLINE: | |
| 297 return "outline"; | |
| 298 case AX_ROLE_PANE: | |
| 299 return "pane"; | |
| 300 case AX_ROLE_PARAGRAPH: | |
| 301 return "paragraph"; | |
| 302 case AX_ROLE_POP_UP_BUTTON: | |
| 303 return "popUpButton"; | |
| 304 case AX_ROLE_PRESENTATIONAL: | |
| 305 return "presentational"; | |
| 306 case AX_ROLE_PROGRESS_INDICATOR: | |
| 307 return "progressIndicator"; | |
| 308 case AX_ROLE_RADIO_BUTTON: | |
| 309 return "radioButton"; | |
| 310 case AX_ROLE_RADIO_GROUP: | |
| 311 return "radioGroup"; | |
| 312 case AX_ROLE_REGION: | |
| 313 return "region"; | |
| 314 case AX_ROLE_ROOT_WEB_AREA: | |
| 315 return "rootWebArea"; | |
| 316 case AX_ROLE_ROW_HEADER: | |
| 317 return "rowHeader"; | |
| 318 case AX_ROLE_ROW: | |
| 319 return "row"; | |
| 320 case AX_ROLE_RULER_MARKER: | |
| 321 return "rulerMarker"; | |
| 322 case AX_ROLE_RULER: | |
| 323 return "ruler"; | |
| 324 case AX_ROLE_SVG_ROOT: | |
| 325 return "svgRoot"; | |
| 326 case AX_ROLE_SCROLL_AREA: | |
| 327 return "scrollArea"; | |
| 328 case AX_ROLE_SCROLL_BAR: | |
| 329 return "scrollBar"; | |
| 330 case AX_ROLE_SEAMLESS_WEB_AREA: | |
| 331 return "seamlessWebArea"; | |
| 332 case AX_ROLE_SEARCH: | |
| 333 return "search"; | |
| 334 case AX_ROLE_SHEET: | |
| 335 return "sheet"; | |
| 336 case AX_ROLE_SLIDER: | |
| 337 return "slider"; | |
| 338 case AX_ROLE_SLIDER_THUMB: | |
| 339 return "sliderThumb"; | |
| 340 case AX_ROLE_SPIN_BUTTON_PART: | |
| 341 return "spinButtonPart"; | |
| 342 case AX_ROLE_SPIN_BUTTON: | |
| 343 return "spinButton"; | |
| 344 case AX_ROLE_SPLIT_GROUP: | |
| 345 return "splitGroup"; | |
| 346 case AX_ROLE_SPLITTER: | |
| 347 return "splitter"; | |
| 348 case AX_ROLE_STATIC_TEXT: | |
| 349 return "staticText"; | |
| 350 case AX_ROLE_STATUS: | |
| 351 return "status"; | |
| 352 case AX_ROLE_SYSTEM_WIDE: | |
| 353 return "systemWide"; | |
| 354 case AX_ROLE_TAB_GROUP: | |
| 355 return "tabGroup"; | |
| 356 case AX_ROLE_TAB_LIST: | |
| 357 return "tabList"; | |
| 358 case AX_ROLE_TAB_PANEL: | |
| 359 return "tabPanel"; | |
| 360 case AX_ROLE_TAB: | |
| 361 return "tab"; | |
| 362 case AX_ROLE_TABLE_HEADER_CONTAINER: | |
| 363 return "tableHeaderContainer"; | |
| 364 case AX_ROLE_TABLE: | |
| 365 return "table"; | |
| 366 case AX_ROLE_TEXT_AREA: | |
| 367 return "textArea"; | |
| 368 case AX_ROLE_TEXT_FIELD: | |
| 369 return "textField"; | |
| 370 case AX_ROLE_TIME: | |
| 371 return "time"; | |
| 372 case AX_ROLE_TIMER: | |
| 373 return "timer"; | |
| 374 case AX_ROLE_TITLE_BAR: | |
| 375 return "titleBar"; | |
| 376 case AX_ROLE_TOGGLE_BUTTON: | |
| 377 return "toggleButton"; | |
| 378 case AX_ROLE_TOOLBAR: | |
| 379 return "toolbar"; | |
| 380 case AX_ROLE_TREE_GRID: | |
| 381 return "treeGrid"; | |
| 382 case AX_ROLE_TREE_ITEM: | |
| 383 return "treeItem"; | |
| 384 case AX_ROLE_TREE: | |
| 385 return "tree"; | |
| 386 case AX_ROLE_UNKNOWN: | |
| 387 return "unknown"; | |
| 388 case AX_ROLE_TOOLTIP: | |
| 389 return "tooltip"; | |
| 390 case AX_ROLE_VALUE_INDICATOR: | |
| 391 return "valueIndicator"; | |
| 392 case AX_ROLE_WEB_AREA: | |
| 393 return "webArea"; | |
| 394 case AX_ROLE_WINDOW: | |
| 395 return "window"; | |
| 396 case AX_ROLE_NONE: | |
| 397 return ""; | |
| 398 } | |
| 399 NOTREACHED(); | |
| 400 return ""; | |
| 401 } | |
| 402 | |
| 403 AXRole ParseAXRole(const std::string& enum_string) { | |
| 404 if (enum_string == "alert_dialog") return AX_ROLE_ALERT_DIALOG; | |
| 405 if (enum_string == "alert") return AX_ROLE_ALERT; | |
| 406 if (enum_string == "annotation") return AX_ROLE_ANNOTATION; | |
| 407 if (enum_string == "application") return AX_ROLE_APPLICATION; | |
| 408 if (enum_string == "article") return AX_ROLE_ARTICLE; | |
| 409 if (enum_string == "banner") return AX_ROLE_BANNER; | |
| 410 if (enum_string == "browser") return AX_ROLE_BROWSER; | |
| 411 if (enum_string == "busy_indicator") return AX_ROLE_BUSY_INDICATOR; | |
| 412 if (enum_string == "button") return AX_ROLE_BUTTON; | |
| 413 if (enum_string == "button_drop_down") return AX_ROLE_BUTTON_DROP_DOWN; | |
| 414 if (enum_string == "canvas") return AX_ROLE_CANVAS; | |
| 415 if (enum_string == "cell") return AX_ROLE_CELL; | |
| 416 if (enum_string == "check_box") return AX_ROLE_CHECK_BOX; | |
| 417 if (enum_string == "client") return AX_ROLE_CLIENT; | |
| 418 if (enum_string == "color_well") return AX_ROLE_COLOR_WELL; | |
| 419 if (enum_string == "column_header") return AX_ROLE_COLUMN_HEADER; | |
| 420 if (enum_string == "column") return AX_ROLE_COLUMN; | |
| 421 if (enum_string == "combo_box") return AX_ROLE_COMBO_BOX; | |
| 422 if (enum_string == "complementary") return AX_ROLE_COMPLEMENTARY; | |
| 423 if (enum_string == "content_info") return AX_ROLE_CONTENT_INFO; | |
| 424 if (enum_string == "date") return AX_ROLE_DATE; | |
| 425 if (enum_string == "date_time") return AX_ROLE_DATE_TIME; | |
| 426 if (enum_string == "definition") return AX_ROLE_DEFINITION; | |
| 427 if (enum_string == "description_list_detail") | |
| 428 return AX_ROLE_DESCRIPTION_LIST_DETAIL; | |
| 429 if (enum_string == "description_list") return AX_ROLE_DESCRIPTION_LIST; | |
| 430 if (enum_string == "description_list_term") | |
| 431 return AX_ROLE_DESCRIPTION_LIST_TERM; | |
| 432 if (enum_string == "desktop") return AX_ROLE_DESKTOP; | |
| 433 if (enum_string == "details") return AX_ROLE_DETAILS; | |
| 434 if (enum_string == "dialog") return AX_ROLE_DIALOG; | |
| 435 if (enum_string == "directory") return AX_ROLE_DIRECTORY; | |
| 436 if (enum_string == "disclosure_triangle") return AX_ROLE_DISCLOSURE_TRIANGLE; | |
| 437 if (enum_string == "div") return AX_ROLE_DIV; | |
| 438 if (enum_string == "document") return AX_ROLE_DOCUMENT; | |
| 439 if (enum_string == "drawer") return AX_ROLE_DRAWER; | |
| 440 if (enum_string == "editable_text") return AX_ROLE_EDITABLE_TEXT; | |
| 441 if (enum_string == "embedded_object") return AX_ROLE_EMBEDDED_OBJECT; | |
| 442 if (enum_string == "figcaption") return AX_ROLE_FIGCAPTION; | |
| 443 if (enum_string == "figure") return AX_ROLE_FIGURE; | |
| 444 if (enum_string == "footer") return AX_ROLE_FOOTER; | |
| 445 if (enum_string == "form") return AX_ROLE_FORM; | |
| 446 if (enum_string == "grid") return AX_ROLE_GRID; | |
| 447 if (enum_string == "group") return AX_ROLE_GROUP; | |
| 448 if (enum_string == "grow_area") return AX_ROLE_GROW_AREA; | |
| 449 if (enum_string == "heading") return AX_ROLE_HEADING; | |
| 450 if (enum_string == "help_tag") return AX_ROLE_HELP_TAG; | |
| 451 if (enum_string == "horizontal_rule") return AX_ROLE_HORIZONTAL_RULE; | |
| 452 if (enum_string == "iframe") return AX_ROLE_IFRAME; | |
| 453 if (enum_string == "ignored") return AX_ROLE_IGNORED; | |
| 454 if (enum_string == "image_map_link") return AX_ROLE_IMAGE_MAP_LINK; | |
| 455 if (enum_string == "image_map") return AX_ROLE_IMAGE_MAP; | |
| 456 if (enum_string == "image") return AX_ROLE_IMAGE; | |
| 457 if (enum_string == "incrementor") return AX_ROLE_INCREMENTOR; | |
| 458 if (enum_string == "inline_text_box") return AX_ROLE_INLINE_TEXT_BOX; | |
| 459 if (enum_string == "label_text") return AX_ROLE_LABEL_TEXT; | |
| 460 if (enum_string == "legend") return AX_ROLE_LEGEND; | |
| 461 if (enum_string == "link") return AX_ROLE_LINK; | |
| 462 if (enum_string == "list_box_option") return AX_ROLE_LIST_BOX_OPTION; | |
| 463 if (enum_string == "list_box") return AX_ROLE_LIST_BOX; | |
| 464 if (enum_string == "list_item") return AX_ROLE_LIST_ITEM; | |
| 465 if (enum_string == "list_marker") return AX_ROLE_LIST_MARKER; | |
| 466 if (enum_string == "list") return AX_ROLE_LIST; | |
| 467 if (enum_string == "location_bar") return AX_ROLE_LOCATION_BAR; | |
| 468 if (enum_string == "log") return AX_ROLE_LOG; | |
| 469 if (enum_string == "main") return AX_ROLE_MAIN; | |
| 470 if (enum_string == "marquee") return AX_ROLE_MARQUEE; | |
| 471 if (enum_string == "math_element") return AX_ROLE_MATH_ELEMENT; | |
| 472 if (enum_string == "math") return AX_ROLE_MATH; | |
| 473 if (enum_string == "matte") return AX_ROLE_MATTE; | |
| 474 if (enum_string == "menu_bar") return AX_ROLE_MENU_BAR; | |
| 475 if (enum_string == "menu_button") return AX_ROLE_MENU_BUTTON; | |
| 476 if (enum_string == "menu_item") return AX_ROLE_MENU_ITEM; | |
| 477 if (enum_string == "menu_item_check_box") return AX_ROLE_MENU_ITEM_CHECK_BOX; | |
| 478 if (enum_string == "menu_item_radio") return AX_ROLE_MENU_ITEM_RADIO; | |
| 479 if (enum_string == "menu_list_option") return AX_ROLE_MENU_LIST_OPTION; | |
| 480 if (enum_string == "menu_list_popup") return AX_ROLE_MENU_LIST_POPUP; | |
| 481 if (enum_string == "menu") return AX_ROLE_MENU; | |
| 482 if (enum_string == "meter") return AX_ROLE_METER; | |
| 483 if (enum_string == "navigation") return AX_ROLE_NAVIGATION; | |
| 484 if (enum_string == "note") return AX_ROLE_NOTE; | |
| 485 if (enum_string == "outline") return AX_ROLE_OUTLINE; | |
| 486 if (enum_string == "pane") return AX_ROLE_PANE; | |
| 487 if (enum_string == "paragraph") return AX_ROLE_PARAGRAPH; | |
| 488 if (enum_string == "pop_up_button") return AX_ROLE_POP_UP_BUTTON; | |
| 489 if (enum_string == "presentational") return AX_ROLE_PRESENTATIONAL; | |
| 490 if (enum_string == "progress_indicator") return AX_ROLE_PROGRESS_INDICATOR; | |
| 491 if (enum_string == "radio_button") return AX_ROLE_RADIO_BUTTON; | |
| 492 if (enum_string == "radio_group") return AX_ROLE_RADIO_GROUP; | |
| 493 if (enum_string == "region") return AX_ROLE_REGION; | |
| 494 if (enum_string == "root_web_area") return AX_ROLE_ROOT_WEB_AREA; | |
| 495 if (enum_string == "row_header") return AX_ROLE_ROW_HEADER; | |
| 496 if (enum_string == "row") return AX_ROLE_ROW; | |
| 497 if (enum_string == "ruler_marker") return AX_ROLE_RULER_MARKER; | |
| 498 if (enum_string == "ruler") return AX_ROLE_RULER; | |
| 499 if (enum_string == "svg_root") return AX_ROLE_SVG_ROOT; | |
| 500 if (enum_string == "scroll_area") return AX_ROLE_SCROLL_AREA; | |
| 501 if (enum_string == "scroll_bar") return AX_ROLE_SCROLL_BAR; | |
| 502 if (enum_string == "seamless_web_area") return AX_ROLE_SEAMLESS_WEB_AREA; | |
| 503 if (enum_string == "search") return AX_ROLE_SEARCH; | |
| 504 if (enum_string == "sheet") return AX_ROLE_SHEET; | |
| 505 if (enum_string == "slider") return AX_ROLE_SLIDER; | |
| 506 if (enum_string == "slider_thumb") return AX_ROLE_SLIDER_THUMB; | |
| 507 if (enum_string == "spin_button_part") return AX_ROLE_SPIN_BUTTON_PART; | |
| 508 if (enum_string == "spin_button") return AX_ROLE_SPIN_BUTTON; | |
| 509 if (enum_string == "split_group") return AX_ROLE_SPLIT_GROUP; | |
| 510 if (enum_string == "splitter") return AX_ROLE_SPLITTER; | |
| 511 if (enum_string == "static_text") return AX_ROLE_STATIC_TEXT; | |
| 512 if (enum_string == "status") return AX_ROLE_STATUS; | |
| 513 if (enum_string == "system_wide") return AX_ROLE_SYSTEM_WIDE; | |
| 514 if (enum_string == "tab_group") return AX_ROLE_TAB_GROUP; | |
| 515 if (enum_string == "tab_list") return AX_ROLE_TAB_LIST; | |
| 516 if (enum_string == "tab_panel") return AX_ROLE_TAB_PANEL; | |
| 517 if (enum_string == "tab") return AX_ROLE_TAB; | |
| 518 if (enum_string == "table_header_container") | |
| 519 return AX_ROLE_TABLE_HEADER_CONTAINER; | |
| 520 if (enum_string == "table") return AX_ROLE_TABLE; | |
| 521 if (enum_string == "text_area") return AX_ROLE_TEXT_AREA; | |
| 522 if (enum_string == "text_field") return AX_ROLE_TEXT_FIELD; | |
| 523 if (enum_string == "time") return AX_ROLE_TIME; | |
| 524 if (enum_string == "timer") return AX_ROLE_TIMER; | |
| 525 if (enum_string == "title_bar") return AX_ROLE_TITLE_BAR; | |
| 526 if (enum_string == "toggle_button") return AX_ROLE_TOGGLE_BUTTON; | |
| 527 if (enum_string == "toolbar") return AX_ROLE_TOOLBAR; | |
| 528 if (enum_string == "tree_grid") return AX_ROLE_TREE_GRID; | |
| 529 if (enum_string == "tree_item") return AX_ROLE_TREE_ITEM; | |
| 530 if (enum_string == "tree") return AX_ROLE_TREE; | |
| 531 if (enum_string == "unknown") return AX_ROLE_UNKNOWN; | |
| 532 if (enum_string == "tooltip") return AX_ROLE_TOOLTIP; | |
| 533 if (enum_string == "value_indicator") return AX_ROLE_VALUE_INDICATOR; | |
| 534 if (enum_string == "web_area") return AX_ROLE_WEB_AREA; | |
| 535 if (enum_string == "window") return AX_ROLE_WINDOW; | |
| 536 return AX_ROLE_NONE; | |
| 537 } | |
| 538 | |
| 539 std::string ToString(AXState enum_param) { | |
| 540 switch (enum_param) { | |
| 541 case AX_STATE_BUSY: | |
| 542 return "busy"; | |
| 543 case AX_STATE_CHECKED: | |
| 544 return "checked"; | |
| 545 case AX_STATE_COLLAPSED: | |
| 546 return "collapsed"; | |
| 547 case AX_STATE_DEFAULT: | |
| 548 return "default"; | |
| 549 case AX_STATE_DISABLED: | |
| 550 return "disabled"; | |
| 551 case AX_STATE_EDITABLE: | |
| 552 return "editable"; | |
| 553 case AX_STATE_ENABLED: | |
| 554 return "enabled"; | |
| 555 case AX_STATE_EXPANDED: | |
| 556 return "expanded"; | |
| 557 case AX_STATE_FOCUSABLE: | |
| 558 return "focusable"; | |
| 559 case AX_STATE_FOCUSED: | |
| 560 return "focused"; | |
| 561 case AX_STATE_HASPOPUP: | |
| 562 return "haspopup"; | |
| 563 case AX_STATE_HOVERED: | |
| 564 return "hovered"; | |
| 565 case AX_STATE_INDETERMINATE: | |
| 566 return "indeterminate"; | |
| 567 case AX_STATE_INVISIBLE: | |
| 568 return "invisible"; | |
| 569 case AX_STATE_LINKED: | |
| 570 return "linked"; | |
| 571 case AX_STATE_MULTISELECTABLE: | |
| 572 return "multiselectable"; | |
| 573 case AX_STATE_OFFSCREEN: | |
| 574 return "offscreen"; | |
| 575 case AX_STATE_PRESSED: | |
| 576 return "pressed"; | |
| 577 case AX_STATE_PROTECTED: | |
| 578 return "protected"; | |
| 579 case AX_STATE_READ_ONLY: | |
| 580 return "readOnly"; | |
| 581 case AX_STATE_REQUIRED: | |
| 582 return "required"; | |
| 583 case AX_STATE_SELECTABLE: | |
| 584 return "selectable"; | |
| 585 case AX_STATE_SELECTED: | |
| 586 return "selected"; | |
| 587 case AX_STATE_VERTICAL: | |
| 588 return "vertical"; | |
| 589 case AX_STATE_VISITED: | |
| 590 return "visited"; | |
| 591 case AX_STATE_NONE: | |
| 592 return ""; | |
| 593 } | |
| 594 NOTREACHED(); | |
| 595 return ""; | |
| 596 } | |
| 597 | |
| 598 AXState ParseAXState(const std::string& enum_string) { | |
| 599 if (enum_string == "busy") return AX_STATE_BUSY; | |
| 600 if (enum_string == "checked") return AX_STATE_CHECKED; | |
| 601 if (enum_string == "collapsed") return AX_STATE_COLLAPSED; | |
| 602 if (enum_string == "default") return AX_STATE_DEFAULT; | |
| 603 if (enum_string == "disabled") return AX_STATE_DISABLED; | |
| 604 if (enum_string == "editable") return AX_STATE_EDITABLE; | |
| 605 if (enum_string == "enabled") return AX_STATE_ENABLED; | |
| 606 if (enum_string == "expanded") return AX_STATE_EXPANDED; | |
| 607 if (enum_string == "focusable") return AX_STATE_FOCUSABLE; | |
| 608 if (enum_string == "focused") return AX_STATE_FOCUSED; | |
| 609 if (enum_string == "haspopup") return AX_STATE_HASPOPUP; | |
| 610 if (enum_string == "hovered") return AX_STATE_HOVERED; | |
| 611 if (enum_string == "indeterminate") return AX_STATE_INDETERMINATE; | |
| 612 if (enum_string == "invisible") return AX_STATE_INVISIBLE; | |
| 613 if (enum_string == "linked") return AX_STATE_LINKED; | |
| 614 if (enum_string == "multiselectable") return AX_STATE_MULTISELECTABLE; | |
| 615 if (enum_string == "offscreen") return AX_STATE_OFFSCREEN; | |
| 616 if (enum_string == "pressed") return AX_STATE_PRESSED; | |
| 617 if (enum_string == "protected") return AX_STATE_PROTECTED; | |
| 618 if (enum_string == "read_only") return AX_STATE_READ_ONLY; | |
| 619 if (enum_string == "required") return AX_STATE_REQUIRED; | |
| 620 if (enum_string == "selectable") return AX_STATE_SELECTABLE; | |
| 621 if (enum_string == "selected") return AX_STATE_SELECTED; | |
| 622 if (enum_string == "vertical") return AX_STATE_VERTICAL; | |
| 623 if (enum_string == "visited") return AX_STATE_VISITED; | |
| 624 return AX_STATE_NONE; | |
| 625 } | |
| 626 | |
| 627 std::string ToString(AXStringAttribute enum_param) { | |
| 628 switch (enum_param) { | |
| 629 case AX_ATTR_DOC_URL: | |
| 630 return "docUrl"; | |
| 631 case AX_ATTR_DOC_TITLE: | |
| 632 return "docTitle"; | |
| 633 case AX_ATTR_DOC_MIMETYPE: | |
| 634 return "docMimetype"; | |
| 635 case AX_ATTR_DOC_DOCTYPE: | |
| 636 return "docDoctype"; | |
| 637 case AX_ATTR_ACCESS_KEY: | |
| 638 return "accessKey"; | |
| 639 case AX_ATTR_ACTION: | |
| 640 return "action"; | |
| 641 case AX_ATTR_CONTAINER_LIVE_RELEVANT: | |
| 642 return "containerLiveRelevant"; | |
| 643 case AX_ATTR_CONTAINER_LIVE_STATUS: | |
| 644 return "containerLiveStatus"; | |
| 645 case AX_ATTR_DESCRIPTION: | |
| 646 return "description"; | |
| 647 case AX_ATTR_DISPLAY: | |
| 648 return "display"; | |
| 649 case AX_ATTR_HELP: | |
| 650 return "help"; | |
| 651 case AX_ATTR_HTML_TAG: | |
| 652 return "htmlTag"; | |
| 653 case AX_ATTR_NAME: | |
| 654 return "name"; | |
| 655 case AX_ATTR_LIVE_RELEVANT: | |
| 656 return "liveRelevant"; | |
| 657 case AX_ATTR_LIVE_STATUS: | |
| 658 return "liveStatus"; | |
| 659 case AX_ATTR_ROLE: | |
| 660 return "role"; | |
| 661 case AX_ATTR_SHORTCUT: | |
| 662 return "shortcut"; | |
| 663 case AX_ATTR_TEXT_INPUT_TYPE: | |
| 664 return "textInputType"; | |
| 665 case AX_ATTR_URL: | |
| 666 return "url"; | |
| 667 case AX_ATTR_VALUE: | |
| 668 return "value"; | |
| 669 case AX_STRING_ATTRIBUTE_NONE: | |
| 670 return ""; | |
| 671 } | |
| 672 NOTREACHED(); | |
| 673 return ""; | |
| 674 } | |
| 675 | |
| 676 AXStringAttribute ParseAXStringAttribute(const std::string& enum_string) { | |
| 677 if (enum_string == "doc_url") return AX_ATTR_DOC_URL; | |
| 678 if (enum_string == "doc_title") return AX_ATTR_DOC_TITLE; | |
| 679 if (enum_string == "doc_mimetype") return AX_ATTR_DOC_MIMETYPE; | |
| 680 if (enum_string == "doc_doctype") return AX_ATTR_DOC_DOCTYPE; | |
| 681 if (enum_string == "access_key") return AX_ATTR_ACCESS_KEY; | |
| 682 if (enum_string == "action") return AX_ATTR_ACTION; | |
| 683 if (enum_string == "container_live_relevant") | |
| 684 return AX_ATTR_CONTAINER_LIVE_RELEVANT; | |
| 685 if (enum_string == "container_live_status") | |
| 686 return AX_ATTR_CONTAINER_LIVE_STATUS; | |
| 687 if (enum_string == "description") return AX_ATTR_DESCRIPTION; | |
| 688 if (enum_string == "display") return AX_ATTR_DISPLAY; | |
| 689 if (enum_string == "help") return AX_ATTR_HELP; | |
| 690 if (enum_string == "html_tag") return AX_ATTR_HTML_TAG; | |
| 691 if (enum_string == "name") return AX_ATTR_NAME; | |
| 692 if (enum_string == "live_relevant") return AX_ATTR_LIVE_RELEVANT; | |
| 693 if (enum_string == "live_status") return AX_ATTR_LIVE_STATUS; | |
| 694 if (enum_string == "role") return AX_ATTR_ROLE; | |
| 695 if (enum_string == "shortcut") return AX_ATTR_SHORTCUT; | |
| 696 if (enum_string == "text_input_type") return AX_ATTR_TEXT_INPUT_TYPE; | |
| 697 if (enum_string == "url") return AX_ATTR_URL; | |
| 698 if (enum_string == "value") return AX_ATTR_VALUE; | |
| 699 return AX_STRING_ATTRIBUTE_NONE; | |
| 700 } | |
| 701 | |
| 702 std::string ToString(AXIntAttribute enum_param) { | |
| 703 switch (enum_param) { | |
| 704 case AX_ATTR_SCROLL_X: | |
| 705 return "scrollX"; | |
| 706 case AX_ATTR_SCROLL_X_MIN: | |
| 707 return "scrollXMin"; | |
| 708 case AX_ATTR_SCROLL_X_MAX: | |
| 709 return "scrollXMax"; | |
| 710 case AX_ATTR_SCROLL_Y: | |
| 711 return "scrollY"; | |
| 712 case AX_ATTR_SCROLL_Y_MIN: | |
| 713 return "scrollYMin"; | |
| 714 case AX_ATTR_SCROLL_Y_MAX: | |
| 715 return "scrollYMax"; | |
| 716 case AX_ATTR_TEXT_SEL_START: | |
| 717 return "textSelStart"; | |
| 718 case AX_ATTR_TEXT_SEL_END: | |
| 719 return "textSelEnd"; | |
| 720 case AX_ATTR_TABLE_ROW_COUNT: | |
| 721 return "tableRowCount"; | |
| 722 case AX_ATTR_TABLE_COLUMN_COUNT: | |
| 723 return "tableColumnCount"; | |
| 724 case AX_ATTR_TABLE_HEADER_ID: | |
| 725 return "tableHeaderId"; | |
| 726 case AX_ATTR_TABLE_ROW_INDEX: | |
| 727 return "tableRowIndex"; | |
| 728 case AX_ATTR_TABLE_ROW_HEADER_ID: | |
| 729 return "tableRowHeaderId"; | |
| 730 case AX_ATTR_TABLE_COLUMN_INDEX: | |
| 731 return "tableColumnIndex"; | |
| 732 case AX_ATTR_TABLE_COLUMN_HEADER_ID: | |
| 733 return "tableColumnHeaderId"; | |
| 734 case AX_ATTR_TABLE_CELL_COLUMN_INDEX: | |
| 735 return "tableCellColumnIndex"; | |
| 736 case AX_ATTR_TABLE_CELL_COLUMN_SPAN: | |
| 737 return "tableCellColumnSpan"; | |
| 738 case AX_ATTR_TABLE_CELL_ROW_INDEX: | |
| 739 return "tableCellRowIndex"; | |
| 740 case AX_ATTR_TABLE_CELL_ROW_SPAN: | |
| 741 return "tableCellRowSpan"; | |
| 742 case AX_ATTR_HIERARCHICAL_LEVEL: | |
| 743 return "hierarchicalLevel"; | |
| 744 case AX_ATTR_TITLE_UI_ELEMENT: | |
| 745 return "titleUiElement"; | |
| 746 case AX_ATTR_ACTIVEDESCENDANT_ID: | |
| 747 return "activedescendantId"; | |
| 748 case AX_ATTR_COLOR_VALUE_RED: | |
| 749 return "colorValueRed"; | |
| 750 case AX_ATTR_COLOR_VALUE_GREEN: | |
| 751 return "colorValueGreen"; | |
| 752 case AX_ATTR_COLOR_VALUE_BLUE: | |
| 753 return "colorValueBlue"; | |
| 754 case AX_ATTR_TEXT_DIRECTION: | |
| 755 return "textDirection"; | |
| 756 case AX_INT_ATTRIBUTE_NONE: | |
| 757 return ""; | |
| 758 } | |
| 759 NOTREACHED(); | |
| 760 return ""; | |
| 761 } | |
| 762 | |
| 763 AXIntAttribute ParseAXIntAttribute(const std::string& enum_string) { | |
| 764 if (enum_string == "scroll_x") return AX_ATTR_SCROLL_X; | |
| 765 if (enum_string == "scroll_x_min") return AX_ATTR_SCROLL_X_MIN; | |
| 766 if (enum_string == "scroll_x_max") return AX_ATTR_SCROLL_X_MAX; | |
| 767 if (enum_string == "scroll_y") return AX_ATTR_SCROLL_Y; | |
| 768 if (enum_string == "scroll_y_min") return AX_ATTR_SCROLL_Y_MIN; | |
| 769 if (enum_string == "scroll_y_max") return AX_ATTR_SCROLL_Y_MAX; | |
| 770 if (enum_string == "text_sel_start") return AX_ATTR_TEXT_SEL_START; | |
| 771 if (enum_string == "text_sel_end") return AX_ATTR_TEXT_SEL_END; | |
| 772 if (enum_string == "table_row_count") return AX_ATTR_TABLE_ROW_COUNT; | |
| 773 if (enum_string == "table_column_count") return AX_ATTR_TABLE_COLUMN_COUNT; | |
| 774 if (enum_string == "table_header_id") return AX_ATTR_TABLE_HEADER_ID; | |
| 775 if (enum_string == "table_row_index") return AX_ATTR_TABLE_ROW_INDEX; | |
| 776 if (enum_string == "table_row_header_id") return AX_ATTR_TABLE_ROW_HEADER_ID; | |
| 777 if (enum_string == "table_column_index") return AX_ATTR_TABLE_COLUMN_INDEX; | |
| 778 if (enum_string == "table_column_header_id") | |
| 779 return AX_ATTR_TABLE_COLUMN_HEADER_ID; | |
| 780 if (enum_string == "table_cell_column_index") | |
| 781 return AX_ATTR_TABLE_CELL_COLUMN_INDEX; | |
| 782 if (enum_string == "table_cell_column_span") | |
| 783 return AX_ATTR_TABLE_CELL_COLUMN_SPAN; | |
| 784 if (enum_string == "table_cell_row_index") | |
| 785 return AX_ATTR_TABLE_CELL_ROW_INDEX; | |
| 786 if (enum_string == "table_cell_row_span") return AX_ATTR_TABLE_CELL_ROW_SPAN; | |
| 787 if (enum_string == "hierarchical_level") return AX_ATTR_HIERARCHICAL_LEVEL; | |
| 788 if (enum_string == "title_ui_element") return AX_ATTR_TITLE_UI_ELEMENT; | |
| 789 if (enum_string == "activedescendant_id") return AX_ATTR_ACTIVEDESCENDANT_ID; | |
| 790 if (enum_string == "color_value_red") return AX_ATTR_COLOR_VALUE_RED; | |
| 791 if (enum_string == "color_value_green") return AX_ATTR_COLOR_VALUE_GREEN; | |
| 792 if (enum_string == "color_value_blue") return AX_ATTR_COLOR_VALUE_BLUE; | |
| 793 if (enum_string == "text_direction") return AX_ATTR_TEXT_DIRECTION; | |
| 794 return AX_INT_ATTRIBUTE_NONE; | |
| 795 } | |
| 796 | |
| 797 std::string ToString(AXFloatAttribute enum_param) { | |
| 798 switch (enum_param) { | |
| 799 case AX_ATTR_DOC_LOADING_PROGRESS: | |
| 800 return "docLoadingProgress"; | |
| 801 case AX_ATTR_VALUE_FOR_RANGE: | |
| 802 return "valueForRange"; | |
| 803 case AX_ATTR_MIN_VALUE_FOR_RANGE: | |
| 804 return "minValueForRange"; | |
| 805 case AX_ATTR_MAX_VALUE_FOR_RANGE: | |
| 806 return "maxValueForRange"; | |
| 807 case AX_FLOAT_ATTRIBUTE_NONE: | |
| 808 return ""; | |
| 809 } | |
| 810 NOTREACHED(); | |
| 811 return ""; | |
| 812 } | |
| 813 | |
| 814 AXFloatAttribute ParseAXFloatAttribute(const std::string& enum_string) { | |
| 815 if (enum_string == "doc_loading_progress") | |
| 816 return AX_ATTR_DOC_LOADING_PROGRESS; | |
| 817 if (enum_string == "value_for_range") return AX_ATTR_VALUE_FOR_RANGE; | |
| 818 if (enum_string == "min_value_for_range") return AX_ATTR_MIN_VALUE_FOR_RANGE; | |
| 819 if (enum_string == "max_value_for_range") return AX_ATTR_MAX_VALUE_FOR_RANGE; | |
| 820 return AX_FLOAT_ATTRIBUTE_NONE; | |
| 821 } | |
| 822 | |
| 823 std::string ToString(AXBoolAttribute enum_param) { | |
| 824 switch (enum_param) { | |
| 825 case AX_ATTR_DOC_LOADED: | |
| 826 return "docLoaded"; | |
| 827 case AX_ATTR_BUTTON_MIXED: | |
| 828 return "buttonMixed"; | |
| 829 case AX_ATTR_CONTAINER_LIVE_ATOMIC: | |
| 830 return "containerLiveAtomic"; | |
| 831 case AX_ATTR_CONTAINER_LIVE_BUSY: | |
| 832 return "containerLiveBusy"; | |
| 833 case AX_ATTR_LIVE_ATOMIC: | |
| 834 return "liveAtomic"; | |
| 835 case AX_ATTR_LIVE_BUSY: | |
| 836 return "liveBusy"; | |
| 837 case AX_ATTR_ARIA_READONLY: | |
| 838 return "ariaReadonly"; | |
| 839 case AX_ATTR_CAN_SET_VALUE: | |
| 840 return "canSetValue"; | |
| 841 case AX_ATTR_UPDATE_LOCATION_ONLY: | |
| 842 return "updateLocationOnly"; | |
| 843 case AX_ATTR_CANVAS_HAS_FALLBACK: | |
| 844 return "canvasHasFallback"; | |
| 845 case AX_ATTR_IS_AX_TREE_HOST: | |
| 846 return "isAxTreeHost"; | |
| 847 case AX_BOOL_ATTRIBUTE_NONE: | |
| 848 return ""; | |
| 849 } | |
| 850 NOTREACHED(); | |
| 851 return ""; | |
| 852 } | |
| 853 | |
| 854 AXBoolAttribute ParseAXBoolAttribute(const std::string& enum_string) { | |
| 855 if (enum_string == "doc_loaded") return AX_ATTR_DOC_LOADED; | |
| 856 if (enum_string == "button_mixed") return AX_ATTR_BUTTON_MIXED; | |
| 857 if (enum_string == "container_live_atomic") | |
| 858 return AX_ATTR_CONTAINER_LIVE_ATOMIC; | |
| 859 if (enum_string == "container_live_busy") return AX_ATTR_CONTAINER_LIVE_BUSY; | |
| 860 if (enum_string == "live_atomic") return AX_ATTR_LIVE_ATOMIC; | |
| 861 if (enum_string == "live_busy") return AX_ATTR_LIVE_BUSY; | |
| 862 if (enum_string == "aria_readonly") return AX_ATTR_ARIA_READONLY; | |
| 863 if (enum_string == "can_set_value") return AX_ATTR_CAN_SET_VALUE; | |
| 864 if (enum_string == "update_location_only") | |
| 865 return AX_ATTR_UPDATE_LOCATION_ONLY; | |
| 866 if (enum_string == "canvas_has_fallback") return AX_ATTR_CANVAS_HAS_FALLBACK; | |
| 867 if (enum_string == "is_ax_tree_host") return AX_ATTR_IS_AX_TREE_HOST; | |
| 868 return AX_BOOL_ATTRIBUTE_NONE; | |
| 869 } | |
| 870 | |
| 871 std::string ToString(AXIntListAttribute enum_param) { | |
| 872 switch (enum_param) { | |
| 873 case AX_ATTR_INDIRECT_CHILD_IDS: | |
| 874 return "indirectChildIds"; | |
| 875 case AX_ATTR_CONTROLS_IDS: | |
| 876 return "controlsIds"; | |
| 877 case AX_ATTR_DESCRIBEDBY_IDS: | |
| 878 return "describedbyIds"; | |
| 879 case AX_ATTR_FLOWTO_IDS: | |
| 880 return "flowtoIds"; | |
| 881 case AX_ATTR_LABELLEDBY_IDS: | |
| 882 return "labelledbyIds"; | |
| 883 case AX_ATTR_OWNS_IDS: | |
| 884 return "ownsIds"; | |
| 885 case AX_ATTR_LINE_BREAKS: | |
| 886 return "lineBreaks"; | |
| 887 case AX_ATTR_CELL_IDS: | |
| 888 return "cellIds"; | |
| 889 case AX_ATTR_UNIQUE_CELL_IDS: | |
| 890 return "uniqueCellIds"; | |
| 891 case AX_ATTR_CHARACTER_OFFSETS: | |
| 892 return "characterOffsets"; | |
| 893 case AX_ATTR_WORD_STARTS: | |
| 894 return "wordStarts"; | |
| 895 case AX_ATTR_WORD_ENDS: | |
| 896 return "wordEnds"; | |
| 897 case AX_INT_LIST_ATTRIBUTE_NONE: | |
| 898 return ""; | |
| 899 } | |
| 900 NOTREACHED(); | |
| 901 return ""; | |
| 902 } | |
| 903 | |
| 904 AXIntListAttribute ParseAXIntListAttribute(const std::string& enum_string) { | |
| 905 if (enum_string == "indirect_child_ids") return AX_ATTR_INDIRECT_CHILD_IDS; | |
| 906 if (enum_string == "controls_ids") return AX_ATTR_CONTROLS_IDS; | |
| 907 if (enum_string == "describedby_ids") return AX_ATTR_DESCRIBEDBY_IDS; | |
| 908 if (enum_string == "flowto_ids") return AX_ATTR_FLOWTO_IDS; | |
| 909 if (enum_string == "labelledby_ids") return AX_ATTR_LABELLEDBY_IDS; | |
| 910 if (enum_string == "owns_ids") return AX_ATTR_OWNS_IDS; | |
| 911 if (enum_string == "line_breaks") return AX_ATTR_LINE_BREAKS; | |
| 912 if (enum_string == "cell_ids") return AX_ATTR_CELL_IDS; | |
| 913 if (enum_string == "unique_cell_ids") return AX_ATTR_UNIQUE_CELL_IDS; | |
| 914 if (enum_string == "character_offsets") return AX_ATTR_CHARACTER_OFFSETS; | |
| 915 if (enum_string == "word_starts") return AX_ATTR_WORD_STARTS; | |
| 916 if (enum_string == "word_ends") return AX_ATTR_WORD_ENDS; | |
| 917 return AX_INT_LIST_ATTRIBUTE_NONE; | |
| 918 } | |
| 919 | |
| 920 std::string ToString(AXTextDirection enum_param) { | |
| 921 switch (enum_param) { | |
| 922 case AX_TEXT_DIRECTION_LR: | |
| 923 return "textDirectionLr"; | |
| 924 case AX_TEXT_DIRECTION_RL: | |
| 925 return "textDirectionRl"; | |
| 926 case AX_TEXT_DIRECTION_TB: | |
| 927 return "textDirectionTb"; | |
| 928 case AX_TEXT_DIRECTION_BT: | |
| 929 return "textDirectionBt"; | |
| 930 case AX_TEXT_DIRECTION_NONE: | |
| 931 return ""; | |
| 932 } | |
| 933 NOTREACHED(); | |
| 934 return ""; | |
| 935 } | |
| 936 | |
| 937 AXTextDirection ParseAXTextDirection(const std::string& enum_string) { | |
| 938 if (enum_string == "text_direction_lr") return AX_TEXT_DIRECTION_LR; | |
| 939 if (enum_string == "text_direction_rl") return AX_TEXT_DIRECTION_RL; | |
| 940 if (enum_string == "text_direction_tb") return AX_TEXT_DIRECTION_TB; | |
| 941 if (enum_string == "text_direction_bt") return AX_TEXT_DIRECTION_BT; | |
| 942 return AX_TEXT_DIRECTION_NONE; | |
| 943 } | |
| 944 | |
| 945 } // namespace ui | |
| OLD | NEW |