Chromium Code Reviews| Index: Source/modules/accessibility/AXObject.cpp |
| diff --git a/Source/modules/accessibility/AXObject.cpp b/Source/modules/accessibility/AXObject.cpp |
| index 2185677552cafc4a1ddf8fcd6c0d33562d30ccd3..ab78b65a05b074f463473a7c370d40175a4f4628 100644 |
| --- a/Source/modules/accessibility/AXObject.cpp |
| +++ b/Source/modules/accessibility/AXObject.cpp |
| @@ -130,7 +130,140 @@ static ARIARoleMap* createARIARoleMap() |
| return roleMap; |
| } |
| -AXObject::AXObject() |
| +struct RoleNameEntry { |
| + AccessibilityRole webcoreRole; |
| + String roleName; |
| +}; |
| + |
| +static Vector<AtomicString>* createRoleNameVector() |
| +{ |
| + const RoleNameEntry roleNames[] = { |
| + { NoRole, "none" }, |
|
dmazzoni
2014/12/09 00:49:51
Actually there is an ARIA role of "none" now, it m
aboxhall
2014/12/13 01:38:36
Good point, although I note it doesn't seem to wor
dmazzoni
2014/12/16 19:18:19
The spec here:
http://www.w3.org/TR/wai-aria-1.1/#
aboxhall
2014/12/16 23:56:37
Ah - I didn't look at the 1.1 spec.
As discussed
|
| + { 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" }, |
| + { EmbeddedObjectRole, "embeddedObject" }, |
| + { FigcaptionRole, "figcaption" }, |
| + { FigureRole, "figure" }, |
| + { FooterRole, "footer" }, |
| + { FormRole, "form" }, |
| + { GridRole, "grid" }, |
| + { GroupRole, "group" }, |
| + { 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" }, |
| + { 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(AXObjectCache* axObjectCache) |
| : m_id(0) |
| , m_haveChildren(false) |
| , m_role(UnknownRole) |
| @@ -140,6 +273,7 @@ AXObject::AXObject() |
| , m_lastModificationCount(-1) |
| , m_cachedIsIgnored(false) |
| , m_cachedLiveRegionRoot(0) |
| + , m_axObjectCache(toAXObjectCacheImpl(axObjectCache)) |
| { |
| } |
| @@ -164,10 +298,7 @@ bool AXObject::isDetached() const |
| AXObjectCacheImpl* AXObject::axObjectCache() const |
| { |
| - Document* doc = document(); |
| - if (doc) |
| - return toAXObjectCacheImpl(doc->axObjectCache()); |
| - return 0; |
| + return m_axObjectCache; |
| } |
| bool AXObject::isARIATextControl() const |
| @@ -978,4 +1109,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 |