Chromium Code Reviews| Index: Source/modules/accessibility/AXObject.cpp |
| diff --git a/Source/modules/accessibility/AXObject.cpp b/Source/modules/accessibility/AXObject.cpp |
| index f696f1c97e1c2dc4200038f0c07a5e6e6e7c0779..ea33caa7cb139351dee002fd5979eefb39233082 100644 |
| --- a/Source/modules/accessibility/AXObject.cpp |
| +++ b/Source/modules/accessibility/AXObject.cpp |
| @@ -130,6 +130,142 @@ static ARIARoleMap* createARIARoleMap() |
| return roleMap; |
| } |
| +struct RoleNameEntry { |
| + AccessibilityRole webcoreRole; |
| + String roleName; |
| +}; |
| + |
| +static Vector<AtomicString>* createRoleNameVector() |
| +{ |
| + const RoleNameEntry roleNames[] = { |
| + { NoRole, "none" }, |
| + { AlertDialogRole, "alertDialog" }, |
| + { AlertRole, "alert" }, |
| + { AnnotationRole, "annotation" }, |
| + { ApplicationRole, "application" }, |
| + { ArticleRole, "article" }, |
| + { BannerRole, "banner" }, |
| + { BlockquoteRole, "blockquote" }, |
| + { BusyIndicatorRole, "busyIndicator" }, |
| + { ButtonRole, "button" }, |
| + { CanvasRole, "canvas" }, |
| + { CellRole, "cell" }, |
| + { CheckBoxRole, "checkBox" }, |
| + { ColorWellRole, "colorWell" }, |
| + { ColumnHeaderRole, "columnHeader" }, |
| + { ColumnRole, "column" }, |
| + { ComboBoxRole, "comboBox" }, |
| + { ComplementaryRole, "complementary" }, |
| + { ContentInfoRole, "contentInfo" }, |
| + { DateRole, "date" }, |
| + { DateTimeRole, "dateTime" }, |
| + { DefinitionRole, "definition" }, |
| + { DescriptionListDetailRole, "descriptionListDetail" }, |
| + { DescriptionListRole, "descriptionList" }, |
| + { DescriptionListTermRole, "descriptionListTerm" }, |
| + { DetailsRole, "details" }, |
| + { DialogRole, "dialog" }, |
| + { DirectoryRole, "directory" }, |
| + { DisclosureTriangleRole, "disclosureTriangle" }, |
| + { DivRole, "div" }, |
| + { DocumentRole, "document" }, |
| + { EditableTextRole, "editableText" }, |
|
dmazzoni
2014/12/03 23:32:13
I think the API is only supposed to return ARIA ro
aboxhall
2014/12/08 23:50:59
Haven't looked into this yet.
|
| + { EmbeddedObjectRole, "embeddedObject" }, |
| + { FigcaptionRole, "figcaption" }, |
| + { FigureRole, "figure" }, |
| + { FooterRole, "footer" }, |
| + { FormRole, "form" }, |
| + { GridRole, "grid" }, |
| + { GroupRole, "group" }, |
| + { GrowAreaRole, "growArea" }, |
| + { HeadingRole, "heading" }, |
| + { IframeRole, "iframe" }, |
| + { IgnoredRole, "ignored" }, |
| + { ImageMapLinkRole, "imageMapLink" }, |
| + { ImageMapRole, "imageMap" }, |
| + { ImageRole, "image" }, |
| + { InlineTextBoxRole, "inlineTextBox" }, |
| + { LabelRole, "label" }, |
| + { LegendRole, "legend" }, |
| + { LinkRole, "link" }, |
| + { ListBoxOptionRole, "listBoxOption" }, |
| + { ListBoxRole, "listBox" }, |
| + { ListItemRole, "listItem" }, |
| + { ListMarkerRole, "listMarker" }, |
| + { ListRole, "list" }, |
| + { LogRole, "log" }, |
| + { MainRole, "main" }, |
| + { MarqueeRole, "marquee" }, |
| + { MathElementRole, "mathElement" }, |
| + { MathRole, "math" }, |
| + { MenuBarRole, "menuBar" }, |
| + { MenuButtonRole, "menuButton" }, |
| + { MenuItemRole, "menuItem" }, |
| + { MenuItemCheckBoxRole, "menuItemCheckBox" }, |
| + { MenuItemRadioRole, "menuItemRadio" }, |
| + { MenuListOptionRole, "menuListOption" }, |
| + { MenuListPopupRole, "menuListPopup" }, |
| + { MenuRole, "menu" }, |
| + { MeterRole, "meter" }, |
| + { NavigationRole, "navigation" }, |
| + { NoneRole, "none" }, |
| + { NoteRole, "note" }, |
| + { OutlineRole, "outline" }, |
| + { ParagraphRole, "paragraph" }, |
| + { PopUpButtonRole, "popUpButton" }, |
| + { PreRole, "pre" }, |
| + { PresentationalRole, "presentational" }, |
| + { ProgressIndicatorRole, "progressIndicator" }, |
| + { RadioButtonRole, "radioButton" }, |
| + { RadioGroupRole, "radioGroup" }, |
| + { RegionRole, "region" }, |
| + { RootWebAreaRole, "rootWebArea" }, |
| + { RowHeaderRole, "rowHeader" }, |
| + { RowRole, "row" }, |
| + { RubyRole, "ruby" }, |
| + { RulerRole, "ruler" }, |
| + { SVGRootRole, "svgRoot" }, |
| + { ScrollAreaRole, "scrollArea" }, |
| + { ScrollBarRole, "scrollBar" }, |
| + { SeamlessWebAreaRole, "seamlessWebArea" }, |
| + { SearchRole, "search" }, |
| + { SliderRole, "slider" }, |
| + { SliderThumbRole, "sliderThumb" }, |
| + { SpinButtonPartRole, "spinButtonPart" }, |
| + { SpinButtonRole, "spinButton" }, |
| + { SplitGroupRole, "splitGroup" }, |
| + { SplitterRole, "splitter" }, |
| + { StaticTextRole, "staticText" }, |
| + { StatusRole, "status" }, |
| + { TabGroupRole, "tabGroup" }, |
| + { TabListRole, "tabList" }, |
| + { TabPanelRole, "tabPanel" }, |
| + { TabRole, "tab" }, |
| + { TableHeaderContainerRole, "tableHeaderContainer" }, |
| + { TableRole, "table" }, |
| + { TextAreaRole, "textArea" }, |
| + { TextFieldRole, "textField" }, |
| + { TimeRole, "time" }, |
| + { TimerRole, "timer" }, |
| + { ToggleButtonRole, "toggleButton" }, |
| + { ToolbarRole, "toolbar" }, |
| + { TreeGridRole, "treeGrid" }, |
| + { TreeItemRole, "treeItem" }, |
| + { TreeRole, "tree" }, |
| + { UnknownRole, "unknown" }, |
| + { UserInterfaceTooltipRole, "userInterfaceTooltip" }, |
| + { WebAreaRole, "webArea" }, |
| + { WindowRole, "window" } |
| + }; |
| + Vector<AtomicString>* roleNameVector = new Vector<AtomicString>(NumRoles); |
| + |
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(roleNames); ++i) { |
| + roleNameVector->insert(roleNames[i].webcoreRole, |
| + AtomicString(roleNames[i].roleName)); |
| + } |
| + return roleNameVector; |
| +} |
| + |
| AXObject::AXObject() |
| : m_id(0) |
| , m_haveChildren(false) |
| @@ -979,4 +1115,11 @@ AccessibilityRole AXObject::buttonRoleType() const |
| return ButtonRole; |
| } |
| +const AtomicString& AXObject::roleName(const AccessibilityRole role) |
| +{ |
| + static const Vector<AtomicString>* roleNameVector = createRoleNameVector(); |
| + |
| + return roleNameVector->at(role); |
| +} |
| + |
| } // namespace blink |