1 // Copyright 2018 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_enum_util.h"
6
7 #include "ui/accessibility/ax_enums.mojom.h"
8
9 namespace ui {
10
ToString(ax::mojom::Event event)11 const char* ToString(ax::mojom::Event event) {
12 switch (event) {
13 case ax::mojom::Event::kNone:
14 return "none";
15 case ax::mojom::Event::kActiveDescendantChanged:
16 return "activedescendantchanged";
17 case ax::mojom::Event::kAlert:
18 return "alert";
19 case ax::mojom::Event::kAriaAttributeChanged:
20 return "ariaAttributeChanged";
21 case ax::mojom::Event::kAutocorrectionOccured:
22 return "autocorrectionOccured";
23 case ax::mojom::Event::kBlur:
24 return "blur";
25 case ax::mojom::Event::kCheckedStateChanged:
26 return "checkedStateChanged";
27 case ax::mojom::Event::kChildrenChanged:
28 return "childrenChanged";
29 case ax::mojom::Event::kClicked:
30 return "clicked";
31 case ax::mojom::Event::kControlsChanged:
32 return "controlsChanged";
33 case ax::mojom::Event::kDocumentSelectionChanged:
34 return "documentSelectionChanged";
35 case ax::mojom::Event::kDocumentTitleChanged:
36 return "documentTitleChanged";
37 case ax::mojom::Event::kEndOfTest:
38 return "endOfTest";
39 case ax::mojom::Event::kExpandedChanged:
40 return "expandedChanged";
41 case ax::mojom::Event::kFocus:
42 return "focus";
43 case ax::mojom::Event::kFocusAfterMenuClose:
44 return "focusAfterMenuClose";
45 case ax::mojom::Event::kFocusContext:
46 return "focusContext";
47 case ax::mojom::Event::kHide:
48 return "hide";
49 case ax::mojom::Event::kHitTestResult:
50 return "hitTestResult";
51 case ax::mojom::Event::kHover:
52 return "hover";
53 case ax::mojom::Event::kImageFrameUpdated:
54 return "imageFrameUpdated";
55 case ax::mojom::Event::kInvalidStatusChanged:
56 return "invalidStatusChanged";
57 case ax::mojom::Event::kLayoutComplete:
58 return "layoutComplete";
59 case ax::mojom::Event::kLiveRegionCreated:
60 return "liveRegionCreated";
61 case ax::mojom::Event::kLiveRegionChanged:
62 return "liveRegionChanged";
63 case ax::mojom::Event::kLoadComplete:
64 return "loadComplete";
65 case ax::mojom::Event::kLoadStart:
66 return "loadStart";
67 case ax::mojom::Event::kLocationChanged:
68 return "locationChanged";
69 case ax::mojom::Event::kMediaStartedPlaying:
70 return "mediaStartedPlaying";
71 case ax::mojom::Event::kMediaStoppedPlaying:
72 return "mediaStoppedPlaying";
73 case ax::mojom::Event::kMenuEnd:
74 return "menuEnd";
75 case ax::mojom::Event::kMenuListItemSelected:
76 return "menuListItemSelected";
77 case ax::mojom::Event::kMenuListValueChanged:
78 return "menuListValueChanged";
79 case ax::mojom::Event::kMenuPopupEnd:
80 return "menuPopupEnd";
81 case ax::mojom::Event::kMenuPopupHide:
82 return "menuPopupHide";
83 case ax::mojom::Event::kMenuPopupStart:
84 return "menuPopupStart";
85 case ax::mojom::Event::kMenuStart:
86 return "menuStart";
87 case ax::mojom::Event::kMouseCanceled:
88 return "mouseCanceled";
89 case ax::mojom::Event::kMouseDragged:
90 return "mouseDragged";
91 case ax::mojom::Event::kMouseMoved:
92 return "mouseMoved";
93 case ax::mojom::Event::kMousePressed:
94 return "mousePressed";
95 case ax::mojom::Event::kMouseReleased:
96 return "mouseReleased";
97 case ax::mojom::Event::kRowCollapsed:
98 return "rowCollapsed";
99 case ax::mojom::Event::kRowCountChanged:
100 return "rowCountChanged";
101 case ax::mojom::Event::kRowExpanded:
102 return "rowExpanded";
103 case ax::mojom::Event::kScrollPositionChanged:
104 return "scrollPositionChanged";
105 case ax::mojom::Event::kScrolledToAnchor:
106 return "scrolledToAnchor";
107 case ax::mojom::Event::kSelectedChildrenChanged:
108 return "selectedChildrenChanged";
109 case ax::mojom::Event::kSelection:
110 return "selection";
111 case ax::mojom::Event::kSelectionAdd:
112 return "selectionAdd";
113 case ax::mojom::Event::kSelectionRemove:
114 return "selectionRemove";
115 case ax::mojom::Event::kShow:
116 return "show";
117 case ax::mojom::Event::kStateChanged:
118 return "stateChanged";
119 case ax::mojom::Event::kTextChanged:
120 return "textChanged";
121 case ax::mojom::Event::kTextSelectionChanged:
122 return "textSelectionChanged";
123 case ax::mojom::Event::kTooltipClosed:
124 return "tooltipClosed";
125 case ax::mojom::Event::kTooltipOpened:
126 return "tooltipOpened";
127 case ax::mojom::Event::kWindowActivated:
128 return "windowActivated";
129 case ax::mojom::Event::kWindowDeactivated:
130 return "windowDeactivated";
131 case ax::mojom::Event::kWindowVisibilityChanged:
132 return "windowVisibilityChanged";
133 case ax::mojom::Event::kTreeChanged:
134 return "treeChanged";
135 case ax::mojom::Event::kValueChanged:
136 return "valueChanged";
137 }
138
139 return "";
140 }
141
ParseEvent(const char * event)142 ax::mojom::Event ParseEvent(const char* event) {
143 if (0 == strcmp(event, "none"))
144 return ax::mojom::Event::kNone;
145 if (0 == strcmp(event, "activedescendantchanged"))
146 return ax::mojom::Event::kActiveDescendantChanged;
147 if (0 == strcmp(event, "alert"))
148 return ax::mojom::Event::kAlert;
149 if (0 == strcmp(event, "ariaAttributeChanged"))
150 return ax::mojom::Event::kAriaAttributeChanged;
151 if (0 == strcmp(event, "autocorrectionOccured"))
152 return ax::mojom::Event::kAutocorrectionOccured;
153 if (0 == strcmp(event, "blur"))
154 return ax::mojom::Event::kBlur;
155 if (0 == strcmp(event, "checkedStateChanged"))
156 return ax::mojom::Event::kCheckedStateChanged;
157 if (0 == strcmp(event, "childrenChanged"))
158 return ax::mojom::Event::kChildrenChanged;
159 if (0 == strcmp(event, "clicked"))
160 return ax::mojom::Event::kClicked;
161 if (0 == strcmp(event, "controlsChanged"))
162 return ax::mojom::Event::kControlsChanged;
163 if (0 == strcmp(event, "documentSelectionChanged"))
164 return ax::mojom::Event::kDocumentSelectionChanged;
165 if (0 == strcmp(event, "documentTitleChanged"))
166 return ax::mojom::Event::kDocumentTitleChanged;
167 if (0 == strcmp(event, "endOfTest"))
168 return ax::mojom::Event::kEndOfTest;
169 if (0 == strcmp(event, "expandedChanged"))
170 return ax::mojom::Event::kExpandedChanged;
171 if (0 == strcmp(event, "focus"))
172 return ax::mojom::Event::kFocus;
173 if (0 == strcmp(event, "focusAfterMenuClose"))
174 return ax::mojom::Event::kFocusAfterMenuClose;
175 if (0 == strcmp(event, "focusContext"))
176 return ax::mojom::Event::kFocusContext;
177 if (0 == strcmp(event, "hide"))
178 return ax::mojom::Event::kHide;
179 if (0 == strcmp(event, "hitTestResult"))
180 return ax::mojom::Event::kHitTestResult;
181 if (0 == strcmp(event, "hover"))
182 return ax::mojom::Event::kHover;
183 if (0 == strcmp(event, "imageFrameUpdated"))
184 return ax::mojom::Event::kImageFrameUpdated;
185 if (0 == strcmp(event, "invalidStatusChanged"))
186 return ax::mojom::Event::kInvalidStatusChanged;
187 if (0 == strcmp(event, "layoutComplete"))
188 return ax::mojom::Event::kLayoutComplete;
189 if (0 == strcmp(event, "liveRegionCreated"))
190 return ax::mojom::Event::kLiveRegionCreated;
191 if (0 == strcmp(event, "liveRegionChanged"))
192 return ax::mojom::Event::kLiveRegionChanged;
193 if (0 == strcmp(event, "loadComplete"))
194 return ax::mojom::Event::kLoadComplete;
195 if (0 == strcmp(event, "loadStart"))
196 return ax::mojom::Event::kLoadStart;
197 if (0 == strcmp(event, "locationChanged"))
198 return ax::mojom::Event::kLocationChanged;
199 if (0 == strcmp(event, "mediaStartedPlaying"))
200 return ax::mojom::Event::kMediaStartedPlaying;
201 if (0 == strcmp(event, "mediaStoppedPlaying"))
202 return ax::mojom::Event::kMediaStoppedPlaying;
203 if (0 == strcmp(event, "menuEnd"))
204 return ax::mojom::Event::kMenuEnd;
205 if (0 == strcmp(event, "menuListItemSelected"))
206 return ax::mojom::Event::kMenuListItemSelected;
207 if (0 == strcmp(event, "menuListValueChanged"))
208 return ax::mojom::Event::kMenuListValueChanged;
209 if (0 == strcmp(event, "menuPopupEnd"))
210 return ax::mojom::Event::kMenuPopupEnd;
211 if (0 == strcmp(event, "menuPopupHide"))
212 return ax::mojom::Event::kMenuPopupHide;
213 if (0 == strcmp(event, "menuPopupStart"))
214 return ax::mojom::Event::kMenuPopupStart;
215 if (0 == strcmp(event, "menuStart"))
216 return ax::mojom::Event::kMenuStart;
217 if (0 == strcmp(event, "mouseCanceled"))
218 return ax::mojom::Event::kMouseCanceled;
219 if (0 == strcmp(event, "mouseDragged"))
220 return ax::mojom::Event::kMouseDragged;
221 if (0 == strcmp(event, "mouseMoved"))
222 return ax::mojom::Event::kMouseMoved;
223 if (0 == strcmp(event, "mousePressed"))
224 return ax::mojom::Event::kMousePressed;
225 if (0 == strcmp(event, "mouseReleased"))
226 return ax::mojom::Event::kMouseReleased;
227 if (0 == strcmp(event, "rowCollapsed"))
228 return ax::mojom::Event::kRowCollapsed;
229 if (0 == strcmp(event, "rowCountChanged"))
230 return ax::mojom::Event::kRowCountChanged;
231 if (0 == strcmp(event, "rowExpanded"))
232 return ax::mojom::Event::kRowExpanded;
233 if (0 == strcmp(event, "scrollPositionChanged"))
234 return ax::mojom::Event::kScrollPositionChanged;
235 if (0 == strcmp(event, "scrolledToAnchor"))
236 return ax::mojom::Event::kScrolledToAnchor;
237 if (0 == strcmp(event, "selectedChildrenChanged"))
238 return ax::mojom::Event::kSelectedChildrenChanged;
239 if (0 == strcmp(event, "selection"))
240 return ax::mojom::Event::kSelection;
241 if (0 == strcmp(event, "selectionAdd"))
242 return ax::mojom::Event::kSelectionAdd;
243 if (0 == strcmp(event, "selectionRemove"))
244 return ax::mojom::Event::kSelectionRemove;
245 if (0 == strcmp(event, "show"))
246 return ax::mojom::Event::kShow;
247 if (0 == strcmp(event, "stateChanged"))
248 return ax::mojom::Event::kStateChanged;
249 if (0 == strcmp(event, "textChanged"))
250 return ax::mojom::Event::kTextChanged;
251 if (0 == strcmp(event, "textSelectionChanged"))
252 return ax::mojom::Event::kTextSelectionChanged;
253 if (0 == strcmp(event, "tooltipClosed"))
254 return ax::mojom::Event::kTooltipClosed;
255 if (0 == strcmp(event, "tooltipOpened"))
256 return ax::mojom::Event::kTooltipOpened;
257 if (0 == strcmp(event, "windowActivated"))
258 return ax::mojom::Event::kWindowActivated;
259 if (0 == strcmp(event, "windowDeactivated"))
260 return ax::mojom::Event::kWindowDeactivated;
261 if (0 == strcmp(event, "windowVisibilityChanged"))
262 return ax::mojom::Event::kWindowVisibilityChanged;
263 if (0 == strcmp(event, "treeChanged"))
264 return ax::mojom::Event::kTreeChanged;
265 if (0 == strcmp(event, "valueChanged"))
266 return ax::mojom::Event::kValueChanged;
267 return ax::mojom::Event::kNone;
268 }
269
ToString(ax::mojom::Role role)270 const char* ToString(ax::mojom::Role role) {
271 switch (role) {
272 case ax::mojom::Role::kNone:
273 return "none";
274 case ax::mojom::Role::kAbbr:
275 return "abbr";
276 case ax::mojom::Role::kAlertDialog:
277 return "alertDialog";
278 case ax::mojom::Role::kAlert:
279 return "alert";
280 case ax::mojom::Role::kAnchor:
281 return "anchor";
282 case ax::mojom::Role::kApplication:
283 return "application";
284 case ax::mojom::Role::kArticle:
285 return "article";
286 case ax::mojom::Role::kAudio:
287 return "audio";
288 case ax::mojom::Role::kBanner:
289 return "banner";
290 case ax::mojom::Role::kBlockquote:
291 return "blockquote";
292 case ax::mojom::Role::kButton:
293 return "button";
294 case ax::mojom::Role::kCanvas:
295 return "canvas";
296 case ax::mojom::Role::kCaption:
297 return "caption";
298 case ax::mojom::Role::kCaret:
299 return "caret";
300 case ax::mojom::Role::kCell:
301 return "cell";
302 case ax::mojom::Role::kCheckBox:
303 return "checkBox";
304 case ax::mojom::Role::kClient:
305 return "client";
306 case ax::mojom::Role::kCode:
307 return "code";
308 case ax::mojom::Role::kColorWell:
309 return "colorWell";
310 case ax::mojom::Role::kColumnHeader:
311 return "columnHeader";
312 case ax::mojom::Role::kColumn:
313 return "column";
314 case ax::mojom::Role::kComboBoxGrouping:
315 return "comboBoxGrouping";
316 case ax::mojom::Role::kComboBoxMenuButton:
317 return "comboBoxMenuButton";
318 case ax::mojom::Role::kComment:
319 return "comment";
320 case ax::mojom::Role::kComplementary:
321 return "complementary";
322 case ax::mojom::Role::kContentDeletion:
323 return "contentDeletion";
324 case ax::mojom::Role::kContentInsertion:
325 return "contentInsertion";
326 case ax::mojom::Role::kContentInfo:
327 return "contentInfo";
328 case ax::mojom::Role::kDate:
329 return "date";
330 case ax::mojom::Role::kDateTime:
331 return "dateTime";
332 case ax::mojom::Role::kDefinition:
333 return "definition";
334 case ax::mojom::Role::kDescriptionListDetail:
335 return "descriptionListDetail";
336 case ax::mojom::Role::kDescriptionList:
337 return "descriptionList";
338 case ax::mojom::Role::kDescriptionListTerm:
339 return "descriptionListTerm";
340 case ax::mojom::Role::kDesktop:
341 return "desktop";
342 case ax::mojom::Role::kDetails:
343 return "details";
344 case ax::mojom::Role::kDialog:
345 return "dialog";
346 case ax::mojom::Role::kDirectory:
347 return "directory";
348 case ax::mojom::Role::kDisclosureTriangle:
349 return "disclosureTriangle";
350 case ax::mojom::Role::kDocAbstract:
351 return "docAbstract";
352 case ax::mojom::Role::kDocAcknowledgments:
353 return "docAcknowledgments";
354 case ax::mojom::Role::kDocAfterword:
355 return "docAfterword";
356 case ax::mojom::Role::kDocAppendix:
357 return "docAppendix";
358 case ax::mojom::Role::kDocBackLink:
359 return "docBackLink";
360 case ax::mojom::Role::kDocBiblioEntry:
361 return "docBiblioEntry";
362 case ax::mojom::Role::kDocBibliography:
363 return "docBibliography";
364 case ax::mojom::Role::kDocBiblioRef:
365 return "docBiblioRef";
366 case ax::mojom::Role::kDocChapter:
367 return "docChapter";
368 case ax::mojom::Role::kDocColophon:
369 return "docColophon";
370 case ax::mojom::Role::kDocConclusion:
371 return "docConclusion";
372 case ax::mojom::Role::kDocCover:
373 return "docCover";
374 case ax::mojom::Role::kDocCredit:
375 return "docCredit";
376 case ax::mojom::Role::kDocCredits:
377 return "docCredits";
378 case ax::mojom::Role::kDocDedication:
379 return "docDedication";
380 case ax::mojom::Role::kDocEndnote:
381 return "docEndnote";
382 case ax::mojom::Role::kDocEndnotes:
383 return "docEndnotes";
384 case ax::mojom::Role::kDocEpigraph:
385 return "docEpigraph";
386 case ax::mojom::Role::kDocEpilogue:
387 return "docEpilogue";
388 case ax::mojom::Role::kDocErrata:
389 return "docErrata";
390 case ax::mojom::Role::kDocExample:
391 return "docExample";
392 case ax::mojom::Role::kDocFootnote:
393 return "docFootnote";
394 case ax::mojom::Role::kDocForeword:
395 return "docForeword";
396 case ax::mojom::Role::kDocGlossary:
397 return "docGlossary";
398 case ax::mojom::Role::kDocGlossRef:
399 return "docGlossref";
400 case ax::mojom::Role::kDocIndex:
401 return "docIndex";
402 case ax::mojom::Role::kDocIntroduction:
403 return "docIntroduction";
404 case ax::mojom::Role::kDocNoteRef:
405 return "docNoteRef";
406 case ax::mojom::Role::kDocNotice:
407 return "docNotice";
408 case ax::mojom::Role::kDocPageBreak:
409 return "docPageBreak";
410 case ax::mojom::Role::kDocPageList:
411 return "docPageList";
412 case ax::mojom::Role::kDocPart:
413 return "docPart";
414 case ax::mojom::Role::kDocPreface:
415 return "docPreface";
416 case ax::mojom::Role::kDocPrologue:
417 return "docPrologue";
418 case ax::mojom::Role::kDocPullquote:
419 return "docPullquote";
420 case ax::mojom::Role::kDocQna:
421 return "docQna";
422 case ax::mojom::Role::kDocSubtitle:
423 return "docSubtitle";
424 case ax::mojom::Role::kDocTip:
425 return "docTip";
426 case ax::mojom::Role::kDocToc:
427 return "docToc";
428 case ax::mojom::Role::kDocument:
429 return "document";
430 case ax::mojom::Role::kEmbeddedObject:
431 return "embeddedObject";
432 case ax::mojom::Role::kEmphasis:
433 return "emphasis";
434 case ax::mojom::Role::kFeed:
435 return "feed";
436 case ax::mojom::Role::kFigcaption:
437 return "figcaption";
438 case ax::mojom::Role::kFigure:
439 return "figure";
440 case ax::mojom::Role::kFooter:
441 return "footer";
442 case ax::mojom::Role::kFooterAsNonLandmark:
443 return "footerAsNonLandmark";
444 case ax::mojom::Role::kForm:
445 return "form";
446 case ax::mojom::Role::kGenericContainer:
447 return "genericContainer";
448 case ax::mojom::Role::kGraphicsDocument:
449 return "graphicsDocument";
450 case ax::mojom::Role::kGraphicsObject:
451 return "graphicsObject";
452 case ax::mojom::Role::kGraphicsSymbol:
453 return "graphicsSymbol";
454 case ax::mojom::Role::kGrid:
455 return "grid";
456 case ax::mojom::Role::kGroup:
457 return "group";
458 case ax::mojom::Role::kHeader:
459 return "header";
460 case ax::mojom::Role::kHeaderAsNonLandmark:
461 return "headerAsNonLandmark";
462 case ax::mojom::Role::kHeading:
463 return "heading";
464 case ax::mojom::Role::kIframe:
465 return "iframe";
466 case ax::mojom::Role::kIframePresentational:
467 return "iframePresentational";
468 case ax::mojom::Role::kIgnored:
469 return "ignored";
470 case ax::mojom::Role::kImageMap:
471 return "imageMap";
472 case ax::mojom::Role::kImage:
473 return "image";
474 case ax::mojom::Role::kInlineTextBox:
475 return "inlineTextBox";
476 case ax::mojom::Role::kInputTime:
477 return "inputTime";
478 case ax::mojom::Role::kKeyboard:
479 return "keyboard";
480 case ax::mojom::Role::kLabelText:
481 return "labelText";
482 case ax::mojom::Role::kLayoutTable:
483 return "layoutTable";
484 case ax::mojom::Role::kLayoutTableCell:
485 return "layoutTableCell";
486 case ax::mojom::Role::kLayoutTableRow:
487 return "layoutTableRow";
488 case ax::mojom::Role::kLegend:
489 return "legend";
490 case ax::mojom::Role::kLineBreak:
491 return "lineBreak";
492 case ax::mojom::Role::kLink:
493 return "link";
494 case ax::mojom::Role::kList:
495 return "list";
496 case ax::mojom::Role::kListBoxOption:
497 return "listBoxOption";
498 case ax::mojom::Role::kListBox:
499 return "listBox";
500 case ax::mojom::Role::kListGrid:
501 return "listGrid";
502 case ax::mojom::Role::kListItem:
503 return "listItem";
504 case ax::mojom::Role::kListMarker:
505 return "listMarker";
506 case ax::mojom::Role::kLog:
507 return "log";
508 case ax::mojom::Role::kMain:
509 return "main";
510 case ax::mojom::Role::kMark:
511 return "mark";
512 case ax::mojom::Role::kMarquee:
513 return "marquee";
514 case ax::mojom::Role::kMath:
515 return "math";
516 case ax::mojom::Role::kMenu:
517 return "menu";
518 case ax::mojom::Role::kMenuBar:
519 return "menuBar";
520 case ax::mojom::Role::kMenuButton:
521 return "menuButton";
522 case ax::mojom::Role::kMenuItem:
523 return "menuItem";
524 case ax::mojom::Role::kMenuItemCheckBox:
525 return "menuItemCheckBox";
526 case ax::mojom::Role::kMenuItemRadio:
527 return "menuItemRadio";
528 case ax::mojom::Role::kMenuListOption:
529 return "menuListOption";
530 case ax::mojom::Role::kMenuListPopup:
531 return "menuListPopup";
532 case ax::mojom::Role::kMeter:
533 return "meter";
534 case ax::mojom::Role::kNavigation:
535 return "navigation";
536 case ax::mojom::Role::kNote:
537 return "note";
538 case ax::mojom::Role::kPane:
539 return "pane";
540 case ax::mojom::Role::kParagraph:
541 return "paragraph";
542 case ax::mojom::Role::kPdfActionableHighlight:
543 return "pdfActionableHighlight";
544 case ax::mojom::Role::kPluginObject:
545 return "pluginObject";
546 case ax::mojom::Role::kPopUpButton:
547 return "popUpButton";
548 case ax::mojom::Role::kPortal:
549 return "portal";
550 case ax::mojom::Role::kPre:
551 return "pre";
552 case ax::mojom::Role::kPresentational:
553 return "presentational";
554 case ax::mojom::Role::kProgressIndicator:
555 return "progressIndicator";
556 case ax::mojom::Role::kRadioButton:
557 return "radioButton";
558 case ax::mojom::Role::kRadioGroup:
559 return "radioGroup";
560 case ax::mojom::Role::kRegion:
561 return "region";
562 case ax::mojom::Role::kRootWebArea:
563 return "rootWebArea";
564 case ax::mojom::Role::kRow:
565 return "row";
566 case ax::mojom::Role::kRowGroup:
567 return "rowGroup";
568 case ax::mojom::Role::kRowHeader:
569 return "rowHeader";
570 case ax::mojom::Role::kRuby:
571 return "ruby";
572 case ax::mojom::Role::kRubyAnnotation:
573 return "rubyAnnotation";
574 case ax::mojom::Role::kSection:
575 return "section";
576 case ax::mojom::Role::kStrong:
577 return "strong";
578 case ax::mojom::Role::kSuggestion:
579 return "suggestion";
580 case ax::mojom::Role::kSvgRoot:
581 return "svgRoot";
582 case ax::mojom::Role::kScrollBar:
583 return "scrollBar";
584 case ax::mojom::Role::kScrollView:
585 return "scrollView";
586 case ax::mojom::Role::kSearch:
587 return "search";
588 case ax::mojom::Role::kSearchBox:
589 return "searchBox";
590 case ax::mojom::Role::kSlider:
591 return "slider";
592 case ax::mojom::Role::kSliderThumb:
593 return "sliderThumb";
594 case ax::mojom::Role::kSpinButton:
595 return "spinButton";
596 case ax::mojom::Role::kSplitter:
597 return "splitter";
598 case ax::mojom::Role::kStaticText:
599 return "staticText";
600 case ax::mojom::Role::kStatus:
601 return "status";
602 case ax::mojom::Role::kSwitch:
603 return "switch";
604 case ax::mojom::Role::kTabList:
605 return "tabList";
606 case ax::mojom::Role::kTabPanel:
607 return "tabPanel";
608 case ax::mojom::Role::kTab:
609 return "tab";
610 case ax::mojom::Role::kTable:
611 return "table";
612 case ax::mojom::Role::kTableHeaderContainer:
613 return "tableHeaderContainer";
614 case ax::mojom::Role::kTerm:
615 return "term";
616 case ax::mojom::Role::kTextField:
617 return "textField";
618 case ax::mojom::Role::kTextFieldWithComboBox:
619 return "textFieldWithComboBox";
620 case ax::mojom::Role::kTime:
621 return "time";
622 case ax::mojom::Role::kTimer:
623 return "timer";
624 case ax::mojom::Role::kTitleBar:
625 return "titleBar";
626 case ax::mojom::Role::kToggleButton:
627 return "toggleButton";
628 case ax::mojom::Role::kToolbar:
629 return "toolbar";
630 case ax::mojom::Role::kTreeGrid:
631 return "treeGrid";
632 case ax::mojom::Role::kTreeItem:
633 return "treeItem";
634 case ax::mojom::Role::kTree:
635 return "tree";
636 case ax::mojom::Role::kUnknown:
637 return "unknown";
638 case ax::mojom::Role::kTooltip:
639 return "tooltip";
640 case ax::mojom::Role::kVideo:
641 return "video";
642 case ax::mojom::Role::kWebArea:
643 return "webArea";
644 case ax::mojom::Role::kWebView:
645 return "webView";
646 case ax::mojom::Role::kWindow:
647 return "window";
648 }
649
650 return "";
651 }
652
ParseRole(const char * role)653 ax::mojom::Role ParseRole(const char* role) {
654 if (0 == strcmp(role, "none"))
655 return ax::mojom::Role::kNone;
656 if (0 == strcmp(role, "abbr"))
657 return ax::mojom::Role::kAbbr;
658 if (0 == strcmp(role, "alertDialog"))
659 return ax::mojom::Role::kAlertDialog;
660 if (0 == strcmp(role, "alert"))
661 return ax::mojom::Role::kAlert;
662 if (0 == strcmp(role, "anchor"))
663 return ax::mojom::Role::kAnchor;
664 if (0 == strcmp(role, "application"))
665 return ax::mojom::Role::kApplication;
666 if (0 == strcmp(role, "article"))
667 return ax::mojom::Role::kArticle;
668 if (0 == strcmp(role, "audio"))
669 return ax::mojom::Role::kAudio;
670 if (0 == strcmp(role, "banner"))
671 return ax::mojom::Role::kBanner;
672 if (0 == strcmp(role, "blockquote"))
673 return ax::mojom::Role::kBlockquote;
674 if (0 == strcmp(role, "button"))
675 return ax::mojom::Role::kButton;
676 if (0 == strcmp(role, "canvas"))
677 return ax::mojom::Role::kCanvas;
678 if (0 == strcmp(role, "caption"))
679 return ax::mojom::Role::kCaption;
680 if (0 == strcmp(role, "caret"))
681 return ax::mojom::Role::kCaret;
682 if (0 == strcmp(role, "cell"))
683 return ax::mojom::Role::kCell;
684 if (0 == strcmp(role, "checkBox"))
685 return ax::mojom::Role::kCheckBox;
686 if (0 == strcmp(role, "client"))
687 return ax::mojom::Role::kClient;
688 if (0 == strcmp(role, "code"))
689 return ax::mojom::Role::kCode;
690 if (0 == strcmp(role, "colorWell"))
691 return ax::mojom::Role::kColorWell;
692 if (0 == strcmp(role, "columnHeader"))
693 return ax::mojom::Role::kColumnHeader;
694 if (0 == strcmp(role, "column"))
695 return ax::mojom::Role::kColumn;
696 if (0 == strcmp(role, "comboBoxGrouping"))
697 return ax::mojom::Role::kComboBoxGrouping;
698 if (0 == strcmp(role, "comboBoxMenuButton"))
699 return ax::mojom::Role::kComboBoxMenuButton;
700 if (0 == strcmp(role, "comment"))
701 return ax::mojom::Role::kComment;
702 if (0 == strcmp(role, "complementary"))
703 return ax::mojom::Role::kComplementary;
704 if (0 == strcmp(role, "contentDeletion"))
705 return ax::mojom::Role::kContentDeletion;
706 if (0 == strcmp(role, "contentInsertion"))
707 return ax::mojom::Role::kContentInsertion;
708 if (0 == strcmp(role, "contentInfo"))
709 return ax::mojom::Role::kContentInfo;
710 if (0 == strcmp(role, "date"))
711 return ax::mojom::Role::kDate;
712 if (0 == strcmp(role, "dateTime"))
713 return ax::mojom::Role::kDateTime;
714 if (0 == strcmp(role, "definition"))
715 return ax::mojom::Role::kDefinition;
716 if (0 == strcmp(role, "descriptionListDetail"))
717 return ax::mojom::Role::kDescriptionListDetail;
718 if (0 == strcmp(role, "descriptionList"))
719 return ax::mojom::Role::kDescriptionList;
720 if (0 == strcmp(role, "descriptionListTerm"))
721 return ax::mojom::Role::kDescriptionListTerm;
722 if (0 == strcmp(role, "desktop"))
723 return ax::mojom::Role::kDesktop;
724 if (0 == strcmp(role, "details"))
725 return ax::mojom::Role::kDetails;
726 if (0 == strcmp(role, "dialog"))
727 return ax::mojom::Role::kDialog;
728 if (0 == strcmp(role, "directory"))
729 return ax::mojom::Role::kDirectory;
730 if (0 == strcmp(role, "disclosureTriangle"))
731 return ax::mojom::Role::kDisclosureTriangle;
732 if (0 == strcmp(role, "docAbstract"))
733 return ax::mojom::Role::kDocAbstract;
734 if (0 == strcmp(role, "docAcknowledgments"))
735 return ax::mojom::Role::kDocAcknowledgments;
736 if (0 == strcmp(role, "docAfterword"))
737 return ax::mojom::Role::kDocAfterword;
738 if (0 == strcmp(role, "docAppendix"))
739 return ax::mojom::Role::kDocAppendix;
740 if (0 == strcmp(role, "docBackLink"))
741 return ax::mojom::Role::kDocBackLink;
742 if (0 == strcmp(role, "docBiblioEntry"))
743 return ax::mojom::Role::kDocBiblioEntry;
744 if (0 == strcmp(role, "docBibliography"))
745 return ax::mojom::Role::kDocBibliography;
746 if (0 == strcmp(role, "docBiblioRef"))
747 return ax::mojom::Role::kDocBiblioRef;
748 if (0 == strcmp(role, "docChapter"))
749 return ax::mojom::Role::kDocChapter;
750 if (0 == strcmp(role, "docColophon"))
751 return ax::mojom::Role::kDocColophon;
752 if (0 == strcmp(role, "docConclusion"))
753 return ax::mojom::Role::kDocConclusion;
754 if (0 == strcmp(role, "docCover"))
755 return ax::mojom::Role::kDocCover;
756 if (0 == strcmp(role, "docCredit"))
757 return ax::mojom::Role::kDocCredit;
758 if (0 == strcmp(role, "docCredits"))
759 return ax::mojom::Role::kDocCredits;
760 if (0 == strcmp(role, "docDedication"))
761 return ax::mojom::Role::kDocDedication;
762 if (0 == strcmp(role, "docEndnote"))
763 return ax::mojom::Role::kDocEndnote;
764 if (0 == strcmp(role, "docEndnotes"))
765 return ax::mojom::Role::kDocEndnotes;
766 if (0 == strcmp(role, "docEpigraph"))
767 return ax::mojom::Role::kDocEpigraph;
768 if (0 == strcmp(role, "docEpilogue"))
769 return ax::mojom::Role::kDocEpilogue;
770 if (0 == strcmp(role, "docErrata"))
771 return ax::mojom::Role::kDocErrata;
772 if (0 == strcmp(role, "docExample"))
773 return ax::mojom::Role::kDocExample;
774 if (0 == strcmp(role, "docFootnote"))
775 return ax::mojom::Role::kDocFootnote;
776 if (0 == strcmp(role, "docForeword"))
777 return ax::mojom::Role::kDocForeword;
778 if (0 == strcmp(role, "docGlossary"))
779 return ax::mojom::Role::kDocGlossary;
780 if (0 == strcmp(role, "docGlossref"))
781 return ax::mojom::Role::kDocGlossRef;
782 if (0 == strcmp(role, "docIndex"))
783 return ax::mojom::Role::kDocIndex;
784 if (0 == strcmp(role, "docIntroduction"))
785 return ax::mojom::Role::kDocIntroduction;
786 if (0 == strcmp(role, "docNoteRef"))
787 return ax::mojom::Role::kDocNoteRef;
788 if (0 == strcmp(role, "docNotice"))
789 return ax::mojom::Role::kDocNotice;
790 if (0 == strcmp(role, "docPageBreak"))
791 return ax::mojom::Role::kDocPageBreak;
792 if (0 == strcmp(role, "docPageList"))
793 return ax::mojom::Role::kDocPageList;
794 if (0 == strcmp(role, "docPart"))
795 return ax::mojom::Role::kDocPart;
796 if (0 == strcmp(role, "docPreface"))
797 return ax::mojom::Role::kDocPreface;
798 if (0 == strcmp(role, "docPrologue"))
799 return ax::mojom::Role::kDocPrologue;
800 if (0 == strcmp(role, "docPullquote"))
801 return ax::mojom::Role::kDocPullquote;
802 if (0 == strcmp(role, "docQna"))
803 return ax::mojom::Role::kDocQna;
804 if (0 == strcmp(role, "docSubtitle"))
805 return ax::mojom::Role::kDocSubtitle;
806 if (0 == strcmp(role, "docTip"))
807 return ax::mojom::Role::kDocTip;
808 if (0 == strcmp(role, "docToc"))
809 return ax::mojom::Role::kDocToc;
810 if (0 == strcmp(role, "document"))
811 return ax::mojom::Role::kDocument;
812 if (0 == strcmp(role, "embeddedObject"))
813 return ax::mojom::Role::kEmbeddedObject;
814 if (0 == strcmp(role, "emphasis"))
815 return ax::mojom::Role::kEmphasis;
816 if (0 == strcmp(role, "feed"))
817 return ax::mojom::Role::kFeed;
818 if (0 == strcmp(role, "figcaption"))
819 return ax::mojom::Role::kFigcaption;
820 if (0 == strcmp(role, "figure"))
821 return ax::mojom::Role::kFigure;
822 if (0 == strcmp(role, "footer"))
823 return ax::mojom::Role::kFooter;
824 if (0 == strcmp(role, "footerAsNonLandmark"))
825 return ax::mojom::Role::kFooterAsNonLandmark;
826 if (0 == strcmp(role, "form"))
827 return ax::mojom::Role::kForm;
828 if (0 == strcmp(role, "genericContainer"))
829 return ax::mojom::Role::kGenericContainer;
830 if (0 == strcmp(role, "graphicsDocument"))
831 return ax::mojom::Role::kGraphicsDocument;
832 if (0 == strcmp(role, "graphicsObject"))
833 return ax::mojom::Role::kGraphicsObject;
834 if (0 == strcmp(role, "graphicsSymbol"))
835 return ax::mojom::Role::kGraphicsSymbol;
836 if (0 == strcmp(role, "grid"))
837 return ax::mojom::Role::kGrid;
838 if (0 == strcmp(role, "group"))
839 return ax::mojom::Role::kGroup;
840 if (0 == strcmp(role, "heading"))
841 return ax::mojom::Role::kHeading;
842 if (0 == strcmp(role, "header"))
843 return ax::mojom::Role::kHeader;
844 if (0 == strcmp(role, "headerAsNonLandmark"))
845 return ax::mojom::Role::kHeaderAsNonLandmark;
846 if (0 == strcmp(role, "pdfActionableHighlight"))
847 return ax::mojom::Role::kPdfActionableHighlight;
848 if (0 == strcmp(role, "iframe"))
849 return ax::mojom::Role::kIframe;
850 if (0 == strcmp(role, "iframePresentational"))
851 return ax::mojom::Role::kIframePresentational;
852 if (0 == strcmp(role, "ignored"))
853 return ax::mojom::Role::kIgnored;
854 if (0 == strcmp(role, "imageMap"))
855 return ax::mojom::Role::kImageMap;
856 if (0 == strcmp(role, "image"))
857 return ax::mojom::Role::kImage;
858 if (0 == strcmp(role, "inlineTextBox"))
859 return ax::mojom::Role::kInlineTextBox;
860 if (0 == strcmp(role, "inputTime"))
861 return ax::mojom::Role::kInputTime;
862 if (0 == strcmp(role, "keyboard"))
863 return ax::mojom::Role::kKeyboard;
864 if (0 == strcmp(role, "labelText"))
865 return ax::mojom::Role::kLabelText;
866 if (0 == strcmp(role, "layoutTable"))
867 return ax::mojom::Role::kLayoutTable;
868 if (0 == strcmp(role, "layoutTableCell"))
869 return ax::mojom::Role::kLayoutTableCell;
870 if (0 == strcmp(role, "layoutTableRow"))
871 return ax::mojom::Role::kLayoutTableRow;
872 if (0 == strcmp(role, "legend"))
873 return ax::mojom::Role::kLegend;
874 if (0 == strcmp(role, "lineBreak"))
875 return ax::mojom::Role::kLineBreak;
876 if (0 == strcmp(role, "link"))
877 return ax::mojom::Role::kLink;
878 if (0 == strcmp(role, "listBoxOption"))
879 return ax::mojom::Role::kListBoxOption;
880 if (0 == strcmp(role, "listBox"))
881 return ax::mojom::Role::kListBox;
882 if (0 == strcmp(role, "listGrid"))
883 return ax::mojom::Role::kListGrid;
884 if (0 == strcmp(role, "listItem"))
885 return ax::mojom::Role::kListItem;
886 if (0 == strcmp(role, "listMarker"))
887 return ax::mojom::Role::kListMarker;
888 if (0 == strcmp(role, "list"))
889 return ax::mojom::Role::kList;
890 if (0 == strcmp(role, "log"))
891 return ax::mojom::Role::kLog;
892 if (0 == strcmp(role, "main"))
893 return ax::mojom::Role::kMain;
894 if (0 == strcmp(role, "mark"))
895 return ax::mojom::Role::kMark;
896 if (0 == strcmp(role, "marquee"))
897 return ax::mojom::Role::kMarquee;
898 if (0 == strcmp(role, "math"))
899 return ax::mojom::Role::kMath;
900 if (0 == strcmp(role, "menu"))
901 return ax::mojom::Role::kMenu;
902 if (0 == strcmp(role, "menuBar"))
903 return ax::mojom::Role::kMenuBar;
904 if (0 == strcmp(role, "menuButton"))
905 return ax::mojom::Role::kMenuButton;
906 if (0 == strcmp(role, "menuItem"))
907 return ax::mojom::Role::kMenuItem;
908 if (0 == strcmp(role, "menuItemCheckBox"))
909 return ax::mojom::Role::kMenuItemCheckBox;
910 if (0 == strcmp(role, "menuItemRadio"))
911 return ax::mojom::Role::kMenuItemRadio;
912 if (0 == strcmp(role, "menuListOption"))
913 return ax::mojom::Role::kMenuListOption;
914 if (0 == strcmp(role, "menuListPopup"))
915 return ax::mojom::Role::kMenuListPopup;
916 if (0 == strcmp(role, "meter"))
917 return ax::mojom::Role::kMeter;
918 if (0 == strcmp(role, "navigation"))
919 return ax::mojom::Role::kNavigation;
920 if (0 == strcmp(role, "note"))
921 return ax::mojom::Role::kNote;
922 if (0 == strcmp(role, "pane"))
923 return ax::mojom::Role::kPane;
924 if (0 == strcmp(role, "paragraph"))
925 return ax::mojom::Role::kParagraph;
926 if (0 == strcmp(role, "pluginObject"))
927 return ax::mojom::Role::kPluginObject;
928 if (0 == strcmp(role, "popUpButton"))
929 return ax::mojom::Role::kPopUpButton;
930 if (0 == strcmp(role, "portal"))
931 return ax::mojom::Role::kPortal;
932 if (0 == strcmp(role, "pre"))
933 return ax::mojom::Role::kPre;
934 if (0 == strcmp(role, "presentational"))
935 return ax::mojom::Role::kPresentational;
936 if (0 == strcmp(role, "progressIndicator"))
937 return ax::mojom::Role::kProgressIndicator;
938 if (0 == strcmp(role, "radioButton"))
939 return ax::mojom::Role::kRadioButton;
940 if (0 == strcmp(role, "radioGroup"))
941 return ax::mojom::Role::kRadioGroup;
942 if (0 == strcmp(role, "region"))
943 return ax::mojom::Role::kRegion;
944 if (0 == strcmp(role, "rootWebArea"))
945 return ax::mojom::Role::kRootWebArea;
946 if (0 == strcmp(role, "row"))
947 return ax::mojom::Role::kRow;
948 if (0 == strcmp(role, "rowGroup"))
949 return ax::mojom::Role::kRowGroup;
950 if (0 == strcmp(role, "rowHeader"))
951 return ax::mojom::Role::kRowHeader;
952 if (0 == strcmp(role, "ruby"))
953 return ax::mojom::Role::kRuby;
954 if (0 == strcmp(role, "rubyAnnotation"))
955 return ax::mojom::Role::kRubyAnnotation;
956 if (0 == strcmp(role, "section"))
957 return ax::mojom::Role::kSection;
958 if (0 == strcmp(role, "scrollBar"))
959 return ax::mojom::Role::kScrollBar;
960 if (0 == strcmp(role, "scrollView"))
961 return ax::mojom::Role::kScrollView;
962 if (0 == strcmp(role, "search"))
963 return ax::mojom::Role::kSearch;
964 if (0 == strcmp(role, "searchBox"))
965 return ax::mojom::Role::kSearchBox;
966 if (0 == strcmp(role, "slider"))
967 return ax::mojom::Role::kSlider;
968 if (0 == strcmp(role, "sliderThumb"))
969 return ax::mojom::Role::kSliderThumb;
970 if (0 == strcmp(role, "spinButton"))
971 return ax::mojom::Role::kSpinButton;
972 if (0 == strcmp(role, "splitter"))
973 return ax::mojom::Role::kSplitter;
974 if (0 == strcmp(role, "staticText"))
975 return ax::mojom::Role::kStaticText;
976 if (0 == strcmp(role, "status"))
977 return ax::mojom::Role::kStatus;
978 if (0 == strcmp(role, "suggestion"))
979 return ax::mojom::Role::kSuggestion;
980 if (0 == strcmp(role, "svgRoot"))
981 return ax::mojom::Role::kSvgRoot;
982 if (0 == strcmp(role, "switch"))
983 return ax::mojom::Role::kSwitch;
984 if (0 == strcmp(role, "strong"))
985 return ax::mojom::Role::kStrong;
986 if (0 == strcmp(role, "tabList"))
987 return ax::mojom::Role::kTabList;
988 if (0 == strcmp(role, "tabPanel"))
989 return ax::mojom::Role::kTabPanel;
990 if (0 == strcmp(role, "tab"))
991 return ax::mojom::Role::kTab;
992 if (0 == strcmp(role, "tableHeaderContainer"))
993 return ax::mojom::Role::kTableHeaderContainer;
994 if (0 == strcmp(role, "table"))
995 return ax::mojom::Role::kTable;
996 if (0 == strcmp(role, "term"))
997 return ax::mojom::Role::kTerm;
998 if (0 == strcmp(role, "textField"))
999 return ax::mojom::Role::kTextField;
1000 if (0 == strcmp(role, "textFieldWithComboBox"))
1001 return ax::mojom::Role::kTextFieldWithComboBox;
1002 if (0 == strcmp(role, "time"))
1003 return ax::mojom::Role::kTime;
1004 if (0 == strcmp(role, "timer"))
1005 return ax::mojom::Role::kTimer;
1006 if (0 == strcmp(role, "titleBar"))
1007 return ax::mojom::Role::kTitleBar;
1008 if (0 == strcmp(role, "toggleButton"))
1009 return ax::mojom::Role::kToggleButton;
1010 if (0 == strcmp(role, "toolbar"))
1011 return ax::mojom::Role::kToolbar;
1012 if (0 == strcmp(role, "treeGrid"))
1013 return ax::mojom::Role::kTreeGrid;
1014 if (0 == strcmp(role, "treeItem"))
1015 return ax::mojom::Role::kTreeItem;
1016 if (0 == strcmp(role, "tree"))
1017 return ax::mojom::Role::kTree;
1018 if (0 == strcmp(role, "unknown"))
1019 return ax::mojom::Role::kUnknown;
1020 if (0 == strcmp(role, "tooltip"))
1021 return ax::mojom::Role::kTooltip;
1022 if (0 == strcmp(role, "video"))
1023 return ax::mojom::Role::kVideo;
1024 if (0 == strcmp(role, "webArea"))
1025 return ax::mojom::Role::kWebArea;
1026 if (0 == strcmp(role, "webView"))
1027 return ax::mojom::Role::kWebView;
1028 if (0 == strcmp(role, "window"))
1029 return ax::mojom::Role::kWindow;
1030 return ax::mojom::Role::kNone;
1031 }
1032
ToString(ax::mojom::State state)1033 const char* ToString(ax::mojom::State state) {
1034 switch (state) {
1035 case ax::mojom::State::kNone:
1036 return "none";
1037 case ax::mojom::State::kAutofillAvailable:
1038 return "autofillAvailable";
1039 case ax::mojom::State::kCollapsed:
1040 return "collapsed";
1041 case ax::mojom::State::kDefault:
1042 return "default";
1043 case ax::mojom::State::kEditable:
1044 return "editable";
1045 case ax::mojom::State::kExpanded:
1046 return "expanded";
1047 case ax::mojom::State::kFocusable:
1048 return "focusable";
1049 case ax::mojom::State::kHorizontal:
1050 return "horizontal";
1051 case ax::mojom::State::kHovered:
1052 return "hovered";
1053 case ax::mojom::State::kIgnored:
1054 return "ignored";
1055 case ax::mojom::State::kInvisible:
1056 return "invisible";
1057 case ax::mojom::State::kLinked:
1058 return "linked";
1059 case ax::mojom::State::kMultiline:
1060 return "multiline";
1061 case ax::mojom::State::kMultiselectable:
1062 return "multiselectable";
1063 case ax::mojom::State::kProtected:
1064 return "protected";
1065 case ax::mojom::State::kRequired:
1066 return "required";
1067 case ax::mojom::State::kRichlyEditable:
1068 return "richlyEditable";
1069 case ax::mojom::State::kVertical:
1070 return "vertical";
1071 case ax::mojom::State::kVisited:
1072 return "visited";
1073 }
1074
1075 return "";
1076 }
1077
ParseState(const char * state)1078 ax::mojom::State ParseState(const char* state) {
1079 if (0 == strcmp(state, "none"))
1080 return ax::mojom::State::kNone;
1081 if (0 == strcmp(state, "autofillAvailable"))
1082 return ax::mojom::State::kAutofillAvailable;
1083 if (0 == strcmp(state, "collapsed"))
1084 return ax::mojom::State::kCollapsed;
1085 if (0 == strcmp(state, "default"))
1086 return ax::mojom::State::kDefault;
1087 if (0 == strcmp(state, "editable"))
1088 return ax::mojom::State::kEditable;
1089 if (0 == strcmp(state, "expanded"))
1090 return ax::mojom::State::kExpanded;
1091 if (0 == strcmp(state, "focusable"))
1092 return ax::mojom::State::kFocusable;
1093 if (0 == strcmp(state, "horizontal"))
1094 return ax::mojom::State::kHorizontal;
1095 if (0 == strcmp(state, "hovered"))
1096 return ax::mojom::State::kHovered;
1097 if (0 == strcmp(state, "ignored"))
1098 return ax::mojom::State::kIgnored;
1099 if (0 == strcmp(state, "invisible"))
1100 return ax::mojom::State::kInvisible;
1101 if (0 == strcmp(state, "linked"))
1102 return ax::mojom::State::kLinked;
1103 if (0 == strcmp(state, "multiline"))
1104 return ax::mojom::State::kMultiline;
1105 if (0 == strcmp(state, "multiselectable"))
1106 return ax::mojom::State::kMultiselectable;
1107 if (0 == strcmp(state, "protected"))
1108 return ax::mojom::State::kProtected;
1109 if (0 == strcmp(state, "required"))
1110 return ax::mojom::State::kRequired;
1111 if (0 == strcmp(state, "richlyEditable"))
1112 return ax::mojom::State::kRichlyEditable;
1113 if (0 == strcmp(state, "vertical"))
1114 return ax::mojom::State::kVertical;
1115 if (0 == strcmp(state, "visited"))
1116 return ax::mojom::State::kVisited;
1117 return ax::mojom::State::kNone;
1118 }
1119
ToString(ax::mojom::Action action)1120 const char* ToString(ax::mojom::Action action) {
1121 switch (action) {
1122 case ax::mojom::Action::kNone:
1123 return "none";
1124 case ax::mojom::Action::kBlur:
1125 return "blur";
1126 case ax::mojom::Action::kClearAccessibilityFocus:
1127 return "clearAccessibilityFocus";
1128 case ax::mojom::Action::kCollapse:
1129 return "collapse";
1130 case ax::mojom::Action::kCustomAction:
1131 return "customAction";
1132 case ax::mojom::Action::kDecrement:
1133 return "decrement";
1134 case ax::mojom::Action::kDoDefault:
1135 return "doDefault";
1136 case ax::mojom::Action::kExpand:
1137 return "expand";
1138 case ax::mojom::Action::kFocus:
1139 return "focus";
1140 case ax::mojom::Action::kGetImageData:
1141 return "getImageData";
1142 case ax::mojom::Action::kHitTest:
1143 return "hitTest";
1144 case ax::mojom::Action::kIncrement:
1145 return "increment";
1146 case ax::mojom::Action::kLoadInlineTextBoxes:
1147 return "loadInlineTextBoxes";
1148 case ax::mojom::Action::kReplaceSelectedText:
1149 return "replaceSelectedText";
1150 case ax::mojom::Action::kScrollBackward:
1151 return "scrollBackward";
1152 case ax::mojom::Action::kScrollForward:
1153 return "scrollForward";
1154 case ax::mojom::Action::kScrollUp:
1155 return "scrollUp";
1156 case ax::mojom::Action::kScrollDown:
1157 return "scrollDown";
1158 case ax::mojom::Action::kScrollLeft:
1159 return "scrollLeft";
1160 case ax::mojom::Action::kScrollRight:
1161 return "scrollRight";
1162 case ax::mojom::Action::kScrollToMakeVisible:
1163 return "scrollToMakeVisible";
1164 case ax::mojom::Action::kScrollToPoint:
1165 return "scrollToPoint";
1166 case ax::mojom::Action::kSetAccessibilityFocus:
1167 return "setAccessibilityFocus";
1168 case ax::mojom::Action::kSetScrollOffset:
1169 return "setScrollOffset";
1170 case ax::mojom::Action::kSetSelection:
1171 return "setSelection";
1172 case ax::mojom::Action::kSetSequentialFocusNavigationStartingPoint:
1173 return "setSequentialFocusNavigationStartingPoint";
1174 case ax::mojom::Action::kSetValue:
1175 return "setValue";
1176 case ax::mojom::Action::kShowContextMenu:
1177 return "showContextMenu";
1178 case ax::mojom::Action::kGetTextLocation:
1179 return "getTextLocation";
1180 case ax::mojom::Action::kAnnotatePageImages:
1181 return "annotatePageImages";
1182 case ax::mojom::Action::kSignalEndOfTest:
1183 return "signalEndOfTest";
1184 case ax::mojom::Action::kShowTooltip:
1185 return "showTooltip";
1186 case ax::mojom::Action::kHideTooltip:
1187 return "hideTooltip";
1188 case ax::mojom::Action::kInternalInvalidateTree:
1189 return "internalInvalidateTree";
1190 }
1191
1192 return "";
1193 }
1194
ParseAction(const char * action)1195 ax::mojom::Action ParseAction(const char* action) {
1196 if (0 == strcmp(action, "none"))
1197 return ax::mojom::Action::kNone;
1198 if (0 == strcmp(action, "annotatePageImages"))
1199 return ax::mojom::Action::kAnnotatePageImages;
1200 if (0 == strcmp(action, "blur"))
1201 return ax::mojom::Action::kBlur;
1202 if (0 == strcmp(action, "clearAccessibilityFocus"))
1203 return ax::mojom::Action::kClearAccessibilityFocus;
1204 if (0 == strcmp(action, "collapse"))
1205 return ax::mojom::Action::kCollapse;
1206 if (0 == strcmp(action, "customAction"))
1207 return ax::mojom::Action::kCustomAction;
1208 if (0 == strcmp(action, "decrement"))
1209 return ax::mojom::Action::kDecrement;
1210 if (0 == strcmp(action, "doDefault"))
1211 return ax::mojom::Action::kDoDefault;
1212 if (0 == strcmp(action, "expand"))
1213 return ax::mojom::Action::kExpand;
1214 if (0 == strcmp(action, "focus"))
1215 return ax::mojom::Action::kFocus;
1216 if (0 == strcmp(action, "getImageData"))
1217 return ax::mojom::Action::kGetImageData;
1218 if (0 == strcmp(action, "getTextLocation"))
1219 return ax::mojom::Action::kGetTextLocation;
1220 if (0 == strcmp(action, "hitTest"))
1221 return ax::mojom::Action::kHitTest;
1222 if (0 == strcmp(action, "increment"))
1223 return ax::mojom::Action::kIncrement;
1224 if (0 == strcmp(action, "loadInlineTextBoxes"))
1225 return ax::mojom::Action::kLoadInlineTextBoxes;
1226 if (0 == strcmp(action, "replaceSelectedText"))
1227 return ax::mojom::Action::kReplaceSelectedText;
1228 if (0 == strcmp(action, "scrollBackward"))
1229 return ax::mojom::Action::kScrollBackward;
1230 if (0 == strcmp(action, "scrollForward"))
1231 return ax::mojom::Action::kScrollForward;
1232 if (0 == strcmp(action, "scrollUp"))
1233 return ax::mojom::Action::kScrollUp;
1234 if (0 == strcmp(action, "scrollDown"))
1235 return ax::mojom::Action::kScrollDown;
1236 if (0 == strcmp(action, "scrollLeft"))
1237 return ax::mojom::Action::kScrollLeft;
1238 if (0 == strcmp(action, "scrollRight"))
1239 return ax::mojom::Action::kScrollRight;
1240 if (0 == strcmp(action, "scrollToMakeVisible"))
1241 return ax::mojom::Action::kScrollToMakeVisible;
1242 if (0 == strcmp(action, "scrollToPoint"))
1243 return ax::mojom::Action::kScrollToPoint;
1244 if (0 == strcmp(action, "setAccessibilityFocus"))
1245 return ax::mojom::Action::kSetAccessibilityFocus;
1246 if (0 == strcmp(action, "setScrollOffset"))
1247 return ax::mojom::Action::kSetScrollOffset;
1248 if (0 == strcmp(action, "setSelection"))
1249 return ax::mojom::Action::kSetSelection;
1250 if (0 == strcmp(action, "setSequentialFocusNavigationStartingPoint"))
1251 return ax::mojom::Action::kSetSequentialFocusNavigationStartingPoint;
1252 if (0 == strcmp(action, "setValue"))
1253 return ax::mojom::Action::kSetValue;
1254 if (0 == strcmp(action, "showContextMenu"))
1255 return ax::mojom::Action::kShowContextMenu;
1256 if (0 == strcmp(action, "signalEndOfTest"))
1257 return ax::mojom::Action::kSignalEndOfTest;
1258 if (0 == strcmp(action, "showTooltip"))
1259 return ax::mojom::Action::kShowTooltip;
1260 if (0 == strcmp(action, "hideTooltip"))
1261 return ax::mojom::Action::kHideTooltip;
1262 if (0 == strcmp(action, "internalInvalidateTree"))
1263 return ax::mojom::Action::kInternalInvalidateTree;
1264 return ax::mojom::Action::kNone;
1265 }
1266
ToString(ax::mojom::ActionFlags action_flags)1267 const char* ToString(ax::mojom::ActionFlags action_flags) {
1268 switch (action_flags) {
1269 case ax::mojom::ActionFlags::kNone:
1270 return "none";
1271 case ax::mojom::ActionFlags::kRequestImages:
1272 return "requestImages";
1273 case ax::mojom::ActionFlags::kRequestInlineTextBoxes:
1274 return "requestInlineTextBoxes";
1275 }
1276
1277 return "";
1278 }
1279
ParseActionFlags(const char * action_flags)1280 ax::mojom::ActionFlags ParseActionFlags(const char* action_flags) {
1281 if (0 == strcmp(action_flags, "none"))
1282 return ax::mojom::ActionFlags::kNone;
1283 if (0 == strcmp(action_flags, "requestImages"))
1284 return ax::mojom::ActionFlags::kRequestImages;
1285 if (0 == strcmp(action_flags, "requestInlineTextBoxes"))
1286 return ax::mojom::ActionFlags::kRequestInlineTextBoxes;
1287 return ax::mojom::ActionFlags::kNone;
1288 }
1289
ToString(ax::mojom::ScrollAlignment scroll_alignment)1290 const char* ToString(ax::mojom::ScrollAlignment scroll_alignment) {
1291 switch (scroll_alignment) {
1292 case ax::mojom::ScrollAlignment::kNone:
1293 return "none";
1294 case ax::mojom::ScrollAlignment::kScrollAlignmentCenter:
1295 return "scrollAlignmentCenter";
1296 case ax::mojom::ScrollAlignment::kScrollAlignmentTop:
1297 return "scrollAlignmentTop";
1298 case ax::mojom::ScrollAlignment::kScrollAlignmentBottom:
1299 return "scrollAlignmentBottom";
1300 case ax::mojom::ScrollAlignment::kScrollAlignmentLeft:
1301 return "scrollAlignmentLeft";
1302 case ax::mojom::ScrollAlignment::kScrollAlignmentRight:
1303 return "scrollAlignmentRight";
1304 case ax::mojom::ScrollAlignment::kScrollAlignmentClosestEdge:
1305 return "scrollAlignmentClosestEdge";
1306 }
1307 }
1308
ParseScrollAlignment(const char * scroll_alignment)1309 ax::mojom::ScrollAlignment ParseScrollAlignment(const char* scroll_alignment) {
1310 if (0 == strcmp(scroll_alignment, "none"))
1311 return ax::mojom::ScrollAlignment::kNone;
1312 if (0 == strcmp(scroll_alignment, "scrollAlignmentCenter"))
1313 return ax::mojom::ScrollAlignment::kScrollAlignmentCenter;
1314 if (0 == strcmp(scroll_alignment, "scrollAlignmentTop"))
1315 return ax::mojom::ScrollAlignment::kScrollAlignmentTop;
1316 if (0 == strcmp(scroll_alignment, "scrollAlignmentBottom"))
1317 return ax::mojom::ScrollAlignment::kScrollAlignmentBottom;
1318 if (0 == strcmp(scroll_alignment, "scrollAlignmentLeft"))
1319 return ax::mojom::ScrollAlignment::kScrollAlignmentLeft;
1320 if (0 == strcmp(scroll_alignment, "scrollAlignmentRight"))
1321 return ax::mojom::ScrollAlignment::kScrollAlignmentRight;
1322 if (0 == strcmp(scroll_alignment, "scrollAlignmentClosestEdge"))
1323 return ax::mojom::ScrollAlignment::kScrollAlignmentClosestEdge;
1324 return ax::mojom::ScrollAlignment::kNone;
1325 }
1326
ToString(ax::mojom::DefaultActionVerb default_action_verb)1327 const char* ToString(ax::mojom::DefaultActionVerb default_action_verb) {
1328 switch (default_action_verb) {
1329 case ax::mojom::DefaultActionVerb::kNone:
1330 return "none";
1331 case ax::mojom::DefaultActionVerb::kActivate:
1332 return "activate";
1333 case ax::mojom::DefaultActionVerb::kCheck:
1334 return "check";
1335 case ax::mojom::DefaultActionVerb::kClick:
1336 return "click";
1337 case ax::mojom::DefaultActionVerb::kClickAncestor:
1338 return "clickAncestor";
1339 case ax::mojom::DefaultActionVerb::kJump:
1340 return "jump";
1341 case ax::mojom::DefaultActionVerb::kOpen:
1342 return "open";
1343 case ax::mojom::DefaultActionVerb::kPress:
1344 return "press";
1345 case ax::mojom::DefaultActionVerb::kSelect:
1346 return "select";
1347 case ax::mojom::DefaultActionVerb::kUncheck:
1348 return "uncheck";
1349 }
1350
1351 return "";
1352 }
1353
ParseDefaultActionVerb(const char * default_action_verb)1354 ax::mojom::DefaultActionVerb ParseDefaultActionVerb(
1355 const char* default_action_verb) {
1356 if (0 == strcmp(default_action_verb, "none"))
1357 return ax::mojom::DefaultActionVerb::kNone;
1358 if (0 == strcmp(default_action_verb, "activate"))
1359 return ax::mojom::DefaultActionVerb::kActivate;
1360 if (0 == strcmp(default_action_verb, "check"))
1361 return ax::mojom::DefaultActionVerb::kCheck;
1362 if (0 == strcmp(default_action_verb, "click"))
1363 return ax::mojom::DefaultActionVerb::kClick;
1364 if (0 == strcmp(default_action_verb, "clickAncestor"))
1365 return ax::mojom::DefaultActionVerb::kClickAncestor;
1366 if (0 == strcmp(default_action_verb, "jump"))
1367 return ax::mojom::DefaultActionVerb::kJump;
1368 if (0 == strcmp(default_action_verb, "open"))
1369 return ax::mojom::DefaultActionVerb::kOpen;
1370 if (0 == strcmp(default_action_verb, "press"))
1371 return ax::mojom::DefaultActionVerb::kPress;
1372 if (0 == strcmp(default_action_verb, "select"))
1373 return ax::mojom::DefaultActionVerb::kSelect;
1374 if (0 == strcmp(default_action_verb, "uncheck"))
1375 return ax::mojom::DefaultActionVerb::kUncheck;
1376 return ax::mojom::DefaultActionVerb::kNone;
1377 }
1378
ToString(ax::mojom::Mutation mutation)1379 const char* ToString(ax::mojom::Mutation mutation) {
1380 switch (mutation) {
1381 case ax::mojom::Mutation::kNone:
1382 return "none";
1383 case ax::mojom::Mutation::kNodeCreated:
1384 return "nodeCreated";
1385 case ax::mojom::Mutation::kSubtreeCreated:
1386 return "subtreeCreated";
1387 case ax::mojom::Mutation::kNodeChanged:
1388 return "nodeChanged";
1389 case ax::mojom::Mutation::kNodeRemoved:
1390 return "nodeRemoved";
1391 }
1392
1393 return "";
1394 }
1395
ParseMutation(const char * mutation)1396 ax::mojom::Mutation ParseMutation(const char* mutation) {
1397 if (0 == strcmp(mutation, "none"))
1398 return ax::mojom::Mutation::kNone;
1399 if (0 == strcmp(mutation, "nodeCreated"))
1400 return ax::mojom::Mutation::kNodeCreated;
1401 if (0 == strcmp(mutation, "subtreeCreated"))
1402 return ax::mojom::Mutation::kSubtreeCreated;
1403 if (0 == strcmp(mutation, "nodeChanged"))
1404 return ax::mojom::Mutation::kNodeChanged;
1405 if (0 == strcmp(mutation, "nodeRemoved"))
1406 return ax::mojom::Mutation::kNodeRemoved;
1407 return ax::mojom::Mutation::kNone;
1408 }
1409
ToString(ax::mojom::StringAttribute string_attribute)1410 const char* ToString(ax::mojom::StringAttribute string_attribute) {
1411 switch (string_attribute) {
1412 case ax::mojom::StringAttribute::kNone:
1413 return "none";
1414 case ax::mojom::StringAttribute::kAccessKey:
1415 return "accessKey";
1416 case ax::mojom::StringAttribute::kAriaInvalidValue:
1417 return "ariaInvalidValue";
1418 case ax::mojom::StringAttribute::kAutoComplete:
1419 return "autoComplete";
1420 case ax::mojom::StringAttribute::kChildTreeId:
1421 return "childTreeId";
1422 case ax::mojom::StringAttribute::kClassName:
1423 return "className";
1424 case ax::mojom::StringAttribute::kContainerLiveRelevant:
1425 return "containerLiveRelevant";
1426 case ax::mojom::StringAttribute::kContainerLiveStatus:
1427 return "containerLiveStatus";
1428 case ax::mojom::StringAttribute::kDescription:
1429 return "description";
1430 case ax::mojom::StringAttribute::kDisplay:
1431 return "display";
1432 case ax::mojom::StringAttribute::kFontFamily:
1433 return "fontFamily";
1434 case ax::mojom::StringAttribute::kHtmlTag:
1435 return "htmlTag";
1436 case ax::mojom::StringAttribute::kImageAnnotation:
1437 return "imageAnnotation";
1438 case ax::mojom::StringAttribute::kImageDataUrl:
1439 return "imageDataUrl";
1440 case ax::mojom::StringAttribute::kInnerHtml:
1441 return "innerHtml";
1442 case ax::mojom::StringAttribute::kInputType:
1443 return "inputType";
1444 case ax::mojom::StringAttribute::kKeyShortcuts:
1445 return "keyShortcuts";
1446 case ax::mojom::StringAttribute::kLanguage:
1447 return "language";
1448 case ax::mojom::StringAttribute::kName:
1449 return "name";
1450 case ax::mojom::StringAttribute::kLiveRelevant:
1451 return "liveRelevant";
1452 case ax::mojom::StringAttribute::kLiveStatus:
1453 return "liveStatus";
1454 case ax::mojom::StringAttribute::kPlaceholder:
1455 return "placeholder";
1456 case ax::mojom::StringAttribute::kRole:
1457 return "role";
1458 case ax::mojom::StringAttribute::kRoleDescription:
1459 return "roleDescription";
1460 case ax::mojom::StringAttribute::kTooltip:
1461 return "tooltip";
1462 case ax::mojom::StringAttribute::kUrl:
1463 return "url";
1464 case ax::mojom::StringAttribute::kValue:
1465 return "value";
1466 }
1467
1468 return "";
1469 }
1470
ParseStringAttribute(const char * string_attribute)1471 ax::mojom::StringAttribute ParseStringAttribute(const char* string_attribute) {
1472 if (0 == strcmp(string_attribute, "none"))
1473 return ax::mojom::StringAttribute::kNone;
1474 if (0 == strcmp(string_attribute, "accessKey"))
1475 return ax::mojom::StringAttribute::kAccessKey;
1476 if (0 == strcmp(string_attribute, "ariaInvalidValue"))
1477 return ax::mojom::StringAttribute::kAriaInvalidValue;
1478 if (0 == strcmp(string_attribute, "autoComplete"))
1479 return ax::mojom::StringAttribute::kAutoComplete;
1480 if (0 == strcmp(string_attribute, "childTreeId"))
1481 return ax::mojom::StringAttribute::kChildTreeId;
1482 if (0 == strcmp(string_attribute, "className"))
1483 return ax::mojom::StringAttribute::kClassName;
1484 if (0 == strcmp(string_attribute, "containerLiveRelevant"))
1485 return ax::mojom::StringAttribute::kContainerLiveRelevant;
1486 if (0 == strcmp(string_attribute, "containerLiveStatus"))
1487 return ax::mojom::StringAttribute::kContainerLiveStatus;
1488 if (0 == strcmp(string_attribute, "description"))
1489 return ax::mojom::StringAttribute::kDescription;
1490 if (0 == strcmp(string_attribute, "display"))
1491 return ax::mojom::StringAttribute::kDisplay;
1492 if (0 == strcmp(string_attribute, "fontFamily"))
1493 return ax::mojom::StringAttribute::kFontFamily;
1494 if (0 == strcmp(string_attribute, "htmlTag"))
1495 return ax::mojom::StringAttribute::kHtmlTag;
1496 if (0 == strcmp(string_attribute, "imageAnnotation"))
1497 return ax::mojom::StringAttribute::kImageAnnotation;
1498 if (0 == strcmp(string_attribute, "imageDataUrl"))
1499 return ax::mojom::StringAttribute::kImageDataUrl;
1500 if (0 == strcmp(string_attribute, "innerHtml"))
1501 return ax::mojom::StringAttribute::kInnerHtml;
1502 if (0 == strcmp(string_attribute, "inputType"))
1503 return ax::mojom::StringAttribute::kInputType;
1504 if (0 == strcmp(string_attribute, "keyShortcuts"))
1505 return ax::mojom::StringAttribute::kKeyShortcuts;
1506 if (0 == strcmp(string_attribute, "language"))
1507 return ax::mojom::StringAttribute::kLanguage;
1508 if (0 == strcmp(string_attribute, "name"))
1509 return ax::mojom::StringAttribute::kName;
1510 if (0 == strcmp(string_attribute, "liveRelevant"))
1511 return ax::mojom::StringAttribute::kLiveRelevant;
1512 if (0 == strcmp(string_attribute, "liveStatus"))
1513 return ax::mojom::StringAttribute::kLiveStatus;
1514 if (0 == strcmp(string_attribute, "placeholder"))
1515 return ax::mojom::StringAttribute::kPlaceholder;
1516 if (0 == strcmp(string_attribute, "role"))
1517 return ax::mojom::StringAttribute::kRole;
1518 if (0 == strcmp(string_attribute, "roleDescription"))
1519 return ax::mojom::StringAttribute::kRoleDescription;
1520 if (0 == strcmp(string_attribute, "tooltip"))
1521 return ax::mojom::StringAttribute::kTooltip;
1522 if (0 == strcmp(string_attribute, "url"))
1523 return ax::mojom::StringAttribute::kUrl;
1524 if (0 == strcmp(string_attribute, "value"))
1525 return ax::mojom::StringAttribute::kValue;
1526 return ax::mojom::StringAttribute::kNone;
1527 }
1528
ToString(ax::mojom::IntAttribute int_attribute)1529 const char* ToString(ax::mojom::IntAttribute int_attribute) {
1530 switch (int_attribute) {
1531 case ax::mojom::IntAttribute::kNone:
1532 return "none";
1533 case ax::mojom::IntAttribute::kDefaultActionVerb:
1534 return "defaultActionVerb";
1535 case ax::mojom::IntAttribute::kDropeffect:
1536 return "dropeffect";
1537 case ax::mojom::IntAttribute::kScrollX:
1538 return "scrollX";
1539 case ax::mojom::IntAttribute::kScrollXMin:
1540 return "scrollXMin";
1541 case ax::mojom::IntAttribute::kScrollXMax:
1542 return "scrollXMax";
1543 case ax::mojom::IntAttribute::kScrollY:
1544 return "scrollY";
1545 case ax::mojom::IntAttribute::kScrollYMin:
1546 return "scrollYMin";
1547 case ax::mojom::IntAttribute::kScrollYMax:
1548 return "scrollYMax";
1549 case ax::mojom::IntAttribute::kTextSelStart:
1550 return "textSelStart";
1551 case ax::mojom::IntAttribute::kTextSelEnd:
1552 return "textSelEnd";
1553 case ax::mojom::IntAttribute::kAriaColumnCount:
1554 return "ariaColumnCount";
1555 case ax::mojom::IntAttribute::kAriaCellColumnIndex:
1556 return "ariaCellColumnIndex";
1557 case ax::mojom::IntAttribute::kAriaCellColumnSpan:
1558 return "ariaCellColumnSpan";
1559 case ax::mojom::IntAttribute::kAriaRowCount:
1560 return "ariaRowCount";
1561 case ax::mojom::IntAttribute::kAriaCellRowIndex:
1562 return "ariaCellRowIndex";
1563 case ax::mojom::IntAttribute::kAriaCellRowSpan:
1564 return "ariaCellRowSpan";
1565 case ax::mojom::IntAttribute::kTableRowCount:
1566 return "tableRowCount";
1567 case ax::mojom::IntAttribute::kTableColumnCount:
1568 return "tableColumnCount";
1569 case ax::mojom::IntAttribute::kTableHeaderId:
1570 return "tableHeaderId";
1571 case ax::mojom::IntAttribute::kTableRowIndex:
1572 return "tableRowIndex";
1573 case ax::mojom::IntAttribute::kTableRowHeaderId:
1574 return "tableRowHeaderId";
1575 case ax::mojom::IntAttribute::kTableColumnIndex:
1576 return "tableColumnIndex";
1577 case ax::mojom::IntAttribute::kTableColumnHeaderId:
1578 return "tableColumnHeaderId";
1579 case ax::mojom::IntAttribute::kTableCellColumnIndex:
1580 return "tableCellColumnIndex";
1581 case ax::mojom::IntAttribute::kTableCellColumnSpan:
1582 return "tableCellColumnSpan";
1583 case ax::mojom::IntAttribute::kTableCellRowIndex:
1584 return "tableCellRowIndex";
1585 case ax::mojom::IntAttribute::kTableCellRowSpan:
1586 return "tableCellRowSpan";
1587 case ax::mojom::IntAttribute::kSortDirection:
1588 return "sortDirection";
1589 case ax::mojom::IntAttribute::kHierarchicalLevel:
1590 return "hierarchicalLevel";
1591 case ax::mojom::IntAttribute::kNameFrom:
1592 return "nameFrom";
1593 case ax::mojom::IntAttribute::kDescriptionFrom:
1594 return "descriptionFrom";
1595 case ax::mojom::IntAttribute::kActivedescendantId:
1596 return "activedescendantId";
1597 case ax::mojom::IntAttribute::kErrormessageId:
1598 return "errormessageId";
1599 case ax::mojom::IntAttribute::kInPageLinkTargetId:
1600 return "inPageLinkTargetId";
1601 case ax::mojom::IntAttribute::kMemberOfId:
1602 return "memberOfId";
1603 case ax::mojom::IntAttribute::kNextOnLineId:
1604 return "nextOnLineId";
1605 case ax::mojom::IntAttribute::kPopupForId:
1606 return "popupForId";
1607 case ax::mojom::IntAttribute::kPreviousOnLineId:
1608 return "previousOnLineId";
1609 case ax::mojom::IntAttribute::kRestriction:
1610 return "restriction";
1611 case ax::mojom::IntAttribute::kSetSize:
1612 return "setSize";
1613 case ax::mojom::IntAttribute::kPosInSet:
1614 return "posInSet";
1615 case ax::mojom::IntAttribute::kColorValue:
1616 return "colorValue";
1617 case ax::mojom::IntAttribute::kAriaCurrentState:
1618 return "ariaCurrentState";
1619 case ax::mojom::IntAttribute::kBackgroundColor:
1620 return "backgroundColor";
1621 case ax::mojom::IntAttribute::kColor:
1622 return "color";
1623 case ax::mojom::IntAttribute::kHasPopup:
1624 return "haspopup";
1625 case ax::mojom::IntAttribute::kInvalidState:
1626 return "invalidState";
1627 case ax::mojom::IntAttribute::kCheckedState:
1628 return "checkedState";
1629 case ax::mojom::IntAttribute::kListStyle:
1630 return "listStyle";
1631 case ax::mojom::IntAttribute::kTextDirection:
1632 return "textDirection";
1633 case ax::mojom::IntAttribute::kTextPosition:
1634 return "textPosition";
1635 case ax::mojom::IntAttribute::kTextStyle:
1636 return "textStyle";
1637 case ax::mojom::IntAttribute::kTextOverlineStyle:
1638 return "textOverlineStyle";
1639 case ax::mojom::IntAttribute::kTextStrikethroughStyle:
1640 return "textStrikethroughStyle";
1641 case ax::mojom::IntAttribute::kTextUnderlineStyle:
1642 return "textUnderlineStyle";
1643 case ax::mojom::IntAttribute::kPreviousFocusId:
1644 return "previousFocusId";
1645 case ax::mojom::IntAttribute::kNextFocusId:
1646 return "nextFocusId";
1647 case ax::mojom::IntAttribute::kImageAnnotationStatus:
1648 return "imageAnnotationStatus";
1649 case ax::mojom::IntAttribute::kDOMNodeId:
1650 return "domNodeId";
1651 }
1652
1653 return "";
1654 }
1655
ParseIntAttribute(const char * int_attribute)1656 ax::mojom::IntAttribute ParseIntAttribute(const char* int_attribute) {
1657 if (0 == strcmp(int_attribute, "none"))
1658 return ax::mojom::IntAttribute::kNone;
1659 if (0 == strcmp(int_attribute, "defaultActionVerb"))
1660 return ax::mojom::IntAttribute::kDefaultActionVerb;
1661 if (0 == strcmp(int_attribute, "dropeffect"))
1662 return ax::mojom::IntAttribute::kDropeffect;
1663 if (0 == strcmp(int_attribute, "scrollX"))
1664 return ax::mojom::IntAttribute::kScrollX;
1665 if (0 == strcmp(int_attribute, "scrollXMin"))
1666 return ax::mojom::IntAttribute::kScrollXMin;
1667 if (0 == strcmp(int_attribute, "scrollXMax"))
1668 return ax::mojom::IntAttribute::kScrollXMax;
1669 if (0 == strcmp(int_attribute, "scrollY"))
1670 return ax::mojom::IntAttribute::kScrollY;
1671 if (0 == strcmp(int_attribute, "scrollYMin"))
1672 return ax::mojom::IntAttribute::kScrollYMin;
1673 if (0 == strcmp(int_attribute, "scrollYMax"))
1674 return ax::mojom::IntAttribute::kScrollYMax;
1675 if (0 == strcmp(int_attribute, "textSelStart"))
1676 return ax::mojom::IntAttribute::kTextSelStart;
1677 if (0 == strcmp(int_attribute, "textSelEnd"))
1678 return ax::mojom::IntAttribute::kTextSelEnd;
1679 if (0 == strcmp(int_attribute, "ariaColumnCount"))
1680 return ax::mojom::IntAttribute::kAriaColumnCount;
1681 if (0 == strcmp(int_attribute, "ariaCellColumnIndex"))
1682 return ax::mojom::IntAttribute::kAriaCellColumnIndex;
1683 if (0 == strcmp(int_attribute, "ariaCellColumnSpan"))
1684 return ax::mojom::IntAttribute::kAriaCellColumnSpan;
1685 if (0 == strcmp(int_attribute, "ariaRowCount"))
1686 return ax::mojom::IntAttribute::kAriaRowCount;
1687 if (0 == strcmp(int_attribute, "ariaCellRowIndex"))
1688 return ax::mojom::IntAttribute::kAriaCellRowIndex;
1689 if (0 == strcmp(int_attribute, "ariaCellRowSpan"))
1690 return ax::mojom::IntAttribute::kAriaCellRowSpan;
1691 if (0 == strcmp(int_attribute, "tableRowCount"))
1692 return ax::mojom::IntAttribute::kTableRowCount;
1693 if (0 == strcmp(int_attribute, "tableColumnCount"))
1694 return ax::mojom::IntAttribute::kTableColumnCount;
1695 if (0 == strcmp(int_attribute, "tableHeaderId"))
1696 return ax::mojom::IntAttribute::kTableHeaderId;
1697 if (0 == strcmp(int_attribute, "tableRowIndex"))
1698 return ax::mojom::IntAttribute::kTableRowIndex;
1699 if (0 == strcmp(int_attribute, "tableRowHeaderId"))
1700 return ax::mojom::IntAttribute::kTableRowHeaderId;
1701 if (0 == strcmp(int_attribute, "tableColumnIndex"))
1702 return ax::mojom::IntAttribute::kTableColumnIndex;
1703 if (0 == strcmp(int_attribute, "tableColumnHeaderId"))
1704 return ax::mojom::IntAttribute::kTableColumnHeaderId;
1705 if (0 == strcmp(int_attribute, "tableCellColumnIndex"))
1706 return ax::mojom::IntAttribute::kTableCellColumnIndex;
1707 if (0 == strcmp(int_attribute, "tableCellColumnSpan"))
1708 return ax::mojom::IntAttribute::kTableCellColumnSpan;
1709 if (0 == strcmp(int_attribute, "tableCellRowIndex"))
1710 return ax::mojom::IntAttribute::kTableCellRowIndex;
1711 if (0 == strcmp(int_attribute, "tableCellRowSpan"))
1712 return ax::mojom::IntAttribute::kTableCellRowSpan;
1713 if (0 == strcmp(int_attribute, "sortDirection"))
1714 return ax::mojom::IntAttribute::kSortDirection;
1715 if (0 == strcmp(int_attribute, "hierarchicalLevel"))
1716 return ax::mojom::IntAttribute::kHierarchicalLevel;
1717 if (0 == strcmp(int_attribute, "nameFrom"))
1718 return ax::mojom::IntAttribute::kNameFrom;
1719 if (0 == strcmp(int_attribute, "descriptionFrom"))
1720 return ax::mojom::IntAttribute::kDescriptionFrom;
1721 if (0 == strcmp(int_attribute, "activedescendantId"))
1722 return ax::mojom::IntAttribute::kActivedescendantId;
1723 if (0 == strcmp(int_attribute, "errormessageId"))
1724 return ax::mojom::IntAttribute::kErrormessageId;
1725 if (0 == strcmp(int_attribute, "inPageLinkTargetId"))
1726 return ax::mojom::IntAttribute::kInPageLinkTargetId;
1727 if (0 == strcmp(int_attribute, "memberOfId"))
1728 return ax::mojom::IntAttribute::kMemberOfId;
1729 if (0 == strcmp(int_attribute, "nextOnLineId"))
1730 return ax::mojom::IntAttribute::kNextOnLineId;
1731 if (0 == strcmp(int_attribute, "popupForId"))
1732 return ax::mojom::IntAttribute::kPopupForId;
1733 if (0 == strcmp(int_attribute, "previousOnLineId"))
1734 return ax::mojom::IntAttribute::kPreviousOnLineId;
1735 if (0 == strcmp(int_attribute, "restriction"))
1736 return ax::mojom::IntAttribute::kRestriction;
1737 if (0 == strcmp(int_attribute, "setSize"))
1738 return ax::mojom::IntAttribute::kSetSize;
1739 if (0 == strcmp(int_attribute, "posInSet"))
1740 return ax::mojom::IntAttribute::kPosInSet;
1741 if (0 == strcmp(int_attribute, "colorValue"))
1742 return ax::mojom::IntAttribute::kColorValue;
1743 if (0 == strcmp(int_attribute, "ariaCurrentState"))
1744 return ax::mojom::IntAttribute::kAriaCurrentState;
1745 if (0 == strcmp(int_attribute, "backgroundColor"))
1746 return ax::mojom::IntAttribute::kBackgroundColor;
1747 if (0 == strcmp(int_attribute, "color"))
1748 return ax::mojom::IntAttribute::kColor;
1749 if (0 == strcmp(int_attribute, "haspopup"))
1750 return ax::mojom::IntAttribute::kHasPopup;
1751 if (0 == strcmp(int_attribute, "invalidState"))
1752 return ax::mojom::IntAttribute::kInvalidState;
1753 if (0 == strcmp(int_attribute, "checkedState"))
1754 return ax::mojom::IntAttribute::kCheckedState;
1755 if (0 == strcmp(int_attribute, "listStyle"))
1756 return ax::mojom::IntAttribute::kListStyle;
1757 if (0 == strcmp(int_attribute, "textDirection"))
1758 return ax::mojom::IntAttribute::kTextDirection;
1759 if (0 == strcmp(int_attribute, "textPosition"))
1760 return ax::mojom::IntAttribute::kTextPosition;
1761 if (0 == strcmp(int_attribute, "textStyle"))
1762 return ax::mojom::IntAttribute::kTextStyle;
1763 if (0 == strcmp(int_attribute, "textOverlineStyle"))
1764 return ax::mojom::IntAttribute::kTextOverlineStyle;
1765 if (0 == strcmp(int_attribute, "textStrikethroughStyle"))
1766 return ax::mojom::IntAttribute::kTextStrikethroughStyle;
1767 if (0 == strcmp(int_attribute, "textUnderlineStyle"))
1768 return ax::mojom::IntAttribute::kTextUnderlineStyle;
1769 if (0 == strcmp(int_attribute, "previousFocusId"))
1770 return ax::mojom::IntAttribute::kPreviousFocusId;
1771 if (0 == strcmp(int_attribute, "nextFocusId"))
1772 return ax::mojom::IntAttribute::kNextFocusId;
1773 if (0 == strcmp(int_attribute, "imageAnnotationStatus"))
1774 return ax::mojom::IntAttribute::kImageAnnotationStatus;
1775 if (0 == strcmp(int_attribute, "domNodeId"))
1776 return ax::mojom::IntAttribute::kDOMNodeId;
1777 return ax::mojom::IntAttribute::kNone;
1778 }
1779
ToString(ax::mojom::FloatAttribute float_attribute)1780 const char* ToString(ax::mojom::FloatAttribute float_attribute) {
1781 switch (float_attribute) {
1782 case ax::mojom::FloatAttribute::kNone:
1783 return "none";
1784 case ax::mojom::FloatAttribute::kValueForRange:
1785 return "valueForRange";
1786 case ax::mojom::FloatAttribute::kMinValueForRange:
1787 return "minValueForRange";
1788 case ax::mojom::FloatAttribute::kMaxValueForRange:
1789 return "maxValueForRange";
1790 case ax::mojom::FloatAttribute::kStepValueForRange:
1791 return "stepValueForRange";
1792 case ax::mojom::FloatAttribute::kFontSize:
1793 return "fontSize";
1794 case ax::mojom::FloatAttribute::kFontWeight:
1795 return "fontWeight";
1796 }
1797
1798 return "";
1799 }
1800
ParseFloatAttribute(const char * float_attribute)1801 ax::mojom::FloatAttribute ParseFloatAttribute(const char* float_attribute) {
1802 if (0 == strcmp(float_attribute, "none"))
1803 return ax::mojom::FloatAttribute::kNone;
1804 if (0 == strcmp(float_attribute, "valueForRange"))
1805 return ax::mojom::FloatAttribute::kValueForRange;
1806 if (0 == strcmp(float_attribute, "minValueForRange"))
1807 return ax::mojom::FloatAttribute::kMinValueForRange;
1808 if (0 == strcmp(float_attribute, "maxValueForRange"))
1809 return ax::mojom::FloatAttribute::kMaxValueForRange;
1810 if (0 == strcmp(float_attribute, "stepValueForRange"))
1811 return ax::mojom::FloatAttribute::kStepValueForRange;
1812 if (0 == strcmp(float_attribute, "fontSize"))
1813 return ax::mojom::FloatAttribute::kFontSize;
1814 if (0 == strcmp(float_attribute, "fontWeight"))
1815 return ax::mojom::FloatAttribute::kFontWeight;
1816 return ax::mojom::FloatAttribute::kNone;
1817 }
1818
ToString(ax::mojom::BoolAttribute bool_attribute)1819 const char* ToString(ax::mojom::BoolAttribute bool_attribute) {
1820 switch (bool_attribute) {
1821 case ax::mojom::BoolAttribute::kNone:
1822 return "none";
1823 case ax::mojom::BoolAttribute::kBusy:
1824 return "busy";
1825 case ax::mojom::BoolAttribute::kEditableRoot:
1826 return "editableRoot";
1827 case ax::mojom::BoolAttribute::kContainerLiveAtomic:
1828 return "containerLiveAtomic";
1829 case ax::mojom::BoolAttribute::kContainerLiveBusy:
1830 return "containerLiveBusy";
1831 case ax::mojom::BoolAttribute::kGrabbed:
1832 return "grabbed";
1833 case ax::mojom::BoolAttribute::kLiveAtomic:
1834 return "liveAtomic";
1835 case ax::mojom::BoolAttribute::kModal:
1836 return "modal";
1837 case ax::mojom::BoolAttribute::kUpdateLocationOnly:
1838 return "updateLocationOnly";
1839 case ax::mojom::BoolAttribute::kCanvasHasFallback:
1840 return "canvasHasFallback";
1841 case ax::mojom::BoolAttribute::kScrollable:
1842 return "scrollable";
1843 case ax::mojom::BoolAttribute::kClickable:
1844 return "clickable";
1845 case ax::mojom::BoolAttribute::kClipsChildren:
1846 return "clipsChildren";
1847 case ax::mojom::BoolAttribute::kSelected:
1848 return "selected";
1849 case ax::mojom::BoolAttribute::kSupportsTextLocation:
1850 return "supportsTextLocation";
1851 case ax::mojom::BoolAttribute::kIsLineBreakingObject:
1852 return "isLineBreakingObject";
1853 case ax::mojom::BoolAttribute::kIsPageBreakingObject:
1854 return "isPageBreakingObject";
1855 case ax::mojom::BoolAttribute::kHasAriaAttribute:
1856 return "hasAriaAttribute";
1857 }
1858
1859 return "";
1860 }
1861
ParseBoolAttribute(const char * bool_attribute)1862 ax::mojom::BoolAttribute ParseBoolAttribute(const char* bool_attribute) {
1863 if (0 == strcmp(bool_attribute, "none"))
1864 return ax::mojom::BoolAttribute::kNone;
1865 if (0 == strcmp(bool_attribute, "busy"))
1866 return ax::mojom::BoolAttribute::kBusy;
1867 if (0 == strcmp(bool_attribute, "editableRoot"))
1868 return ax::mojom::BoolAttribute::kEditableRoot;
1869 if (0 == strcmp(bool_attribute, "containerLiveAtomic"))
1870 return ax::mojom::BoolAttribute::kContainerLiveAtomic;
1871 if (0 == strcmp(bool_attribute, "containerLiveBusy"))
1872 return ax::mojom::BoolAttribute::kContainerLiveBusy;
1873 if (0 == strcmp(bool_attribute, "grabbed"))
1874 return ax::mojom::BoolAttribute::kGrabbed;
1875 if (0 == strcmp(bool_attribute, "liveAtomic"))
1876 return ax::mojom::BoolAttribute::kLiveAtomic;
1877 if (0 == strcmp(bool_attribute, "modal"))
1878 return ax::mojom::BoolAttribute::kModal;
1879 if (0 == strcmp(bool_attribute, "updateLocationOnly"))
1880 return ax::mojom::BoolAttribute::kUpdateLocationOnly;
1881 if (0 == strcmp(bool_attribute, "canvasHasFallback"))
1882 return ax::mojom::BoolAttribute::kCanvasHasFallback;
1883 if (0 == strcmp(bool_attribute, "scrollable"))
1884 return ax::mojom::BoolAttribute::kScrollable;
1885 if (0 == strcmp(bool_attribute, "clickable"))
1886 return ax::mojom::BoolAttribute::kClickable;
1887 if (0 == strcmp(bool_attribute, "clipsChildren"))
1888 return ax::mojom::BoolAttribute::kClipsChildren;
1889 if (0 == strcmp(bool_attribute, "selected"))
1890 return ax::mojom::BoolAttribute::kSelected;
1891 if (0 == strcmp(bool_attribute, "supportsTextLocation"))
1892 return ax::mojom::BoolAttribute::kSupportsTextLocation;
1893 if (0 == strcmp(bool_attribute, "isLineBreakingObject"))
1894 return ax::mojom::BoolAttribute::kIsLineBreakingObject;
1895 if (0 == strcmp(bool_attribute, "isPageBreakingObject"))
1896 return ax::mojom::BoolAttribute::kIsPageBreakingObject;
1897 if (0 == strcmp(bool_attribute, "hasAriaAttribute"))
1898 return ax::mojom::BoolAttribute::kHasAriaAttribute;
1899 return ax::mojom::BoolAttribute::kNone;
1900 }
1901
ToString(ax::mojom::IntListAttribute int_list_attribute)1902 const char* ToString(ax::mojom::IntListAttribute int_list_attribute) {
1903 switch (int_list_attribute) {
1904 case ax::mojom::IntListAttribute::kNone:
1905 return "none";
1906 case ax::mojom::IntListAttribute::kIndirectChildIds:
1907 return "indirectChildIds";
1908 case ax::mojom::IntListAttribute::kControlsIds:
1909 return "controlsIds";
1910 case ax::mojom::IntListAttribute::kDetailsIds:
1911 return "detailsIds";
1912 case ax::mojom::IntListAttribute::kDescribedbyIds:
1913 return "describedbyIds";
1914 case ax::mojom::IntListAttribute::kFlowtoIds:
1915 return "flowtoIds";
1916 case ax::mojom::IntListAttribute::kLabelledbyIds:
1917 return "labelledbyIds";
1918 case ax::mojom::IntListAttribute::kRadioGroupIds:
1919 return "radioGroupIds";
1920 case ax::mojom::IntListAttribute::kMarkerTypes:
1921 return "markerTypes";
1922 case ax::mojom::IntListAttribute::kMarkerStarts:
1923 return "markerStarts";
1924 case ax::mojom::IntListAttribute::kMarkerEnds:
1925 return "markerEnds";
1926 case ax::mojom::IntListAttribute::kCharacterOffsets:
1927 return "characterOffsets";
1928 case ax::mojom::IntListAttribute::kCachedLineStarts:
1929 return "cachedLineStarts";
1930 case ax::mojom::IntListAttribute::kWordStarts:
1931 return "wordStarts";
1932 case ax::mojom::IntListAttribute::kWordEnds:
1933 return "wordEnds";
1934 case ax::mojom::IntListAttribute::kCustomActionIds:
1935 return "customActionIds";
1936 }
1937
1938 return "";
1939 }
1940
ParseIntListAttribute(const char * int_list_attribute)1941 ax::mojom::IntListAttribute ParseIntListAttribute(
1942 const char* int_list_attribute) {
1943 if (0 == strcmp(int_list_attribute, "none"))
1944 return ax::mojom::IntListAttribute::kNone;
1945 if (0 == strcmp(int_list_attribute, "indirectChildIds"))
1946 return ax::mojom::IntListAttribute::kIndirectChildIds;
1947 if (0 == strcmp(int_list_attribute, "controlsIds"))
1948 return ax::mojom::IntListAttribute::kControlsIds;
1949 if (0 == strcmp(int_list_attribute, "detailsIds"))
1950 return ax::mojom::IntListAttribute::kDetailsIds;
1951 if (0 == strcmp(int_list_attribute, "describedbyIds"))
1952 return ax::mojom::IntListAttribute::kDescribedbyIds;
1953 if (0 == strcmp(int_list_attribute, "flowtoIds"))
1954 return ax::mojom::IntListAttribute::kFlowtoIds;
1955 if (0 == strcmp(int_list_attribute, "labelledbyIds"))
1956 return ax::mojom::IntListAttribute::kLabelledbyIds;
1957 if (0 == strcmp(int_list_attribute, "radioGroupIds"))
1958 return ax::mojom::IntListAttribute::kRadioGroupIds;
1959 if (0 == strcmp(int_list_attribute, "markerTypes"))
1960 return ax::mojom::IntListAttribute::kMarkerTypes;
1961 if (0 == strcmp(int_list_attribute, "markerStarts"))
1962 return ax::mojom::IntListAttribute::kMarkerStarts;
1963 if (0 == strcmp(int_list_attribute, "markerEnds"))
1964 return ax::mojom::IntListAttribute::kMarkerEnds;
1965 if (0 == strcmp(int_list_attribute, "characterOffsets"))
1966 return ax::mojom::IntListAttribute::kCharacterOffsets;
1967 if (0 == strcmp(int_list_attribute, "cachedLineStarts"))
1968 return ax::mojom::IntListAttribute::kCachedLineStarts;
1969 if (0 == strcmp(int_list_attribute, "wordStarts"))
1970 return ax::mojom::IntListAttribute::kWordStarts;
1971 if (0 == strcmp(int_list_attribute, "wordEnds"))
1972 return ax::mojom::IntListAttribute::kWordEnds;
1973 if (0 == strcmp(int_list_attribute, "customActionIds"))
1974 return ax::mojom::IntListAttribute::kCustomActionIds;
1975 return ax::mojom::IntListAttribute::kNone;
1976 }
1977
ToString(ax::mojom::StringListAttribute string_list_attribute)1978 const char* ToString(ax::mojom::StringListAttribute string_list_attribute) {
1979 switch (string_list_attribute) {
1980 case ax::mojom::StringListAttribute::kNone:
1981 return "none";
1982 case ax::mojom::StringListAttribute::kCustomActionDescriptions:
1983 return "customActionDescriptions";
1984 }
1985
1986 return "";
1987 }
1988
ParseStringListAttribute(const char * string_list_attribute)1989 ax::mojom::StringListAttribute ParseStringListAttribute(
1990 const char* string_list_attribute) {
1991 if (0 == strcmp(string_list_attribute, "none"))
1992 return ax::mojom::StringListAttribute::kNone;
1993 if (0 == strcmp(string_list_attribute, "customActionDescriptions"))
1994 return ax::mojom::StringListAttribute::kCustomActionDescriptions;
1995 return ax::mojom::StringListAttribute::kNone;
1996 }
1997
ToString(ax::mojom::ListStyle list_style)1998 const char* ToString(ax::mojom::ListStyle list_style) {
1999 switch (list_style) {
2000 case ax::mojom::ListStyle::kNone:
2001 return "none";
2002 case ax::mojom::ListStyle::kCircle:
2003 return "circle";
2004 case ax::mojom::ListStyle::kDisc:
2005 return "disc";
2006 case ax::mojom::ListStyle::kImage:
2007 return "image";
2008 case ax::mojom::ListStyle::kNumeric:
2009 return "numeric";
2010 case ax::mojom::ListStyle::kOther:
2011 return "other";
2012 case ax::mojom::ListStyle::kSquare:
2013 return "square";
2014 }
2015
2016 return "";
2017 }
2018
ParseListStyle(const char * list_style)2019 ax::mojom::ListStyle ParseListStyle(const char* list_style) {
2020 if (0 == strcmp(list_style, "none"))
2021 return ax::mojom::ListStyle::kNone;
2022 if (0 == strcmp(list_style, "circle"))
2023 return ax::mojom::ListStyle::kCircle;
2024 if (0 == strcmp(list_style, "disc"))
2025 return ax::mojom::ListStyle::kDisc;
2026 if (0 == strcmp(list_style, "image"))
2027 return ax::mojom::ListStyle::kImage;
2028 if (0 == strcmp(list_style, "numeric"))
2029 return ax::mojom::ListStyle::kNumeric;
2030 if (0 == strcmp(list_style, "other"))
2031 return ax::mojom::ListStyle::kOther;
2032 if (0 == strcmp(list_style, "square"))
2033 return ax::mojom::ListStyle::kSquare;
2034 return ax::mojom::ListStyle::kNone;
2035 }
2036
ToString(ax::mojom::MarkerType marker_type)2037 const char* ToString(ax::mojom::MarkerType marker_type) {
2038 switch (marker_type) {
2039 case ax::mojom::MarkerType::kNone:
2040 return "none";
2041 case ax::mojom::MarkerType::kSpelling:
2042 return "spelling";
2043 case ax::mojom::MarkerType::kGrammar:
2044 return "grammar";
2045 case ax::mojom::MarkerType::kTextMatch:
2046 return "textMatch";
2047 case ax::mojom::MarkerType::kActiveSuggestion:
2048 return "activeSuggestion";
2049 case ax::mojom::MarkerType::kSuggestion:
2050 return "suggestion";
2051 }
2052
2053 return "";
2054 }
2055
ParseMarkerType(const char * marker_type)2056 ax::mojom::MarkerType ParseMarkerType(const char* marker_type) {
2057 if (0 == strcmp(marker_type, "none"))
2058 return ax::mojom::MarkerType::kNone;
2059 if (0 == strcmp(marker_type, "spelling"))
2060 return ax::mojom::MarkerType::kSpelling;
2061 if (0 == strcmp(marker_type, "grammar"))
2062 return ax::mojom::MarkerType::kGrammar;
2063 if (0 == strcmp(marker_type, "textMatch"))
2064 return ax::mojom::MarkerType::kTextMatch;
2065 if (0 == strcmp(marker_type, "activeSuggestion"))
2066 return ax::mojom::MarkerType::kActiveSuggestion;
2067 if (0 == strcmp(marker_type, "suggestion"))
2068 return ax::mojom::MarkerType::kSuggestion;
2069 return ax::mojom::MarkerType::kNone;
2070 }
2071
ToString(ax::mojom::MoveDirection move_direction)2072 const char* ToString(ax::mojom::MoveDirection move_direction) {
2073 switch (move_direction) {
2074 case ax::mojom::MoveDirection::kForward:
2075 return "forward";
2076 case ax::mojom::MoveDirection::kBackward:
2077 return "backward";
2078 }
2079
2080 return "";
2081 }
2082
ParseMoveDirection(const char * move_direction)2083 ax::mojom::MoveDirection ParseMoveDirection(const char* move_direction) {
2084 if (0 == strcmp(move_direction, "forward"))
2085 return ax::mojom::MoveDirection::kForward;
2086 if (0 == strcmp(move_direction, "backward"))
2087 return ax::mojom::MoveDirection::kBackward;
2088 return ax::mojom::MoveDirection::kForward;
2089 }
2090
ToString(ax::mojom::EditCommand edit_command)2091 const char* ToString(ax::mojom::EditCommand edit_command) {
2092 switch (edit_command) {
2093 case ax::mojom::EditCommand::kType:
2094 return "type";
2095 case ax::mojom::EditCommand::kCut:
2096 return "cut";
2097 case ax::mojom::EditCommand::kDelete:
2098 return "delete";
2099 case ax::mojom::EditCommand::kDictate:
2100 return "dictate";
2101 case ax::mojom::EditCommand::kFormat:
2102 return "format";
2103 case ax::mojom::EditCommand::kInsert:
2104 return "insert";
2105 case ax::mojom::EditCommand::kMarker:
2106 return "marker";
2107 case ax::mojom::EditCommand::kPaste:
2108 return "paste";
2109 case ax::mojom::EditCommand::kReplace:
2110 return "replace";
2111 }
2112
2113 return "";
2114 }
2115
ParseEditCommand(const char * edit_command)2116 ax::mojom::EditCommand ParseEditCommand(const char* edit_command) {
2117 if (0 == strcmp(edit_command, "type"))
2118 return ax::mojom::EditCommand::kType;
2119 if (0 == strcmp(edit_command, "cut"))
2120 return ax::mojom::EditCommand::kCut;
2121 if (0 == strcmp(edit_command, "delete"))
2122 return ax::mojom::EditCommand::kDelete;
2123 if (0 == strcmp(edit_command, "dictate"))
2124 return ax::mojom::EditCommand::kDictate;
2125 if (0 == strcmp(edit_command, "format"))
2126 return ax::mojom::EditCommand::kFormat;
2127 if (0 == strcmp(edit_command, "insert"))
2128 return ax::mojom::EditCommand::kInsert;
2129 if (0 == strcmp(edit_command, "marker"))
2130 return ax::mojom::EditCommand::kMarker;
2131 if (0 == strcmp(edit_command, "paste"))
2132 return ax::mojom::EditCommand::kPaste;
2133 if (0 == strcmp(edit_command, "replace"))
2134 return ax::mojom::EditCommand::kReplace;
2135 return ax::mojom::EditCommand::kType;
2136 }
2137
ToString(ax::mojom::SelectionCommand selection_command)2138 const char* ToString(ax::mojom::SelectionCommand selection_command) {
2139 switch (selection_command) {
2140 case ax::mojom::SelectionCommand::kSet:
2141 return "set";
2142 case ax::mojom::SelectionCommand::kClear:
2143 return "clear";
2144 case ax::mojom::SelectionCommand::kShrink:
2145 return "shrink";
2146 case ax::mojom::SelectionCommand::kExtend:
2147 return "extend";
2148 }
2149
2150 return "";
2151 }
2152
ParseSelectionCommand(const char * selection_command)2153 ax::mojom::SelectionCommand ParseSelectionCommand(
2154 const char* selection_command) {
2155 if (0 == strcmp(selection_command, "set"))
2156 return ax::mojom::SelectionCommand::kSet;
2157 if (0 == strcmp(selection_command, "clear"))
2158 return ax::mojom::SelectionCommand::kClear;
2159 if (0 == strcmp(selection_command, "shrink"))
2160 return ax::mojom::SelectionCommand::kShrink;
2161 if (0 == strcmp(selection_command, "extend"))
2162 return ax::mojom::SelectionCommand::kExtend;
2163 return ax::mojom::SelectionCommand::kSet;
2164 }
2165
ToString(ax::mojom::TextBoundary text_boundary)2166 const char* ToString(ax::mojom::TextBoundary text_boundary) {
2167 switch (text_boundary) {
2168 case ax::mojom::TextBoundary::kCharacter:
2169 return "character";
2170 case ax::mojom::TextBoundary::kFormat:
2171 return "format";
2172 case ax::mojom::TextBoundary::kLineEnd:
2173 return "lineEnd";
2174 case ax::mojom::TextBoundary::kLineStart:
2175 return "lineStart";
2176 case ax::mojom::TextBoundary::kLineStartOrEnd:
2177 return "lineStartOrEnd";
2178 case ax::mojom::TextBoundary::kObject:
2179 return "object";
2180 case ax::mojom::TextBoundary::kPageEnd:
2181 return "pageEnd";
2182 case ax::mojom::TextBoundary::kPageStart:
2183 return "pageStart";
2184 case ax::mojom::TextBoundary::kPageStartOrEnd:
2185 return "pageStartOrEnd";
2186 case ax::mojom::TextBoundary::kParagraphEnd:
2187 return "paragraphEnd";
2188 case ax::mojom::TextBoundary::kParagraphStart:
2189 return "paragraphStart";
2190 case ax::mojom::TextBoundary::kParagraphStartOrEnd:
2191 return "paragraphStartOrEnd";
2192 case ax::mojom::TextBoundary::kSentenceEnd:
2193 return "sentenceEnd";
2194 case ax::mojom::TextBoundary::kSentenceStart:
2195 return "sentenceStart";
2196 case ax::mojom::TextBoundary::kSentenceStartOrEnd:
2197 return "sentenceStartOrEnd";
2198 case ax::mojom::TextBoundary::kWebPage:
2199 return "webPage";
2200 case ax::mojom::TextBoundary::kWordEnd:
2201 return "wordEnd";
2202 case ax::mojom::TextBoundary::kWordStart:
2203 return "wordStart";
2204 case ax::mojom::TextBoundary::kWordStartOrEnd:
2205 return "wordStartOrEnd";
2206 }
2207
2208 return "";
2209 }
2210
ParseTextBoundary(const char * text_boundary)2211 ax::mojom::TextBoundary ParseTextBoundary(const char* text_boundary) {
2212 if (0 == strcmp(text_boundary, "object"))
2213 return ax::mojom::TextBoundary::kObject;
2214 if (0 == strcmp(text_boundary, "character"))
2215 return ax::mojom::TextBoundary::kCharacter;
2216 if (0 == strcmp(text_boundary, "format"))
2217 return ax::mojom::TextBoundary::kFormat;
2218 if (0 == strcmp(text_boundary, "lineEnd"))
2219 return ax::mojom::TextBoundary::kLineEnd;
2220 if (0 == strcmp(text_boundary, "lineStart"))
2221 return ax::mojom::TextBoundary::kLineStart;
2222 if (0 == strcmp(text_boundary, "lineStartOrEnd"))
2223 return ax::mojom::TextBoundary::kLineStartOrEnd;
2224 if (0 == strcmp(text_boundary, "pageEnd"))
2225 return ax::mojom::TextBoundary::kPageEnd;
2226 if (0 == strcmp(text_boundary, "pageStart"))
2227 return ax::mojom::TextBoundary::kPageStart;
2228 if (0 == strcmp(text_boundary, "pageStartOrEnd"))
2229 return ax::mojom::TextBoundary::kPageStartOrEnd;
2230 if (0 == strcmp(text_boundary, "paragraphEnd"))
2231 return ax::mojom::TextBoundary::kParagraphEnd;
2232 if (0 == strcmp(text_boundary, "paragraphStart"))
2233 return ax::mojom::TextBoundary::kParagraphStart;
2234 if (0 == strcmp(text_boundary, "paragraphStartOrEnd"))
2235 return ax::mojom::TextBoundary::kParagraphStartOrEnd;
2236 if (0 == strcmp(text_boundary, "sentenceEnd"))
2237 return ax::mojom::TextBoundary::kSentenceEnd;
2238 if (0 == strcmp(text_boundary, "sentenceStart"))
2239 return ax::mojom::TextBoundary::kSentenceStart;
2240 if (0 == strcmp(text_boundary, "sentenceStartOrEnd"))
2241 return ax::mojom::TextBoundary::kSentenceStartOrEnd;
2242 if (0 == strcmp(text_boundary, "webPage"))
2243 return ax::mojom::TextBoundary::kWebPage;
2244 if (0 == strcmp(text_boundary, "wordEnd"))
2245 return ax::mojom::TextBoundary::kWordEnd;
2246 if (0 == strcmp(text_boundary, "wordStart"))
2247 return ax::mojom::TextBoundary::kWordStart;
2248 if (0 == strcmp(text_boundary, "wordStartOrEnd"))
2249 return ax::mojom::TextBoundary::kWordStartOrEnd;
2250 return ax::mojom::TextBoundary::kObject;
2251 }
2252
ToString(ax::mojom::TextDecorationStyle text_decoration_style)2253 const char* ToString(ax::mojom::TextDecorationStyle text_decoration_style) {
2254 switch (text_decoration_style) {
2255 case ax::mojom::TextDecorationStyle::kNone:
2256 return "none";
2257 case ax::mojom::TextDecorationStyle::kSolid:
2258 return "solid";
2259 case ax::mojom::TextDecorationStyle::kDashed:
2260 return "dashed";
2261 case ax::mojom::TextDecorationStyle::kDotted:
2262 return "dotted";
2263 case ax::mojom::TextDecorationStyle::kDouble:
2264 return "double";
2265 case ax::mojom::TextDecorationStyle::kWavy:
2266 return "wavy";
2267 }
2268
2269 return "";
2270 }
2271
ParseTextDecorationStyle(const char * text_decoration_style)2272 ax::mojom::TextDecorationStyle ParseTextDecorationStyle(
2273 const char* text_decoration_style) {
2274 if (0 == strcmp(text_decoration_style, "none"))
2275 return ax::mojom::TextDecorationStyle::kNone;
2276 if (0 == strcmp(text_decoration_style, "solid"))
2277 return ax::mojom::TextDecorationStyle::kSolid;
2278 if (0 == strcmp(text_decoration_style, "dashed"))
2279 return ax::mojom::TextDecorationStyle::kDashed;
2280 if (0 == strcmp(text_decoration_style, "dotted"))
2281 return ax::mojom::TextDecorationStyle::kDotted;
2282 if (0 == strcmp(text_decoration_style, "double"))
2283 return ax::mojom::TextDecorationStyle::kDouble;
2284 if (0 == strcmp(text_decoration_style, "wavy"))
2285 return ax::mojom::TextDecorationStyle::kWavy;
2286 return ax::mojom::TextDecorationStyle::kNone;
2287 }
2288
ToString(ax::mojom::TextDirection text_direction)2289 const char* ToString(ax::mojom::TextDirection text_direction) {
2290 switch (text_direction) {
2291 case ax::mojom::TextDirection::kNone:
2292 return "none";
2293 case ax::mojom::TextDirection::kLtr:
2294 return "ltr";
2295 case ax::mojom::TextDirection::kRtl:
2296 return "rtl";
2297 case ax::mojom::TextDirection::kTtb:
2298 return "ttb";
2299 case ax::mojom::TextDirection::kBtt:
2300 return "btt";
2301 }
2302
2303 return "";
2304 }
2305
ParseTextDirection(const char * text_direction)2306 ax::mojom::TextDirection ParseTextDirection(const char* text_direction) {
2307 if (0 == strcmp(text_direction, "none"))
2308 return ax::mojom::TextDirection::kNone;
2309 if (0 == strcmp(text_direction, "ltr"))
2310 return ax::mojom::TextDirection::kLtr;
2311 if (0 == strcmp(text_direction, "rtl"))
2312 return ax::mojom::TextDirection::kRtl;
2313 if (0 == strcmp(text_direction, "ttb"))
2314 return ax::mojom::TextDirection::kTtb;
2315 if (0 == strcmp(text_direction, "btt"))
2316 return ax::mojom::TextDirection::kBtt;
2317 return ax::mojom::TextDirection::kNone;
2318 }
2319
ToString(ax::mojom::TextPosition text_position)2320 const char* ToString(ax::mojom::TextPosition text_position) {
2321 switch (text_position) {
2322 case ax::mojom::TextPosition::kNone:
2323 return "none";
2324 case ax::mojom::TextPosition::kSubscript:
2325 return "subscript";
2326 case ax::mojom::TextPosition::kSuperscript:
2327 return "superscript";
2328 }
2329
2330 return "";
2331 }
2332
ParseTextPosition(const char * text_position)2333 ax::mojom::TextPosition ParseTextPosition(const char* text_position) {
2334 if (0 == strcmp(text_position, "none"))
2335 return ax::mojom::TextPosition::kNone;
2336 if (0 == strcmp(text_position, "subscript"))
2337 return ax::mojom::TextPosition::kSubscript;
2338 if (0 == strcmp(text_position, "superscript"))
2339 return ax::mojom::TextPosition::kSuperscript;
2340 return ax::mojom::TextPosition::kNone;
2341 }
2342
ToString(ax::mojom::TextStyle text_style)2343 const char* ToString(ax::mojom::TextStyle text_style) {
2344 switch (text_style) {
2345 case ax::mojom::TextStyle::kNone:
2346 return "none";
2347 case ax::mojom::TextStyle::kBold:
2348 return "bold";
2349 case ax::mojom::TextStyle::kItalic:
2350 return "italic";
2351 case ax::mojom::TextStyle::kUnderline:
2352 return "underline";
2353 case ax::mojom::TextStyle::kLineThrough:
2354 return "lineThrough";
2355 case ax::mojom::TextStyle::kOverline:
2356 return "overline";
2357 }
2358
2359 return "";
2360 }
2361
ParseTextStyle(const char * text_style)2362 ax::mojom::TextStyle ParseTextStyle(const char* text_style) {
2363 if (0 == strcmp(text_style, "none"))
2364 return ax::mojom::TextStyle::kNone;
2365 if (0 == strcmp(text_style, "bold"))
2366 return ax::mojom::TextStyle::kBold;
2367 if (0 == strcmp(text_style, "italic"))
2368 return ax::mojom::TextStyle::kItalic;
2369 if (0 == strcmp(text_style, "underline"))
2370 return ax::mojom::TextStyle::kUnderline;
2371 if (0 == strcmp(text_style, "lineThrough"))
2372 return ax::mojom::TextStyle::kLineThrough;
2373 if (0 == strcmp(text_style, "overline"))
2374 return ax::mojom::TextStyle::kOverline;
2375 return ax::mojom::TextStyle::kNone;
2376 }
2377
ToString(ax::mojom::AriaCurrentState aria_current_state)2378 const char* ToString(ax::mojom::AriaCurrentState aria_current_state) {
2379 switch (aria_current_state) {
2380 case ax::mojom::AriaCurrentState::kNone:
2381 return "none";
2382 case ax::mojom::AriaCurrentState::kFalse:
2383 return "false";
2384 case ax::mojom::AriaCurrentState::kTrue:
2385 return "true";
2386 case ax::mojom::AriaCurrentState::kPage:
2387 return "page";
2388 case ax::mojom::AriaCurrentState::kStep:
2389 return "step";
2390 case ax::mojom::AriaCurrentState::kLocation:
2391 return "location";
2392 case ax::mojom::AriaCurrentState::kUnclippedLocation:
2393 return "unclippedLocation";
2394 case ax::mojom::AriaCurrentState::kDate:
2395 return "date";
2396 case ax::mojom::AriaCurrentState::kTime:
2397 return "time";
2398 }
2399
2400 return "";
2401 }
2402
ParseAriaCurrentState(const char * aria_current_state)2403 ax::mojom::AriaCurrentState ParseAriaCurrentState(
2404 const char* aria_current_state) {
2405 if (0 == strcmp(aria_current_state, "none"))
2406 return ax::mojom::AriaCurrentState::kNone;
2407 if (0 == strcmp(aria_current_state, "false"))
2408 return ax::mojom::AriaCurrentState::kFalse;
2409 if (0 == strcmp(aria_current_state, "true"))
2410 return ax::mojom::AriaCurrentState::kTrue;
2411 if (0 == strcmp(aria_current_state, "page"))
2412 return ax::mojom::AriaCurrentState::kPage;
2413 if (0 == strcmp(aria_current_state, "step"))
2414 return ax::mojom::AriaCurrentState::kStep;
2415 if (0 == strcmp(aria_current_state, "location"))
2416 return ax::mojom::AriaCurrentState::kLocation;
2417 if (0 == strcmp(aria_current_state, "unclippedLocation"))
2418 return ax::mojom::AriaCurrentState::kUnclippedLocation;
2419 if (0 == strcmp(aria_current_state, "date"))
2420 return ax::mojom::AriaCurrentState::kDate;
2421 if (0 == strcmp(aria_current_state, "time"))
2422 return ax::mojom::AriaCurrentState::kTime;
2423 return ax::mojom::AriaCurrentState::kNone;
2424 }
2425
ToString(ax::mojom::HasPopup has_popup)2426 const char* ToString(ax::mojom::HasPopup has_popup) {
2427 switch (has_popup) {
2428 case ax::mojom::HasPopup::kFalse:
2429 return "";
2430 case ax::mojom::HasPopup::kTrue:
2431 return "true";
2432 case ax::mojom::HasPopup::kMenu:
2433 return "menu";
2434 case ax::mojom::HasPopup::kListbox:
2435 return "listbox";
2436 case ax::mojom::HasPopup::kTree:
2437 return "tree";
2438 case ax::mojom::HasPopup::kGrid:
2439 return "grid";
2440 case ax::mojom::HasPopup::kDialog:
2441 return "dialog";
2442 }
2443
2444 return "";
2445 }
2446
ParseHasPopup(const char * has_popup)2447 ax::mojom::HasPopup ParseHasPopup(const char* has_popup) {
2448 if (0 == strcmp(has_popup, "true"))
2449 return ax::mojom::HasPopup::kTrue;
2450 if (0 == strcmp(has_popup, "menu"))
2451 return ax::mojom::HasPopup::kMenu;
2452 if (0 == strcmp(has_popup, "listbox"))
2453 return ax::mojom::HasPopup::kListbox;
2454 if (0 == strcmp(has_popup, "tree"))
2455 return ax::mojom::HasPopup::kTree;
2456 if (0 == strcmp(has_popup, "grid"))
2457 return ax::mojom::HasPopup::kGrid;
2458 if (0 == strcmp(has_popup, "dialog"))
2459 return ax::mojom::HasPopup::kDialog;
2460
2461 return ax::mojom::HasPopup::kFalse;
2462 }
2463
ToString(ax::mojom::InvalidState invalid_state)2464 const char* ToString(ax::mojom::InvalidState invalid_state) {
2465 switch (invalid_state) {
2466 case ax::mojom::InvalidState::kNone:
2467 return "none";
2468 case ax::mojom::InvalidState::kFalse:
2469 return "false";
2470 case ax::mojom::InvalidState::kTrue:
2471 return "true";
2472 case ax::mojom::InvalidState::kOther:
2473 return "other";
2474 }
2475
2476 return "";
2477 }
2478
ParseInvalidState(const char * invalid_state)2479 ax::mojom::InvalidState ParseInvalidState(const char* invalid_state) {
2480 if (0 == strcmp(invalid_state, "none"))
2481 return ax::mojom::InvalidState::kNone;
2482 if (0 == strcmp(invalid_state, "false"))
2483 return ax::mojom::InvalidState::kFalse;
2484 if (0 == strcmp(invalid_state, "true"))
2485 return ax::mojom::InvalidState::kTrue;
2486 if (0 == strcmp(invalid_state, "other"))
2487 return ax::mojom::InvalidState::kOther;
2488 return ax::mojom::InvalidState::kNone;
2489 }
2490
ToString(ax::mojom::Restriction restriction)2491 const char* ToString(ax::mojom::Restriction restriction) {
2492 switch (restriction) {
2493 case ax::mojom::Restriction::kNone:
2494 return "none";
2495 case ax::mojom::Restriction::kReadOnly:
2496 return "readOnly";
2497 case ax::mojom::Restriction::kDisabled:
2498 return "disabled";
2499 }
2500
2501 return "";
2502 }
2503
ParseRestriction(const char * restriction)2504 ax::mojom::Restriction ParseRestriction(const char* restriction) {
2505 if (0 == strcmp(restriction, "none"))
2506 return ax::mojom::Restriction::kNone;
2507 if (0 == strcmp(restriction, "readOnly"))
2508 return ax::mojom::Restriction::kReadOnly;
2509 if (0 == strcmp(restriction, "disabled"))
2510 return ax::mojom::Restriction::kDisabled;
2511 return ax::mojom::Restriction::kNone;
2512 }
2513
ToString(ax::mojom::CheckedState checked_state)2514 const char* ToString(ax::mojom::CheckedState checked_state) {
2515 switch (checked_state) {
2516 case ax::mojom::CheckedState::kNone:
2517 return "none";
2518 case ax::mojom::CheckedState::kFalse:
2519 return "false";
2520 case ax::mojom::CheckedState::kTrue:
2521 return "true";
2522 case ax::mojom::CheckedState::kMixed:
2523 return "mixed";
2524 }
2525
2526 return "";
2527 }
2528
ParseCheckedState(const char * checked_state)2529 ax::mojom::CheckedState ParseCheckedState(const char* checked_state) {
2530 if (0 == strcmp(checked_state, "none"))
2531 return ax::mojom::CheckedState::kNone;
2532 if (0 == strcmp(checked_state, "false"))
2533 return ax::mojom::CheckedState::kFalse;
2534 if (0 == strcmp(checked_state, "true"))
2535 return ax::mojom::CheckedState::kTrue;
2536 if (0 == strcmp(checked_state, "mixed"))
2537 return ax::mojom::CheckedState::kMixed;
2538 return ax::mojom::CheckedState::kNone;
2539 }
2540
ToString(ax::mojom::SortDirection sort_direction)2541 const char* ToString(ax::mojom::SortDirection sort_direction) {
2542 switch (sort_direction) {
2543 case ax::mojom::SortDirection::kNone:
2544 return "none";
2545 case ax::mojom::SortDirection::kUnsorted:
2546 return "unsorted";
2547 case ax::mojom::SortDirection::kAscending:
2548 return "ascending";
2549 case ax::mojom::SortDirection::kDescending:
2550 return "descending";
2551 case ax::mojom::SortDirection::kOther:
2552 return "other";
2553 }
2554
2555 return "";
2556 }
2557
ParseSortDirection(const char * sort_direction)2558 ax::mojom::SortDirection ParseSortDirection(const char* sort_direction) {
2559 if (0 == strcmp(sort_direction, "none"))
2560 return ax::mojom::SortDirection::kNone;
2561 if (0 == strcmp(sort_direction, "unsorted"))
2562 return ax::mojom::SortDirection::kUnsorted;
2563 if (0 == strcmp(sort_direction, "ascending"))
2564 return ax::mojom::SortDirection::kAscending;
2565 if (0 == strcmp(sort_direction, "descending"))
2566 return ax::mojom::SortDirection::kDescending;
2567 if (0 == strcmp(sort_direction, "other"))
2568 return ax::mojom::SortDirection::kOther;
2569 return ax::mojom::SortDirection::kNone;
2570 }
2571
ToString(ax::mojom::NameFrom name_from)2572 const char* ToString(ax::mojom::NameFrom name_from) {
2573 switch (name_from) {
2574 case ax::mojom::NameFrom::kNone:
2575 return "none";
2576 case ax::mojom::NameFrom::kUninitialized:
2577 return "uninitialized";
2578 case ax::mojom::NameFrom::kAttribute:
2579 return "attribute";
2580 case ax::mojom::NameFrom::kAttributeExplicitlyEmpty:
2581 return "attributeExplicitlyEmpty";
2582 case ax::mojom::NameFrom::kCaption:
2583 return "caption";
2584 case ax::mojom::NameFrom::kContents:
2585 return "contents";
2586 case ax::mojom::NameFrom::kPlaceholder:
2587 return "placeholder";
2588 case ax::mojom::NameFrom::kRelatedElement:
2589 return "relatedElement";
2590 case ax::mojom::NameFrom::kTitle:
2591 return "title";
2592 case ax::mojom::NameFrom::kValue:
2593 return "value";
2594 }
2595
2596 return "";
2597 }
2598
ParseNameFrom(const char * name_from)2599 ax::mojom::NameFrom ParseNameFrom(const char* name_from) {
2600 if (0 == strcmp(name_from, "none"))
2601 return ax::mojom::NameFrom::kNone;
2602 if (0 == strcmp(name_from, "uninitialized"))
2603 return ax::mojom::NameFrom::kUninitialized;
2604 if (0 == strcmp(name_from, "attribute"))
2605 return ax::mojom::NameFrom::kAttribute;
2606 if (0 == strcmp(name_from, "attributeExplicitlyEmpty"))
2607 return ax::mojom::NameFrom::kAttributeExplicitlyEmpty;
2608 if (0 == strcmp(name_from, "caption"))
2609 return ax::mojom::NameFrom::kCaption;
2610 if (0 == strcmp(name_from, "contents"))
2611 return ax::mojom::NameFrom::kContents;
2612 if (0 == strcmp(name_from, "placeholder"))
2613 return ax::mojom::NameFrom::kPlaceholder;
2614 if (0 == strcmp(name_from, "relatedElement"))
2615 return ax::mojom::NameFrom::kRelatedElement;
2616 if (0 == strcmp(name_from, "title"))
2617 return ax::mojom::NameFrom::kTitle;
2618 if (0 == strcmp(name_from, "value"))
2619 return ax::mojom::NameFrom::kValue;
2620 return ax::mojom::NameFrom::kNone;
2621 }
2622
ToString(ax::mojom::DescriptionFrom description_from)2623 const char* ToString(ax::mojom::DescriptionFrom description_from) {
2624 switch (description_from) {
2625 case ax::mojom::DescriptionFrom::kNone:
2626 return "none";
2627 case ax::mojom::DescriptionFrom::kUninitialized:
2628 return "uninitialized";
2629 case ax::mojom::DescriptionFrom::kAttribute:
2630 return "attribute";
2631 case ax::mojom::DescriptionFrom::kContents:
2632 return "contents";
2633 case ax::mojom::DescriptionFrom::kRelatedElement:
2634 return "relatedElement";
2635 case ax::mojom::DescriptionFrom::kTitle:
2636 return "title";
2637 }
2638
2639 return "";
2640 }
2641
ParseDescriptionFrom(const char * description_from)2642 ax::mojom::DescriptionFrom ParseDescriptionFrom(const char* description_from) {
2643 if (0 == strcmp(description_from, "none"))
2644 return ax::mojom::DescriptionFrom::kNone;
2645 if (0 == strcmp(description_from, "uninitialized"))
2646 return ax::mojom::DescriptionFrom::kUninitialized;
2647 if (0 == strcmp(description_from, "attribute"))
2648 return ax::mojom::DescriptionFrom::kAttribute;
2649 if (0 == strcmp(description_from, "contents"))
2650 return ax::mojom::DescriptionFrom::kContents;
2651 if (0 == strcmp(description_from, "relatedElement"))
2652 return ax::mojom::DescriptionFrom::kRelatedElement;
2653 if (0 == strcmp(description_from, "title"))
2654 return ax::mojom::DescriptionFrom::kTitle;
2655 return ax::mojom::DescriptionFrom::kNone;
2656 }
2657
ToString(ax::mojom::EventFrom event_from)2658 const char* ToString(ax::mojom::EventFrom event_from) {
2659 switch (event_from) {
2660 case ax::mojom::EventFrom::kNone:
2661 return "none";
2662 case ax::mojom::EventFrom::kUser:
2663 return "user";
2664 case ax::mojom::EventFrom::kPage:
2665 return "page";
2666 case ax::mojom::EventFrom::kAction:
2667 return "action";
2668 }
2669
2670 return "";
2671 }
2672
ParseEventFrom(const char * event_from)2673 ax::mojom::EventFrom ParseEventFrom(const char* event_from) {
2674 if (0 == strcmp(event_from, "none"))
2675 return ax::mojom::EventFrom::kNone;
2676 if (0 == strcmp(event_from, "user"))
2677 return ax::mojom::EventFrom::kUser;
2678 if (0 == strcmp(event_from, "page"))
2679 return ax::mojom::EventFrom::kPage;
2680 if (0 == strcmp(event_from, "action"))
2681 return ax::mojom::EventFrom::kAction;
2682 return ax::mojom::EventFrom::kNone;
2683 }
2684
ToString(ax::mojom::Gesture gesture)2685 const char* ToString(ax::mojom::Gesture gesture) {
2686 switch (gesture) {
2687 case ax::mojom::Gesture::kNone:
2688 return "none";
2689 case ax::mojom::Gesture::kClick:
2690 return "click";
2691 case ax::mojom::Gesture::kSwipeLeft1:
2692 return "swipeLeft1";
2693 case ax::mojom::Gesture::kSwipeUp1:
2694 return "swipeUp1";
2695 case ax::mojom::Gesture::kSwipeRight1:
2696 return "swipeRight1";
2697 case ax::mojom::Gesture::kSwipeDown1:
2698 return "swipeDown1";
2699 case ax::mojom::Gesture::kSwipeLeft2:
2700 return "swipeLeft2";
2701 case ax::mojom::Gesture::kSwipeUp2:
2702 return "swipeUp2";
2703 case ax::mojom::Gesture::kSwipeRight2:
2704 return "swipeRight2";
2705 case ax::mojom::Gesture::kSwipeDown2:
2706 return "swipeDown2";
2707 case ax::mojom::Gesture::kSwipeLeft3:
2708 return "swipeLeft3";
2709 case ax::mojom::Gesture::kSwipeUp3:
2710 return "swipeUp3";
2711 case ax::mojom::Gesture::kSwipeRight3:
2712 return "swipeRight3";
2713 case ax::mojom::Gesture::kSwipeDown3:
2714 return "swipeDown3";
2715 case ax::mojom::Gesture::kSwipeLeft4:
2716 return "swipeLeft4";
2717 case ax::mojom::Gesture::kSwipeUp4:
2718 return "swipeUp4";
2719 case ax::mojom::Gesture::kSwipeRight4:
2720 return "swipeRight4";
2721 case ax::mojom::Gesture::kSwipeDown4:
2722 return "swipeDown4";
2723 case ax::mojom::Gesture::kTap2:
2724 return "tap2";
2725 case ax::mojom::Gesture::kTap3:
2726 return "tap3";
2727 case ax::mojom::Gesture::kTap4:
2728 return "tap4";
2729 }
2730
2731 return "";
2732 }
2733
ParseGesture(const char * gesture)2734 ax::mojom::Gesture ParseGesture(const char* gesture) {
2735 if (0 == strcmp(gesture, "none"))
2736 return ax::mojom::Gesture::kNone;
2737 if (0 == strcmp(gesture, "click"))
2738 return ax::mojom::Gesture::kClick;
2739 if (0 == strcmp(gesture, "swipeLeft1"))
2740 return ax::mojom::Gesture::kSwipeLeft1;
2741 if (0 == strcmp(gesture, "swipeUp1"))
2742 return ax::mojom::Gesture::kSwipeUp1;
2743 if (0 == strcmp(gesture, "swipeRight1"))
2744 return ax::mojom::Gesture::kSwipeRight1;
2745 if (0 == strcmp(gesture, "swipeDown1"))
2746 return ax::mojom::Gesture::kSwipeDown1;
2747 if (0 == strcmp(gesture, "swipeLeft2"))
2748 return ax::mojom::Gesture::kSwipeLeft2;
2749 if (0 == strcmp(gesture, "swipeUp2"))
2750 return ax::mojom::Gesture::kSwipeUp2;
2751 if (0 == strcmp(gesture, "swipeRight2"))
2752 return ax::mojom::Gesture::kSwipeRight2;
2753 if (0 == strcmp(gesture, "swipeDown2"))
2754 return ax::mojom::Gesture::kSwipeDown2;
2755 if (0 == strcmp(gesture, "swipeLeft3"))
2756 return ax::mojom::Gesture::kSwipeLeft3;
2757 if (0 == strcmp(gesture, "swipeUp3"))
2758 return ax::mojom::Gesture::kSwipeUp3;
2759 if (0 == strcmp(gesture, "swipeRight3"))
2760 return ax::mojom::Gesture::kSwipeRight3;
2761 if (0 == strcmp(gesture, "swipeDown3"))
2762 return ax::mojom::Gesture::kSwipeDown3;
2763 if (0 == strcmp(gesture, "swipeLeft4"))
2764 return ax::mojom::Gesture::kSwipeLeft4;
2765 if (0 == strcmp(gesture, "swipeUp4"))
2766 return ax::mojom::Gesture::kSwipeUp4;
2767 if (0 == strcmp(gesture, "swipeRight4"))
2768 return ax::mojom::Gesture::kSwipeRight4;
2769 if (0 == strcmp(gesture, "swipeDown4"))
2770 return ax::mojom::Gesture::kSwipeDown4;
2771 if (0 == strcmp(gesture, "tap2"))
2772 return ax::mojom::Gesture::kTap2;
2773 if (0 == strcmp(gesture, "tap3"))
2774 return ax::mojom::Gesture::kTap3;
2775 if (0 == strcmp(gesture, "tap4"))
2776 return ax::mojom::Gesture::kTap4;
2777 return ax::mojom::Gesture::kNone;
2778 }
2779
ToString(ax::mojom::TextAffinity text_affinity)2780 const char* ToString(ax::mojom::TextAffinity text_affinity) {
2781 switch (text_affinity) {
2782 case ax::mojom::TextAffinity::kNone:
2783 return "none";
2784 case ax::mojom::TextAffinity::kDownstream:
2785 return "downstream";
2786 case ax::mojom::TextAffinity::kUpstream:
2787 return "upstream";
2788 }
2789
2790 return "";
2791 }
2792
ParseTextAffinity(const char * text_affinity)2793 ax::mojom::TextAffinity ParseTextAffinity(const char* text_affinity) {
2794 if (0 == strcmp(text_affinity, "none"))
2795 return ax::mojom::TextAffinity::kNone;
2796 if (0 == strcmp(text_affinity, "downstream"))
2797 return ax::mojom::TextAffinity::kDownstream;
2798 if (0 == strcmp(text_affinity, "upstream"))
2799 return ax::mojom::TextAffinity::kUpstream;
2800 return ax::mojom::TextAffinity::kNone;
2801 }
2802
ToString(ax::mojom::TreeOrder tree_order)2803 const char* ToString(ax::mojom::TreeOrder tree_order) {
2804 switch (tree_order) {
2805 case ax::mojom::TreeOrder::kNone:
2806 return "none";
2807 case ax::mojom::TreeOrder::kUndefined:
2808 return "undefined";
2809 case ax::mojom::TreeOrder::kBefore:
2810 return "before";
2811 case ax::mojom::TreeOrder::kEqual:
2812 return "equal";
2813 case ax::mojom::TreeOrder::kAfter:
2814 return "after";
2815 }
2816
2817 return "";
2818 }
2819
ParseTreeOrder(const char * tree_order)2820 ax::mojom::TreeOrder ParseTreeOrder(const char* tree_order) {
2821 if (0 == strcmp(tree_order, "none"))
2822 return ax::mojom::TreeOrder::kNone;
2823 if (0 == strcmp(tree_order, "undefined"))
2824 return ax::mojom::TreeOrder::kUndefined;
2825 if (0 == strcmp(tree_order, "before"))
2826 return ax::mojom::TreeOrder::kBefore;
2827 if (0 == strcmp(tree_order, "equal"))
2828 return ax::mojom::TreeOrder::kEqual;
2829 if (0 == strcmp(tree_order, "after"))
2830 return ax::mojom::TreeOrder::kAfter;
2831 return ax::mojom::TreeOrder::kNone;
2832 }
2833
ToString(ax::mojom::ImageAnnotationStatus status)2834 const char* ToString(ax::mojom::ImageAnnotationStatus status) {
2835 switch (status) {
2836 case ax::mojom::ImageAnnotationStatus::kNone:
2837 return "none";
2838 case ax::mojom::ImageAnnotationStatus::kWillNotAnnotateDueToScheme:
2839 return "kWillNotAnnotateDueToScheme";
2840 case ax::mojom::ImageAnnotationStatus::kIneligibleForAnnotation:
2841 return "ineligibleForAnnotation";
2842 case ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation:
2843 return "eligibleForAnnotation";
2844 case ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation:
2845 return "silentlyEligibleForAnnotation";
2846 case ax::mojom::ImageAnnotationStatus::kAnnotationPending:
2847 return "annotationPending";
2848 case ax::mojom::ImageAnnotationStatus::kAnnotationSucceeded:
2849 return "annotationSucceeded";
2850 case ax::mojom::ImageAnnotationStatus::kAnnotationEmpty:
2851 return "annotationEmpty";
2852 case ax::mojom::ImageAnnotationStatus::kAnnotationAdult:
2853 return "annotationAdult";
2854 case ax::mojom::ImageAnnotationStatus::kAnnotationProcessFailed:
2855 return "annotationProcessFailed";
2856 }
2857
2858 return "";
2859 }
2860
ParseImageAnnotationStatus(const char * status)2861 ax::mojom::ImageAnnotationStatus ParseImageAnnotationStatus(
2862 const char* status) {
2863 if (0 == strcmp(status, "none"))
2864 return ax::mojom::ImageAnnotationStatus::kNone;
2865 if (0 == strcmp(status, "kWillNotAnnotateDueToScheme"))
2866 return ax::mojom::ImageAnnotationStatus::kWillNotAnnotateDueToScheme;
2867 if (0 == strcmp(status, "ineligibleForAnnotation"))
2868 return ax::mojom::ImageAnnotationStatus::kIneligibleForAnnotation;
2869 if (0 == strcmp(status, "eligibleForAnnotation"))
2870 return ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation;
2871 if (0 == strcmp(status, "silentlyEligibleForAnnotation"))
2872 return ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation;
2873 if (0 == strcmp(status, "annotationPending"))
2874 return ax::mojom::ImageAnnotationStatus::kAnnotationPending;
2875 if (0 == strcmp(status, "annotationSucceeded"))
2876 return ax::mojom::ImageAnnotationStatus::kAnnotationSucceeded;
2877 if (0 == strcmp(status, "annotationEmpty"))
2878 return ax::mojom::ImageAnnotationStatus::kAnnotationEmpty;
2879 if (0 == strcmp(status, "annotationAdult"))
2880 return ax::mojom::ImageAnnotationStatus::kAnnotationAdult;
2881 if (0 == strcmp(status, "annotationProcessFailed"))
2882 return ax::mojom::ImageAnnotationStatus::kAnnotationProcessFailed;
2883
2884 return ax::mojom::ImageAnnotationStatus::kNone;
2885 }
2886
ParseDropeffect(const char * dropeffect)2887 ax::mojom::Dropeffect ParseDropeffect(const char* dropeffect) {
2888 if (0 == strcmp(dropeffect, "copy"))
2889 return ax::mojom::Dropeffect::kCopy;
2890 if (0 == strcmp(dropeffect, "execute"))
2891 return ax::mojom::Dropeffect::kExecute;
2892 if (0 == strcmp(dropeffect, "link"))
2893 return ax::mojom::Dropeffect::kLink;
2894 if (0 == strcmp(dropeffect, "move"))
2895 return ax::mojom::Dropeffect::kMove;
2896 if (0 == strcmp(dropeffect, "popup"))
2897 return ax::mojom::Dropeffect::kPopup;
2898 return ax::mojom::Dropeffect::kNone;
2899 }
2900
ToString(ax::mojom::Dropeffect dropeffect)2901 const char* ToString(ax::mojom::Dropeffect dropeffect) {
2902 switch (dropeffect) {
2903 case ax::mojom::Dropeffect::kCopy:
2904 return "copy";
2905 case ax::mojom::Dropeffect::kExecute:
2906 return "execute";
2907 case ax::mojom::Dropeffect::kLink:
2908 return "link";
2909 case ax::mojom::Dropeffect::kMove:
2910 return "move";
2911 case ax::mojom::Dropeffect::kPopup:
2912 return "popup";
2913 case ax::mojom::Dropeffect::kNone:
2914 return "none";
2915 }
2916
2917 return "";
2918 }
2919
2920 } // namespace ui
2921