Modernize AccessibilityObject.h
https://bugs.webkit.org/show_bug.cgi?id=178892

Reviewed by Tim Horton.

The enums in AccessibilityObject.h are causing naming collisions with unified builds.
This is what enum classes are for.
HashMaps of enum classes still need a few casts to/from int.
        
I also made some RefPtr's Ref's, use some initializer lists instead of values in the constructor implementation, and indentation fixing.
        
No change in behavior.

* accessibility/AXObjectCache.cpp:
(WebCore::AXComputedObjectAttributeCache::getIgnored const):
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::remove):
(WebCore::AXObjectCache::notificationPostTimerFired):
* accessibility/AXObjectCache.h:
(WebCore::AXComputedObjectAttributeCache::CachedAXObjectAttributes::CachedAXObjectAttributes):
(WebCore::AXComputedObjectAttributeCache::getIgnored const):
* accessibility/AccessibilityARIAGrid.cpp:
(WebCore::AccessibilityARIAGrid::addChildren):
* accessibility/AccessibilityARIAGridCell.cpp:
(WebCore::AccessibilityARIAGridCell::parentRowGroup const):
* accessibility/AccessibilityARIAGridRow.cpp:
(WebCore::AccessibilityARIAGridRow::headerObject):
* accessibility/AccessibilityAttachment.cpp:
(WebCore::AccessibilityAttachment::accessibilityText):
* accessibility/AccessibilityAttachment.h:
* accessibility/AccessibilityImageMapLink.cpp:
(WebCore::AccessibilityImageMapLink::roleValue const):
(WebCore::AccessibilityImageMapLink::accessibilityText):
* accessibility/AccessibilityLabel.cpp:
(WebCore::childrenContainOnlyStaticText):
* accessibility/AccessibilityLabel.h:
* accessibility/AccessibilityList.cpp:
(WebCore::AccessibilityList::isUnorderedList const):
(WebCore::AccessibilityList::isOrderedList const):
(WebCore::AccessibilityList::determineAccessibilityRole):
(WebCore::AccessibilityList::roleValue const):
* accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::setSelectedChildren):
(WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject const):
* accessibility/AccessibilityListBox.h:
* accessibility/AccessibilityListBoxOption.h:
* accessibility/AccessibilityMathMLElement.cpp:
(WebCore::AccessibilityMathMLElement::determineAccessibilityRole):
(WebCore::AccessibilityMathMLElement::isMathScriptObject const):
(WebCore::AccessibilityMathMLElement::isMathMultiscriptObject const):
* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaControl::accessibilityText):
(WebCore::AccessibilityMediaControl::roleValue const):
* accessibility/AccessibilityMediaControls.h:
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::addChildren):
* accessibility/AccessibilityMenuList.h:
* accessibility/AccessibilityMenuListOption.h:
* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject const):
* accessibility/AccessibilityMenuListPopup.h:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::AccessibilityNodeObject):
(WebCore::AccessibilityNodeObject::determineAccessibilityRole):
(WebCore::AccessibilityNodeObject::canHaveChildren const):
(WebCore::AccessibilityNodeObject::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityNodeObject::isSearchField const):
(WebCore::AccessibilityNodeObject::isImage const):
(WebCore::AccessibilityNodeObject::isPasswordField const):
(WebCore::AccessibilityNodeObject::isInputImage const):
(WebCore::AccessibilityNodeObject::isProgressIndicator const):
(WebCore::AccessibilityNodeObject::isSlider const):
(WebCore::AccessibilityNodeObject::isMenuRelated const):
(WebCore::AccessibilityNodeObject::isMenu const):
(WebCore::AccessibilityNodeObject::isMenuBar const):
(WebCore::AccessibilityNodeObject::isMenuButton const):
(WebCore::AccessibilityNodeObject::isMenuItem const):
(WebCore::AccessibilityNodeObject::isEnabled const):
(WebCore::AccessibilityNodeObject::isChecked const):
(WebCore::AccessibilityNodeObject::supportsRequiredAttribute const):
(WebCore::AccessibilityNodeObject::headingLevel const):
(WebCore::AccessibilityNodeObject::isHeading const):
(WebCore::AccessibilityNodeObject::isLink const):
(WebCore::AccessibilityNodeObject::isGroup const):
(WebCore::AccessibilityNodeObject::selectedRadioButton):
(WebCore::AccessibilityNodeObject::checkboxOrRadioValue const):
(WebCore::AccessibilityNodeObject::actionElement const):
(WebCore::AccessibilityNodeObject::alterSliderValue):
(WebCore::AccessibilityNodeObject::isGenericFocusableElement const):
(WebCore::AccessibilityNodeObject::menuElementForMenuButton const):
(WebCore::AccessibilityNodeObject::menuItemElementForMenu const):
(WebCore::AccessibilityNodeObject::titleElementText const):
(WebCore::AccessibilityNodeObject::alternativeText const):
(WebCore::AccessibilityNodeObject::visibleText const):
(WebCore::AccessibilityNodeObject::helpText const):
(WebCore::AccessibilityNodeObject::accessibilityText):
(WebCore::AccessibilityNodeObject::ariaLabeledByText const):
(WebCore::AccessibilityNodeObject::accessibilityDescription const):
(WebCore::AccessibilityNodeObject::roleIgnoresTitle const):
(WebCore::AccessibilityNodeObject::hierarchicalLevel const):
(WebCore::AccessibilityNodeObject::title const):
(WebCore::AccessibilityNodeObject::text const):
(WebCore::AccessibilityNodeObject::stringValue const):
(WebCore::AccessibilityNodeObject::determineAriaRoleAttribute const):
(WebCore::AccessibilityNodeObject::remapAriaRoleDueToParent const):
(WebCore::AccessibilityNodeObject::canSetSelectedAttribute const):
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::detach):
(WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
(WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
(WebCore::AccessibilityObject::isBlockquote const):
(WebCore::AccessibilityObject::isTextControl const):
(WebCore::AccessibilityObject::isARIATextControl const):
(WebCore::AccessibilityObject::isLandmark const):
(WebCore::AccessibilityObject::findMatchingObjects):
(WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const):
(WebCore::AccessibilityObject::selectText):
(WebCore::AccessibilityObject::isARIAInput):
(WebCore::AccessibilityObject::isARIAControl):
(WebCore::AccessibilityObject::isRangeControl const):
(WebCore::AccessibilityObject::visiblePositionForBounds const):
(WebCore::AccessibilityObject::supportsARIAReadOnly const):
(WebCore::AccessibilityObject::ariaReadOnlyValue const):
(WebCore::AccessibilityObject::headingElementForNode):
(WebCore::AccessibilityObject::ariaTreeRows):
(WebCore::AccessibilityObject::ariaTreeItemContent):
(WebCore::AccessibilityObject::ariaTreeItemDisclosedRows):
(WebCore::AccessibilityObject::defaultLiveRegionStatusForRole):
(WebCore::AccessibilityObject::actionVerb const):
(WebCore::AccessibilityObject::ariaCurrentState const):
(WebCore::AccessibilityObject::ariaCurrentValue const):
(WebCore::AccessibilityObject::orientation const):
(WebCore::initializeRoleMap):
(WebCore::AccessibilityObject::ariaRoleToWebCoreRole):
(WebCore::AccessibilityObject::computedRoleString const):
(WebCore::AccessibilityObject::supportsPressAction const):
(WebCore::AccessibilityObject::sortDirection const):
(WebCore::AccessibilityObject::supportsExpanded const):
(WebCore::AccessibilityObject::isExpanded const):
(WebCore::AccessibilityObject::supportsChecked const):
(WebCore::AccessibilityObject::checkboxOrRadioValue const):
(WebCore::AccessibilityObject::scrollByPage const):
(WebCore::AccessibilityObject::lastKnownIsIgnoredValue):
(WebCore::AccessibilityObject::setLastKnownIsIgnoredValue):
(WebCore::AccessibilityObject::buttonRoleType const):
(WebCore::AccessibilityObject::isButton const):
(WebCore::AccessibilityObject::accessibilityIsIgnoredByDefault const):
(WebCore::AccessibilityObject::defaultObjectInclusion const):
(WebCore::AccessibilityObject::accessibilityIsIgnored const):
(WebCore::AccessibilityObject::isContainedByPasswordField const):
(WebCore::AccessibilityObject::AccessibilityObject): Deleted.
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityText::AccessibilityText):
(WebCore::AccessibilityIsIgnoredFromParentData::AccessibilityIsIgnoredFromParentData):
(WebCore::AccessibilityObject::isImageMap const):
(WebCore::AccessibilityObject::isWebArea const):
(WebCore::AccessibilityObject::isCheckbox const):
(WebCore::AccessibilityObject::isRadioButton const):
(WebCore::AccessibilityObject::isListBox const):
(WebCore::AccessibilityObject::isSpinButton const):
(WebCore::AccessibilityObject::isSwitch const):
(WebCore::AccessibilityObject::isToggleButton const):
(WebCore::AccessibilityObject::isTabList const):
(WebCore::AccessibilityObject::isTabItem const):
(WebCore::AccessibilityObject::isRadioGroup const):
(WebCore::AccessibilityObject::isComboBox const):
(WebCore::AccessibilityObject::isTree const):
(WebCore::AccessibilityObject::isTreeGrid const):
(WebCore::AccessibilityObject::isTreeItem const):
(WebCore::AccessibilityObject::isScrollbar const):
(WebCore::AccessibilityObject::isListItem const):
(WebCore::AccessibilityObject::isScrollView const):
(WebCore::AccessibilityObject::isCanvas const):
(WebCore::AccessibilityObject::isPopUpButton const):
(WebCore::AccessibilityObject::isColorWell const):
(WebCore::AccessibilityObject::isSplitter const):
(WebCore::AccessibilityObject::isToolbar const):
(WebCore::AccessibilityObject::isSummary const):
(WebCore::AccessibilityObject::isStaticText const):
(WebCore::AccessibilityObject::ariaRoleAttribute const):
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
* accessibility/AccessibilityProgressIndicator.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::parentObject const):
(WebCore::AccessibilityRenderObject::isAttachment const):
(WebCore::AccessibilityRenderObject::helpText const):
(WebCore::AccessibilityRenderObject::stringValue const):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupChildren const):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers const):
(WebCore::AccessibilityRenderObject::linkedUIElements const):
(WebCore::AccessibilityRenderObject::isAllowedChildOfTree const):
(WebCore::objectInclusionFromAltText):
(WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityRenderObject::selectedTextRange const):
(WebCore::AccessibilityRenderObject::isTabItemSelected const):
(WebCore::AccessibilityRenderObject::isFocused const):
(WebCore::AccessibilityRenderObject::setSelectedRows):
(WebCore::AccessibilityRenderObject::getDocumentLinks):
(WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
(WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
(WebCore::AccessibilityRenderObject::supportsExpandedTextValue const):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
(WebCore::AccessibilityRenderObject::orientation const):
(WebCore::AccessibilityRenderObject::inheritsPresentationalRole const):
(WebCore::AccessibilityRenderObject::ariaRoleHasPresentationalChildren const):
(WebCore::AccessibilityRenderObject::canSetExpandedAttribute const):
(WebCore::AccessibilityRenderObject::addImageMapChildren):
(WebCore::AccessibilityRenderObject::addTextFieldChildren):
(WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
(WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic const):
(WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
(WebCore::AccessibilityRenderObject::ariaListboxSelectedChildren):
(WebCore::AccessibilityRenderObject::selectedChildren):
(WebCore::AccessibilityRenderObject::visibleChildren):
(WebCore::AccessibilityRenderObject::tabChildren):
(WebCore::AccessibilityRenderObject::actionVerb const):
(WebCore::msaaRoleForRenderer):
(WebCore::AccessibilityRenderObject::roleValueForMSAA const):
* accessibility/AccessibilitySVGElement.cpp:
(WebCore::AccessibilitySVGElement::accessibilityText):
(WebCore::AccessibilitySVGElement::computeAccessibilityIsIgnored const):
(WebCore::AccessibilitySVGElement::inheritsPresentationalRole const):
(WebCore::AccessibilitySVGElement::determineAriaRoleAttribute const):
(WebCore::AccessibilitySVGElement::determineAccessibilityRole):
* accessibility/AccessibilitySVGRoot.h:
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::scrollBar):
* accessibility/AccessibilityScrollView.h:
* accessibility/AccessibilityScrollbar.cpp:
(WebCore::AccessibilityScrollbar::orientation const):
* accessibility/AccessibilityScrollbar.h:
* accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::orientation const):
(WebCore::AccessibilitySlider::addChildren):
* accessibility/AccessibilitySlider.h:
* accessibility/AccessibilitySpinButton.cpp:
(WebCore::AccessibilitySpinButton::addChildren):
* accessibility/AccessibilitySpinButton.h:
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::hasARIARole const):
(WebCore::AccessibilityTable::addChildren):
(WebCore::AccessibilityTable::headerContainer):
(WebCore::AccessibilityTable::roleValue const):
(WebCore::AccessibilityTable::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityTable::titleElementText const):
* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityTableCell::determineAccessibilityRole):
* accessibility/AccessibilityTableColumn.cpp:
(WebCore::AccessibilityTableColumn::headerObject):
* accessibility/AccessibilityTableColumn.h:
* accessibility/AccessibilityTableHeaderContainer.h:
* accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::determineAccessibilityRole):
(WebCore::AccessibilityTableRow::computeAccessibilityIsIgnored const):
* accessibility/AccessibilityTree.cpp:
(WebCore::AccessibilityTree::determineAccessibilityRole):
* accessibility/ios/AccessibilityObjectIOS.mm:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
(WebCore::AccessibilityObject::isInputTypePopupButton const):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
(-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
(-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityListAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
(-[WebAccessibilityObjectWrapper _accessibilityTextEntryTraits]):
(-[WebAccessibilityObjectWrapper accessibilityTraits]):
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
(-[WebAccessibilityObjectWrapper stringValueShouldBeUsedInLabel]):
(-[WebAccessibilityObjectWrapper accessibilityLabel]):
(-[WebAccessibilityObjectWrapper accessibilityValue]):
(-[WebAccessibilityObjectWrapper accessibilityIsComboBox]):
(-[WebAccessibilityObjectWrapper containsUnnaturallySegmentedChildren]):
(-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
(-[WebAccessibilityObjectWrapper treeItemParentForObject:]):
(-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
(-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
(-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
(-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
(-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
(createAccessibilitySearchKeyMap):
(accessibilitySearchKeyForString):
(accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(accessibilitySelectTextCriteriaForCriteriaParameterizedAttribute):
(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(createAccessibilityRoleMap):
(roleValueToNSString):
(-[WebAccessibilityObjectWrapper role]):
(-[WebAccessibilityObjectWrapper subrole]):
(-[WebAccessibilityObjectWrapper roleDescription]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityPerformShowMenuAction]):
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@224074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
index 99f8538..2e27650 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
@@ -126,7 +126,7 @@
         // WebCore Accessibility should provide us with the text alternative computation
         // in the order defined by that spec. So take the first thing that our platform
         // does not expose via the AtkObject description.
-        if (text.textSource != HelpText && text.textSource != SummaryText)
+        if (text.textSource != AccessibilityTextSource::Help && text.textSource != AccessibilityTextSource::Summary)
             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, text.text);
     }
 
@@ -146,12 +146,12 @@
         // WebCore Accessibility should provide us with the text alternative computation
         // in the order defined by that spec. So take the first thing that our platform
         // does not expose via the AtkObject name.
-        if (text.textSource == HelpText || text.textSource == SummaryText)
+        if (text.textSource == AccessibilityTextSource::Help || text.textSource == AccessibilityTextSource::Summary)
             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
 
         // If there is no other text alternative, the title tag contents will have been
         // used for the AtkObject name. We don't want to duplicate it here.
-        if (text.textSource == TitleTagText && nameTextAvailable)
+        if (text.textSource == AccessibilityTextSource::TitleTag && nameTextAvailable)
             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
 
         nameTextAvailable = true;
@@ -185,7 +185,7 @@
     } else if (coreObject->isFieldset()) {
         if (AccessibilityObject* label = coreObject->titleUIElement())
             atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
-    } else if (coreObject->roleValue() == LegendRole) {
+    } else if (coreObject->roleValue() == AccessibilityRole::Legend) {
         if (RenderBlock* renderFieldset = ancestorsOfType<RenderBlock>(*coreObject->renderer()).first()) {
             if (renderFieldset->isFieldset()) {
                 AccessibilityObject* fieldset = coreObject->axObjectCache()->getOrCreate(renderFieldset);
@@ -455,10 +455,10 @@
         attributeSet = addToAtkAttributeSet(attributeSet, "level", value.utf8().data());
     }
 
-    if (coreObject->roleValue() == MathElementRole) {
-        if (coreObject->isMathMultiscriptObject(PreSuperscript) || coreObject->isMathMultiscriptObject(PreSubscript))
+    if (coreObject->roleValue() == AccessibilityRole::MathElement) {
+        if (coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSuperscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSubscript))
             attributeSet = addToAtkAttributeSet(attributeSet, "multiscript-type", "pre");
-        else if (coreObject->isMathMultiscriptObject(PostSuperscript) || coreObject->isMathMultiscriptObject(PostSubscript))
+        else if (coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSuperscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSubscript))
             attributeSet = addToAtkAttributeSet(attributeSet, "multiscript-type", "post");
     }
 
@@ -511,18 +511,18 @@
     // The Core AAM states that an explicitly-set value should be exposed, including "none".
     if (coreObject->hasAttribute(HTMLNames::aria_sortAttr)) {
         switch (coreObject->sortDirection()) {
-        case SortDirectionInvalid:
+        case AccessibilitySortDirection::Invalid:
             break;
-        case SortDirectionAscending:
+        case AccessibilitySortDirection::Ascending:
             attributeSet = addToAtkAttributeSet(attributeSet, "sort", "ascending");
             break;
-        case SortDirectionDescending:
+        case AccessibilitySortDirection::Descending:
             attributeSet = addToAtkAttributeSet(attributeSet, "sort", "descending");
             break;
-        case SortDirectionOther:
+        case AccessibilitySortDirection::Other:
             attributeSet = addToAtkAttributeSet(attributeSet, "sort", "other");
             break;
-        default:
+        case AccessibilitySortDirection::None:
             attributeSet = addToAtkAttributeSet(attributeSet, "sort", "none");
         }
     }
@@ -556,7 +556,7 @@
 
         // The HTML AAM maps several elements to ARIA landmark roles. In order for the type of landmark
         // to be obtainable in the same fashion as an ARIA landmark, fall back on the computedRoleString.
-        if (coreObject->ariaRoleAttribute() == UnknownRole && coreObject->isLandmark())
+        if (coreObject->ariaRoleAttribute() == AccessibilityRole::Unknown && coreObject->isLandmark())
             attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", computedRoleString.utf8().data());
     }
 
@@ -613,202 +613,202 @@
 {
     AccessibilityRole role = coreObject->roleValue();
     switch (role) {
-    case ApplicationAlertRole:
+    case AccessibilityRole::ApplicationAlert:
         return ATK_ROLE_ALERT;
-    case ApplicationAlertDialogRole:
-    case ApplicationDialogRole:
+    case AccessibilityRole::ApplicationAlertDialog:
+    case AccessibilityRole::ApplicationDialog:
         return ATK_ROLE_DIALOG;
-    case ApplicationStatusRole:
+    case AccessibilityRole::ApplicationStatus:
         return ATK_ROLE_STATUSBAR;
-    case UnknownRole:
+    case AccessibilityRole::Unknown:
         return ATK_ROLE_UNKNOWN;
-    case AudioRole:
+    case AccessibilityRole::Audio:
 #if ATK_CHECK_VERSION(2, 11, 3)
         return ATK_ROLE_AUDIO;
 #endif
-    case VideoRole:
+    case AccessibilityRole::Video:
 #if ATK_CHECK_VERSION(2, 11, 3)
         return ATK_ROLE_VIDEO;
 #endif
         return ATK_ROLE_EMBEDDED;
-    case ButtonRole:
+    case AccessibilityRole::Button:
         return ATK_ROLE_PUSH_BUTTON;
-    case SwitchRole:
-    case ToggleButtonRole:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::ToggleButton:
         return ATK_ROLE_TOGGLE_BUTTON;
-    case RadioButtonRole:
+    case AccessibilityRole::RadioButton:
         return ATK_ROLE_RADIO_BUTTON;
-    case CheckBoxRole:
+    case AccessibilityRole::CheckBox:
         return ATK_ROLE_CHECK_BOX;
-    case SliderRole:
+    case AccessibilityRole::Slider:
         return ATK_ROLE_SLIDER;
-    case TabGroupRole:
-    case TabListRole:
+    case AccessibilityRole::TabGroup:
+    case AccessibilityRole::TabList:
         return ATK_ROLE_PAGE_TAB_LIST;
-    case TextFieldRole:
-    case TextAreaRole:
-    case SearchFieldRole:
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::TextArea:
+    case AccessibilityRole::SearchField:
         return ATK_ROLE_ENTRY;
-    case StaticTextRole:
+    case AccessibilityRole::StaticText:
 #if ATK_CHECK_VERSION(2, 15, 2)
         return ATK_ROLE_STATIC;
 #else
         return ATK_ROLE_TEXT;
 #endif
-    case OutlineRole:
-    case TreeRole:
+    case AccessibilityRole::Outline:
+    case AccessibilityRole::Tree:
         return ATK_ROLE_TREE;
-    case TreeItemRole:
+    case AccessibilityRole::TreeItem:
         return ATK_ROLE_TREE_ITEM;
-    case MenuBarRole:
+    case AccessibilityRole::MenuBar:
         return ATK_ROLE_MENU_BAR;
-    case MenuListPopupRole:
-    case MenuRole:
+    case AccessibilityRole::MenuListPopup:
+    case AccessibilityRole::Menu:
         return ATK_ROLE_MENU;
-    case MenuListOptionRole:
-    case MenuItemRole:
-    case MenuButtonRole:
+    case AccessibilityRole::MenuListOption:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuButton:
         return ATK_ROLE_MENU_ITEM;
-    case MenuItemCheckboxRole:
+    case AccessibilityRole::MenuItemCheckbox:
         return ATK_ROLE_CHECK_MENU_ITEM;
-    case MenuItemRadioRole:
+    case AccessibilityRole::MenuItemRadio:
         return ATK_ROLE_RADIO_MENU_ITEM;
-    case ColumnRole:
+    case AccessibilityRole::Column:
         // return ATK_ROLE_TABLE_COLUMN_HEADER; // Is this right?
         return ATK_ROLE_UNKNOWN; // Matches Mozilla
-    case RowRole:
+    case AccessibilityRole::Row:
         return ATK_ROLE_TABLE_ROW;
-    case ToolbarRole:
+    case AccessibilityRole::Toolbar:
         return ATK_ROLE_TOOL_BAR;
-    case BusyIndicatorRole:
+    case AccessibilityRole::BusyIndicator:
         return ATK_ROLE_PROGRESS_BAR; // Is this right?
-    case ProgressIndicatorRole:
+    case AccessibilityRole::ProgressIndicator:
         return coreObject->isMeter() ? ATK_ROLE_LEVEL_BAR : ATK_ROLE_PROGRESS_BAR;
-    case WindowRole:
+    case AccessibilityRole::Window:
         return ATK_ROLE_WINDOW;
-    case PopUpButtonRole:
+    case AccessibilityRole::PopUpButton:
         return coreObject->ariaHasPopup() ? ATK_ROLE_PUSH_BUTTON : ATK_ROLE_COMBO_BOX;
-    case ComboBoxRole:
+    case AccessibilityRole::ComboBox:
         return ATK_ROLE_COMBO_BOX;
-    case SplitGroupRole:
+    case AccessibilityRole::SplitGroup:
         return ATK_ROLE_SPLIT_PANE;
-    case SplitterRole:
+    case AccessibilityRole::Splitter:
         return ATK_ROLE_SEPARATOR;
-    case ColorWellRole:
+    case AccessibilityRole::ColorWell:
 #if PLATFORM(GTK)
         // ATK_ROLE_COLOR_CHOOSER is defined as a dialog (i.e. it's what appears when you push the button).
         return ATK_ROLE_PUSH_BUTTON;
 #endif
-    case ListRole:
+    case AccessibilityRole::List:
         return ATK_ROLE_LIST;
-    case ScrollBarRole:
+    case AccessibilityRole::ScrollBar:
         return ATK_ROLE_SCROLL_BAR;
-    case ScrollAreaRole:
-    case TabPanelRole:
+    case AccessibilityRole::ScrollArea:
+    case AccessibilityRole::TabPanel:
         return ATK_ROLE_SCROLL_PANE;
-    case GridRole:
-    case TableRole:
+    case AccessibilityRole::Grid:
+    case AccessibilityRole::Table:
         return ATK_ROLE_TABLE;
-    case TreeGridRole:
+    case AccessibilityRole::TreeGrid:
         return ATK_ROLE_TREE_TABLE;
-    case ApplicationRole:
+    case AccessibilityRole::Application:
         return ATK_ROLE_APPLICATION;
-    case ApplicationGroupRole:
-    case FeedRole:
-    case FigureRole:
-    case GroupRole:
-    case RadioGroupRole:
-    case SVGRootRole:
+    case AccessibilityRole::ApplicationGroup:
+    case AccessibilityRole::Feed:
+    case AccessibilityRole::Figure:
+    case AccessibilityRole::Group:
+    case AccessibilityRole::RadioGroup:
+    case AccessibilityRole::SVGRoot:
         return ATK_ROLE_PANEL;
-    case RowHeaderRole:
+    case AccessibilityRole::RowHeader:
         return ATK_ROLE_ROW_HEADER;
-    case ColumnHeaderRole:
+    case AccessibilityRole::ColumnHeader:
         return ATK_ROLE_COLUMN_HEADER;
-    case CaptionRole:
+    case AccessibilityRole::Caption:
         return ATK_ROLE_CAPTION;
-    case CellRole:
-    case GridCellRole:
+    case AccessibilityRole::Cell:
+    case AccessibilityRole::GridCell:
         return coreObject->inheritsPresentationalRole() ? ATK_ROLE_SECTION : ATK_ROLE_TABLE_CELL;
-    case LinkRole:
-    case WebCoreLinkRole:
-    case ImageMapLinkRole:
+    case AccessibilityRole::Link:
+    case AccessibilityRole::WebCoreLink:
+    case AccessibilityRole::ImageMapLink:
         return ATK_ROLE_LINK;
-    case ImageMapRole:
+    case AccessibilityRole::ImageMap:
         return ATK_ROLE_IMAGE_MAP;
-    case ImageRole:
+    case AccessibilityRole::Image:
         return ATK_ROLE_IMAGE;
-    case ListMarkerRole:
+    case AccessibilityRole::ListMarker:
         return ATK_ROLE_TEXT;
-    case DocumentArticleRole:
+    case AccessibilityRole::DocumentArticle:
 #if ATK_CHECK_VERSION(2, 11, 3)
         return ATK_ROLE_ARTICLE;
 #endif
-    case DocumentRole:
+    case AccessibilityRole::Document:
         return ATK_ROLE_DOCUMENT_FRAME;
-    case DocumentNoteRole:
+    case AccessibilityRole::DocumentNote:
         return ATK_ROLE_COMMENT;
-    case HeadingRole:
+    case AccessibilityRole::Heading:
         return ATK_ROLE_HEADING;
-    case ListBoxRole:
+    case AccessibilityRole::ListBox:
         // https://rawgit.com/w3c/aria/master/core-aam/core-aam.html#role-map-listbox
-        return coreObject->isDescendantOfRole(ComboBoxRole) ? ATK_ROLE_MENU : ATK_ROLE_LIST_BOX;
-    case ListItemRole:
+        return coreObject->isDescendantOfRole(AccessibilityRole::ComboBox) ? ATK_ROLE_MENU : ATK_ROLE_LIST_BOX;
+    case AccessibilityRole::ListItem:
         return coreObject->inheritsPresentationalRole() ? ATK_ROLE_SECTION : ATK_ROLE_LIST_ITEM;
-    case ListBoxOptionRole:
-        return coreObject->isDescendantOfRole(ComboBoxRole) ? ATK_ROLE_MENU_ITEM : ATK_ROLE_LIST_ITEM;
-    case ParagraphRole:
+    case AccessibilityRole::ListBoxOption:
+        return coreObject->isDescendantOfRole(AccessibilityRole::ComboBox) ? ATK_ROLE_MENU_ITEM : ATK_ROLE_LIST_ITEM;
+    case AccessibilityRole::Paragraph:
         return ATK_ROLE_PARAGRAPH;
-    case LabelRole:
-    case LegendRole:
+    case AccessibilityRole::Label:
+    case AccessibilityRole::Legend:
         return ATK_ROLE_LABEL;
-    case BlockquoteRole:
+    case AccessibilityRole::Blockquote:
 #if ATK_CHECK_VERSION(2, 11, 3)
         return ATK_ROLE_BLOCK_QUOTE;
 #endif
-    case FootnoteRole:
+    case AccessibilityRole::Footnote:
 #if ATK_CHECK_VERSION(2, 25, 2)
         return ATK_ROLE_FOOTNOTE;
 #endif
-    case ApplicationTextGroupRole:
-    case DivRole:
-    case PreRole:
-    case SVGTextRole:
-    case TextGroupRole:
+    case AccessibilityRole::ApplicationTextGroup:
+    case AccessibilityRole::Div:
+    case AccessibilityRole::Pre:
+    case AccessibilityRole::SVGText:
+    case AccessibilityRole::TextGroup:
         return ATK_ROLE_SECTION;
-    case FooterRole:
+    case AccessibilityRole::Footer:
         return ATK_ROLE_FOOTER;
-    case FormRole:
+    case AccessibilityRole::Form:
 #if ATK_CHECK_VERSION(2, 11, 3)
-        if (coreObject->ariaRoleAttribute() != UnknownRole)
+        if (coreObject->ariaRoleAttribute() != AccessibilityRole::Unknown)
             return ATK_ROLE_LANDMARK;
 #endif
         return ATK_ROLE_FORM;
-    case CanvasRole:
+    case AccessibilityRole::Canvas:
         return ATK_ROLE_CANVAS;
-    case HorizontalRuleRole:
+    case AccessibilityRole::HorizontalRule:
         return ATK_ROLE_SEPARATOR;
-    case SpinButtonRole:
+    case AccessibilityRole::SpinButton:
         return ATK_ROLE_SPIN_BUTTON;
-    case TabRole:
+    case AccessibilityRole::Tab:
         return ATK_ROLE_PAGE_TAB;
-    case UserInterfaceTooltipRole:
+    case AccessibilityRole::UserInterfaceTooltip:
         return ATK_ROLE_TOOL_TIP;
-    case WebAreaRole:
+    case AccessibilityRole::WebArea:
         return ATK_ROLE_DOCUMENT_WEB;
-    case WebApplicationRole:
+    case AccessibilityRole::WebApplication:
         return ATK_ROLE_EMBEDDED;
 #if ATK_CHECK_VERSION(2, 11, 3)
-    case ApplicationLogRole:
+    case AccessibilityRole::ApplicationLog:
         return ATK_ROLE_LOG;
-    case ApplicationMarqueeRole:
+    case AccessibilityRole::ApplicationMarquee:
         return ATK_ROLE_MARQUEE;
-    case ApplicationTimerRole:
+    case AccessibilityRole::ApplicationTimer:
         return ATK_ROLE_TIMER;
-    case DefinitionRole:
+    case AccessibilityRole::Definition:
         return ATK_ROLE_DEFINITION;
-    case DocumentMathRole:
+    case AccessibilityRole::DocumentMath:
         return ATK_ROLE_MATH;
-    case MathElementRole:
+    case AccessibilityRole::MathElement:
         if (coreObject->isMathRow())
             return ATK_ROLE_PANEL;
         if (coreObject->isMathTable())
@@ -824,11 +824,11 @@
             return ATK_ROLE_MATH_FRACTION;
         if (coreObject->isMathSquareRoot() || coreObject->isMathRoot())
             return ATK_ROLE_MATH_ROOT;
-        if (coreObject->isMathScriptObject(Subscript)
-            || coreObject->isMathMultiscriptObject(PreSubscript) || coreObject->isMathMultiscriptObject(PostSubscript))
+        if (coreObject->isMathScriptObject(AccessibilityMathScriptObjectType::Subscript)
+            || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSubscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSubscript))
             return ATK_ROLE_SUBSCRIPT;
-        if (coreObject->isMathScriptObject(Superscript)
-            || coreObject->isMathMultiscriptObject(PreSuperscript) || coreObject->isMathMultiscriptObject(PostSuperscript))
+        if (coreObject->isMathScriptObject(AccessibilityMathScriptObjectType::Superscript)
+            || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSuperscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSuperscript))
             return ATK_ROLE_SUPERSCRIPT;
 #endif
 #if ATK_CHECK_VERSION(2, 15, 2)
@@ -836,26 +836,26 @@
             return ATK_ROLE_STATIC;
 #endif
         return ATK_ROLE_UNKNOWN;
-    case LandmarkBannerRole:
-    case LandmarkComplementaryRole:
-    case LandmarkContentInfoRole:
-    case LandmarkDocRegionRole:
-    case LandmarkMainRole:
-    case LandmarkNavigationRole:
-    case LandmarkRegionRole:
-    case LandmarkSearchRole:
+    case AccessibilityRole::LandmarkBanner:
+    case AccessibilityRole::LandmarkComplementary:
+    case AccessibilityRole::LandmarkContentInfo:
+    case AccessibilityRole::LandmarkDocRegion:
+    case AccessibilityRole::LandmarkMain:
+    case AccessibilityRole::LandmarkNavigation:
+    case AccessibilityRole::LandmarkRegion:
+    case AccessibilityRole::LandmarkSearch:
         return ATK_ROLE_LANDMARK;
 #endif
 #if ATK_CHECK_VERSION(2, 11, 4)
-    case DescriptionListRole:
+    case AccessibilityRole::DescriptionList:
         return ATK_ROLE_DESCRIPTION_LIST;
-    case TermRole:
-    case DescriptionListTermRole:
+    case AccessibilityRole::Term:
+    case AccessibilityRole::DescriptionListTerm:
         return ATK_ROLE_DESCRIPTION_TERM;
-    case DescriptionListDetailRole:
+    case AccessibilityRole::DescriptionListDetail:
         return ATK_ROLE_DESCRIPTION_VALUE;
 #endif
-    case InlineRole:
+    case AccessibilityRole::Inline:
 #if ATK_CHECK_VERSION(2, 15, 4)
         if (coreObject->isSubscriptStyleGroup())
             return ATK_ROLE_SUBSCRIPT;
@@ -864,9 +864,9 @@
 #endif
 #if ATK_CHECK_VERSION(2, 15, 2)
         return ATK_ROLE_STATIC;
-    case SVGTextPathRole:
-    case SVGTSpanRole:
-    case TimeRole:
+    case AccessibilityRole::SVGTextPath:
+    case AccessibilityRole::SVGTSpan:
+    case AccessibilityRole::Time:
         return ATK_ROLE_STATIC;
 #endif
     default:
@@ -930,7 +930,7 @@
 
     // Please keep the state list in alphabetical order
     if ((isListBoxOption && coreObject->isSelectedOptionActive())
-        || coreObject->ariaCurrentState() != ARIACurrentFalse)
+        || coreObject->ariaCurrentState() != AccessibilityARIACurrentState::False)
         atk_state_set_add_state(stateSet, ATK_STATE_ACTIVE);
 
     if (coreObject->isBusy())
@@ -972,9 +972,9 @@
         atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED);
     }
 
-    if (coreObject->orientation() == AccessibilityOrientationHorizontal)
+    if (coreObject->orientation() == AccessibilityOrientation::Horizontal)
         atk_state_set_add_state(stateSet, ATK_STATE_HORIZONTAL);
-    else if (coreObject->orientation() == AccessibilityOrientationVertical)
+    else if (coreObject->orientation() == AccessibilityOrientation::Vertical)
         atk_state_set_add_state(stateSet, ATK_STATE_VERTICAL);
 
     if (coreObject->ariaHasPopup())
@@ -983,7 +983,7 @@
     if (coreObject->isIndeterminate())
         atk_state_set_add_state(stateSet, ATK_STATE_INDETERMINATE);
     else if (coreObject->isCheckboxOrRadio() || coreObject->isMenuItem() || coreObject->isToggleButton()) {
-        if (coreObject->checkboxOrRadioValue() == ButtonStateMixed)
+        if (coreObject->checkboxOrRadioValue() == AccessibilityButtonState::Mixed)
             atk_state_set_add_state(stateSet, ATK_STATE_INDETERMINATE);
     }
 
@@ -1039,9 +1039,9 @@
     }
 
     // Mutually exclusive, so we group these two
-    if (coreObject->roleValue() == TextAreaRole || coreObject->ariaIsMultiline())
+    if (coreObject->roleValue() == AccessibilityRole::TextArea || coreObject->ariaIsMultiline())
         atk_state_set_add_state(stateSet, ATK_STATE_MULTI_LINE);
-    else if (coreObject->roleValue() == TextFieldRole || coreObject->roleValue() == SearchFieldRole)
+    else if (coreObject->roleValue() == AccessibilityRole::TextField || coreObject->roleValue() == AccessibilityRole::SearchField)
         atk_state_set_add_state(stateSet, ATK_STATE_SINGLE_LINE);
 
     // TODO: ATK_STATE_SENSITIVE
@@ -1260,9 +1260,17 @@
 
 static bool roleIsTextType(AccessibilityRole role)
 {
-    return role == ParagraphRole || role == HeadingRole || role == DivRole || role == CellRole
-        || role == LinkRole || role == WebCoreLinkRole || role == ListItemRole || role == PreRole
-        || role == GridCellRole || role == TextGroupRole || role == ApplicationTextGroupRole;
+    return role == AccessibilityRole::Paragraph
+        || role == AccessibilityRole::Heading
+        || role == AccessibilityRole::Div
+        || role == AccessibilityRole::Cell
+        || role == AccessibilityRole::Link
+        || role == AccessibilityRole::WebCoreLink
+        || role == AccessibilityRole::ListItem
+        || role == AccessibilityRole::Pre
+        || role == AccessibilityRole::GridCell
+        || role == AccessibilityRole::TextGroup
+        || role == AccessibilityRole::ApplicationTextGroup;
 }
 
 static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
@@ -1296,14 +1304,14 @@
         interfaceMask |= 1 << WAIHyperlink;
 
     // Text, Editable Text & Hypertext
-    if (role == StaticTextRole || coreObject->isMenuListOption())
+    if (role == AccessibilityRole::StaticText || coreObject->isMenuListOption())
         interfaceMask |= 1 << WAIText;
     else if (coreObject->isTextControl() || coreObject->isNonNativeTextControl()) {
         interfaceMask |= 1 << WAIText;
         if (coreObject->canSetValueAttribute())
             interfaceMask |= 1 << WAIEditableText;
     } else if (!coreObject->isWebArea()) {
-        if (role != TableRole) {
+        if (role != AccessibilityRole::Table) {
             interfaceMask |= 1 << WAIHypertext;
             if ((renderer && renderer->childrenInline()) || roleIsTextType(role) || coreObject->isMathToken())
                 interfaceMask |= 1 << WAIText;
@@ -1311,7 +1319,7 @@
 
         // Add the TEXT interface for list items whose
         // first accessible child has a text renderer
-        if (role == ListItemRole) {
+        if (role == AccessibilityRole::ListItem) {
             const AccessibilityObject::AccessibilityChildrenVector& children = coreObject->children();
             if (children.size()) {
                 AccessibilityObject* axRenderChild = children.at(0).get();
@@ -1329,12 +1337,12 @@
         interfaceMask |= 1 << WAITable;
 
 #if ATK_CHECK_VERSION(2,11,90)
-    if (role == CellRole || role == GridCellRole || role == ColumnHeaderRole || role == RowHeaderRole)
+    if (role == AccessibilityRole::Cell || role == AccessibilityRole::GridCell || role == AccessibilityRole::ColumnHeader || role == AccessibilityRole::RowHeader)
         interfaceMask |= 1 << WAITableCell;
 #endif
 
     // Document
-    if (role == WebAreaRole)
+    if (role == AccessibilityRole::WebArea)
         interfaceMask |= 1 << WAIDocument;
 
     // Value
@@ -1343,7 +1351,7 @@
 
 #if ENABLE(INPUT_TYPE_COLOR)
     // Color type.
-    if (role == ColorWellRole)
+    if (role == AccessibilityRole::ColorWell)
         interfaceMask |= 1 << WAIText;
 #endif
 
@@ -1412,7 +1420,7 @@
 {
     ASSERT(accessible->m_object);
 
-    if (accessible->m_object->roleValue() == WebAreaRole)
+    if (accessible->m_object->roleValue() == AccessibilityRole::WebArea)
         atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, true);
 
     // We replace the WebCore AccessibilityObject with a fallback object that