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 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/strings/grit/ui_strings.h"
11 
12 namespace ui {
13 
ToString(ax::mojom::Event event)14 const char* ToString(ax::mojom::Event event) {
15   switch (event) {
16     case ax::mojom::Event::kNone:
17       return "none";
18     case ax::mojom::Event::kActiveDescendantChanged:
19       return "activedescendantchanged";
20     case ax::mojom::Event::kAlert:
21       return "alert";
22     case ax::mojom::Event::kAriaAttributeChanged:
23       return "ariaAttributeChanged";
24     case ax::mojom::Event::kAutocorrectionOccured:
25       return "autocorrectionOccured";
26     case ax::mojom::Event::kBlur:
27       return "blur";
28     case ax::mojom::Event::kCheckedStateChanged:
29       return "checkedStateChanged";
30     case ax::mojom::Event::kChildrenChanged:
31       return "childrenChanged";
32     case ax::mojom::Event::kClicked:
33       return "clicked";
34     case ax::mojom::Event::kControlsChanged:
35       return "controlsChanged";
36     case ax::mojom::Event::kDocumentSelectionChanged:
37       return "documentSelectionChanged";
38     case ax::mojom::Event::kDocumentTitleChanged:
39       return "documentTitleChanged";
40     case ax::mojom::Event::kEndOfTest:
41       return "endOfTest";
42     case ax::mojom::Event::kExpandedChanged:
43       return "expandedChanged";
44     case ax::mojom::Event::kFocus:
45       return "focus";
46     case ax::mojom::Event::kFocusAfterMenuClose:
47       return "focusAfterMenuClose";
48     case ax::mojom::Event::kFocusContext:
49       return "focusContext";
50     case ax::mojom::Event::kHide:
51       return "hide";
52     case ax::mojom::Event::kHitTestResult:
53       return "hitTestResult";
54     case ax::mojom::Event::kHover:
55       return "hover";
56     case ax::mojom::Event::kImageFrameUpdated:
57       return "imageFrameUpdated";
58     case ax::mojom::Event::kLayoutComplete:
59       return "layoutComplete";
60     case ax::mojom::Event::kLiveRegionCreated:
61       return "liveRegionCreated";
62     case ax::mojom::Event::kLiveRegionChanged:
63       return "liveRegionChanged";
64     case ax::mojom::Event::kLoadComplete:
65       return "loadComplete";
66     case ax::mojom::Event::kLoadStart:
67       return "loadStart";
68     case ax::mojom::Event::kLocationChanged:
69       return "locationChanged";
70     case ax::mojom::Event::kMediaStartedPlaying:
71       return "mediaStartedPlaying";
72     case ax::mojom::Event::kMediaStoppedPlaying:
73       return "mediaStoppedPlaying";
74     case ax::mojom::Event::kMenuEnd:
75       return "menuEnd";
76     case ax::mojom::Event::kMenuListValueChanged:
77       return "menuListValueChanged";
78     case ax::mojom::Event::kMenuPopupEnd:
79       return "menuPopupEnd";
80     case ax::mojom::Event::kMenuPopupStart:
81       return "menuPopupStart";
82     case ax::mojom::Event::kMenuStart:
83       return "menuStart";
84     case ax::mojom::Event::kMouseCanceled:
85       return "mouseCanceled";
86     case ax::mojom::Event::kMouseDragged:
87       return "mouseDragged";
88     case ax::mojom::Event::kMouseMoved:
89       return "mouseMoved";
90     case ax::mojom::Event::kMousePressed:
91       return "mousePressed";
92     case ax::mojom::Event::kMouseReleased:
93       return "mouseReleased";
94     case ax::mojom::Event::kRowCollapsed:
95       return "rowCollapsed";
96     case ax::mojom::Event::kRowCountChanged:
97       return "rowCountChanged";
98     case ax::mojom::Event::kRowExpanded:
99       return "rowExpanded";
100     case ax::mojom::Event::kScrollPositionChanged:
101       return "scrollPositionChanged";
102     case ax::mojom::Event::kScrolledToAnchor:
103       return "scrolledToAnchor";
104     case ax::mojom::Event::kSelectedChildrenChanged:
105       return "selectedChildrenChanged";
106     case ax::mojom::Event::kSelection:
107       return "selection";
108     case ax::mojom::Event::kSelectionAdd:
109       return "selectionAdd";
110     case ax::mojom::Event::kSelectionRemove:
111       return "selectionRemove";
112     case ax::mojom::Event::kShow:
113       return "show";
114     case ax::mojom::Event::kStateChanged:
115       return "stateChanged";
116     case ax::mojom::Event::kTextChanged:
117       return "textChanged";
118     case ax::mojom::Event::kTextSelectionChanged:
119       return "textSelectionChanged";
120     case ax::mojom::Event::kTooltipClosed:
121       return "tooltipClosed";
122     case ax::mojom::Event::kTooltipOpened:
123       return "tooltipOpened";
124     case ax::mojom::Event::kTreeChanged:
125       return "treeChanged";
126     case ax::mojom::Event::kValueChanged:
127       return "valueChanged";
128     case ax::mojom::Event::kWindowActivated:
129       return "windowActivated";
130     case ax::mojom::Event::kWindowDeactivated:
131       return "windowDeactivated";
132     case ax::mojom::Event::kWindowVisibilityChanged:
133       return "windowVisibilityChanged";
134   }
135 
136   return "";
137 }
138 
ToString(ax::mojom::Role role)139 const char* ToString(ax::mojom::Role role) {
140   switch (role) {
141     case ax::mojom::Role::kNone:
142       return "none";
143     case ax::mojom::Role::kAbbr:
144       return "abbr";
145     case ax::mojom::Role::kAlertDialog:
146       return "alertDialog";
147     case ax::mojom::Role::kAlert:
148       return "alert";
149     case ax::mojom::Role::kAnchor:
150       return "anchor";
151     case ax::mojom::Role::kApplication:
152       return "application";
153     case ax::mojom::Role::kArticle:
154       return "article";
155     case ax::mojom::Role::kAudio:
156       return "audio";
157     case ax::mojom::Role::kBanner:
158       return "banner";
159     case ax::mojom::Role::kBlockquote:
160       return "blockquote";
161     case ax::mojom::Role::kButton:
162       return "button";
163     case ax::mojom::Role::kCanvas:
164       return "canvas";
165     case ax::mojom::Role::kCaption:
166       return "caption";
167     case ax::mojom::Role::kCaret:
168       return "caret";
169     case ax::mojom::Role::kCell:
170       return "cell";
171     case ax::mojom::Role::kCheckBox:
172       return "checkBox";
173     case ax::mojom::Role::kClient:
174       return "client";
175     case ax::mojom::Role::kCode:
176       return "code";
177     case ax::mojom::Role::kColorWell:
178       return "colorWell";
179     case ax::mojom::Role::kColumnHeader:
180       return "columnHeader";
181     case ax::mojom::Role::kColumn:
182       return "column";
183     case ax::mojom::Role::kComboBoxGrouping:
184       return "comboBoxGrouping";
185     case ax::mojom::Role::kComboBoxMenuButton:
186       return "comboBoxMenuButton";
187     case ax::mojom::Role::kComment:
188       return "comment";
189     case ax::mojom::Role::kComplementary:
190       return "complementary";
191     case ax::mojom::Role::kContentDeletion:
192       return "contentDeletion";
193     case ax::mojom::Role::kContentInsertion:
194       return "contentInsertion";
195     case ax::mojom::Role::kContentInfo:
196       return "contentInfo";
197     case ax::mojom::Role::kDate:
198       return "date";
199     case ax::mojom::Role::kDateTime:
200       return "dateTime";
201     case ax::mojom::Role::kDefinition:
202       return "definition";
203     case ax::mojom::Role::kDescriptionListDetail:
204       return "descriptionListDetail";
205     case ax::mojom::Role::kDescriptionList:
206       return "descriptionList";
207     case ax::mojom::Role::kDescriptionListTerm:
208       return "descriptionListTerm";
209     case ax::mojom::Role::kDesktop:
210       return "desktop";
211     case ax::mojom::Role::kDetails:
212       return "details";
213     case ax::mojom::Role::kDialog:
214       return "dialog";
215     case ax::mojom::Role::kDirectory:
216       return "directory";
217     case ax::mojom::Role::kDisclosureTriangle:
218       return "disclosureTriangle";
219     case ax::mojom::Role::kDocAbstract:
220       return "docAbstract";
221     case ax::mojom::Role::kDocAcknowledgments:
222       return "docAcknowledgments";
223     case ax::mojom::Role::kDocAfterword:
224       return "docAfterword";
225     case ax::mojom::Role::kDocAppendix:
226       return "docAppendix";
227     case ax::mojom::Role::kDocBackLink:
228       return "docBackLink";
229     case ax::mojom::Role::kDocBiblioEntry:
230       return "docBiblioEntry";
231     case ax::mojom::Role::kDocBibliography:
232       return "docBibliography";
233     case ax::mojom::Role::kDocBiblioRef:
234       return "docBiblioRef";
235     case ax::mojom::Role::kDocChapter:
236       return "docChapter";
237     case ax::mojom::Role::kDocColophon:
238       return "docColophon";
239     case ax::mojom::Role::kDocConclusion:
240       return "docConclusion";
241     case ax::mojom::Role::kDocCover:
242       return "docCover";
243     case ax::mojom::Role::kDocCredit:
244       return "docCredit";
245     case ax::mojom::Role::kDocCredits:
246       return "docCredits";
247     case ax::mojom::Role::kDocDedication:
248       return "docDedication";
249     case ax::mojom::Role::kDocEndnote:
250       return "docEndnote";
251     case ax::mojom::Role::kDocEndnotes:
252       return "docEndnotes";
253     case ax::mojom::Role::kDocEpigraph:
254       return "docEpigraph";
255     case ax::mojom::Role::kDocEpilogue:
256       return "docEpilogue";
257     case ax::mojom::Role::kDocErrata:
258       return "docErrata";
259     case ax::mojom::Role::kDocExample:
260       return "docExample";
261     case ax::mojom::Role::kDocFootnote:
262       return "docFootnote";
263     case ax::mojom::Role::kDocForeword:
264       return "docForeword";
265     case ax::mojom::Role::kDocGlossary:
266       return "docGlossary";
267     case ax::mojom::Role::kDocGlossRef:
268       return "docGlossref";
269     case ax::mojom::Role::kDocIndex:
270       return "docIndex";
271     case ax::mojom::Role::kDocIntroduction:
272       return "docIntroduction";
273     case ax::mojom::Role::kDocNoteRef:
274       return "docNoteRef";
275     case ax::mojom::Role::kDocNotice:
276       return "docNotice";
277     case ax::mojom::Role::kDocPageBreak:
278       return "docPageBreak";
279     case ax::mojom::Role::kDocPageFooter:
280       return "docPageFooter";
281     case ax::mojom::Role::kDocPageHeader:
282       return "docPageHeader";
283     case ax::mojom::Role::kDocPageList:
284       return "docPageList";
285     case ax::mojom::Role::kDocPart:
286       return "docPart";
287     case ax::mojom::Role::kDocPreface:
288       return "docPreface";
289     case ax::mojom::Role::kDocPrologue:
290       return "docPrologue";
291     case ax::mojom::Role::kDocPullquote:
292       return "docPullquote";
293     case ax::mojom::Role::kDocQna:
294       return "docQna";
295     case ax::mojom::Role::kDocSubtitle:
296       return "docSubtitle";
297     case ax::mojom::Role::kDocTip:
298       return "docTip";
299     case ax::mojom::Role::kDocToc:
300       return "docToc";
301     case ax::mojom::Role::kDocument:
302       return "document";
303     case ax::mojom::Role::kEmbeddedObject:
304       return "embeddedObject";
305     case ax::mojom::Role::kEmphasis:
306       return "emphasis";
307     case ax::mojom::Role::kFeed:
308       return "feed";
309     case ax::mojom::Role::kFigcaption:
310       return "figcaption";
311     case ax::mojom::Role::kFigure:
312       return "figure";
313     case ax::mojom::Role::kFooter:
314       return "footer";
315     case ax::mojom::Role::kFooterAsNonLandmark:
316       return "footerAsNonLandmark";
317     case ax::mojom::Role::kForm:
318       return "form";
319     case ax::mojom::Role::kGenericContainer:
320       return "genericContainer";
321     case ax::mojom::Role::kGraphicsDocument:
322       return "graphicsDocument";
323     case ax::mojom::Role::kGraphicsObject:
324       return "graphicsObject";
325     case ax::mojom::Role::kGraphicsSymbol:
326       return "graphicsSymbol";
327     case ax::mojom::Role::kGrid:
328       return "grid";
329     case ax::mojom::Role::kGroup:
330       return "group";
331     case ax::mojom::Role::kHeader:
332       return "header";
333     case ax::mojom::Role::kHeaderAsNonLandmark:
334       return "headerAsNonLandmark";
335     case ax::mojom::Role::kHeading:
336       return "heading";
337     case ax::mojom::Role::kIframe:
338       return "iframe";
339     case ax::mojom::Role::kIframePresentational:
340       return "iframePresentational";
341     case ax::mojom::Role::kIgnored:
342       return "ignored";
343     case ax::mojom::Role::kImageMap:
344       return "imageMap";
345     case ax::mojom::Role::kImage:
346       return "image";
347     case ax::mojom::Role::kImeCandidate:
348       return "imeCandidate";
349     case ax::mojom::Role::kInlineTextBox:
350       return "inlineTextBox";
351     case ax::mojom::Role::kInputTime:
352       return "inputTime";
353     case ax::mojom::Role::kKeyboard:
354       return "keyboard";
355     case ax::mojom::Role::kLabelText:
356       return "labelText";
357     case ax::mojom::Role::kLayoutTable:
358       return "layoutTable";
359     case ax::mojom::Role::kLayoutTableCell:
360       return "layoutTableCell";
361     case ax::mojom::Role::kLayoutTableRow:
362       return "layoutTableRow";
363     case ax::mojom::Role::kLegend:
364       return "legend";
365     case ax::mojom::Role::kLineBreak:
366       return "lineBreak";
367     case ax::mojom::Role::kLink:
368       return "link";
369     case ax::mojom::Role::kList:
370       return "list";
371     case ax::mojom::Role::kListBoxOption:
372       return "listBoxOption";
373     case ax::mojom::Role::kListBox:
374       return "listBox";
375     case ax::mojom::Role::kListGrid:
376       return "listGrid";
377     case ax::mojom::Role::kListItem:
378       return "listItem";
379     case ax::mojom::Role::kListMarker:
380       return "listMarker";
381     case ax::mojom::Role::kLog:
382       return "log";
383     case ax::mojom::Role::kMain:
384       return "main";
385     case ax::mojom::Role::kMark:
386       return "mark";
387     case ax::mojom::Role::kMarquee:
388       return "marquee";
389     case ax::mojom::Role::kMath:
390       return "math";
391     case ax::mojom::Role::kMenu:
392       return "menu";
393     case ax::mojom::Role::kMenuBar:
394       return "menuBar";
395     case ax::mojom::Role::kMenuItem:
396       return "menuItem";
397     case ax::mojom::Role::kMenuItemCheckBox:
398       return "menuItemCheckBox";
399     case ax::mojom::Role::kMenuItemRadio:
400       return "menuItemRadio";
401     case ax::mojom::Role::kMenuListOption:
402       return "menuListOption";
403     case ax::mojom::Role::kMenuListPopup:
404       return "menuListPopup";
405     case ax::mojom::Role::kMeter:
406       return "meter";
407     case ax::mojom::Role::kNavigation:
408       return "navigation";
409     case ax::mojom::Role::kNote:
410       return "note";
411     case ax::mojom::Role::kPane:
412       return "pane";
413     case ax::mojom::Role::kParagraph:
414       return "paragraph";
415     case ax::mojom::Role::kPdfActionableHighlight:
416       return "pdfActionableHighlight";
417     case ax::mojom::Role::kPluginObject:
418       return "pluginObject";
419     case ax::mojom::Role::kPopUpButton:
420       return "popUpButton";
421     case ax::mojom::Role::kPortal:
422       return "portal";
423     case ax::mojom::Role::kPre:
424       return "pre";
425     case ax::mojom::Role::kPresentational:
426       return "presentational";
427     case ax::mojom::Role::kProgressIndicator:
428       return "progressIndicator";
429     case ax::mojom::Role::kRadioButton:
430       return "radioButton";
431     case ax::mojom::Role::kRadioGroup:
432       return "radioGroup";
433     case ax::mojom::Role::kRegion:
434       return "region";
435     case ax::mojom::Role::kRootWebArea:
436       return "rootWebArea";
437     case ax::mojom::Role::kRow:
438       return "row";
439     case ax::mojom::Role::kRowGroup:
440       return "rowGroup";
441     case ax::mojom::Role::kRowHeader:
442       return "rowHeader";
443     case ax::mojom::Role::kRuby:
444       return "ruby";
445     case ax::mojom::Role::kRubyAnnotation:
446       return "rubyAnnotation";
447     case ax::mojom::Role::kSection:
448       return "section";
449     case ax::mojom::Role::kStrong:
450       return "strong";
451     case ax::mojom::Role::kSuggestion:
452       return "suggestion";
453     case ax::mojom::Role::kSvgRoot:
454       return "svgRoot";
455     case ax::mojom::Role::kScrollBar:
456       return "scrollBar";
457     case ax::mojom::Role::kScrollView:
458       return "scrollView";
459     case ax::mojom::Role::kSearch:
460       return "search";
461     case ax::mojom::Role::kSearchBox:
462       return "searchBox";
463     case ax::mojom::Role::kSlider:
464       return "slider";
465     case ax::mojom::Role::kSliderThumb:
466       return "sliderThumb";
467     case ax::mojom::Role::kSpinButton:
468       return "spinButton";
469     case ax::mojom::Role::kSplitter:
470       return "splitter";
471     case ax::mojom::Role::kStaticText:
472       return "staticText";
473     case ax::mojom::Role::kStatus:
474       return "status";
475     case ax::mojom::Role::kSwitch:
476       return "switch";
477     case ax::mojom::Role::kTabList:
478       return "tabList";
479     case ax::mojom::Role::kTabPanel:
480       return "tabPanel";
481     case ax::mojom::Role::kTab:
482       return "tab";
483     case ax::mojom::Role::kTable:
484       return "table";
485     case ax::mojom::Role::kTableHeaderContainer:
486       return "tableHeaderContainer";
487     case ax::mojom::Role::kTerm:
488       return "term";
489     case ax::mojom::Role::kTextField:
490       return "textField";
491     case ax::mojom::Role::kTextFieldWithComboBox:
492       return "textFieldWithComboBox";
493     case ax::mojom::Role::kTime:
494       return "time";
495     case ax::mojom::Role::kTimer:
496       return "timer";
497     case ax::mojom::Role::kTitleBar:
498       return "titleBar";
499     case ax::mojom::Role::kToggleButton:
500       return "toggleButton";
501     case ax::mojom::Role::kToolbar:
502       return "toolbar";
503     case ax::mojom::Role::kTreeGrid:
504       return "treeGrid";
505     case ax::mojom::Role::kTreeItem:
506       return "treeItem";
507     case ax::mojom::Role::kTree:
508       return "tree";
509     case ax::mojom::Role::kUnknown:
510       return "unknown";
511     case ax::mojom::Role::kTooltip:
512       return "tooltip";
513     case ax::mojom::Role::kVideo:
514       return "video";
515     case ax::mojom::Role::kWebArea:
516       return "webArea";
517     case ax::mojom::Role::kWebView:
518       return "webView";
519     case ax::mojom::Role::kWindow:
520       return "window";
521   }
522 
523   return "";
524 }
525 
ToString(ax::mojom::State state)526 const char* ToString(ax::mojom::State state) {
527   switch (state) {
528     case ax::mojom::State::kNone:
529       return "none";
530     case ax::mojom::State::kAutofillAvailable:
531       return "autofillAvailable";
532     case ax::mojom::State::kCollapsed:
533       return "collapsed";
534     case ax::mojom::State::kDefault:
535       return "default";
536     case ax::mojom::State::kEditable:
537       return "editable";
538     case ax::mojom::State::kExpanded:
539       return "expanded";
540     case ax::mojom::State::kFocusable:
541       return "focusable";
542     case ax::mojom::State::kHorizontal:
543       return "horizontal";
544     case ax::mojom::State::kHovered:
545       return "hovered";
546     case ax::mojom::State::kIgnored:
547       return "ignored";
548     case ax::mojom::State::kInvisible:
549       return "invisible";
550     case ax::mojom::State::kLinked:
551       return "linked";
552     case ax::mojom::State::kMultiline:
553       return "multiline";
554     case ax::mojom::State::kMultiselectable:
555       return "multiselectable";
556     case ax::mojom::State::kProtected:
557       return "protected";
558     case ax::mojom::State::kRequired:
559       return "required";
560     case ax::mojom::State::kRichlyEditable:
561       return "richlyEditable";
562     case ax::mojom::State::kVertical:
563       return "vertical";
564     case ax::mojom::State::kVisited:
565       return "visited";
566   }
567 
568   return "";
569 }
570 
ToString(ax::mojom::Action action)571 const char* ToString(ax::mojom::Action action) {
572   switch (action) {
573     case ax::mojom::Action::kNone:
574       return "none";
575     case ax::mojom::Action::kBlur:
576       return "blur";
577     case ax::mojom::Action::kClearAccessibilityFocus:
578       return "clearAccessibilityFocus";
579     case ax::mojom::Action::kCollapse:
580       return "collapse";
581     case ax::mojom::Action::kCustomAction:
582       return "customAction";
583     case ax::mojom::Action::kDecrement:
584       return "decrement";
585     case ax::mojom::Action::kDoDefault:
586       return "doDefault";
587     case ax::mojom::Action::kExpand:
588       return "expand";
589     case ax::mojom::Action::kFocus:
590       return "focus";
591     case ax::mojom::Action::kGetImageData:
592       return "getImageData";
593     case ax::mojom::Action::kHitTest:
594       return "hitTest";
595     case ax::mojom::Action::kIncrement:
596       return "increment";
597     case ax::mojom::Action::kLoadInlineTextBoxes:
598       return "loadInlineTextBoxes";
599     case ax::mojom::Action::kReplaceSelectedText:
600       return "replaceSelectedText";
601     case ax::mojom::Action::kScrollBackward:
602       return "scrollBackward";
603     case ax::mojom::Action::kScrollForward:
604       return "scrollForward";
605     case ax::mojom::Action::kScrollUp:
606       return "scrollUp";
607     case ax::mojom::Action::kScrollDown:
608       return "scrollDown";
609     case ax::mojom::Action::kScrollLeft:
610       return "scrollLeft";
611     case ax::mojom::Action::kScrollRight:
612       return "scrollRight";
613     case ax::mojom::Action::kScrollToMakeVisible:
614       return "scrollToMakeVisible";
615     case ax::mojom::Action::kScrollToPoint:
616       return "scrollToPoint";
617     case ax::mojom::Action::kSetAccessibilityFocus:
618       return "setAccessibilityFocus";
619     case ax::mojom::Action::kSetScrollOffset:
620       return "setScrollOffset";
621     case ax::mojom::Action::kSetSelection:
622       return "setSelection";
623     case ax::mojom::Action::kSetSequentialFocusNavigationStartingPoint:
624       return "setSequentialFocusNavigationStartingPoint";
625     case ax::mojom::Action::kSetValue:
626       return "setValue";
627     case ax::mojom::Action::kShowContextMenu:
628       return "showContextMenu";
629     case ax::mojom::Action::kGetTextLocation:
630       return "getTextLocation";
631     case ax::mojom::Action::kAnnotatePageImages:
632       return "annotatePageImages";
633     case ax::mojom::Action::kSignalEndOfTest:
634       return "signalEndOfTest";
635     case ax::mojom::Action::kShowTooltip:
636       return "showTooltip";
637     case ax::mojom::Action::kHideTooltip:
638       return "hideTooltip";
639     case ax::mojom::Action::kInternalInvalidateTree:
640       return "internalInvalidateTree";
641   }
642 
643   return "";
644 }
645 
ToString(ax::mojom::ActionFlags action_flags)646 const char* ToString(ax::mojom::ActionFlags action_flags) {
647   switch (action_flags) {
648     case ax::mojom::ActionFlags::kNone:
649       return "none";
650     case ax::mojom::ActionFlags::kRequestImages:
651       return "requestImages";
652     case ax::mojom::ActionFlags::kRequestInlineTextBoxes:
653       return "requestInlineTextBoxes";
654   }
655 
656   return "";
657 }
658 
ToString(ax::mojom::ScrollAlignment scroll_alignment)659 const char* ToString(ax::mojom::ScrollAlignment scroll_alignment) {
660   switch (scroll_alignment) {
661     case ax::mojom::ScrollAlignment::kNone:
662       return "none";
663     case ax::mojom::ScrollAlignment::kScrollAlignmentCenter:
664       return "scrollAlignmentCenter";
665     case ax::mojom::ScrollAlignment::kScrollAlignmentTop:
666       return "scrollAlignmentTop";
667     case ax::mojom::ScrollAlignment::kScrollAlignmentBottom:
668       return "scrollAlignmentBottom";
669     case ax::mojom::ScrollAlignment::kScrollAlignmentLeft:
670       return "scrollAlignmentLeft";
671     case ax::mojom::ScrollAlignment::kScrollAlignmentRight:
672       return "scrollAlignmentRight";
673     case ax::mojom::ScrollAlignment::kScrollAlignmentClosestEdge:
674       return "scrollAlignmentClosestEdge";
675   }
676 }
677 
ToString(ax::mojom::DefaultActionVerb default_action_verb)678 const char* ToString(ax::mojom::DefaultActionVerb default_action_verb) {
679   switch (default_action_verb) {
680     case ax::mojom::DefaultActionVerb::kNone:
681       return "none";
682     case ax::mojom::DefaultActionVerb::kActivate:
683       return "activate";
684     case ax::mojom::DefaultActionVerb::kCheck:
685       return "check";
686     case ax::mojom::DefaultActionVerb::kClick:
687       return "click";
688     case ax::mojom::DefaultActionVerb::kClickAncestor:
689       // Some screen readers, such as Jaws, expect the following spelling of
690       // this verb.
691       return "clickAncestor";
692     case ax::mojom::DefaultActionVerb::kJump:
693       return "jump";
694     case ax::mojom::DefaultActionVerb::kOpen:
695       return "open";
696     case ax::mojom::DefaultActionVerb::kPress:
697       return "press";
698     case ax::mojom::DefaultActionVerb::kSelect:
699       return "select";
700     case ax::mojom::DefaultActionVerb::kUncheck:
701       return "uncheck";
702   }
703 
704   return "";
705 }
706 
ToLocalizedString(ax::mojom::DefaultActionVerb action_verb)707 std::string ToLocalizedString(ax::mojom::DefaultActionVerb action_verb) {
708   switch (action_verb) {
709     case ax::mojom::DefaultActionVerb::kNone:
710       return "";
711     case ax::mojom::DefaultActionVerb::kActivate:
712       return l10n_util::GetStringUTF8(IDS_AX_ACTIVATE_ACTION_VERB);
713     case ax::mojom::DefaultActionVerb::kCheck:
714       return l10n_util::GetStringUTF8(IDS_AX_CHECK_ACTION_VERB);
715     case ax::mojom::DefaultActionVerb::kClick:
716       return l10n_util::GetStringUTF8(IDS_AX_CLICK_ACTION_VERB);
717     case ax::mojom::DefaultActionVerb::kClickAncestor:
718       return l10n_util::GetStringUTF8(IDS_AX_CLICK_ANCESTOR_ACTION_VERB);
719     case ax::mojom::DefaultActionVerb::kJump:
720       return l10n_util::GetStringUTF8(IDS_AX_JUMP_ACTION_VERB);
721     case ax::mojom::DefaultActionVerb::kOpen:
722       return l10n_util::GetStringUTF8(IDS_AX_OPEN_ACTION_VERB);
723     case ax::mojom::DefaultActionVerb::kPress:
724       return l10n_util::GetStringUTF8(IDS_AX_PRESS_ACTION_VERB);
725     case ax::mojom::DefaultActionVerb::kSelect:
726       return l10n_util::GetStringUTF8(IDS_AX_SELECT_ACTION_VERB);
727     case ax::mojom::DefaultActionVerb::kUncheck:
728       return l10n_util::GetStringUTF8(IDS_AX_UNCHECK_ACTION_VERB);
729   }
730 
731   return "";
732 }
733 
ToString(ax::mojom::Mutation mutation)734 const char* ToString(ax::mojom::Mutation mutation) {
735   switch (mutation) {
736     case ax::mojom::Mutation::kNone:
737       return "none";
738     case ax::mojom::Mutation::kNodeCreated:
739       return "nodeCreated";
740     case ax::mojom::Mutation::kSubtreeCreated:
741       return "subtreeCreated";
742     case ax::mojom::Mutation::kNodeChanged:
743       return "nodeChanged";
744     case ax::mojom::Mutation::kNodeRemoved:
745       return "nodeRemoved";
746   }
747 
748   return "";
749 }
750 
ToString(ax::mojom::StringAttribute string_attribute)751 const char* ToString(ax::mojom::StringAttribute string_attribute) {
752   switch (string_attribute) {
753     case ax::mojom::StringAttribute::kNone:
754       return "none";
755     case ax::mojom::StringAttribute::kAccessKey:
756       return "accessKey";
757     case ax::mojom::StringAttribute::kAriaInvalidValue:
758       return "ariaInvalidValue";
759     case ax::mojom::StringAttribute::kAutoComplete:
760       return "autoComplete";
761     case ax::mojom::StringAttribute::kCheckedStateDescription:
762       return "checkedStateDescription";
763     case ax::mojom::StringAttribute::kChildTreeId:
764       return "childTreeId";
765     case ax::mojom::StringAttribute::kClassName:
766       return "className";
767     case ax::mojom::StringAttribute::kContainerLiveRelevant:
768       return "containerLiveRelevant";
769     case ax::mojom::StringAttribute::kContainerLiveStatus:
770       return "containerLiveStatus";
771     case ax::mojom::StringAttribute::kDescription:
772       return "description";
773     case ax::mojom::StringAttribute::kDisplay:
774       return "display";
775     case ax::mojom::StringAttribute::kFontFamily:
776       return "fontFamily";
777     case ax::mojom::StringAttribute::kHtmlTag:
778       return "htmlTag";
779     case ax::mojom::StringAttribute::kImageAnnotation:
780       return "imageAnnotation";
781     case ax::mojom::StringAttribute::kImageDataUrl:
782       return "imageDataUrl";
783     case ax::mojom::StringAttribute::kInnerHtml:
784       return "innerHtml";
785     case ax::mojom::StringAttribute::kInputType:
786       return "inputType";
787     case ax::mojom::StringAttribute::kKeyShortcuts:
788       return "keyShortcuts";
789     case ax::mojom::StringAttribute::kLanguage:
790       return "language";
791     case ax::mojom::StringAttribute::kName:
792       return "name";
793     case ax::mojom::StringAttribute::kLiveRelevant:
794       return "liveRelevant";
795     case ax::mojom::StringAttribute::kLiveStatus:
796       return "liveStatus";
797     case ax::mojom::StringAttribute::kPlaceholder:
798       return "placeholder";
799     case ax::mojom::StringAttribute::kRole:
800       return "role";
801     case ax::mojom::StringAttribute::kRoleDescription:
802       return "roleDescription";
803     case ax::mojom::StringAttribute::kTooltip:
804       return "tooltip";
805     case ax::mojom::StringAttribute::kUrl:
806       return "url";
807     case ax::mojom::StringAttribute::kValue:
808       return "value";
809   }
810 
811   return "";
812 }
813 
ToString(ax::mojom::IntAttribute int_attribute)814 const char* ToString(ax::mojom::IntAttribute int_attribute) {
815   switch (int_attribute) {
816     case ax::mojom::IntAttribute::kNone:
817       return "none";
818     case ax::mojom::IntAttribute::kDefaultActionVerb:
819       return "defaultActionVerb";
820     case ax::mojom::IntAttribute::kDropeffect:
821       return "dropeffect";
822     case ax::mojom::IntAttribute::kScrollX:
823       return "scrollX";
824     case ax::mojom::IntAttribute::kScrollXMin:
825       return "scrollXMin";
826     case ax::mojom::IntAttribute::kScrollXMax:
827       return "scrollXMax";
828     case ax::mojom::IntAttribute::kScrollY:
829       return "scrollY";
830     case ax::mojom::IntAttribute::kScrollYMin:
831       return "scrollYMin";
832     case ax::mojom::IntAttribute::kScrollYMax:
833       return "scrollYMax";
834     case ax::mojom::IntAttribute::kTextSelStart:
835       return "textSelStart";
836     case ax::mojom::IntAttribute::kTextSelEnd:
837       return "textSelEnd";
838     case ax::mojom::IntAttribute::kAriaColumnCount:
839       return "ariaColumnCount";
840     case ax::mojom::IntAttribute::kAriaCellColumnIndex:
841       return "ariaCellColumnIndex";
842     case ax::mojom::IntAttribute::kAriaCellColumnSpan:
843       return "ariaCellColumnSpan";
844     case ax::mojom::IntAttribute::kAriaRowCount:
845       return "ariaRowCount";
846     case ax::mojom::IntAttribute::kAriaCellRowIndex:
847       return "ariaCellRowIndex";
848     case ax::mojom::IntAttribute::kAriaCellRowSpan:
849       return "ariaCellRowSpan";
850     case ax::mojom::IntAttribute::kTableRowCount:
851       return "tableRowCount";
852     case ax::mojom::IntAttribute::kTableColumnCount:
853       return "tableColumnCount";
854     case ax::mojom::IntAttribute::kTableHeaderId:
855       return "tableHeaderId";
856     case ax::mojom::IntAttribute::kTableRowIndex:
857       return "tableRowIndex";
858     case ax::mojom::IntAttribute::kTableRowHeaderId:
859       return "tableRowHeaderId";
860     case ax::mojom::IntAttribute::kTableColumnIndex:
861       return "tableColumnIndex";
862     case ax::mojom::IntAttribute::kTableColumnHeaderId:
863       return "tableColumnHeaderId";
864     case ax::mojom::IntAttribute::kTableCellColumnIndex:
865       return "tableCellColumnIndex";
866     case ax::mojom::IntAttribute::kTableCellColumnSpan:
867       return "tableCellColumnSpan";
868     case ax::mojom::IntAttribute::kTableCellRowIndex:
869       return "tableCellRowIndex";
870     case ax::mojom::IntAttribute::kTableCellRowSpan:
871       return "tableCellRowSpan";
872     case ax::mojom::IntAttribute::kSortDirection:
873       return "sortDirection";
874     case ax::mojom::IntAttribute::kHierarchicalLevel:
875       return "hierarchicalLevel";
876     case ax::mojom::IntAttribute::kNameFrom:
877       return "nameFrom";
878     case ax::mojom::IntAttribute::kDescriptionFrom:
879       return "descriptionFrom";
880     case ax::mojom::IntAttribute::kActivedescendantId:
881       return "activedescendantId";
882     case ax::mojom::IntAttribute::kErrormessageId:
883       return "errormessageId";
884     case ax::mojom::IntAttribute::kInPageLinkTargetId:
885       return "inPageLinkTargetId";
886     case ax::mojom::IntAttribute::kMemberOfId:
887       return "memberOfId";
888     case ax::mojom::IntAttribute::kNextOnLineId:
889       return "nextOnLineId";
890     case ax::mojom::IntAttribute::kPopupForId:
891       return "popupForId";
892     case ax::mojom::IntAttribute::kPreviousOnLineId:
893       return "previousOnLineId";
894     case ax::mojom::IntAttribute::kRestriction:
895       return "restriction";
896     case ax::mojom::IntAttribute::kSetSize:
897       return "setSize";
898     case ax::mojom::IntAttribute::kPosInSet:
899       return "posInSet";
900     case ax::mojom::IntAttribute::kColorValue:
901       return "colorValue";
902     case ax::mojom::IntAttribute::kAriaCurrentState:
903       return "ariaCurrentState";
904     case ax::mojom::IntAttribute::kBackgroundColor:
905       return "backgroundColor";
906     case ax::mojom::IntAttribute::kColor:
907       return "color";
908     case ax::mojom::IntAttribute::kHasPopup:
909       return "haspopup";
910     case ax::mojom::IntAttribute::kInvalidState:
911       return "invalidState";
912     case ax::mojom::IntAttribute::kCheckedState:
913       return "checkedState";
914     case ax::mojom::IntAttribute::kListStyle:
915       return "listStyle";
916     case ax::mojom::IntAttribute::kTextAlign:
917       return "text-align";
918     case ax::mojom::IntAttribute::kTextDirection:
919       return "textDirection";
920     case ax::mojom::IntAttribute::kTextPosition:
921       return "textPosition";
922     case ax::mojom::IntAttribute::kTextStyle:
923       return "textStyle";
924     case ax::mojom::IntAttribute::kTextOverlineStyle:
925       return "textOverlineStyle";
926     case ax::mojom::IntAttribute::kTextStrikethroughStyle:
927       return "textStrikethroughStyle";
928     case ax::mojom::IntAttribute::kTextUnderlineStyle:
929       return "textUnderlineStyle";
930     case ax::mojom::IntAttribute::kPreviousFocusId:
931       return "previousFocusId";
932     case ax::mojom::IntAttribute::kNextFocusId:
933       return "nextFocusId";
934     case ax::mojom::IntAttribute::kImageAnnotationStatus:
935       return "imageAnnotationStatus";
936     case ax::mojom::IntAttribute::kDOMNodeId:
937       return "domNodeId";
938   }
939 
940   return "";
941 }
942 
ToString(ax::mojom::FloatAttribute float_attribute)943 const char* ToString(ax::mojom::FloatAttribute float_attribute) {
944   switch (float_attribute) {
945     case ax::mojom::FloatAttribute::kNone:
946       return "none";
947     case ax::mojom::FloatAttribute::kValueForRange:
948       return "valueForRange";
949     case ax::mojom::FloatAttribute::kMinValueForRange:
950       return "minValueForRange";
951     case ax::mojom::FloatAttribute::kMaxValueForRange:
952       return "maxValueForRange";
953     case ax::mojom::FloatAttribute::kStepValueForRange:
954       return "stepValueForRange";
955     case ax::mojom::FloatAttribute::kFontSize:
956       return "fontSize";
957     case ax::mojom::FloatAttribute::kFontWeight:
958       return "fontWeight";
959     case ax::mojom::FloatAttribute::kTextIndent:
960       return "textIndent";
961   }
962 
963   return "";
964 }
965 
ToString(ax::mojom::BoolAttribute bool_attribute)966 const char* ToString(ax::mojom::BoolAttribute bool_attribute) {
967   switch (bool_attribute) {
968     case ax::mojom::BoolAttribute::kNone:
969       return "none";
970     case ax::mojom::BoolAttribute::kBusy:
971       return "busy";
972     case ax::mojom::BoolAttribute::kEditableRoot:
973       return "editableRoot";
974     case ax::mojom::BoolAttribute::kContainerLiveAtomic:
975       return "containerLiveAtomic";
976     case ax::mojom::BoolAttribute::kContainerLiveBusy:
977       return "containerLiveBusy";
978     case ax::mojom::BoolAttribute::kGrabbed:
979       return "grabbed";
980     case ax::mojom::BoolAttribute::kLiveAtomic:
981       return "liveAtomic";
982     case ax::mojom::BoolAttribute::kModal:
983       return "modal";
984     case ax::mojom::BoolAttribute::kUpdateLocationOnly:
985       return "updateLocationOnly";
986     case ax::mojom::BoolAttribute::kCanvasHasFallback:
987       return "canvasHasFallback";
988     case ax::mojom::BoolAttribute::kScrollable:
989       return "scrollable";
990     case ax::mojom::BoolAttribute::kClickable:
991       return "clickable";
992     case ax::mojom::BoolAttribute::kClipsChildren:
993       return "clipsChildren";
994     case ax::mojom::BoolAttribute::kNotUserSelectableStyle:
995       return "notUserSelectableStyle";
996     case ax::mojom::BoolAttribute::kSelected:
997       return "selected";
998     case ax::mojom::BoolAttribute::kSelectedFromFocus:
999       return "selectedFromFocus";
1000     case ax::mojom::BoolAttribute::kSupportsTextLocation:
1001       return "supportsTextLocation";
1002     case ax::mojom::BoolAttribute::kIsLineBreakingObject:
1003       return "isLineBreakingObject";
1004     case ax::mojom::BoolAttribute::kIsPageBreakingObject:
1005       return "isPageBreakingObject";
1006     case ax::mojom::BoolAttribute::kHasAriaAttribute:
1007       return "hasAriaAttribute";
1008   }
1009 
1010   return "";
1011 }
1012 
ToString(ax::mojom::IntListAttribute int_list_attribute)1013 const char* ToString(ax::mojom::IntListAttribute int_list_attribute) {
1014   switch (int_list_attribute) {
1015     case ax::mojom::IntListAttribute::kNone:
1016       return "none";
1017     case ax::mojom::IntListAttribute::kIndirectChildIds:
1018       return "indirectChildIds";
1019     case ax::mojom::IntListAttribute::kControlsIds:
1020       return "controlsIds";
1021     case ax::mojom::IntListAttribute::kDetailsIds:
1022       return "detailsIds";
1023     case ax::mojom::IntListAttribute::kDescribedbyIds:
1024       return "describedbyIds";
1025     case ax::mojom::IntListAttribute::kFlowtoIds:
1026       return "flowtoIds";
1027     case ax::mojom::IntListAttribute::kLabelledbyIds:
1028       return "labelledbyIds";
1029     case ax::mojom::IntListAttribute::kRadioGroupIds:
1030       return "radioGroupIds";
1031     case ax::mojom::IntListAttribute::kMarkerTypes:
1032       return "markerTypes";
1033     case ax::mojom::IntListAttribute::kMarkerStarts:
1034       return "markerStarts";
1035     case ax::mojom::IntListAttribute::kMarkerEnds:
1036       return "markerEnds";
1037     case ax::mojom::IntListAttribute::kCharacterOffsets:
1038       return "characterOffsets";
1039     case ax::mojom::IntListAttribute::kCachedLineStarts:
1040       return "cachedLineStarts";
1041     case ax::mojom::IntListAttribute::kWordStarts:
1042       return "wordStarts";
1043     case ax::mojom::IntListAttribute::kWordEnds:
1044       return "wordEnds";
1045     case ax::mojom::IntListAttribute::kCustomActionIds:
1046       return "customActionIds";
1047   }
1048 
1049   return "";
1050 }
1051 
ToString(ax::mojom::StringListAttribute string_list_attribute)1052 const char* ToString(ax::mojom::StringListAttribute string_list_attribute) {
1053   switch (string_list_attribute) {
1054     case ax::mojom::StringListAttribute::kNone:
1055       return "none";
1056     case ax::mojom::StringListAttribute::kCustomActionDescriptions:
1057       return "customActionDescriptions";
1058   }
1059 
1060   return "";
1061 }
1062 
ToString(ax::mojom::ListStyle list_style)1063 const char* ToString(ax::mojom::ListStyle list_style) {
1064   switch (list_style) {
1065     case ax::mojom::ListStyle::kNone:
1066       return "none";
1067     case ax::mojom::ListStyle::kCircle:
1068       return "circle";
1069     case ax::mojom::ListStyle::kDisc:
1070       return "disc";
1071     case ax::mojom::ListStyle::kImage:
1072       return "image";
1073     case ax::mojom::ListStyle::kNumeric:
1074       return "numeric";
1075     case ax::mojom::ListStyle::kOther:
1076       return "other";
1077     case ax::mojom::ListStyle::kSquare:
1078       return "square";
1079   }
1080 
1081   return "";
1082 }
1083 
ToString(ax::mojom::MarkerType marker_type)1084 const char* ToString(ax::mojom::MarkerType marker_type) {
1085   switch (marker_type) {
1086     case ax::mojom::MarkerType::kNone:
1087       return "none";
1088     case ax::mojom::MarkerType::kSpelling:
1089       return "spelling";
1090     case ax::mojom::MarkerType::kGrammar:
1091       return "grammar";
1092     case ax::mojom::MarkerType::kTextMatch:
1093       return "textMatch";
1094     case ax::mojom::MarkerType::kActiveSuggestion:
1095       return "activeSuggestion";
1096     case ax::mojom::MarkerType::kSuggestion:
1097       return "suggestion";
1098   }
1099 
1100   return "";
1101 }
1102 
ToString(ax::mojom::MoveDirection move_direction)1103 const char* ToString(ax::mojom::MoveDirection move_direction) {
1104   switch (move_direction) {
1105     case ax::mojom::MoveDirection::kNone:
1106       return "none";
1107     case ax::mojom::MoveDirection::kBackward:
1108       return "backward";
1109     case ax::mojom::MoveDirection::kForward:
1110       return "forward";
1111   }
1112 
1113   return "";
1114 }
1115 
ToString(ax::mojom::Command command)1116 const char* ToString(ax::mojom::Command command) {
1117   switch (command) {
1118     case ax::mojom::Command::kNone:
1119       return "none";
1120     case ax::mojom::Command::kClearSelection:
1121       return "clearSelection";
1122     case ax::mojom::Command::kDelete:
1123       return "delete";
1124     case ax::mojom::Command::kDictate:
1125       return "dictate";
1126     case ax::mojom::Command::kExtendSelection:
1127       return "extendSelection";
1128     case ax::mojom::Command::kFormat:
1129       return "format";
1130     case ax::mojom::Command::kHistory:
1131       return "history";
1132     case ax::mojom::Command::kInsert:
1133       return "insert";
1134     case ax::mojom::Command::kMarker:
1135       return "marker";
1136     case ax::mojom::Command::kMoveSelection:
1137       return "moveSelection";
1138     case ax::mojom::Command::kSetSelection:
1139       return "setSelection";
1140   }
1141 
1142   return "";
1143 }
1144 
ToString(ax::mojom::InputEventType input_event_type)1145 const char* ToString(ax::mojom::InputEventType input_event_type) {
1146   switch (input_event_type) {
1147     case ax::mojom::InputEventType::kNone:
1148       return "none";
1149     case ax::mojom::InputEventType::kInsertText:
1150       return "insertText";
1151     case ax::mojom::InputEventType::kInsertLineBreak:
1152       return "insertLineBreak";
1153     case ax::mojom::InputEventType::kInsertParagraph:
1154       return "insertParagraph";
1155     case ax::mojom::InputEventType::kInsertOrderedList:
1156       return "insertOrderedList";
1157     case ax::mojom::InputEventType::kInsertUnorderedList:
1158       return "insertUnorderedList";
1159     case ax::mojom::InputEventType::kInsertHorizontalRule:
1160       return "insertHorizontalRule";
1161     case ax::mojom::InputEventType::kInsertFromPaste:
1162       return "insertFromPaste";
1163     case ax::mojom::InputEventType::kInsertFromDrop:
1164       return "insertFromDrop";
1165     case ax::mojom::InputEventType::kInsertFromYank:
1166       return "insertFromYank";
1167     case ax::mojom::InputEventType::kInsertTranspose:
1168       return "insertTranspose";
1169     case ax::mojom::InputEventType::kInsertReplacementText:
1170       return "insertReplacementText";
1171     case ax::mojom::InputEventType::kInsertCompositionText:
1172       return "insertCompositionText";
1173     case ax::mojom::InputEventType::kDeleteWordBackward:
1174       return "deleteWordBackward";
1175     case ax::mojom::InputEventType::kDeleteWordForward:
1176       return "deleteWordForward";
1177     case ax::mojom::InputEventType::kDeleteSoftLineBackward:
1178       return "deleteSoftLineBackward";
1179     case ax::mojom::InputEventType::kDeleteSoftLineForward:
1180       return "deleteSoftLineForward";
1181     case ax::mojom::InputEventType::kDeleteHardLineBackward:
1182       return "deleteHardLineBackward";
1183     case ax::mojom::InputEventType::kDeleteHardLineForward:
1184       return "deleteHardLineForward";
1185     case ax::mojom::InputEventType::kDeleteContentBackward:
1186       return "deleteContentBackward";
1187     case ax::mojom::InputEventType::kDeleteContentForward:
1188       return "deleteContentForward";
1189     case ax::mojom::InputEventType::kDeleteByCut:
1190       return "deleteByCut";
1191     case ax::mojom::InputEventType::kDeleteByDrag:
1192       return "deleteByDrag";
1193     case ax::mojom::InputEventType::kHistoryUndo:
1194       return "historyUndo";
1195     case ax::mojom::InputEventType::kHistoryRedo:
1196       return "historyRedo";
1197     case ax::mojom::InputEventType::kFormatBold:
1198       return "formatBold";
1199     case ax::mojom::InputEventType::kFormatItalic:
1200       return "formatItalic";
1201     case ax::mojom::InputEventType::kFormatUnderline:
1202       return "formatUnderline";
1203     case ax::mojom::InputEventType::kFormatStrikeThrough:
1204       return "formatStrikeThrough";
1205     case ax::mojom::InputEventType::kFormatSuperscript:
1206       return "formatSuperscript";
1207     case ax::mojom::InputEventType::kFormatSubscript:
1208       return "formatSubscript";
1209     case ax::mojom::InputEventType::kFormatJustifyCenter:
1210       return "formatJustifyCenter";
1211     case ax::mojom::InputEventType::kFormatJustifyFull:
1212       return "formatJustifyFull";
1213     case ax::mojom::InputEventType::kFormatJustifyRight:
1214       return "formatJustifyRight";
1215     case ax::mojom::InputEventType::kFormatJustifyLeft:
1216       return "formatJustifyLeft";
1217     case ax::mojom::InputEventType::kFormatIndent:
1218       return "formatIndent";
1219     case ax::mojom::InputEventType::kFormatOutdent:
1220       return "formatOutdent";
1221     case ax::mojom::InputEventType::kFormatRemove:
1222       return "formatRemove";
1223     case ax::mojom::InputEventType::kFormatSetBlockTextDirection:
1224       return "formatSetBlockTextDirection";
1225   }
1226 
1227   return "";
1228 }
1229 
ToString(ax::mojom::TextBoundary text_boundary)1230 const char* ToString(ax::mojom::TextBoundary text_boundary) {
1231   switch (text_boundary) {
1232     case ax::mojom::TextBoundary::kNone:
1233       return "none";
1234     case ax::mojom::TextBoundary::kCharacter:
1235       return "character";
1236     case ax::mojom::TextBoundary::kFormat:
1237       return "format";
1238     case ax::mojom::TextBoundary::kLineEnd:
1239       return "lineEnd";
1240     case ax::mojom::TextBoundary::kLineStart:
1241       return "lineStart";
1242     case ax::mojom::TextBoundary::kLineStartOrEnd:
1243       return "lineStartOrEnd";
1244     case ax::mojom::TextBoundary::kObject:
1245       return "object";
1246     case ax::mojom::TextBoundary::kPageEnd:
1247       return "pageEnd";
1248     case ax::mojom::TextBoundary::kPageStart:
1249       return "pageStart";
1250     case ax::mojom::TextBoundary::kPageStartOrEnd:
1251       return "pageStartOrEnd";
1252     case ax::mojom::TextBoundary::kParagraphEnd:
1253       return "paragraphEnd";
1254     case ax::mojom::TextBoundary::kParagraphStart:
1255       return "paragraphStart";
1256     case ax::mojom::TextBoundary::kParagraphStartOrEnd:
1257       return "paragraphStartOrEnd";
1258     case ax::mojom::TextBoundary::kSentenceEnd:
1259       return "sentenceEnd";
1260     case ax::mojom::TextBoundary::kSentenceStart:
1261       return "sentenceStart";
1262     case ax::mojom::TextBoundary::kSentenceStartOrEnd:
1263       return "sentenceStartOrEnd";
1264     case ax::mojom::TextBoundary::kWebPage:
1265       return "webPage";
1266     case ax::mojom::TextBoundary::kWordEnd:
1267       return "wordEnd";
1268     case ax::mojom::TextBoundary::kWordStart:
1269       return "wordStart";
1270     case ax::mojom::TextBoundary::kWordStartOrEnd:
1271       return "wordStartOrEnd";
1272   }
1273 
1274   return "";
1275 }
1276 
ToString(ax::mojom::TextAlign text_align)1277 const char* ToString(ax::mojom::TextAlign text_align) {
1278   switch (text_align) {
1279     case ax::mojom::TextAlign::kNone:
1280       return "none";
1281     case ax::mojom::TextAlign::kLeft:
1282       return "left";
1283     case ax::mojom::TextAlign::kRight:
1284       return "right";
1285     case ax::mojom::TextAlign::kCenter:
1286       return "center";
1287     case ax::mojom::TextAlign::kJustify:
1288       return "justify";
1289   }
1290 
1291   return "";
1292 }
1293 
ToString(ax::mojom::WritingDirection writing_direction)1294 const char* ToString(ax::mojom::WritingDirection writing_direction) {
1295   switch (writing_direction) {
1296     case ax::mojom::WritingDirection::kNone:
1297       return "none";
1298     case ax::mojom::WritingDirection::kLtr:
1299       return "ltr";
1300     case ax::mojom::WritingDirection::kRtl:
1301       return "rtl";
1302     case ax::mojom::WritingDirection::kTtb:
1303       return "ttb";
1304     case ax::mojom::WritingDirection::kBtt:
1305       return "btt";
1306   }
1307 
1308   return "";
1309 }
1310 
ToString(ax::mojom::TextPosition text_position)1311 const char* ToString(ax::mojom::TextPosition text_position) {
1312   switch (text_position) {
1313     case ax::mojom::TextPosition::kNone:
1314       return "none";
1315     case ax::mojom::TextPosition::kSubscript:
1316       return "subscript";
1317     case ax::mojom::TextPosition::kSuperscript:
1318       return "superscript";
1319   }
1320 
1321   return "";
1322 }
1323 
ToString(ax::mojom::TextStyle text_style)1324 const char* ToString(ax::mojom::TextStyle text_style) {
1325   switch (text_style) {
1326     case ax::mojom::TextStyle::kNone:
1327       return "none";
1328     case ax::mojom::TextStyle::kBold:
1329       return "bold";
1330     case ax::mojom::TextStyle::kItalic:
1331       return "italic";
1332     case ax::mojom::TextStyle::kUnderline:
1333       return "underline";
1334     case ax::mojom::TextStyle::kLineThrough:
1335       return "lineThrough";
1336     case ax::mojom::TextStyle::kOverline:
1337       return "overline";
1338   }
1339 
1340   return "";
1341 }
1342 
ToString(ax::mojom::TextDecorationStyle text_decoration_style)1343 const char* ToString(ax::mojom::TextDecorationStyle text_decoration_style) {
1344   switch (text_decoration_style) {
1345     case ax::mojom::TextDecorationStyle::kNone:
1346       return "none";
1347     case ax::mojom::TextDecorationStyle::kSolid:
1348       return "solid";
1349     case ax::mojom::TextDecorationStyle::kDashed:
1350       return "dashed";
1351     case ax::mojom::TextDecorationStyle::kDotted:
1352       return "dotted";
1353     case ax::mojom::TextDecorationStyle::kDouble:
1354       return "double";
1355     case ax::mojom::TextDecorationStyle::kWavy:
1356       return "wavy";
1357   }
1358 
1359   return "";
1360 }
1361 
ToString(ax::mojom::AriaCurrentState aria_current_state)1362 const char* ToString(ax::mojom::AriaCurrentState aria_current_state) {
1363   switch (aria_current_state) {
1364     case ax::mojom::AriaCurrentState::kNone:
1365       return "none";
1366     case ax::mojom::AriaCurrentState::kFalse:
1367       return "false";
1368     case ax::mojom::AriaCurrentState::kTrue:
1369       return "true";
1370     case ax::mojom::AriaCurrentState::kPage:
1371       return "page";
1372     case ax::mojom::AriaCurrentState::kStep:
1373       return "step";
1374     case ax::mojom::AriaCurrentState::kLocation:
1375       return "location";
1376     case ax::mojom::AriaCurrentState::kUnclippedLocation:
1377       return "unclippedLocation";
1378     case ax::mojom::AriaCurrentState::kDate:
1379       return "date";
1380     case ax::mojom::AriaCurrentState::kTime:
1381       return "time";
1382   }
1383 
1384   return "";
1385 }
1386 
ToString(ax::mojom::HasPopup has_popup)1387 const char* ToString(ax::mojom::HasPopup has_popup) {
1388   switch (has_popup) {
1389     case ax::mojom::HasPopup::kFalse:
1390       return "";
1391     case ax::mojom::HasPopup::kTrue:
1392       return "true";
1393     case ax::mojom::HasPopup::kMenu:
1394       return "menu";
1395     case ax::mojom::HasPopup::kListbox:
1396       return "listbox";
1397     case ax::mojom::HasPopup::kTree:
1398       return "tree";
1399     case ax::mojom::HasPopup::kGrid:
1400       return "grid";
1401     case ax::mojom::HasPopup::kDialog:
1402       return "dialog";
1403   }
1404 
1405   return "";
1406 }
1407 
ToString(ax::mojom::InvalidState invalid_state)1408 const char* ToString(ax::mojom::InvalidState invalid_state) {
1409   switch (invalid_state) {
1410     case ax::mojom::InvalidState::kNone:
1411       return "none";
1412     case ax::mojom::InvalidState::kFalse:
1413       return "false";
1414     case ax::mojom::InvalidState::kTrue:
1415       return "true";
1416     case ax::mojom::InvalidState::kOther:
1417       return "other";
1418   }
1419 
1420   return "";
1421 }
1422 
ToString(ax::mojom::Restriction restriction)1423 const char* ToString(ax::mojom::Restriction restriction) {
1424   switch (restriction) {
1425     case ax::mojom::Restriction::kNone:
1426       return "none";
1427     case ax::mojom::Restriction::kReadOnly:
1428       return "readOnly";
1429     case ax::mojom::Restriction::kDisabled:
1430       return "disabled";
1431   }
1432 
1433   return "";
1434 }
1435 
ToString(ax::mojom::CheckedState checked_state)1436 const char* ToString(ax::mojom::CheckedState checked_state) {
1437   switch (checked_state) {
1438     case ax::mojom::CheckedState::kNone:
1439       return "none";
1440     case ax::mojom::CheckedState::kFalse:
1441       return "false";
1442     case ax::mojom::CheckedState::kTrue:
1443       return "true";
1444     case ax::mojom::CheckedState::kMixed:
1445       return "mixed";
1446   }
1447 
1448   return "";
1449 }
1450 
ToString(ax::mojom::SortDirection sort_direction)1451 const char* ToString(ax::mojom::SortDirection sort_direction) {
1452   switch (sort_direction) {
1453     case ax::mojom::SortDirection::kNone:
1454       return "none";
1455     case ax::mojom::SortDirection::kUnsorted:
1456       return "unsorted";
1457     case ax::mojom::SortDirection::kAscending:
1458       return "ascending";
1459     case ax::mojom::SortDirection::kDescending:
1460       return "descending";
1461     case ax::mojom::SortDirection::kOther:
1462       return "other";
1463   }
1464 
1465   return "";
1466 }
1467 
ToString(ax::mojom::NameFrom name_from)1468 const char* ToString(ax::mojom::NameFrom name_from) {
1469   switch (name_from) {
1470     case ax::mojom::NameFrom::kNone:
1471       return "none";
1472     case ax::mojom::NameFrom::kUninitialized:
1473       return "uninitialized";
1474     case ax::mojom::NameFrom::kAttribute:
1475       return "attribute";
1476     case ax::mojom::NameFrom::kAttributeExplicitlyEmpty:
1477       return "attributeExplicitlyEmpty";
1478     case ax::mojom::NameFrom::kCaption:
1479       return "caption";
1480     case ax::mojom::NameFrom::kContents:
1481       return "contents";
1482     case ax::mojom::NameFrom::kPlaceholder:
1483       return "placeholder";
1484     case ax::mojom::NameFrom::kRelatedElement:
1485       return "relatedElement";
1486     case ax::mojom::NameFrom::kTitle:
1487       return "title";
1488     case ax::mojom::NameFrom::kValue:
1489       return "value";
1490   }
1491 
1492   return "";
1493 }
1494 
ToString(ax::mojom::DescriptionFrom description_from)1495 const char* ToString(ax::mojom::DescriptionFrom description_from) {
1496   switch (description_from) {
1497     case ax::mojom::DescriptionFrom::kNone:
1498       return "none";
1499     case ax::mojom::DescriptionFrom::kUninitialized:
1500       return "uninitialized";
1501     case ax::mojom::DescriptionFrom::kAttribute:
1502       return "attribute";
1503     case ax::mojom::DescriptionFrom::kContents:
1504       return "contents";
1505     case ax::mojom::DescriptionFrom::kRelatedElement:
1506       return "relatedElement";
1507     case ax::mojom::DescriptionFrom::kTitle:
1508       return "title";
1509   }
1510 
1511   return "";
1512 }
1513 
ToString(ax::mojom::EventFrom event_from)1514 const char* ToString(ax::mojom::EventFrom event_from) {
1515   switch (event_from) {
1516     case ax::mojom::EventFrom::kNone:
1517       return "none";
1518     case ax::mojom::EventFrom::kUser:
1519       return "user";
1520     case ax::mojom::EventFrom::kPage:
1521       return "page";
1522     case ax::mojom::EventFrom::kAction:
1523       return "action";
1524   }
1525 
1526   return "";
1527 }
1528 
ToString(ax::mojom::Gesture gesture)1529 const char* ToString(ax::mojom::Gesture gesture) {
1530   switch (gesture) {
1531     case ax::mojom::Gesture::kNone:
1532       return "none";
1533     case ax::mojom::Gesture::kClick:
1534       return "click";
1535     case ax::mojom::Gesture::kSwipeLeft1:
1536       return "swipeLeft1";
1537     case ax::mojom::Gesture::kSwipeUp1:
1538       return "swipeUp1";
1539     case ax::mojom::Gesture::kSwipeRight1:
1540       return "swipeRight1";
1541     case ax::mojom::Gesture::kSwipeDown1:
1542       return "swipeDown1";
1543     case ax::mojom::Gesture::kSwipeLeft2:
1544       return "swipeLeft2";
1545     case ax::mojom::Gesture::kSwipeUp2:
1546       return "swipeUp2";
1547     case ax::mojom::Gesture::kSwipeRight2:
1548       return "swipeRight2";
1549     case ax::mojom::Gesture::kSwipeDown2:
1550       return "swipeDown2";
1551     case ax::mojom::Gesture::kSwipeLeft3:
1552       return "swipeLeft3";
1553     case ax::mojom::Gesture::kSwipeUp3:
1554       return "swipeUp3";
1555     case ax::mojom::Gesture::kSwipeRight3:
1556       return "swipeRight3";
1557     case ax::mojom::Gesture::kSwipeDown3:
1558       return "swipeDown3";
1559     case ax::mojom::Gesture::kSwipeLeft4:
1560       return "swipeLeft4";
1561     case ax::mojom::Gesture::kSwipeUp4:
1562       return "swipeUp4";
1563     case ax::mojom::Gesture::kSwipeRight4:
1564       return "swipeRight4";
1565     case ax::mojom::Gesture::kSwipeDown4:
1566       return "swipeDown4";
1567     case ax::mojom::Gesture::kTap2:
1568       return "tap2";
1569     case ax::mojom::Gesture::kTap3:
1570       return "tap3";
1571     case ax::mojom::Gesture::kTap4:
1572       return "tap4";
1573     case ax::mojom::Gesture::kTouchExplore:
1574       return "touchExplore";
1575   }
1576 
1577   return "";
1578 }
1579 
ToString(ax::mojom::TextAffinity text_affinity)1580 const char* ToString(ax::mojom::TextAffinity text_affinity) {
1581   switch (text_affinity) {
1582     case ax::mojom::TextAffinity::kNone:
1583       return "none";
1584     case ax::mojom::TextAffinity::kDownstream:
1585       return "downstream";
1586     case ax::mojom::TextAffinity::kUpstream:
1587       return "upstream";
1588   }
1589 
1590   return "";
1591 }
1592 
ToString(ax::mojom::TreeOrder tree_order)1593 const char* ToString(ax::mojom::TreeOrder tree_order) {
1594   switch (tree_order) {
1595     case ax::mojom::TreeOrder::kNone:
1596       return "none";
1597     case ax::mojom::TreeOrder::kUndefined:
1598       return "undefined";
1599     case ax::mojom::TreeOrder::kBefore:
1600       return "before";
1601     case ax::mojom::TreeOrder::kEqual:
1602       return "equal";
1603     case ax::mojom::TreeOrder::kAfter:
1604       return "after";
1605   }
1606 
1607   return "";
1608 }
1609 
ToString(ax::mojom::ImageAnnotationStatus status)1610 const char* ToString(ax::mojom::ImageAnnotationStatus status) {
1611   switch (status) {
1612     case ax::mojom::ImageAnnotationStatus::kNone:
1613       return "none";
1614     case ax::mojom::ImageAnnotationStatus::kWillNotAnnotateDueToScheme:
1615       return "kWillNotAnnotateDueToScheme";
1616     case ax::mojom::ImageAnnotationStatus::kIneligibleForAnnotation:
1617       return "ineligibleForAnnotation";
1618     case ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation:
1619       return "eligibleForAnnotation";
1620     case ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation:
1621       return "silentlyEligibleForAnnotation";
1622     case ax::mojom::ImageAnnotationStatus::kAnnotationPending:
1623       return "annotationPending";
1624     case ax::mojom::ImageAnnotationStatus::kAnnotationSucceeded:
1625       return "annotationSucceeded";
1626     case ax::mojom::ImageAnnotationStatus::kAnnotationEmpty:
1627       return "annotationEmpty";
1628     case ax::mojom::ImageAnnotationStatus::kAnnotationAdult:
1629       return "annotationAdult";
1630     case ax::mojom::ImageAnnotationStatus::kAnnotationProcessFailed:
1631       return "annotationProcessFailed";
1632   }
1633 
1634   return "";
1635 }
1636 
ToString(ax::mojom::Dropeffect dropeffect)1637 const char* ToString(ax::mojom::Dropeffect dropeffect) {
1638   switch (dropeffect) {
1639     case ax::mojom::Dropeffect::kCopy:
1640       return "copy";
1641     case ax::mojom::Dropeffect::kExecute:
1642       return "execute";
1643     case ax::mojom::Dropeffect::kLink:
1644       return "link";
1645     case ax::mojom::Dropeffect::kMove:
1646       return "move";
1647     case ax::mojom::Dropeffect::kPopup:
1648       return "popup";
1649     case ax::mojom::Dropeffect::kNone:
1650       return "none";
1651   }
1652 
1653   return "";
1654 }
1655 
1656 }  // namespace ui
1657