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/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp
index dee234a..db22204 100644
--- a/Source/WebCore/accessibility/AXObjectCache.cpp
+++ b/Source/WebCore/accessibility/AXObjectCache.cpp
@@ -120,8 +120,8 @@
 
 AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(AXID id) const
 {
-    HashMap<AXID, CachedAXObjectAttributes>::const_iterator it = m_idMapping.find(id);
-    return it != m_idMapping.end() ? it->value.ignored : DefaultBehavior;
+    auto it = m_idMapping.find(id);
+    return it != m_idMapping.end() ? it->value.ignored : AccessibilityObjectInclusion::DefaultBehavior;
 }
 
 void AXComputedObjectAttributeCache::setIgnored(AXID id, AccessibilityObjectInclusion inclusion)
@@ -203,8 +203,8 @@
     m_focusAriaModalNodeTimer.stop();
 
     for (const auto& object : m_objects.values()) {
-        detachWrapper(object.get(), CacheDestroyed);
-        object->detach(CacheDestroyed);
+        detachWrapper(object.get(), AccessibilityDetachmentType::CacheDestroyed);
+        object->detach(AccessibilityDetachmentType::CacheDestroyed);
         removeAXID(object.get());
     }
 }
@@ -647,31 +647,31 @@
     
     // will be filled in...
     switch (role) {
-    case ListBoxOptionRole:
+    case AccessibilityRole::ListBoxOption:
         obj = AccessibilityListBoxOption::create();
         break;
-    case ImageMapLinkRole:
+    case AccessibilityRole::ImageMapLink:
         obj = AccessibilityImageMapLink::create();
         break;
-    case ColumnRole:
+    case AccessibilityRole::Column:
         obj = AccessibilityTableColumn::create();
         break;            
-    case TableHeaderContainerRole:
+    case AccessibilityRole::TableHeaderContainer:
         obj = AccessibilityTableHeaderContainer::create();
         break;   
-    case SliderThumbRole:
+    case AccessibilityRole::SliderThumb:
         obj = AccessibilitySliderThumb::create();
         break;
-    case MenuListPopupRole:
+    case AccessibilityRole::MenuListPopup:
         obj = AccessibilityMenuListPopup::create();
         break;
-    case MenuListOptionRole:
+    case AccessibilityRole::MenuListOption:
         obj = AccessibilityMenuListOption::create();
         break;
-    case SpinButtonRole:
+    case AccessibilityRole::SpinButton:
         obj = AccessibilitySpinButton::create();
         break;
-    case SpinButtonPartRole:
+    case AccessibilityRole::SpinButtonPart:
         obj = AccessibilitySpinButtonPart::create();
         break;
     default:
@@ -699,8 +699,8 @@
     if (!obj)
         return;
     
-    detachWrapper(obj, ElementDestroyed);
-    obj->detach(ElementDestroyed, this);
+    detachWrapper(obj, AccessibilityDetachmentType::ElementDestroyed);
+    obj->detach(AccessibilityDetachmentType::ElementDestroyed, this);
     removeAXID(obj);
     
     // finally remove the object
@@ -920,7 +920,7 @@
         // the axChildren when the menu is marked as opening.
         if (notification == AXMenuOpened) {
             obj->updateChildrenIfNecessary();
-            if (obj->roleValue() != MenuRole)
+            if (obj->roleValue() != AccessibilityRole::Menu)
                 continue;
         }
         
diff --git a/Source/WebCore/accessibility/AXObjectCache.h b/Source/WebCore/accessibility/AXObjectCache.h
index b7d3cb0..2f0d733 100644
--- a/Source/WebCore/accessibility/AXObjectCache.h
+++ b/Source/WebCore/accessibility/AXObjectCache.h
@@ -91,7 +91,9 @@
 
 private:
     struct CachedAXObjectAttributes {
-        CachedAXObjectAttributes() : ignored(DefaultBehavior) { }
+        CachedAXObjectAttributes()
+            : ignored(AccessibilityObjectInclusion::DefaultBehavior)
+        { }
 
         AccessibilityObjectInclusion ignored;
     };
@@ -466,7 +468,7 @@
 bool isNodeAriaVisible(Node*);
     
 #if !HAVE(ACCESSIBILITY)
-inline AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(AXID) const { return DefaultBehavior; }
+inline AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(AXID) const { return AccessibilityObjectInclusion::DefaultBehavior; }
 inline AccessibilityReplacedText::AccessibilityReplacedText(const VisibleSelection&) { }
 inline void AccessibilityReplacedText::postTextStateChangeNotification(AXObjectCache*, AXTextEditType, const String&, const VisibleSelection&) { }
 inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObjectInclusion) { }
diff --git a/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp b/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
index ae8ac57..367fbb0 100644
--- a/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
+++ b/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
@@ -139,7 +139,7 @@
     
     // make the columns based on the number of columns in the first body
     for (unsigned i = 0; i < columnCount; ++i) {
-        auto& column = downcast<AccessibilityTableColumn>(*axCache->getOrCreate(ColumnRole));
+        auto& column = downcast<AccessibilityTableColumn>(*axCache->getOrCreate(AccessibilityRole::Column));
         column.setColumnIndex(static_cast<int>(i));
         column.setParent(this);
         m_columns.append(&column);
diff --git a/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp b/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
index 2163b96..0b9d220 100644
--- a/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
+++ b/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
@@ -169,7 +169,7 @@
 AccessibilityObject* AccessibilityARIAGridCell::parentRowGroup() const
 {
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
-        if (parent->hasTagName(theadTag) || parent->hasTagName(tbodyTag) || parent->hasTagName(tfootTag) || parent->roleValue() == RowGroupRole)
+        if (parent->hasTagName(theadTag) || parent->hasTagName(tbodyTag) || parent->hasTagName(tfootTag) || parent->roleValue() == AccessibilityRole::RowGroup)
             return parent;
     }
     
diff --git a/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp b/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp
index 6de1702..b72ee1e 100644
--- a/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp
+++ b/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp
@@ -136,7 +136,7 @@
 AccessibilityObject* AccessibilityARIAGridRow::headerObject()
 {
     for (const auto& child : children()) {
-        if (child->ariaRoleAttribute() == RowHeaderRole)
+        if (child->ariaRoleAttribute() == AccessibilityRole::RowHeader)
             return child.get();
     }
     
diff --git a/Source/WebCore/accessibility/AccessibilityAttachment.cpp b/Source/WebCore/accessibility/AccessibilityAttachment.cpp
index a7d3c37..92aa7f7 100644
--- a/Source/WebCore/accessibility/AccessibilityAttachment.cpp
+++ b/Source/WebCore/accessibility/AccessibilityAttachment.cpp
@@ -95,13 +95,13 @@
     auto& action = getAttribute(actionAttr);
     
     if (action.length())
-        textOrder.append(AccessibilityText(action, ActionText));
+        textOrder.append(AccessibilityText(action, AccessibilityTextSource::Action));
 
     if (title.length())
-        textOrder.append(AccessibilityText(title, TitleText));
+        textOrder.append(AccessibilityText(title, AccessibilityTextSource::Title));
 
     if (subtitle.length())
-        textOrder.append(AccessibilityText(subtitle, SubtitleText));
+        textOrder.append(AccessibilityText(subtitle, AccessibilityTextSource::Subtitle));
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/accessibility/AccessibilityAttachment.h b/Source/WebCore/accessibility/AccessibilityAttachment.h
index 2b65773..06e1b32 100644
--- a/Source/WebCore/accessibility/AccessibilityAttachment.h
+++ b/Source/WebCore/accessibility/AccessibilityAttachment.h
@@ -42,7 +42,7 @@
     bool hasProgress(float* progress = nullptr) const;
     
 private:
-    AccessibilityRole roleValue() const override { return ButtonRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::Button; }
     bool isAttachmentElement() const override { return true; }
 
     String roleDescription() const override;
diff --git a/Source/WebCore/accessibility/AccessibilityImageMapLink.cpp b/Source/WebCore/accessibility/AccessibilityImageMapLink.cpp
index 9ac744d..98c61a6 100644
--- a/Source/WebCore/accessibility/AccessibilityImageMapLink.cpp
+++ b/Source/WebCore/accessibility/AccessibilityImageMapLink.cpp
@@ -66,13 +66,13 @@
 AccessibilityRole AccessibilityImageMapLink::roleValue() const
 {
     if (!m_areaElement)
-        return WebCoreLinkRole;
+        return AccessibilityRole::WebCoreLink;
     
     const AtomicString& ariaRole = getAttribute(roleAttr);
     if (!ariaRole.isEmpty())
         return AccessibilityObject::ariaRoleToWebCoreRole(ariaRole);
 
-    return WebCoreLinkRole;
+    return AccessibilityRole::WebCoreLink;
 }
     
 Element* AccessibilityImageMapLink::actionElement() const
@@ -97,15 +97,15 @@
 {
     String description = accessibilityDescription();
     if (!description.isEmpty())
-        textOrder.append(AccessibilityText(description, AlternativeText));
+        textOrder.append(AccessibilityText(description, AccessibilityTextSource::Alternative));
 
     const AtomicString& titleText = getAttribute(titleAttr);
     if (!titleText.isEmpty())
-        textOrder.append(AccessibilityText(titleText, TitleTagText));
+        textOrder.append(AccessibilityText(titleText, AccessibilityTextSource::TitleTag));
 
     const AtomicString& summary = getAttribute(summaryAttr);
     if (!summary.isEmpty())
-        textOrder.append(AccessibilityText(summary, SummaryText));
+        textOrder.append(AccessibilityText(summary, AccessibilityTextSource::Summary));
 }
     
 String AccessibilityImageMapLink::accessibilityDescription() const
diff --git a/Source/WebCore/accessibility/AccessibilityLabel.cpp b/Source/WebCore/accessibility/AccessibilityLabel.cpp
index 61dda4f..7f548d1 100644
--- a/Source/WebCore/accessibility/AccessibilityLabel.cpp
+++ b/Source/WebCore/accessibility/AccessibilityLabel.cpp
@@ -65,9 +65,9 @@
     if (!children.size())
         return false;
     for (const auto& child : children) {
-        if (child->roleValue() == StaticTextRole)
+        if (child->roleValue() == AccessibilityRole::StaticText)
             continue;
-        if (child->roleValue() == GroupRole) {
+        if (child->roleValue() == AccessibilityRole::Group) {
             if (!childrenContainOnlyStaticText(child->children()))
                 return false;
         } else
diff --git a/Source/WebCore/accessibility/AccessibilityLabel.h b/Source/WebCore/accessibility/AccessibilityLabel.h
index ed75f66..5056b33 100644
--- a/Source/WebCore/accessibility/AccessibilityLabel.h
+++ b/Source/WebCore/accessibility/AccessibilityLabel.h
@@ -42,7 +42,7 @@
 private:
     explicit AccessibilityLabel(RenderObject*);
     bool computeAccessibilityIsIgnored() const final;
-    AccessibilityRole roleValue() const final { return LabelRole; }
+    AccessibilityRole roleValue() const final { return AccessibilityRole::Label; }
     bool isLabel() const final { return true; }
     String stringValue() const final;
     void updateChildrenIfNecessary() final;
diff --git a/Source/WebCore/accessibility/AccessibilityList.cpp b/Source/WebCore/accessibility/AccessibilityList.cpp
index f90cecb..6e301b0 100644
--- a/Source/WebCore/accessibility/AccessibilityList.cpp
+++ b/Source/WebCore/accessibility/AccessibilityList.cpp
@@ -67,7 +67,7 @@
     // The ARIA spec says the "list" role is supposed to mimic a UL or OL tag.
     // Since it can't be both, it's probably OK to say that it's an un-ordered list.
     // On the Mac, there's no distinction to the client.
-    if (ariaRoleAttribute() == ListRole)
+    if (ariaRoleAttribute() == AccessibilityRole::List)
         return true;
     
     return node && node->hasTagName(ulTag);
@@ -79,7 +79,7 @@
         return false;
 
     // ARIA says a directory is like a static table of contents, which sounds like an ordered list.
-    if (ariaRoleAttribute() == DirectoryRole)
+    if (ariaRoleAttribute() == AccessibilityRole::Directory)
         return true;
 
     Node* node = m_renderer->node();
@@ -129,8 +129,8 @@
     m_ariaRole = determineAriaRoleAttribute();
     
     // Directory is mapped to list for now, but does not adhere to the same heuristics.
-    if (ariaRoleAttribute() == DirectoryRole)
-        return ListRole;
+    if (ariaRoleAttribute() == AccessibilityRole::Directory)
+        return AccessibilityRole::List;
     
     // Heuristic to determine if this list is being used for layout or for content.
     //   1. If it's a named list, like ol or aria=list, then it's a list.
@@ -140,7 +140,7 @@
     //   4. If it does not have any listitem children, it's not a list.
     //   5. Otherwise it's a list (for now).
     
-    AccessibilityRole role = ListRole;
+    AccessibilityRole role = AccessibilityRole::List;
     
     // Temporarily set role so that we can query children (otherwise canHaveChildren returns false).
     m_role = role;
@@ -151,12 +151,12 @@
     const auto& children = this->children();
     // DescriptionLists are always semantically a description list, so do not apply heuristics.
     if (isDescriptionList() && children.size())
-        return DescriptionListRole;
+        return AccessibilityRole::DescriptionList;
 
     for (const auto& child : children) {
-        if (child->ariaRoleAttribute() == ListItemRole)
+        if (child->ariaRoleAttribute() == AccessibilityRole::ListItem)
             listItemCount++;
-        else if (child->roleValue() == ListItemRole) {
+        else if (child->roleValue() == AccessibilityRole::ListItem) {
             RenderObject* listItem = child->renderer();
             if (!listItem)
                 continue;
@@ -168,7 +168,7 @@
                 listItemCount++;
             } else if (listItem->node() && listItem->node()->hasTagName(liTag)) {
                 // Inline elements that are in a list with an explicit role should also count.
-                if (m_ariaRole == ListRole)
+                if (m_ariaRole == AccessibilityRole::List)
                     listItemCount++;
 
                 if (childHasPseudoVisibleListItemMarkers(listItem)) {
@@ -181,18 +181,18 @@
     
     // Non <ul> lists and ARIA lists only need to have one child.
     // <ul>, <ol> lists need to have visible markers.
-    if (ariaRoleAttribute() != UnknownRole) {
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown) {
         if (!listItemCount)
-            role = ApplicationGroupRole;
+            role = AccessibilityRole::ApplicationGroup;
     } else if (!hasVisibleMarkers)
-        role = GroupRole;
+        role = AccessibilityRole::Group;
 
     return role;
 }
     
 AccessibilityRole AccessibilityList::roleValue() const
 {
-    ASSERT(m_role != UnknownRole);
+    ASSERT(m_role != AccessibilityRole::Unknown);
     return m_role;
 }
     
diff --git a/Source/WebCore/accessibility/AccessibilityListBox.cpp b/Source/WebCore/accessibility/AccessibilityListBox.cpp
index 77fcaeb..07aedc9 100644
--- a/Source/WebCore/accessibility/AccessibilityListBox.cpp
+++ b/Source/WebCore/accessibility/AccessibilityListBox.cpp
@@ -96,9 +96,9 @@
     }
     
     for (const auto& obj : children) {
-        if (obj->roleValue() != ListBoxOptionRole)
+        if (obj->roleValue() != AccessibilityRole::ListBoxOption)
             continue;
-                
+
         downcast<AccessibilityListBoxOption>(*obj).setSelected(true);
     }
 }
@@ -136,7 +136,7 @@
     if (!element || element->hasTagName(hrTag))
         return nullptr;
     
-    AccessibilityObject& listBoxObject = *m_renderer->document().axObjectCache()->getOrCreate(ListBoxOptionRole);
+    AccessibilityObject& listBoxObject = *m_renderer->document().axObjectCache()->getOrCreate(AccessibilityRole::ListBoxOption);
     downcast<AccessibilityListBoxOption>(listBoxObject).setHTMLElement(element);
     
     return &listBoxObject;
diff --git a/Source/WebCore/accessibility/AccessibilityListBox.h b/Source/WebCore/accessibility/AccessibilityListBox.h
index ab91d93..47a39ce 100644
--- a/Source/WebCore/accessibility/AccessibilityListBox.h
+++ b/Source/WebCore/accessibility/AccessibilityListBox.h
@@ -39,7 +39,7 @@
     
     bool canSetSelectedChildrenAttribute() const override;
     void setSelectedChildren(const AccessibilityChildrenVector&);
-    AccessibilityRole roleValue() const override { return ListBoxRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::ListBox; }
         
     void selectedChildren(AccessibilityChildrenVector&) override;
     void visibleChildren(AccessibilityChildrenVector&) override;
diff --git a/Source/WebCore/accessibility/AccessibilityListBoxOption.h b/Source/WebCore/accessibility/AccessibilityListBoxOption.h
index 9d3ecd2..2d77237 100644
--- a/Source/WebCore/accessibility/AccessibilityListBoxOption.h
+++ b/Source/WebCore/accessibility/AccessibilityListBoxOption.h
@@ -45,7 +45,7 @@
     
     void setHTMLElement(HTMLElement* element) { m_optionElement = element; }
     
-    AccessibilityRole roleValue() const override { return ListBoxOptionRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::ListBoxOption; }
     bool isSelected() const override;
     bool isEnabled() const override;
     bool isSelectedOptionActive() const override;
diff --git a/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp b/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp
index 4beedf1..7abffae 100644
--- a/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp
+++ b/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp
@@ -51,18 +51,18 @@
 AccessibilityRole AccessibilityMathMLElement::determineAccessibilityRole()
 {
     if (!m_renderer)
-        return UnknownRole;
+        return AccessibilityRole::Unknown;
 
-    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
+    if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown)
         return m_ariaRole;
 
     Node* node = m_renderer->node();
     if (node && node->hasTagName(MathMLNames::mathTag))
-        return DocumentMathRole;
+        return AccessibilityRole::DocumentMath;
 
     // It's not clear which role a platform should choose for a math element.
     // Declaring a math element role should give flexibility to platforms to choose.
-    return MathElementRole;
+    return AccessibilityRole::MathElement;
 }
 
 String AccessibilityMathMLElement::textUnderElement(AccessibilityTextUnderElementMode mode) const
@@ -206,7 +206,7 @@
     if (!parent)
         return false;
 
-    return type == Subscript ? this == parent->mathSubscriptObject() : this == parent->mathSuperscriptObject();
+    return type == AccessibilityMathScriptObjectType::Subscript ? this == parent->mathSubscriptObject() : this == parent->mathSuperscriptObject();
 }
 
 bool AccessibilityMathMLElement::isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType type) const
@@ -221,16 +221,16 @@
     // this token is present and in the position corresponding with the type.
 
     AccessibilityMathMultiscriptPairs pairs;
-    if (type == PreSubscript || type == PreSuperscript)
+    if (type == AccessibilityMathMultiscriptObjectType::PreSubscript || type == AccessibilityMathMultiscriptObjectType::PreSuperscript)
         parent->mathPrescripts(pairs);
     else
         parent->mathPostscripts(pairs);
 
     for (const auto& pair : pairs) {
         if (this == pair.first)
-            return (type == PreSubscript || type == PostSubscript);
+            return (type == AccessibilityMathMultiscriptObjectType::PreSubscript || type == AccessibilityMathMultiscriptObjectType::PostSubscript);
         if (this == pair.second)
-            return (type == PreSuperscript || type == PostSuperscript);
+            return (type == AccessibilityMathMultiscriptObjectType::PreSuperscript || type == AccessibilityMathMultiscriptObjectType::PostSuperscript);
     }
 
     return false;
diff --git a/Source/WebCore/accessibility/AccessibilityMediaControls.cpp b/Source/WebCore/accessibility/AccessibilityMediaControls.cpp
index 083ccc7..fe293bc 100644
--- a/Source/WebCore/accessibility/AccessibilityMediaControls.cpp
+++ b/Source/WebCore/accessibility/AccessibilityMediaControls.cpp
@@ -142,15 +142,15 @@
 {
     String description = accessibilityDescription();
     if (!description.isEmpty())
-        textOrder.append(AccessibilityText(description, AlternativeText));
+        textOrder.append(AccessibilityText(description, AccessibilityTextSource::Alternative));
 
     String title = this->title();
     if (!title.isEmpty())
-        textOrder.append(AccessibilityText(title, AlternativeText));
+        textOrder.append(AccessibilityText(title, AccessibilityTextSource::Alternative));
 
     String helptext = helpText();
     if (!helptext.isEmpty())
-        textOrder.append(AccessibilityText(helptext, HelpText));
+        textOrder.append(AccessibilityText(helptext, AccessibilityTextSource::Help));
 }
     
 
@@ -197,23 +197,22 @@
     case MediaPauseButton:
     case MediaShowClosedCaptionsButton:
     case MediaHideClosedCaptionsButton:
-        return ButtonRole;
+        return AccessibilityRole::Button;
 
     case MediaStatusDisplay:
-        return StaticTextRole;
+        return AccessibilityRole::StaticText;
 
     case MediaTimelineContainer:
-        return GroupRole;
+        return AccessibilityRole::Group;
 
     default:
         break;
     }
 
-    return UnknownRole;
+    return AccessibilityRole::Unknown;
 }
 
 
-
 //
 // AccessibilityMediaControlsContainer
 
diff --git a/Source/WebCore/accessibility/AccessibilityMediaControls.h b/Source/WebCore/accessibility/AccessibilityMediaControls.h
index 2fbecc8..024cd04 100644
--- a/Source/WebCore/accessibility/AccessibilityMediaControls.h
+++ b/Source/WebCore/accessibility/AccessibilityMediaControls.h
@@ -78,7 +78,7 @@
     static Ref<AccessibilityObject> create(RenderObject*);
     virtual ~AccessibilityMediaControlsContainer() = default;
 
-    AccessibilityRole roleValue() const override { return ToolbarRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::Toolbar; }
 
     String helpText() const override;
     String accessibilityDescription() const override;
@@ -96,7 +96,7 @@
     static Ref<AccessibilityObject> create(RenderObject*);
     virtual ~AccessibilityMediaTimeDisplay() = default;
 
-    AccessibilityRole roleValue() const override { return ApplicationTimerRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::ApplicationTimer; }
 
     String stringValue() const override;
     String accessibilityDescription() const override;
diff --git a/Source/WebCore/accessibility/AccessibilityMenuList.cpp b/Source/WebCore/accessibility/AccessibilityMenuList.cpp
index b824d6b..91616c6 100644
--- a/Source/WebCore/accessibility/AccessibilityMenuList.cpp
+++ b/Source/WebCore/accessibility/AccessibilityMenuList.cpp
@@ -65,7 +65,7 @@
     if (!cache)
         return;
     
-    AccessibilityObject* list = cache->getOrCreate(MenuListPopupRole);
+    AccessibilityObject* list = cache->getOrCreate(AccessibilityRole::MenuListPopup);
     if (!list)
         return;
 
diff --git a/Source/WebCore/accessibility/AccessibilityMenuList.h b/Source/WebCore/accessibility/AccessibilityMenuList.h
index 8f1123d..fc602aa 100644
--- a/Source/WebCore/accessibility/AccessibilityMenuList.h
+++ b/Source/WebCore/accessibility/AccessibilityMenuList.h
@@ -44,7 +44,7 @@
     explicit AccessibilityMenuList(RenderMenuList*);
 
     bool isMenuList() const override { return true; }
-    AccessibilityRole roleValue() const override { return PopUpButtonRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::PopUpButton; }
     bool canSetFocusAttribute() const override;
 
     void addChildren() override;
diff --git a/Source/WebCore/accessibility/AccessibilityMenuListOption.h b/Source/WebCore/accessibility/AccessibilityMenuListOption.h
index 4111e07..511fa7b 100644
--- a/Source/WebCore/accessibility/AccessibilityMenuListOption.h
+++ b/Source/WebCore/accessibility/AccessibilityMenuListOption.h
@@ -42,7 +42,7 @@
 
     bool isMenuListOption() const override { return true; }
 
-    AccessibilityRole roleValue() const override { return MenuListOptionRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::MenuListOption; }
     bool canHaveChildren() const override { return false; }
 
     Element* actionElement() const override;
diff --git a/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp b/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
index fe1bd34..ee961b5 100644
--- a/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
+++ b/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
@@ -73,7 +73,7 @@
     if (!is<HTMLOptionElement>(element) || !element->inRenderedDocument())
         return nullptr;
 
-    auto& option = downcast<AccessibilityMenuListOption>(*document()->axObjectCache()->getOrCreate(MenuListOptionRole));
+    auto& option = downcast<AccessibilityMenuListOption>(*document()->axObjectCache()->getOrCreate(AccessibilityRole::MenuListOption));
     option.setElement(element);
 
     return &option;
diff --git a/Source/WebCore/accessibility/AccessibilityMenuListPopup.h b/Source/WebCore/accessibility/AccessibilityMenuListPopup.h
index c1987cd..3ca3d52 100644
--- a/Source/WebCore/accessibility/AccessibilityMenuListPopup.h
+++ b/Source/WebCore/accessibility/AccessibilityMenuListPopup.h
@@ -48,7 +48,7 @@
     bool isMenuListPopup() const override { return true; }
 
     LayoutRect elementRect() const override { return LayoutRect(); }
-    AccessibilityRole roleValue() const override { return MenuListPopupRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::MenuListPopup; }
 
     bool isVisible() const override;
     bool press() override;
diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
index 92e304f..a4b9adf 100644
--- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
@@ -83,11 +83,6 @@
 
 AccessibilityNodeObject::AccessibilityNodeObject(Node* node)
     : AccessibilityObject()
-    , m_ariaRole(UnknownRole)
-    , m_roleForMSAA(UnknownRole)
-#ifndef NDEBUG
-    , m_initialized(false)
-#endif
     , m_node(node)
 {
 }
@@ -282,57 +277,57 @@
 AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
 {
     if (!node())
-        return UnknownRole;
+        return AccessibilityRole::Unknown;
 
-    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
+    if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown)
         return m_ariaRole;
     
     if (node()->isLink())
-        return WebCoreLinkRole;
+        return AccessibilityRole::WebCoreLink;
     if (node()->isTextNode())
-        return StaticTextRole;
+        return AccessibilityRole::StaticText;
     if (node()->hasTagName(buttonTag))
         return buttonRoleType();
     if (is<HTMLInputElement>(*node())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node());
         if (input.isCheckbox())
-            return CheckBoxRole;
+            return AccessibilityRole::CheckBox;
         if (input.isRadioButton())
-            return RadioButtonRole;
+            return AccessibilityRole::RadioButton;
         if (input.isTextButton())
             return buttonRoleType();
         if (input.isRangeControl())
-            return SliderRole;
+            return AccessibilityRole::Slider;
         if (input.isInputTypeHidden())
-            return IgnoredRole;
+            return AccessibilityRole::Ignored;
         if (input.isSearchField())
-            return SearchFieldRole;
+            return AccessibilityRole::SearchField;
 #if ENABLE(INPUT_TYPE_COLOR)
         if (input.isColorControl())
-            return ColorWellRole;
+            return AccessibilityRole::ColorWell;
 #endif
-        return TextFieldRole;
+        return AccessibilityRole::TextField;
     }
     if (node()->hasTagName(selectTag)) {
         HTMLSelectElement& selectElement = downcast<HTMLSelectElement>(*node());
-        return selectElement.multiple() ? ListBoxRole : PopUpButtonRole;
+        return selectElement.multiple() ? AccessibilityRole::ListBox : AccessibilityRole::PopUpButton;
     }
     if (is<HTMLTextAreaElement>(*node()))
-        return TextAreaRole;
+        return AccessibilityRole::TextArea;
     if (headingLevel())
-        return HeadingRole;
+        return AccessibilityRole::Heading;
     if (node()->hasTagName(blockquoteTag))
-        return BlockquoteRole;
+        return AccessibilityRole::Blockquote;
     if (node()->hasTagName(divTag))
-        return DivRole;
+        return AccessibilityRole::Div;
     if (node()->hasTagName(pTag))
-        return ParagraphRole;
+        return AccessibilityRole::Paragraph;
     if (is<HTMLLabelElement>(*node()))
-        return LabelRole;
+        return AccessibilityRole::Label;
     if (is<Element>(*node()) && downcast<Element>(*node()).isFocusable())
-        return GroupRole;
+        return AccessibilityRole::Group;
     
-    return UnknownRole;
+    return AccessibilityRole::Unknown;
 }
 
 void AccessibilityNodeObject::addChildren()
@@ -370,23 +365,23 @@
     
     // Elements that should not have children
     switch (roleValue()) {
-    case ImageRole:
-    case ButtonRole:
-    case PopUpButtonRole:
-    case CheckBoxRole:
-    case RadioButtonRole:
-    case TabRole:
-    case ToggleButtonRole:
-    case StaticTextRole:
-    case ListBoxOptionRole:
-    case ScrollBarRole:
-    case ProgressIndicatorRole:
-    case SwitchRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case SplitterRole:
+    case AccessibilityRole::Image:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::Tab:
+    case AccessibilityRole::ToggleButton:
+    case AccessibilityRole::StaticText:
+    case AccessibilityRole::ListBoxOption:
+    case AccessibilityRole::ScrollBar:
+    case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::Splitter:
         return false;
-    case DocumentMathRole:
+    case AccessibilityRole::DocumentMath:
 #if ENABLE(MATHML)
         return node()->isMathMLElement();
 #endif
@@ -417,18 +412,18 @@
     }
 
     AccessibilityObjectInclusion decision = defaultObjectInclusion();
-    if (decision == IncludeObject)
+    if (decision == AccessibilityObjectInclusion::IncludeObject)
         return false;
-    if (decision == IgnoreObject)
+    if (decision == AccessibilityObjectInclusion::IgnoreObject)
         return true;
     // If this element is within a parent that cannot have children, it should not be exposed.
     if (isDescendantOfBarrenParent())
         return true;
 
-    if (roleValue() == IgnoredRole)
+    if (roleValue() == AccessibilityRole::Ignored)
         return true;
     
-    return m_role == UnknownRole;
+    return m_role == AccessibilityRole::Unknown;
 }
 
 bool AccessibilityNodeObject::canvasHasFallbackContent() const
@@ -471,7 +466,7 @@
     if (!node)
         return false;
 
-    if (roleValue() == SearchFieldRole)
+    if (roleValue() == AccessibilityRole::SearchField)
         return true;
 
     if (!is<HTMLInputElement>(*node))
@@ -518,7 +513,7 @@
 
 bool AccessibilityNodeObject::isImage() const
 {
-    return roleValue() == ImageRole;
+    return roleValue() == AccessibilityRole::Image;
 }
 
 bool AccessibilityNodeObject::isPasswordField() const
@@ -527,7 +522,7 @@
     if (!is<HTMLInputElement>(node))
         return false;
 
-    if (ariaRoleAttribute() != UnknownRole)
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown)
         return false;
 
     return downcast<HTMLInputElement>(*node).isPasswordField();
@@ -555,7 +550,7 @@
 bool AccessibilityNodeObject::isInputImage() const
 {
     Node* node = this->node();
-    if (is<HTMLInputElement>(node) && roleValue() == ButtonRole) {
+    if (is<HTMLInputElement>(node) && roleValue() == AccessibilityRole::Button) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         return input.isImageButton();
     }
@@ -565,23 +560,23 @@
 
 bool AccessibilityNodeObject::isProgressIndicator() const
 {
-    return roleValue() == ProgressIndicatorRole;
+    return roleValue() == AccessibilityRole::ProgressIndicator;
 }
 
 bool AccessibilityNodeObject::isSlider() const
 {
-    return roleValue() == SliderRole;
+    return roleValue() == AccessibilityRole::Slider;
 }
 
 bool AccessibilityNodeObject::isMenuRelated() const
 {
     switch (roleValue()) {
-    case MenuRole:
-    case MenuBarRole:
-    case MenuButtonRole:
-    case MenuItemRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
+    case AccessibilityRole::Menu:
+    case AccessibilityRole::MenuBar:
+    case AccessibilityRole::MenuButton:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
         return true;
     default:
         return false;
@@ -590,25 +585,25 @@
 
 bool AccessibilityNodeObject::isMenu() const
 {
-    return roleValue() == MenuRole;
+    return roleValue() == AccessibilityRole::Menu;
 }
 
 bool AccessibilityNodeObject::isMenuBar() const
 {
-    return roleValue() == MenuBarRole;
+    return roleValue() == AccessibilityRole::MenuBar;
 }
 
 bool AccessibilityNodeObject::isMenuButton() const
 {
-    return roleValue() == MenuButtonRole;
+    return roleValue() == AccessibilityRole::MenuButton;
 }
 
 bool AccessibilityNodeObject::isMenuItem() const
 {
     switch (roleValue()) {
-    case MenuItemRole:
-    case MenuItemRadioRole:
-    case MenuItemCheckboxRole:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::MenuItemCheckbox:
         return true;
     default:
         return false;
@@ -636,7 +631,7 @@
             break;
     }
     
-    if (roleValue() == HorizontalRuleRole)
+    if (roleValue() == AccessibilityRole::HorizontalRule)
         return false;
     
     Node* node = this->node();
@@ -682,12 +677,12 @@
     // Else, if this is an ARIA checkbox or radio, respect the aria-checked attribute
     bool validRole = false;
     switch (ariaRoleAttribute()) {
-    case RadioButtonRole:
-    case CheckBoxRole:
-    case MenuItemRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case SwitchRole:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::Switch:
         validRole = true;
         break;
     default:
@@ -736,26 +731,26 @@
 bool AccessibilityNodeObject::supportsRequiredAttribute() const
 {
     switch (roleValue()) {
-    case ButtonRole:
+    case AccessibilityRole::Button:
         return isFileUploadButton();
-    case CellRole:
-    case ColumnHeaderRole:
-    case CheckBoxRole:
-    case ComboBoxRole:
-    case GridRole:
-    case GridCellRole:
-    case IncrementorRole:
-    case ListBoxRole:
-    case PopUpButtonRole:
-    case RadioButtonRole:
-    case RadioGroupRole:
-    case RowHeaderRole:
-    case SliderRole:
-    case SpinButtonRole:
-    case TableHeaderContainerRole:
-    case TextAreaRole:
-    case TextFieldRole:
-    case ToggleButtonRole:
+    case AccessibilityRole::Cell:
+    case AccessibilityRole::ColumnHeader:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::Grid:
+    case AccessibilityRole::GridCell:
+    case AccessibilityRole::Incrementor:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::RadioGroup:
+    case AccessibilityRole::RowHeader:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::SpinButton:
+    case AccessibilityRole::TableHeaderContainer:
+    case AccessibilityRole::TextArea:
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::ToggleButton:
         return true;
     default:
         return false;
@@ -795,7 +790,7 @@
 
     // The implicit value of aria-level is 2 for the heading role.
     // https://www.w3.org/TR/wai-aria-1.1/#heading
-    if (ariaRoleAttribute() == HeadingRole)
+    if (ariaRoleAttribute() == AccessibilityRole::Heading)
         return 2;
 
     return 0;
@@ -876,12 +871,12 @@
 
 bool AccessibilityNodeObject::isHeading() const
 {
-    return roleValue() == HeadingRole;
+    return roleValue() == AccessibilityRole::Heading;
 }
 
 bool AccessibilityNodeObject::isLink() const
 {
-    return roleValue() == WebCoreLinkRole;
+    return roleValue() == AccessibilityRole::WebCoreLink;
 }
 
 bool AccessibilityNodeObject::isControl() const
@@ -905,7 +900,7 @@
 bool AccessibilityNodeObject::isGroup() const
 {
     AccessibilityRole role = roleValue();
-    return role == GroupRole || role == TextGroupRole || role == ApplicationGroupRole || role == ApplicationTextGroupRole;
+    return role == AccessibilityRole::Group || role == AccessibilityRole::TextGroup || role == AccessibilityRole::ApplicationGroup || role == AccessibilityRole::ApplicationTextGroup;
 }
 
 AccessibilityObject* AccessibilityNodeObject::selectedRadioButton()
@@ -915,7 +910,7 @@
 
     // Find the child radio button that is selected (ie. the intValue == 1).
     for (const auto& child : children()) {
-        if (child->roleValue() == RadioButtonRole && child->checkboxOrRadioValue() == ButtonStateOn)
+        if (child->roleValue() == AccessibilityRole::RadioButton && child->checkboxOrRadioValue() == AccessibilityButtonState::On)
             return child.get();
     }
     return nullptr;
@@ -941,7 +936,7 @@
 AccessibilityButtonState AccessibilityNodeObject::checkboxOrRadioValue() const
 {
     if (isNativeCheckboxOrRadio())
-        return isIndeterminate() ? ButtonStateMixed : isChecked() ? ButtonStateOn : ButtonStateOff;
+        return isIndeterminate() ? AccessibilityButtonState::Mixed : isChecked() ? AccessibilityButtonState::On : AccessibilityButtonState::Off;
 
     return AccessibilityObject::checkboxOrRadioValue();
 }
@@ -1008,14 +1003,14 @@
         return downcast<Element>(node);
 
     switch (roleValue()) {
-    case ButtonRole:
-    case PopUpButtonRole:
-    case ToggleButtonRole:
-    case TabRole:
-    case MenuItemRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case ListItemRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::ToggleButton:
+    case AccessibilityRole::Tab:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::ListItem:
         // Check if the author is hiding the real control element inside the ARIA element.
         if (Element* nativeElement = nativeActionElement(node))
             return nativeElement;
@@ -1066,7 +1061,7 @@
 
 void AccessibilityNodeObject::alterSliderValue(bool increase)
 {
-    if (roleValue() != SliderRole)
+    if (roleValue() != AccessibilityRole::Slider)
         return;
 
     if (!getAttribute(stepAttr).isEmpty())
@@ -1125,11 +1120,11 @@
         return false;
     
     AccessibilityRole role = roleValue();
-    if (role == VideoRole || role == AudioRole)
+    if (role == AccessibilityRole::Video || role == AccessibilityRole::Audio)
         return false;
 
     // If it has an aria role, it's not generic.
-    if (m_ariaRole != UnknownRole)
+    if (m_ariaRole != AccessibilityRole::Unknown)
         return false;
 
     // If the content editable attribute is set on this element, that's the reason
@@ -1141,14 +1136,14 @@
 
     // The web area and body element are both focusable, but existing logic handles these
     // cases already, so we don't need to include them here.
-    if (role == WebAreaRole)
+    if (role == AccessibilityRole::WebArea)
         return false;
     if (node() && node()->hasTagName(bodyTag))
         return false;
 
     // An SVG root is focusable by default, but it's probably not interactive, so don't
     // include it. It can still be made accessible by giving it an ARIA role.
-    if (role == SVGRootRole)
+    if (role == AccessibilityRole::SVGRoot)
         return false;
 
     return true;
@@ -1199,7 +1194,7 @@
 
 Element* AccessibilityNodeObject::menuElementForMenuButton() const
 {
-    if (ariaRoleAttribute() != MenuButtonRole)
+    if (ariaRoleAttribute() != AccessibilityRole::MenuButton)
         return nullptr;
 
     return siblingWithAriaRole(node(), "menu");
@@ -1214,7 +1209,7 @@
 
 Element* AccessibilityNodeObject::menuItemElementForMenu() const
 {
-    if (ariaRoleAttribute() != MenuRole)
+    if (ariaRoleAttribute() != AccessibilityRole::Menu)
         return nullptr;
     
     return siblingWithAriaRole(node(), "menuitem");
@@ -1298,15 +1293,15 @@
             String innerText = textForLabelElement(label);
             
             // Only use the <label> text if there's no ARIA override.
-            if (!innerText.isEmpty() && !ariaAccessibilityDescription())
-                textOrder.append(AccessibilityText(innerText, isMeter() ? AlternativeText : LabelByElementText, labelObject));
+            if (labelObject && !innerText.isEmpty() && !ariaAccessibilityDescription())
+                textOrder.append(AccessibilityText(innerText, isMeter() ? AccessibilityTextSource::Alternative : AccessibilityTextSource::LabelByElement, *labelObject));
             return;
         }
     }
     
     AccessibilityObject* titleUIElement = this->titleUIElement();
     if (titleUIElement)
-        textOrder.append(AccessibilityText(String(), LabelByElementText, titleUIElement));
+        textOrder.append(AccessibilityText(String(), AccessibilityTextSource::LabelByElement, *titleUIElement));
 }
 
 void AccessibilityNodeObject::alternativeText(Vector<AccessibilityText>& textOrder) const
@@ -1314,7 +1309,7 @@
     if (isWebArea()) {
         String webAreaText = alternativeTextForWebArea();
         if (!webAreaText.isEmpty())
-            textOrder.append(AccessibilityText(webAreaText, AlternativeText));
+            textOrder.append(AccessibilityText(webAreaText, AccessibilityTextSource::Alternative));
         return;
     }
     
@@ -1322,7 +1317,7 @@
     
     const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
     if (!ariaLabel.isEmpty())
-        textOrder.append(AccessibilityText(ariaLabel, AlternativeText));
+        textOrder.append(AccessibilityText(ariaLabel, AccessibilityTextSource::Alternative));
     
     if (usesAltTagForTextComputation()) {
         if (is<RenderImage>(renderer())) {
@@ -1330,7 +1325,7 @@
 
             // RenderImage will return title as a fallback from altText, but we don't want title here because we consider that in helpText.
             if (!renderAltText.isEmpty() && renderAltText != getAttribute(titleAttr)) {
-                textOrder.append(AccessibilityText(renderAltText, AlternativeText));
+                textOrder.append(AccessibilityText(renderAltText, AccessibilityTextSource::Alternative));
                 return;
             }
         }
@@ -1338,7 +1333,7 @@
         // Otherwise, it should fallback to other methods, like the title attribute.
         const AtomicString& alt = getAttribute(altAttr);
         if (!alt.isEmpty())
-            textOrder.append(AccessibilityText(alt, AlternativeText));
+            textOrder.append(AccessibilityText(alt, AccessibilityTextSource::Alternative));
     }
     
     Node* node = this->node();
@@ -1349,23 +1344,23 @@
     if (is<HTMLFieldSetElement>(*node)) {
         AccessibilityObject* object = axObjectCache()->getOrCreate(downcast<HTMLFieldSetElement>(*node).legend());
         if (object && !object->isHidden())
-            textOrder.append(AccessibilityText(accessibleNameForNode(object->node()), AlternativeText));
+            textOrder.append(AccessibilityText(accessibleNameForNode(object->node()), AccessibilityTextSource::Alternative));
     }
     
     // The figure element derives its alternative text from the first associated figcaption element if one is available.
     if (isFigureElement()) {
         AccessibilityObject* captionForFigure = this->captionForFigure();
         if (captionForFigure && !captionForFigure->isHidden())
-            textOrder.append(AccessibilityText(accessibleNameForNode(captionForFigure->node()), AlternativeText));
+            textOrder.append(AccessibilityText(accessibleNameForNode(captionForFigure->node()), AccessibilityTextSource::Alternative));
     }
     
     // Tree items missing a label are labeled by all child elements.
     if (isTreeItem() && ariaLabel.isEmpty() && ariaLabeledByAttribute().isEmpty())
-        textOrder.append(AccessibilityText(accessibleNameForNode(node), AlternativeText));
+        textOrder.append(AccessibilityText(accessibleNameForNode(node), AccessibilityTextSource::Alternative));
     
 #if ENABLE(MATHML)
     if (node->isMathMLElement())
-        textOrder.append(AccessibilityText(getAttribute(MathMLNames::alttextAttr), AlternativeText));
+        textOrder.append(AccessibilityText(getAttribute(MathMLNames::alttextAttr), AccessibilityTextSource::Alternative));
 #endif
 }
 
@@ -1379,7 +1374,7 @@
     if (isInputTag) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (input.isTextButton()) {
-            textOrder.append(AccessibilityText(input.valueWithDefault(), VisibleText));
+            textOrder.append(AccessibilityText(input.valueWithDefault(), AccessibilityTextSource::Visible));
             return;
         }
     }
@@ -1391,26 +1386,26 @@
     bool useTextUnderElement = false;
     
     switch (roleValue()) {
-    case PopUpButtonRole:
+    case AccessibilityRole::PopUpButton:
         // Native popup buttons should not use their button children's text as a title. That value is retrieved through stringValue().
         if (node->hasTagName(selectTag))
             break;
         FALLTHROUGH;
-    case ButtonRole:
-    case ToggleButtonRole:
-    case CheckBoxRole:
-    case ListBoxOptionRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::ToggleButton:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ListBoxOption:
     // MacOS does not expect native <li> elements to expose label information, it only expects leaf node elements to do that.
 #if !PLATFORM(COCOA)
-    case ListItemRole:
+    case AccessibilityRole::ListItem:
 #endif
-    case MenuButtonRole:
-    case MenuItemRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case RadioButtonRole:
-    case SwitchRole:
-    case TabRole:
+    case AccessibilityRole::MenuButton:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::Tab:
         useTextUnderElement = true;
         break;
     default:
@@ -1434,7 +1429,7 @@
 
         String text = textUnderElement(mode);
         if (!text.isEmpty())
-            textOrder.append(AccessibilityText(text, ChildrenText));
+            textOrder.append(AccessibilityText(text, AccessibilityTextSource::Children));
     }
 }
 
@@ -1442,28 +1437,28 @@
 {
     const AtomicString& ariaHelp = getAttribute(aria_helpAttr);
     if (!ariaHelp.isEmpty())
-        textOrder.append(AccessibilityText(ariaHelp, HelpText));
+        textOrder.append(AccessibilityText(ariaHelp, AccessibilityTextSource::Help));
     
     String describedBy = ariaDescribedByAttribute();
     if (!describedBy.isEmpty())
-        textOrder.append(AccessibilityText(describedBy, SummaryText));
+        textOrder.append(AccessibilityText(describedBy, AccessibilityTextSource::Summary));
 
     // Summary attribute used as help text on tables.
     const AtomicString& summary = getAttribute(summaryAttr);
     if (!summary.isEmpty())
-        textOrder.append(AccessibilityText(summary, SummaryText));
+        textOrder.append(AccessibilityText(summary, AccessibilityTextSource::Summary));
 
     // The title attribute should be used as help text unless it is already being used as descriptive text.
     // However, when the title attribute is the only text alternative provided, it may be exposed as the
     // descriptive text. This is problematic in the case of meters because the HTML spec suggests authors
     // can expose units through this attribute. Therefore, if the element is a meter, change its source
-    // type to HelpText.
+    // type to AccessibilityTextSource::Help.
     const AtomicString& title = getAttribute(titleAttr);
     if (!title.isEmpty()) {
         if (!isMeter() && !roleIgnoresTitle())
-            textOrder.append(AccessibilityText(title, TitleTagText));
+            textOrder.append(AccessibilityText(title, AccessibilityTextSource::TitleTag));
         else
-            textOrder.append(AccessibilityText(title, HelpText));
+            textOrder.append(AccessibilityText(title, AccessibilityTextSource::Help));
     }
 }
 
@@ -1476,7 +1471,7 @@
     
     String placeholder = placeholderValue();
     if (!placeholder.isEmpty())
-        textOrder.append(AccessibilityText(placeholder, PlaceholderText));
+        textOrder.append(AccessibilityText(placeholder, AccessibilityTextSource::Placeholder));
 }
     
 void AccessibilityNodeObject::ariaLabeledByText(Vector<AccessibilityText>& textOrder) const
@@ -1486,13 +1481,13 @@
         Vector<Element*> elements;
         ariaLabeledByElements(elements);
         
-        Vector<RefPtr<AccessibilityObject>> axElements;
+        Vector<Ref<AccessibilityObject>> axElements;
         for (const auto& element : elements) {
-            RefPtr<AccessibilityObject> axElement = axObjectCache()->getOrCreate(element);
-            axElements.append(axElement);
+            if (auto axElement = axObjectCache()->getOrCreate(element))
+                axElements.append(*axElement);
         }
         
-        textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, WTFMove(axElements)));
+        textOrder.append(AccessibilityText(ariaLabeledBy, AccessibilityTextSource::Alternative, WTFMove(axElements)));
     }
 }
     
@@ -1541,7 +1536,7 @@
 String AccessibilityNodeObject::accessibilityDescription() const
 {
     // Static text should not have a description, it should only have a stringValue.
-    if (roleValue() == StaticTextRole)
+    if (roleValue() == AccessibilityRole::StaticText)
         return String();
 
     String ariaDescription = ariaAccessibilityDescription();
@@ -1576,12 +1571,12 @@
 // accessibility hierarchy. This applies to generic groups like <div>'s with no role value set.
 bool AccessibilityNodeObject::roleIgnoresTitle() const
 {
-    if (ariaRoleAttribute() != UnknownRole)
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown)
         return false;
 
     switch (roleValue()) {
-    case DivRole:
-    case UnknownRole:
+    case AccessibilityRole::Div:
+    case AccessibilityRole::Unknown:
         return true;
     default:
         return false;
@@ -1619,7 +1614,7 @@
         // Only take help text from an ancestor element if its a group or an unknown role. If help was 
         // added to those kinds of elements, it is likely it was meant for a child element.
         if (AccessibilityObject* axObj = axObjectCache()->getOrCreate(ancestor)) {
-            if (!axObj->isGroup() && axObj->roleValue() != UnknownRole)
+            if (!axObj->isGroup() && axObj->roleValue() != AccessibilityRole::Unknown)
                 break;
         }
     }
@@ -1638,7 +1633,7 @@
         return ariaLevel.toInt();
     
     // Only tree item will calculate its level through the DOM currently.
-    if (roleValue() != TreeItemRole)
+    if (roleValue() != AccessibilityRole::TreeItem)
         return 0;
     
     // Hierarchy leveling starts at 1, to match the aria-level spec.
@@ -1646,9 +1641,9 @@
     unsigned level = 1;
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
         AccessibilityRole parentRole = parent->ariaRoleAttribute();
-        if (parentRole == ApplicationGroupRole)
+        if (parentRole == AccessibilityRole::ApplicationGroup)
             level++;
-        else if (parentRole == TreeRole)
+        else if (parentRole == AccessibilityRole::Tree)
             break;
     }
     
@@ -1805,26 +1800,26 @@
         return String();
 
     switch (roleValue()) {
-    case PopUpButtonRole:
+    case AccessibilityRole::PopUpButton:
         // Native popup buttons should not use their button children's text as a title. That value is retrieved through stringValue().
         if (node->hasTagName(selectTag))
             return String();
         FALLTHROUGH;
-    case ButtonRole:
-    case ToggleButtonRole:
-    case CheckBoxRole:
-    case ListBoxOptionRole:
-    case ListItemRole:
-    case MenuButtonRole:
-    case MenuItemRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case RadioButtonRole:
-    case SwitchRole:
-    case TabRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::ToggleButton:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ListBoxOption:
+    case AccessibilityRole::ListItem:
+    case AccessibilityRole::MenuButton:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::Tab:
         return textUnderElement();
     // SVGRoots should not use the text under itself as a title. That could include the text of objects like <text>.
-    case SVGRootRole:
+    case AccessibilityRole::SVGRoot:
         return String();
     default:
         break;
@@ -1841,7 +1836,7 @@
 String AccessibilityNodeObject::text() const
 {
     // If this is a user defined static text, use the accessible name computation.                                      
-    if (ariaRoleAttribute() == StaticTextRole) {
+    if (ariaRoleAttribute() == AccessibilityRole::StaticText) {
         Vector<AccessibilityText> textOrder;
         alternativeText(textOrder);
         if (textOrder.size() > 0 && textOrder[0].text.length())
@@ -1870,7 +1865,7 @@
     if (!node)
         return String();
 
-    if (ariaRoleAttribute() == StaticTextRole) {
+    if (ariaRoleAttribute() == AccessibilityRole::StaticText) {
         String staticText = text();
         if (!staticText.length())
             staticText = textUnderElement();
@@ -2128,37 +2123,37 @@
 {
     const AtomicString& ariaRole = getAttribute(roleAttr);
     if (ariaRole.isNull() || ariaRole.isEmpty())
-        return UnknownRole;
+        return AccessibilityRole::Unknown;
     
     AccessibilityRole role = ariaRoleToWebCoreRole(ariaRole);
 
     // ARIA states if an item can get focus, it should not be presentational.
-    if (role == PresentationalRole && canSetFocusAttribute())
-        return UnknownRole;
+    if (role == AccessibilityRole::Presentational && canSetFocusAttribute())
+        return AccessibilityRole::Unknown;
 
-    if (role == ButtonRole)
+    if (role == AccessibilityRole::Button)
         role = buttonRoleType();
 
-    if (role == TextAreaRole && !ariaIsMultiline())
-        role = TextFieldRole;
+    if (role == AccessibilityRole::TextArea && !ariaIsMultiline())
+        role = AccessibilityRole::TextField;
 
     role = remapAriaRoleDueToParent(role);
     
     // Presentational roles are invalidated by the presence of ARIA attributes.
-    if (role == PresentationalRole && supportsARIAAttributes())
-        role = UnknownRole;
+    if (role == AccessibilityRole::Presentational && supportsARIAAttributes())
+        role = AccessibilityRole::Unknown;
     
     // The ARIA spec states, "Authors must give each element with role region a brief label that
     // describes the purpose of the content in the region." The Core AAM states, "Special case:
     // if the region does not have an accessible name, do not expose the element as a landmark.
     // Use the native host language role of the element instead."
-    if (role == LandmarkRegionRole && !hasAttribute(aria_labelAttr) && !hasAttribute(aria_labelledbyAttr))
-        role = UnknownRole;
+    if (role == AccessibilityRole::LandmarkRegion && !hasAttribute(aria_labelAttr) && !hasAttribute(aria_labelledbyAttr))
+        role = AccessibilityRole::Unknown;
 
-    if (role)
+    if (static_cast<int>(role))
         return role;
 
-    return UnknownRole;
+    return AccessibilityRole::Unknown;
 }
 
 AccessibilityRole AccessibilityNodeObject::ariaRoleAttribute() const
@@ -2173,21 +2168,21 @@
     // While inside the call stack of creating an element, we need to avoid accessibilityIsIgnored().
     // https://bugs.webkit.org/show_bug.cgi?id=65174
 
-    if (role != ListBoxOptionRole && role != MenuItemRole)
+    if (role != AccessibilityRole::ListBoxOption && role != AccessibilityRole::MenuItem)
         return role;
     
     for (AccessibilityObject* parent = parentObject(); parent && !parent->accessibilityIsIgnored(); parent = parent->parentObject()) {
         AccessibilityRole parentAriaRole = parent->ariaRoleAttribute();
 
         // Selects and listboxes both have options as child roles, but they map to different roles within WebCore.
-        if (role == ListBoxOptionRole && parentAriaRole == MenuRole)
-            return MenuItemRole;
+        if (role == AccessibilityRole::ListBoxOption && parentAriaRole == AccessibilityRole::Menu)
+            return AccessibilityRole::MenuItem;
         // An aria "menuitem" may map to MenuButton or MenuItem depending on its parent.
-        if (role == MenuItemRole && parentAriaRole == ApplicationGroupRole)
-            return MenuButtonRole;
+        if (role == AccessibilityRole::MenuItem && parentAriaRole == AccessibilityRole::ApplicationGroup)
+            return AccessibilityRole::MenuButton;
         
         // If the parent had a different role, then we don't need to continue searching up the chain.
-        if (parentAriaRole)
+        if (parentAriaRole != AccessibilityRole::Unknown)
             break;
     }
     
@@ -2198,19 +2193,19 @@
 {
     // Elements that can be selected
     switch (roleValue()) {
-    case CellRole:
-    case GridCellRole:
-    case RadioButtonRole:
-    case RowHeaderRole:
-    case RowRole:
-    case TabListRole:
-    case TabRole:
-    case TreeGridRole:
-    case TreeItemRole:
-    case TreeRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case MenuItemRole:
+    case AccessibilityRole::Cell:
+    case AccessibilityRole::GridCell:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::RowHeader:
+    case AccessibilityRole::Row:
+    case AccessibilityRole::TabList:
+    case AccessibilityRole::Tab:
+    case AccessibilityRole::TreeGrid:
+    case AccessibilityRole::TreeItem:
+    case AccessibilityRole::Tree:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::MenuItem:
         return isEnabled();
     default:
         return false;
diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.h b/Source/WebCore/accessibility/AccessibilityNodeObject.h
index ad63686..f80582d 100644
--- a/Source/WebCore/accessibility/AccessibilityNodeObject.h
+++ b/Source/WebCore/accessibility/AccessibilityNodeObject.h
@@ -144,10 +144,10 @@
 protected:
     explicit AccessibilityNodeObject(Node*);
 
-    AccessibilityRole m_ariaRole;
-    mutable AccessibilityRole m_roleForMSAA;
+    AccessibilityRole m_ariaRole { AccessibilityRole::Unknown };
+    mutable AccessibilityRole m_roleForMSAA { AccessibilityRole::Unknown };
 #ifndef NDEBUG
-    bool m_initialized;
+    bool m_initialized { false };
 #endif
 
     bool isDetached() const override { return !m_node; }
diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp
index a673e0d..a2499f4 100644
--- a/Source/WebCore/accessibility/AccessibilityObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityObject.cpp
@@ -84,20 +84,6 @@
 
 using namespace HTMLNames;
 
-AccessibilityObject::AccessibilityObject()
-    : m_id(0)
-    , m_haveChildren(false)
-    , m_role(UnknownRole)
-    , m_lastKnownIsIgnoredValue(DefaultBehavior)
-    , m_isIgnoredFromParentData(AccessibilityIsIgnoredFromParentData())
-    , m_childrenDirty(false)
-    , m_subtreeDirty(false)
-#if PLATFORM(GTK)
-    , m_wrapper(nullptr)
-#endif
-{
-}
-
 AccessibilityObject::~AccessibilityObject()
 {
     ASSERT(isDetached());
@@ -106,7 +92,7 @@
 void AccessibilityObject::detach(AccessibilityDetachmentType detachmentType, AXObjectCache* cache)
 {
     // Menu close events need to notify the platform. No element is used in the notification because it's a destruction event.
-    if (detachmentType == ElementDestroyed && roleValue() == MenuRole && cache)
+    if (detachmentType == AccessibilityDetachmentType::ElementDestroyed && roleValue() == AccessibilityRole::Menu && cache)
         cache->postNotification(nullptr, &cache->document(), AXObjectCache::AXMenuClosed);
     
     // Clear any children and call detachFromParent on them so that
@@ -130,142 +116,142 @@
 bool AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex(AccessibilityObject* axObject, AccessibilitySearchCriteria* criteria, size_t index)
 {
     switch (criteria->searchKeys[index]) {
-    // The AnyTypeSearchKey matches any non-null AccessibilityObject.
-    case AnyTypeSearchKey:
+    // The AccessibilitySearchKey::AnyType matches any non-null AccessibilityObject.
+    case AccessibilitySearchKey::AnyType:
         return true;
         
-    case ArticleSearchKey:
-        return axObject->roleValue() == DocumentArticleRole;
+    case AccessibilitySearchKey::Article:
+        return axObject->roleValue() == AccessibilityRole::DocumentArticle;
             
-    case BlockquoteSameLevelSearchKey:
+    case AccessibilitySearchKey::BlockquoteSameLevel:
         return criteria->startObject
             && axObject->isBlockquote()
             && axObject->blockquoteLevel() == criteria->startObject->blockquoteLevel();
         
-    case BlockquoteSearchKey:
+    case AccessibilitySearchKey::Blockquote:
         return axObject->isBlockquote();
         
-    case BoldFontSearchKey:
+    case AccessibilitySearchKey::BoldFont:
         return axObject->hasBoldFont();
         
-    case ButtonSearchKey:
+    case AccessibilitySearchKey::Button:
         return axObject->isButton();
         
-    case CheckBoxSearchKey:
+    case AccessibilitySearchKey::CheckBox:
         return axObject->isCheckbox();
         
-    case ControlSearchKey:
+    case AccessibilitySearchKey::Control:
         return axObject->isControl();
         
-    case DifferentTypeSearchKey:
+    case AccessibilitySearchKey::DifferentType:
         return criteria->startObject
             && axObject->roleValue() != criteria->startObject->roleValue();
         
-    case FontChangeSearchKey:
+    case AccessibilitySearchKey::FontChange:
         return criteria->startObject
             && !axObject->hasSameFont(criteria->startObject->renderer());
         
-    case FontColorChangeSearchKey:
+    case AccessibilitySearchKey::FontColorChange:
         return criteria->startObject
             && !axObject->hasSameFontColor(criteria->startObject->renderer());
         
-    case FrameSearchKey:
+    case AccessibilitySearchKey::Frame:
         return axObject->isWebArea();
         
-    case GraphicSearchKey:
+    case AccessibilitySearchKey::Graphic:
         return axObject->isImage();
         
-    case HeadingLevel1SearchKey:
+    case AccessibilitySearchKey::HeadingLevel1:
         return axObject->headingLevel() == 1;
         
-    case HeadingLevel2SearchKey:
+    case AccessibilitySearchKey::HeadingLevel2:
         return axObject->headingLevel() == 2;
         
-    case HeadingLevel3SearchKey:
+    case AccessibilitySearchKey::HeadingLevel3:
         return axObject->headingLevel() == 3;
         
-    case HeadingLevel4SearchKey:
+    case AccessibilitySearchKey::HeadingLevel4:
         return axObject->headingLevel() == 4;
         
-    case HeadingLevel5SearchKey:
+    case AccessibilitySearchKey::HeadingLevel5:
         return axObject->headingLevel() == 5;
         
-    case HeadingLevel6SearchKey:
+    case AccessibilitySearchKey::HeadingLevel6:
         return axObject->headingLevel() == 6;
         
-    case HeadingSameLevelSearchKey:
+    case AccessibilitySearchKey::HeadingSameLevel:
         return criteria->startObject
             && axObject->isHeading()
             && axObject->headingLevel() == criteria->startObject->headingLevel();
         
-    case HeadingSearchKey:
+    case AccessibilitySearchKey::Heading:
         return axObject->isHeading();
     
-    case HighlightedSearchKey:
+    case AccessibilitySearchKey::Highlighted:
         return axObject->hasHighlighting();
             
-    case ItalicFontSearchKey:
+    case AccessibilitySearchKey::ItalicFont:
         return axObject->hasItalicFont();
         
-    case LandmarkSearchKey:
+    case AccessibilitySearchKey::Landmark:
         return axObject->isLandmark();
         
-    case LinkSearchKey: {
+    case AccessibilitySearchKey::Link: {
         bool isLink = axObject->isLink();
 #if PLATFORM(IOS)
         if (!isLink)
-            isLink = axObject->isDescendantOfRole(WebCoreLinkRole);
+            isLink = axObject->isDescendantOfRole(AccessibilityRole::WebCoreLink);
 #endif
         return isLink;
     }
         
-    case ListSearchKey:
+    case AccessibilitySearchKey::List:
         return axObject->isList();
         
-    case LiveRegionSearchKey:
+    case AccessibilitySearchKey::LiveRegion:
         return axObject->supportsARIALiveRegion();
         
-    case MisspelledWordSearchKey:
+    case AccessibilitySearchKey::MisspelledWord:
         return axObject->hasMisspelling();
         
-    case OutlineSearchKey:
+    case AccessibilitySearchKey::Outline:
         return axObject->isTree();
         
-    case PlainTextSearchKey:
+    case AccessibilitySearchKey::PlainText:
         return axObject->hasPlainText();
         
-    case RadioGroupSearchKey:
+    case AccessibilitySearchKey::RadioGroup:
         return axObject->isRadioGroup();
         
-    case SameTypeSearchKey:
+    case AccessibilitySearchKey::SameType:
         return criteria->startObject
             && axObject->roleValue() == criteria->startObject->roleValue();
         
-    case StaticTextSearchKey:
+    case AccessibilitySearchKey::StaticText:
         return axObject->isStaticText();
         
-    case StyleChangeSearchKey:
+    case AccessibilitySearchKey::StyleChange:
         return criteria->startObject
             && !axObject->hasSameStyle(criteria->startObject->renderer());
         
-    case TableSameLevelSearchKey:
+    case AccessibilitySearchKey::TableSameLevel:
         return criteria->startObject
             && is<AccessibilityTable>(*axObject) && downcast<AccessibilityTable>(*axObject).isExposableThroughAccessibility()
             && downcast<AccessibilityTable>(*axObject).tableLevel() == criteria->startObject->tableLevel();
         
-    case TableSearchKey:
+    case AccessibilitySearchKey::Table:
         return is<AccessibilityTable>(*axObject) && downcast<AccessibilityTable>(*axObject).isExposableThroughAccessibility();
         
-    case TextFieldSearchKey:
+    case AccessibilitySearchKey::TextField:
         return axObject->isTextControl();
         
-    case UnderlineSearchKey:
+    case AccessibilitySearchKey::Underline:
         return axObject->hasUnderline();
         
-    case UnvisitedLinkSearchKey:
+    case AccessibilitySearchKey::UnvisitedLink:
         return axObject->isUnvisited();
         
-    case VisitedLinkSearchKey:
+    case AccessibilitySearchKey::VisitedLink:
         return axObject->isVisited();
         
     default:
@@ -312,51 +298,51 @@
 {
     // First check for objects specifically identified by ARIA.
     switch (ariaRoleAttribute()) {
-    case ApplicationAlertRole:
-    case ApplicationAlertDialogRole:
-    case ApplicationDialogRole:
-    case ApplicationGroupRole:
-    case ApplicationLogRole:
-    case ApplicationMarqueeRole:
-    case ApplicationStatusRole:
-    case ApplicationTimerRole:
-    case ComboBoxRole:
-    case DefinitionRole:
-    case DocumentRole:
-    case DocumentArticleRole:
-    case DocumentMathRole:
-    case DocumentNoteRole:
-    case LandmarkRegionRole:
-    case LandmarkDocRegionRole:
-    case FormRole:
-    case GridRole:
-    case GroupRole:
-    case ImageRole:
-    case ListRole:
-    case ListBoxRole:
-    case LandmarkBannerRole:
-    case LandmarkComplementaryRole:
-    case LandmarkContentInfoRole:
-    case LandmarkNavigationRole:
-    case LandmarkMainRole:
-    case LandmarkSearchRole:
-    case MenuRole:
-    case MenuBarRole:
-    case ProgressIndicatorRole:
-    case RadioGroupRole:
-    case ScrollBarRole:
-    case SliderRole:
-    case SpinButtonRole:
-    case SplitterRole:
-    case TableRole:
-    case TabListRole:
-    case TabPanelRole:
-    case TextAreaRole:
-    case TextFieldRole:
-    case ToolbarRole:
-    case TreeGridRole:
-    case TreeRole:
-    case WebApplicationRole:
+    case AccessibilityRole::ApplicationAlert:
+    case AccessibilityRole::ApplicationAlertDialog:
+    case AccessibilityRole::ApplicationDialog:
+    case AccessibilityRole::ApplicationGroup:
+    case AccessibilityRole::ApplicationLog:
+    case AccessibilityRole::ApplicationMarquee:
+    case AccessibilityRole::ApplicationStatus:
+    case AccessibilityRole::ApplicationTimer:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::Definition:
+    case AccessibilityRole::Document:
+    case AccessibilityRole::DocumentArticle:
+    case AccessibilityRole::DocumentMath:
+    case AccessibilityRole::DocumentNote:
+    case AccessibilityRole::LandmarkRegion:
+    case AccessibilityRole::LandmarkDocRegion:
+    case AccessibilityRole::Form:
+    case AccessibilityRole::Grid:
+    case AccessibilityRole::Group:
+    case AccessibilityRole::Image:
+    case AccessibilityRole::List:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::LandmarkBanner:
+    case AccessibilityRole::LandmarkComplementary:
+    case AccessibilityRole::LandmarkContentInfo:
+    case AccessibilityRole::LandmarkNavigation:
+    case AccessibilityRole::LandmarkMain:
+    case AccessibilityRole::LandmarkSearch:
+    case AccessibilityRole::Menu:
+    case AccessibilityRole::MenuBar:
+    case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::RadioGroup:
+    case AccessibilityRole::ScrollBar:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::SpinButton:
+    case AccessibilityRole::Splitter:
+    case AccessibilityRole::Table:
+    case AccessibilityRole::TabList:
+    case AccessibilityRole::TabPanel:
+    case AccessibilityRole::TextArea:
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::Toolbar:
+    case AccessibilityRole::TreeGrid:
+    case AccessibilityRole::Tree:
+    case AccessibilityRole::WebApplication:
         return false;
     default:
         break;
@@ -364,7 +350,7 @@
     
     // Now check for generically derived elements now that we know the element does not match a specific ARIA role.
     switch (roleValue()) {
-    case SliderRole:
+    case AccessibilityRole::Slider:
         return false;
     default:
         break;
@@ -388,16 +374,16 @@
 
 bool AccessibilityObject::isBlockquote() const
 {
-    return roleValue() == BlockquoteRole;
+    return roleValue() == AccessibilityRole::Blockquote;
 }
 
 bool AccessibilityObject::isTextControl() const
 {
     switch (roleValue()) {
-    case ComboBoxRole:
-    case SearchFieldRole:
-    case TextAreaRole:
-    case TextFieldRole:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::SearchField:
+    case AccessibilityRole::TextArea:
+    case AccessibilityRole::TextField:
         return true;
     default:
         return false;
@@ -406,7 +392,7 @@
     
 bool AccessibilityObject::isARIATextControl() const
 {
-    return ariaRoleAttribute() == TextAreaRole || ariaRoleAttribute() == TextFieldRole || ariaRoleAttribute() == SearchFieldRole;
+    return ariaRoleAttribute() == AccessibilityRole::TextArea || ariaRoleAttribute() == AccessibilityRole::TextField || ariaRoleAttribute() == AccessibilityRole::SearchField;
 }
 
 bool AccessibilityObject::isNonNativeTextControl() const
@@ -418,14 +404,14 @@
 {
     AccessibilityRole role = roleValue();
     
-    return role == LandmarkBannerRole
-        || role == LandmarkComplementaryRole
-        || role == LandmarkContentInfoRole
-        || role == LandmarkDocRegionRole
-        || role == LandmarkMainRole
-        || role == LandmarkNavigationRole
-        || role == LandmarkRegionRole
-        || role == LandmarkSearchRole;
+    return role == AccessibilityRole::LandmarkBanner
+        || role == AccessibilityRole::LandmarkComplementary
+        || role == AccessibilityRole::LandmarkContentInfo
+        || role == AccessibilityRole::LandmarkDocRegion
+        || role == AccessibilityRole::LandmarkMain
+        || role == AccessibilityRole::LandmarkNavigation
+        || role == AccessibilityRole::LandmarkRegion
+        || role == AccessibilityRole::LandmarkSearch;
 }
 
 bool AccessibilityObject::hasMisspelling() const
@@ -677,7 +663,7 @@
     if (!startObject)
         startObject = this;
     
-    bool isForward = criteria->searchDirection == SearchDirectionNext;
+    bool isForward = criteria->searchDirection == AccessibilitySearchDirection::Next;
     
     // The first iteration of the outer loop will examine the children of the start object for matches. However, when
     // iterating backwards, the start object children should not be considered, so the loop is skipped ahead. We make an
@@ -760,7 +746,7 @@
     if (!referenceRange)
         return nullptr;
     
-    bool isBackwardSearch = searchDirection == SearchDirectionPrevious;
+    bool isBackwardSearch = searchDirection == AccessibilitySearchDirection::Previous;
     FindOptions findOptions = AtWordStarts | AtWordEnds | CaseInsensitive | StartInSelection;
     if (isBackwardSearch)
         findOptions |= Backwards;
@@ -832,11 +818,11 @@
     RefPtr<Range> closestAfterStringRange = nullptr;
     RefPtr<Range> closestBeforeStringRange = nullptr;
     // Search forward if necessary.
-    if (ambiguityResolution == ClosestAfterSelectionAmbiguityResolution || ambiguityResolution == ClosestToSelectionAmbiguityResolution)
-        closestAfterStringRange = rangeOfStringClosestToRangeInDirection(selectedStringRange.get(), SearchDirectionNext, searchStrings);
+    if (ambiguityResolution == AccessibilitySelectTextAmbiguityResolution::ClosestAfter || ambiguityResolution == AccessibilitySelectTextAmbiguityResolution::ClosestTo)
+        closestAfterStringRange = rangeOfStringClosestToRangeInDirection(selectedStringRange.get(), AccessibilitySearchDirection::Next, searchStrings);
     // Search backward if necessary.
-    if (ambiguityResolution == ClosestBeforeSelectionAmbiguityResolution || ambiguityResolution == ClosestToSelectionAmbiguityResolution)
-        closestBeforeStringRange = rangeOfStringClosestToRangeInDirection(selectedStringRange.get(), SearchDirectionPrevious, searchStrings);
+    if (ambiguityResolution == AccessibilitySelectTextAmbiguityResolution::ClosestBefore || ambiguityResolution == AccessibilitySelectTextAmbiguityResolution::ClosestTo)
+        closestBeforeStringRange = rangeOfStringClosestToRangeInDirection(selectedStringRange.get(), AccessibilitySearchDirection::Previous, searchStrings);
     
     // Determine which candidate is closest to the selection and perform the activity.
     if (RefPtr<Range> closestStringRange = rangeClosestToRange(selectedStringRange.get(), WTFMove(closestAfterStringRange), WTFMove(closestBeforeStringRange))) {
@@ -850,20 +836,20 @@
         bool replaceSelection = false;
         if (frame->selection().setSelectedRange(closestStringRange.get(), DOWNSTREAM, true)) {
             switch (activity) {
-            case FindAndCapitalize:
+            case AccessibilitySelectTextActivity::FindAndCapitalize:
                 replacementString = closestString;
                 makeCapitalized(&replacementString, 0);
                 replaceSelection = true;
                 break;
-            case FindAndUppercase:
+            case AccessibilitySelectTextActivity::FindAndUppercase:
                 replacementString = closestString.convertToUppercaseWithoutLocale(); // FIXME: Needs locale to work correctly.
                 replaceSelection = true;
                 break;
-            case FindAndLowercase:
+            case AccessibilitySelectTextActivity::FindAndLowercase:
                 replacementString = closestString.convertToLowercaseWithoutLocale(); // FIXME: Needs locale to work correctly.
                 replaceSelection = true;
                 break;
-            case FindAndReplaceActivity: {
+            case AccessibilitySelectTextActivity::FindAndReplace: {
                 replaceSelection = true;
                 // When applying find and replace activities, we want to match the capitalization of the replaced text,
                 // (unless we're replacing with an abbreviation.)
@@ -875,7 +861,7 @@
                 }
                 break;
             }
-            case FindAndSelectActivity:
+            case AccessibilitySelectTextActivity::FindAndSelect:
                 break;
             }
             
@@ -912,24 +898,23 @@
 
 bool AccessibilityObject::isARIAInput(AccessibilityRole ariaRole)
 {
-    return ariaRole == RadioButtonRole || ariaRole == CheckBoxRole || ariaRole == TextFieldRole || ariaRole == SwitchRole || ariaRole == SearchFieldRole;
+    return ariaRole == AccessibilityRole::RadioButton || ariaRole == AccessibilityRole::CheckBox || ariaRole == AccessibilityRole::TextField || ariaRole == AccessibilityRole::Switch || ariaRole == AccessibilityRole::SearchField;
 }    
     
 bool AccessibilityObject::isARIAControl(AccessibilityRole ariaRole)
 {
-    return isARIAInput(ariaRole) || ariaRole == TextAreaRole || ariaRole == ButtonRole 
-    || ariaRole == ComboBoxRole || ariaRole == SliderRole; 
+    return isARIAInput(ariaRole) || ariaRole == AccessibilityRole::TextArea || ariaRole == AccessibilityRole::Button || ariaRole == AccessibilityRole::ComboBox || ariaRole == AccessibilityRole::Slider;
 }
     
 bool AccessibilityObject::isRangeControl() const
 {
     switch (roleValue()) {
-    case ProgressIndicatorRole:
-    case SliderRole:
-    case ScrollBarRole:
-    case SpinButtonRole:
+    case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::ScrollBar:
+    case AccessibilityRole::SpinButton:
         return true;
-    case SplitterRole:
+    case AccessibilityRole::Splitter:
         return canSetFocusAttribute();
     default:
         return false;
@@ -1459,7 +1444,7 @@
         return VisiblePosition();
     
     // FIXME: Add support for right-to-left languages.
-    IntPoint corner = (visiblePositionForBounds == FirstVisiblePositionForBounds) ? rect.minXMinYCorner() : rect.maxXMaxYCorner();
+    IntPoint corner = (visiblePositionForBounds == AccessibilityVisiblePositionForBounds::First) ? rect.minXMinYCorner() : rect.maxXMaxYCorner();
     VisiblePosition position = mainFrame->visiblePositionForPoint(corner);
     
     if (rect.contains(position.absoluteCaretBounds().center()))
@@ -1652,29 +1637,29 @@
 {
     AccessibilityRole role = roleValue();
 
-    return role == CheckBoxRole
-        || role == ColumnHeaderRole
-        || role == ComboBoxRole
-        || role == GridRole
-        || role == GridCellRole
-        || role == ListBoxRole
-        || role == MenuItemCheckboxRole
-        || role == MenuItemRadioRole
-        || role == RadioGroupRole
-        || role == RowHeaderRole
-        || role == SearchFieldRole
-        || role == SliderRole
-        || role == SpinButtonRole
-        || role == SwitchRole
-        || role == TextFieldRole
-        || role == TreeGridRole
+    return role == AccessibilityRole::CheckBox
+        || role == AccessibilityRole::ColumnHeader
+        || role == AccessibilityRole::ComboBox
+        || role == AccessibilityRole::Grid
+        || role == AccessibilityRole::GridCell
+        || role == AccessibilityRole::ListBox
+        || role == AccessibilityRole::MenuItemCheckbox
+        || role == AccessibilityRole::MenuItemRadio
+        || role == AccessibilityRole::RadioGroup
+        || role == AccessibilityRole::RowHeader
+        || role == AccessibilityRole::SearchField
+        || role == AccessibilityRole::Slider
+        || role == AccessibilityRole::SpinButton
+        || role == AccessibilityRole::Switch
+        || role == AccessibilityRole::TextField
+        || role == AccessibilityRole::TreeGrid
         || isPasswordField();
 }
 
 String AccessibilityObject::ariaReadOnlyValue() const
 {
     if (!hasAttribute(aria_readonlyAttr))
-        return ariaRoleAttribute() != UnknownRole && supportsARIAReadOnly() ? "false" : String();
+        return ariaRoleAttribute() != AccessibilityRole::Unknown && supportsARIAReadOnly() ? "false" : String();
 
     return getAttribute(aria_readonlyAttr).string().convertToASCIILowercase();
 }
@@ -1891,7 +1876,7 @@
     AccessibilityObject* axObject = renderObject->document().axObjectCache()->getOrCreate(renderObject);
     
     return const_cast<AccessibilityObject*>(AccessibilityObject::matchedParent(*axObject, true, [] (const AccessibilityObject& object) {
-        return object.roleValue() == HeadingRole;
+        return object.roleValue() == AccessibilityRole::Heading;
     }));
 }
 
@@ -1909,7 +1894,7 @@
 {
     for (const auto& child : children()) {
         // Add tree items as the rows.
-        if (child->roleValue() == TreeItemRole)
+        if (child->roleValue() == AccessibilityRole::TreeItem)
             result.append(child);
 
         // Now see if this item also has rows hiding inside of it.
@@ -1921,7 +1906,7 @@
 {
     // The ARIA tree item content are the item that are not other tree items or their containing groups.
     for (const auto& child : children()) {
-        if (!child->isGroup() && child->roleValue() != TreeItemRole)
+        if (!child->isGroup() && child->roleValue() != AccessibilityRole::TreeItem)
             result.append(child);
     }
 }
@@ -1930,7 +1915,7 @@
 {
     for (const auto& obj : children()) {
         // Add tree items as the rows.
-        if (obj->roleValue() == TreeItemRole)
+        if (obj->roleValue() == AccessibilityRole::TreeItem)
             result.append(obj);
         // If it's not a tree item, then descend into the group to find more tree items.
         else 
@@ -1941,14 +1926,14 @@
 const String AccessibilityObject::defaultLiveRegionStatusForRole(AccessibilityRole role)
 {
     switch (role) {
-    case ApplicationAlertDialogRole:
-    case ApplicationAlertRole:
+    case AccessibilityRole::ApplicationAlertDialog:
+    case AccessibilityRole::ApplicationAlert:
         return ASCIILiteral("assertive");
-    case ApplicationLogRole:
-    case ApplicationStatusRole:
+    case AccessibilityRole::ApplicationLog:
+    case AccessibilityRole::ApplicationStatus:
         return ASCIILiteral("polite");
-    case ApplicationTimerRole:
-    case ApplicationMarqueeRole:
+    case AccessibilityRole::ApplicationTimer:
+    case AccessibilityRole::ApplicationMarquee:
         return ASCIILiteral("off");
     default:
         return nullAtom();
@@ -1971,25 +1956,25 @@
     static NeverDestroyed<const String> listItemAction(AXListItemActionVerb());
 
     switch (roleValue()) {
-    case ButtonRole:
-    case ToggleButtonRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::ToggleButton:
         return buttonAction;
-    case TextFieldRole:
-    case TextAreaRole:
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::TextArea:
         return textFieldAction;
-    case RadioButtonRole:
+    case AccessibilityRole::RadioButton:
         return radioButtonAction;
-    case CheckBoxRole:
-    case SwitchRole:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::Switch:
         return isChecked() ? checkedCheckBoxAction : uncheckedCheckBoxAction;
-    case LinkRole:
-    case WebCoreLinkRole:
+    case AccessibilityRole::Link:
+    case AccessibilityRole::WebCoreLink:
         return linkAction;
-    case PopUpButtonRole:
+    case AccessibilityRole::PopUpButton:
         return menuListAction;
-    case MenuListPopupRole:
+    case AccessibilityRole::MenuListPopup:
         return menuListPopupAction;
-    case ListItemRole:
+    case AccessibilityRole::ListItem:
         return listItemAction;
     default:
         return nullAtom();
@@ -2052,40 +2037,40 @@
     
     // If "false", empty, or missing, return false state.
     if (currentStateValue.isEmpty() || currentStateValue == "false")
-        return ARIACurrentFalse;
+        return AccessibilityARIACurrentState::False;
     
     if (currentStateValue == "page")
-        return ARIACurrentPage;
+        return AccessibilityARIACurrentState::Page;
     if (currentStateValue == "step")
-        return ARIACurrentStep;
+        return AccessibilityARIACurrentState::Step;
     if (currentStateValue == "location")
-        return ARIACurrentLocation;
+        return AccessibilityARIACurrentState::Location;
     if (currentStateValue == "date")
-        return ARIACurrentDate;
+        return AccessibilityARIACurrentState::Date;
     if (currentStateValue == "time")
-        return ARIACurrentTime;
+        return AccessibilityARIACurrentState::Time;
     
     // Any value not included in the list of allowed values should be treated as "true".
-    return ARIACurrentTrue;
+    return AccessibilityARIACurrentState::True;
 }
 
 String AccessibilityObject::ariaCurrentValue() const
 {
     switch (ariaCurrentState()) {
-    case ARIACurrentFalse:
+    case AccessibilityARIACurrentState::False:
         return "false";
-    case ARIACurrentPage:
+    case AccessibilityARIACurrentState::Page:
         return "page";
-    case ARIACurrentStep:
+    case AccessibilityARIACurrentState::Step:
         return "step";
-    case ARIACurrentLocation:
+    case AccessibilityARIACurrentState::Location:
         return "location";
-    case ARIACurrentTime:
+    case AccessibilityARIACurrentState::Time:
         return "time";
-    case ARIACurrentDate:
+    case AccessibilityARIACurrentState::Date:
         return "date";
     default:
-    case ARIACurrentTrue:
+    case AccessibilityARIACurrentState::True:
         return "true";
     }
 }
@@ -2164,11 +2149,11 @@
 {
     LayoutRect bounds = elementRect();
     if (bounds.size().width() > bounds.size().height())
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     if (bounds.size().height() > bounds.size().width())
-        return AccessibilityOrientationVertical;
+        return AccessibilityOrientation::Vertical;
 
-    return AccessibilityOrientationUndefined;
+    return AccessibilityOrientation::Undefined;
 }    
 
 bool AccessibilityObject::isDescendantOfObject(const AccessibilityObject* axObject) const
@@ -2216,117 +2201,117 @@
     ASSERT(!gAriaReverseRoleMap);
 
     const RoleEntry roles[] = {
-        { "alert", ApplicationAlertRole },
-        { "alertdialog", ApplicationAlertDialogRole },
-        { "application", WebApplicationRole },
-        { "article", DocumentArticleRole },
-        { "banner", LandmarkBannerRole },
-        { "button", ButtonRole },
-        { "checkbox", CheckBoxRole },
-        { "complementary", LandmarkComplementaryRole },
-        { "contentinfo", LandmarkContentInfoRole },
-        { "dialog", ApplicationDialogRole },
-        { "directory", DirectoryRole },
+        { "alert", AccessibilityRole::ApplicationAlert },
+        { "alertdialog", AccessibilityRole::ApplicationAlertDialog },
+        { "application", AccessibilityRole::WebApplication },
+        { "article", AccessibilityRole::DocumentArticle },
+        { "banner", AccessibilityRole::LandmarkBanner },
+        { "button", AccessibilityRole::Button },
+        { "checkbox", AccessibilityRole::CheckBox },
+        { "complementary", AccessibilityRole::LandmarkComplementary },
+        { "contentinfo", AccessibilityRole::LandmarkContentInfo },
+        { "dialog", AccessibilityRole::ApplicationDialog },
+        { "directory", AccessibilityRole::Directory },
         // The 'doc-*' roles are defined the ARIA DPUB mobile: https://www.w3.org/TR/dpub-aam-1.0/ 
         // Editor's draft is currently at https://rawgit.com/w3c/aria/master/dpub-aam/dpub-aam.html 
-        { "doc-abstract", ApplicationTextGroupRole },
-        { "doc-acknowledgments", LandmarkDocRegionRole },
-        { "doc-afterword", LandmarkDocRegionRole },
-        { "doc-appendix", LandmarkDocRegionRole },
-        { "doc-backlink", WebCoreLinkRole },
-        { "doc-biblioentry", ListItemRole },
-        { "doc-bibliography", LandmarkDocRegionRole },
-        { "doc-biblioref", WebCoreLinkRole },
-        { "doc-chapter", LandmarkDocRegionRole },
-        { "doc-colophon", ApplicationTextGroupRole },
-        { "doc-conclusion", LandmarkDocRegionRole },
-        { "doc-cover", ImageRole },
-        { "doc-credit", ApplicationTextGroupRole },
-        { "doc-credits", LandmarkDocRegionRole },
-        { "doc-dedication", ApplicationTextGroupRole },
-        { "doc-endnote", ListItemRole },
-        { "doc-endnotes", LandmarkDocRegionRole },
-        { "doc-epigraph", ApplicationTextGroupRole },
-        { "doc-epilogue", LandmarkDocRegionRole },
-        { "doc-errata", LandmarkDocRegionRole },
-        { "doc-example", ApplicationTextGroupRole },
-        { "doc-footnote", FootnoteRole },
-        { "doc-foreword", LandmarkDocRegionRole },
-        { "doc-glossary", LandmarkDocRegionRole },
-        { "doc-glossref", WebCoreLinkRole },
-        { "doc-index", LandmarkNavigationRole },
-        { "doc-introduction", LandmarkDocRegionRole },
-        { "doc-noteref", WebCoreLinkRole },
-        { "doc-notice", DocumentNoteRole },
-        { "doc-pagebreak", SplitterRole },
-        { "doc-pagelist", LandmarkNavigationRole },
-        { "doc-part", LandmarkDocRegionRole },
-        { "doc-preface", LandmarkDocRegionRole },
-        { "doc-prologue", LandmarkDocRegionRole },
-        { "doc-pullquote", ApplicationTextGroupRole },
-        { "doc-qna", ApplicationTextGroupRole },
-        { "doc-subtitle", HeadingRole },
-        { "doc-tip", DocumentNoteRole },
-        { "doc-toc", LandmarkNavigationRole },
-        { "figure", FigureRole },
-        { "grid", GridRole },
-        { "gridcell", GridCellRole },
-        { "table", TableRole },
-        { "cell", CellRole },
-        { "columnheader", ColumnHeaderRole },
-        { "combobox", ComboBoxRole },
-        { "definition", DefinitionRole },
-        { "document", DocumentRole },
-        { "feed", FeedRole },
-        { "form", FormRole },
-        { "rowheader", RowHeaderRole },
-        { "group", ApplicationGroupRole },
-        { "heading", HeadingRole },
-        { "img", ImageRole },
-        { "link", WebCoreLinkRole },
-        { "list", ListRole },        
-        { "listitem", ListItemRole },        
-        { "listbox", ListBoxRole },
-        { "log", ApplicationLogRole },
-        { "main", LandmarkMainRole },
-        { "marquee", ApplicationMarqueeRole },
-        { "math", DocumentMathRole },
-        { "menu", MenuRole },
-        { "menubar", MenuBarRole },
-        { "menuitem", MenuItemRole },
-        { "menuitemcheckbox", MenuItemCheckboxRole },
-        { "menuitemradio", MenuItemRadioRole },
-        { "none", PresentationalRole },
-        { "note", DocumentNoteRole },
-        { "navigation", LandmarkNavigationRole },
-        { "option", ListBoxOptionRole },
-        { "presentation", PresentationalRole },
-        { "progressbar", ProgressIndicatorRole },
-        { "radio", RadioButtonRole },
-        { "radiogroup", RadioGroupRole },
-        { "region", LandmarkRegionRole },
-        { "row", RowRole },
-        { "rowgroup", RowGroupRole },
-        { "scrollbar", ScrollBarRole },
-        { "search", LandmarkSearchRole },
-        { "searchbox", SearchFieldRole },
-        { "separator", SplitterRole },
-        { "slider", SliderRole },
-        { "spinbutton", SpinButtonRole },
-        { "status", ApplicationStatusRole },
-        { "switch", SwitchRole },
-        { "tab", TabRole },
-        { "tablist", TabListRole },
-        { "tabpanel", TabPanelRole },
-        { "text", StaticTextRole },
-        { "textbox", TextAreaRole },
-        { "term", TermRole },
-        { "timer", ApplicationTimerRole },
-        { "toolbar", ToolbarRole },
-        { "tooltip", UserInterfaceTooltipRole },
-        { "tree", TreeRole },
-        { "treegrid", TreeGridRole },
-        { "treeitem", TreeItemRole }
+        { "doc-abstract", AccessibilityRole::ApplicationTextGroup },
+        { "doc-acknowledgments", AccessibilityRole::LandmarkDocRegion },
+        { "doc-afterword", AccessibilityRole::LandmarkDocRegion },
+        { "doc-appendix", AccessibilityRole::LandmarkDocRegion },
+        { "doc-backlink", AccessibilityRole::WebCoreLink },
+        { "doc-biblioentry", AccessibilityRole::ListItem },
+        { "doc-bibliography", AccessibilityRole::LandmarkDocRegion },
+        { "doc-biblioref", AccessibilityRole::WebCoreLink },
+        { "doc-chapter", AccessibilityRole::LandmarkDocRegion },
+        { "doc-colophon", AccessibilityRole::ApplicationTextGroup },
+        { "doc-conclusion", AccessibilityRole::LandmarkDocRegion },
+        { "doc-cover", AccessibilityRole::Image },
+        { "doc-credit", AccessibilityRole::ApplicationTextGroup },
+        { "doc-credits", AccessibilityRole::LandmarkDocRegion },
+        { "doc-dedication", AccessibilityRole::ApplicationTextGroup },
+        { "doc-endnote", AccessibilityRole::ListItem },
+        { "doc-endnotes", AccessibilityRole::LandmarkDocRegion },
+        { "doc-epigraph", AccessibilityRole::ApplicationTextGroup },
+        { "doc-epilogue", AccessibilityRole::LandmarkDocRegion },
+        { "doc-errata", AccessibilityRole::LandmarkDocRegion },
+        { "doc-example", AccessibilityRole::ApplicationTextGroup },
+        { "doc-footnote", AccessibilityRole::Footnote },
+        { "doc-foreword", AccessibilityRole::LandmarkDocRegion },
+        { "doc-glossary", AccessibilityRole::LandmarkDocRegion },
+        { "doc-glossref", AccessibilityRole::WebCoreLink },
+        { "doc-index", AccessibilityRole::LandmarkNavigation },
+        { "doc-introduction", AccessibilityRole::LandmarkDocRegion },
+        { "doc-noteref", AccessibilityRole::WebCoreLink },
+        { "doc-notice", AccessibilityRole::DocumentNote },
+        { "doc-pagebreak", AccessibilityRole::Splitter },
+        { "doc-pagelist", AccessibilityRole::LandmarkNavigation },
+        { "doc-part", AccessibilityRole::LandmarkDocRegion },
+        { "doc-preface", AccessibilityRole::LandmarkDocRegion },
+        { "doc-prologue", AccessibilityRole::LandmarkDocRegion },
+        { "doc-pullquote", AccessibilityRole::ApplicationTextGroup },
+        { "doc-qna", AccessibilityRole::ApplicationTextGroup },
+        { "doc-subtitle", AccessibilityRole::Heading },
+        { "doc-tip", AccessibilityRole::DocumentNote },
+        { "doc-toc", AccessibilityRole::LandmarkNavigation },
+        { "figure", AccessibilityRole::Figure },
+        { "grid", AccessibilityRole::Grid },
+        { "gridcell", AccessibilityRole::GridCell },
+        { "table", AccessibilityRole::Table },
+        { "cell", AccessibilityRole::Cell },
+        { "columnheader", AccessibilityRole::ColumnHeader },
+        { "combobox", AccessibilityRole::ComboBox },
+        { "definition", AccessibilityRole::Definition },
+        { "document", AccessibilityRole::Document },
+        { "feed", AccessibilityRole::Feed },
+        { "form", AccessibilityRole::Form },
+        { "rowheader", AccessibilityRole::RowHeader },
+        { "group", AccessibilityRole::ApplicationGroup },
+        { "heading", AccessibilityRole::Heading },
+        { "img", AccessibilityRole::Image },
+        { "link", AccessibilityRole::WebCoreLink },
+        { "list", AccessibilityRole::List },
+        { "listitem", AccessibilityRole::ListItem },
+        { "listbox", AccessibilityRole::ListBox },
+        { "log", AccessibilityRole::ApplicationLog },
+        { "main", AccessibilityRole::LandmarkMain },
+        { "marquee", AccessibilityRole::ApplicationMarquee },
+        { "math", AccessibilityRole::DocumentMath },
+        { "menu", AccessibilityRole::Menu },
+        { "menubar", AccessibilityRole::MenuBar },
+        { "menuitem", AccessibilityRole::MenuItem },
+        { "menuitemcheckbox", AccessibilityRole::MenuItemCheckbox },
+        { "menuitemradio", AccessibilityRole::MenuItemRadio },
+        { "none", AccessibilityRole::Presentational },
+        { "note", AccessibilityRole::DocumentNote },
+        { "navigation", AccessibilityRole::LandmarkNavigation },
+        { "option", AccessibilityRole::ListBoxOption },
+        { "presentation", AccessibilityRole::Presentational },
+        { "progressbar", AccessibilityRole::ProgressIndicator },
+        { "radio", AccessibilityRole::RadioButton },
+        { "radiogroup", AccessibilityRole::RadioGroup },
+        { "region", AccessibilityRole::LandmarkRegion },
+        { "row", AccessibilityRole::Row },
+        { "rowgroup", AccessibilityRole::RowGroup },
+        { "scrollbar", AccessibilityRole::ScrollBar },
+        { "search", AccessibilityRole::LandmarkSearch },
+        { "searchbox", AccessibilityRole::SearchField },
+        { "separator", AccessibilityRole::Splitter },
+        { "slider", AccessibilityRole::Slider },
+        { "spinbutton", AccessibilityRole::SpinButton },
+        { "status", AccessibilityRole::ApplicationStatus },
+        { "switch", AccessibilityRole::Switch },
+        { "tab", AccessibilityRole::Tab },
+        { "tablist", AccessibilityRole::TabList },
+        { "tabpanel", AccessibilityRole::TabPanel },
+        { "text", AccessibilityRole::StaticText },
+        { "textbox", AccessibilityRole::TextArea },
+        { "term", AccessibilityRole::Term },
+        { "timer", AccessibilityRole::ApplicationTimer },
+        { "toolbar", AccessibilityRole::Toolbar },
+        { "tooltip", AccessibilityRole::UserInterfaceTooltip },
+        { "tree", AccessibilityRole::Tree },
+        { "treegrid", AccessibilityRole::TreeGrid },
+        { "treeitem", AccessibilityRole::TreeItem }
     };
 
     gAriaRoleMap = new ARIARoleMap;
@@ -2334,7 +2319,7 @@
     size_t roleLength = WTF_ARRAY_LENGTH(roles);
     for (size_t i = 0; i < roleLength; ++i) {
         gAriaRoleMap->set(roles[i].ariaRole, roles[i].webcoreRole);
-        gAriaReverseRoleMap->set(roles[i].webcoreRole, roles[i].ariaRole);
+        gAriaReverseRoleMap->set(static_cast<int>(roles[i].webcoreRole), roles[i].ariaRole);
     }
 }
 
@@ -2354,10 +2339,11 @@
 {
     ASSERT(!value.isEmpty());
     for (auto roleName : StringView(value).split(' ')) {
-        if (AccessibilityRole role = ariaRoleMap().get<ASCIICaseInsensitiveStringViewHashTranslator>(roleName))
+        AccessibilityRole role = ariaRoleMap().get<ASCIICaseInsensitiveStringViewHashTranslator>(roleName);
+        if (static_cast<int>(role))
             return role;
     }
-    return UnknownRole;
+    return AccessibilityRole::Unknown;
 }
 
 String AccessibilityObject::computedRoleString() const
@@ -2366,23 +2352,23 @@
     AccessibilityRole role = roleValue();
 
     // We do not compute a role string for generic block elements with user-agent assigned roles.
-    if (role == GroupRole || role == TextGroupRole)
+    if (role == AccessibilityRole::Group || role == AccessibilityRole::TextGroup)
         return "";
 
     // We do compute a role string for block elements with author-provided roles.
-    if (role == ApplicationTextGroupRole || role == FootnoteRole)
-        return reverseAriaRoleMap().get(ApplicationGroupRole);
+    if (role == AccessibilityRole::ApplicationTextGroup || role == AccessibilityRole::Footnote)
+        return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::ApplicationGroup));
 
-    if (role == HorizontalRuleRole)
-        return reverseAriaRoleMap().get(SplitterRole);
+    if (role == AccessibilityRole::HorizontalRule)
+        return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::Splitter));
 
-    if (role == PopUpButtonRole || role == ToggleButtonRole)
-        return reverseAriaRoleMap().get(ButtonRole);
+    if (role == AccessibilityRole::PopUpButton || role == AccessibilityRole::ToggleButton)
+        return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::Button));
 
-    if (role == LandmarkDocRegionRole)
-        return reverseAriaRoleMap().get(LandmarkRegionRole);
+    if (role == AccessibilityRole::LandmarkDocRegion)
+        return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::LandmarkRegion));
 
-    return reverseAriaRoleMap().get(role);
+    return reverseAriaRoleMap().get(static_cast<int>(role));
 }
 
 bool AccessibilityObject::hasHighlighting() const
@@ -2409,7 +2395,7 @@
 {
     if (isButton())
         return true;
-    if (roleValue() == DetailsRole)
+    if (roleValue() == AccessibilityRole::Details)
         return true;
     
     Element* actionElement = this->actionElement();
@@ -2422,8 +2408,8 @@
             AccessibilityChildrenVector results;
             // Search within for immediate descendants that are static text. If we find more than one
             // then this is an event delegator actionElement and we should expose the press action.
-            Vector<AccessibilitySearchKey> keys({ StaticTextSearchKey, ControlSearchKey, GraphicSearchKey, HeadingSearchKey, LinkSearchKey });
-            AccessibilitySearchCriteria criteria(axObj, SearchDirectionNext, emptyString(), 2, false, false);
+            Vector<AccessibilitySearchKey> keys({ AccessibilitySearchKey::StaticText, AccessibilitySearchKey::Control, AccessibilitySearchKey::Graphic, AccessibilitySearchKey::Heading, AccessibilitySearchKey::Link });
+            AccessibilitySearchCriteria criteria(axObj, AccessibilitySearchDirection::Next, emptyString(), 2, false, false);
             criteria.searchKeys = keys;
             axObj->findMatchingObjects(&criteria, results);
             if (results.size() > 1)
@@ -2594,18 +2580,18 @@
 AccessibilitySortDirection AccessibilityObject::sortDirection() const
 {
     AccessibilityRole role = roleValue();
-    if (role != RowHeaderRole && role != ColumnHeaderRole)
-        return SortDirectionInvalid;
+    if (role != AccessibilityRole::RowHeader && role != AccessibilityRole::ColumnHeader)
+        return AccessibilitySortDirection::Invalid;
 
     const AtomicString& sortAttribute = getAttribute(aria_sortAttr);
     if (equalLettersIgnoringASCIICase(sortAttribute, "ascending"))
-        return SortDirectionAscending;
+        return AccessibilitySortDirection::Ascending;
     if (equalLettersIgnoringASCIICase(sortAttribute, "descending"))
-        return SortDirectionDescending;
+        return AccessibilitySortDirection::Descending;
     if (equalLettersIgnoringASCIICase(sortAttribute, "other"))
-        return SortDirectionOther;
+        return AccessibilitySortDirection::Other;
     
-    return SortDirectionNone;
+    return AccessibilitySortDirection::None;
 }
 
 bool AccessibilityObject::supportsRangeValue() const
@@ -2695,9 +2681,9 @@
     if (equalLettersIgnoringASCIICase(expanded, "true") || equalLettersIgnoringASCIICase(expanded, "false"))
         return true;
     switch (roleValue()) {
-    case ComboBoxRole:
-    case DisclosureTriangleRole:
-    case DetailsRole:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::DisclosureTriangle:
+    case AccessibilityRole::Details:
         return true;
     default:
         return false;
@@ -2715,7 +2701,7 @@
     // Summary element should use its details parent's expanded status.
     if (isSummary()) {
         if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*this, false, [] (const AccessibilityObject& object) {
-            return object.roleValue() == DetailsRole;
+            return object.roleValue() == AccessibilityRole::Details;
         }))
             return parent->isExpanded();
     }
@@ -2726,11 +2712,11 @@
 bool AccessibilityObject::supportsChecked() const
 {
     switch (roleValue()) {
-    case CheckBoxRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case RadioButtonRole:
-    case SwitchRole:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::Switch:
         return true;
     default:
         return false;
@@ -2746,27 +2732,27 @@
     if (isToggleButton()) {
         const AtomicString& ariaPressed = getAttribute(aria_pressedAttr);
         if (equalLettersIgnoringASCIICase(ariaPressed, "true"))
-            return ButtonStateOn;
+            return AccessibilityButtonState::On;
         if (equalLettersIgnoringASCIICase(ariaPressed, "mixed"))
-            return ButtonStateMixed;
-        return ButtonStateOff;
+            return AccessibilityButtonState::Mixed;
+        return AccessibilityButtonState::Off;
     }
     
     const AtomicString& result = getAttribute(aria_checkedAttr);
     if (equalLettersIgnoringASCIICase(result, "true"))
-        return ButtonStateOn;
+        return AccessibilityButtonState::On;
     if (equalLettersIgnoringASCIICase(result, "mixed")) {
         // ARIA says that radio, menuitemradio, and switch elements must NOT expose button state mixed.
         AccessibilityRole ariaRole = ariaRoleAttribute();
-        if (ariaRole == RadioButtonRole || ariaRole == MenuItemRadioRole || ariaRole == SwitchRole)
-            return ButtonStateOff;
-        return ButtonStateMixed;
+        if (ariaRole == AccessibilityRole::RadioButton || ariaRole == AccessibilityRole::MenuItemRadio || ariaRole == AccessibilityRole::Switch)
+            return AccessibilityButtonState::Off;
+        return AccessibilityButtonState::Mixed;
     }
     
     if (isIndeterminate())
-        return ButtonStateMixed;
+        return AccessibilityButtonState::Mixed;
     
-    return ButtonStateOff;
+    return AccessibilityButtonState::Off;
 }
 
 // This is a 1-dimensional scroll offset helper function that's applied
@@ -3065,34 +3051,32 @@
     IntSize scrollSize = scrollableArea->contentsSize();
     IntRect scrollVisibleRect = scrollableArea->visibleContentRect(ScrollableArea::LegacyIOSDocumentVisibleRect);
     switch (direction) {
-    case Right: {
+    case ScrollByPageDirection::Right: {
         int scrollAmount = scrollVisibleRect.size().width();
         int newX = scrollPosition.x() - scrollAmount;
         newScrollPosition.setX(std::max(newX, 0));
         break;
     }
-    case Left: {
+    case ScrollByPageDirection::Left: {
         int scrollAmount = scrollVisibleRect.size().width();
         int newX = scrollAmount + scrollPosition.x();
         int maxX = scrollSize.width() - scrollAmount;
         newScrollPosition.setX(std::min(newX, maxX));
         break;
     }
-    case Up: {
+    case ScrollByPageDirection::Up: {
         int scrollAmount = scrollVisibleRect.size().height();
         int newY = scrollPosition.y() - scrollAmount;
         newScrollPosition.setY(std::max(newY, 0));
         break;
     }
-    case Down: {
+    case ScrollByPageDirection::Down: {
         int scrollAmount = scrollVisibleRect.size().height();
         int newY = scrollAmount + scrollPosition.y();
         int maxY = scrollSize.height() - scrollAmount;
         newScrollPosition.setY(std::min(newY, maxY));
         break;
     }
-    default:
-        break;
     }
     
     if (newScrollPosition != scrollPosition) {
@@ -3107,15 +3091,15 @@
 
 bool AccessibilityObject::lastKnownIsIgnoredValue()
 {
-    if (m_lastKnownIsIgnoredValue == DefaultBehavior)
-        m_lastKnownIsIgnoredValue = accessibilityIsIgnored() ? IgnoreObject : IncludeObject;
+    if (m_lastKnownIsIgnoredValue == AccessibilityObjectInclusion::DefaultBehavior)
+        m_lastKnownIsIgnoredValue = accessibilityIsIgnored() ? AccessibilityObjectInclusion::IgnoreObject : AccessibilityObjectInclusion::IncludeObject;
 
-    return m_lastKnownIsIgnoredValue == IgnoreObject;
+    return m_lastKnownIsIgnoredValue == AccessibilityObjectInclusion::IgnoreObject;
 }
 
 void AccessibilityObject::setLastKnownIsIgnoredValue(bool isIgnored)
 {
-    m_lastKnownIsIgnoredValue = isIgnored ? IgnoreObject : IncludeObject;
+    m_lastKnownIsIgnoredValue = isIgnored ? AccessibilityObjectInclusion::IgnoreObject : AccessibilityObjectInclusion::IncludeObject;
 }
 
 void AccessibilityObject::notifyIfIgnoredValueChanged()
@@ -3151,25 +3135,25 @@
     // If aria-pressed is present, then it should be exposed as a toggle button.
     // http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed
     if (ariaPressedIsPresent())
-        return ToggleButtonRole;
+        return AccessibilityRole::ToggleButton;
     if (ariaHasPopup())
-        return PopUpButtonRole;
-    // We don't contemplate RadioButtonRole, as it depends on the input
+        return AccessibilityRole::PopUpButton;
+    // We don't contemplate AccessibilityRole::RadioButton, as it depends on the input
     // type.
 
-    return ButtonRole;
+    return AccessibilityRole::Button;
 }
 
 bool AccessibilityObject::isButton() const
 {
     AccessibilityRole role = roleValue();
 
-    return role == ButtonRole || role == PopUpButtonRole || role == ToggleButtonRole;
+    return role == AccessibilityRole::Button || role == AccessibilityRole::PopUpButton || role == AccessibilityRole::ToggleButton;
 }
 
 bool AccessibilityObject::accessibilityIsIgnoredByDefault() const
 {
-    return defaultObjectInclusion() == IgnoreObject;
+    return defaultObjectInclusion() == AccessibilityObjectInclusion::IgnoreObject;
 }
 
 // ARIA component of hidden definition.
@@ -3212,13 +3196,13 @@
     bool useParentData = !m_isIgnoredFromParentData.isNull();
     
     if (useParentData ? m_isIgnoredFromParentData.isARIAHidden : isARIAHidden())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
     
     if (ignoredFromARIAModalPresence())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
     
     if (useParentData ? m_isIgnoredFromParentData.isPresentationalChildOfAriaRole : isPresentationalChildOfAriaRole())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
     
     return accessibilityPlatformIncludesObject();
 }
@@ -3233,11 +3217,11 @@
     if (attributeCache) {
         AccessibilityObjectInclusion ignored = attributeCache->getIgnored(axObjectID());
         switch (ignored) {
-        case IgnoreObject:
+        case AccessibilityObjectInclusion::IgnoreObject:
             return true;
-        case IncludeObject:
+        case AccessibilityObjectInclusion::IncludeObject:
             return false;
-        case DefaultBehavior:
+        case AccessibilityObjectInclusion::DefaultBehavior:
             break;
         }
     }
@@ -3246,7 +3230,7 @@
 
     // In case computing axIsIgnored disables attribute caching, we should refetch the object to see if it exists.
     if (cache && (attributeCache = cache->computedObjectAttributeCache()))
-        attributeCache->setIgnored(axObjectID(), result ? IgnoreObject : IncludeObject);
+        attributeCache->setIgnored(axObjectID(), result ? AccessibilityObjectInclusion::IgnoreObject : AccessibilityObjectInclusion::IncludeObject);
 
     return result;
 }
@@ -3369,7 +3353,7 @@
     if (!node)
         return false;
     
-    if (ariaRoleAttribute() != UnknownRole)
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown)
         return false;
 
     Element* element = node->shadowHost();
diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h
index 741f7c8..4fbe016 100644
--- a/Source/WebCore/accessibility/AccessibilityObject.h
+++ b/Source/WebCore/accessibility/AccessibilityObject.h
@@ -92,187 +92,187 @@
 
 typedef unsigned AXID;
 
-enum AccessibilityRole {
-    AnnotationRole = 1,
-    ApplicationRole,
-    ApplicationAlertRole,
-    ApplicationAlertDialogRole,
-    ApplicationDialogRole,
-    ApplicationGroupRole,
-    ApplicationLogRole,
-    ApplicationMarqueeRole,
-    ApplicationStatusRole,
-    ApplicationTextGroupRole,
-    ApplicationTimerRole,
-    AudioRole,
-    BlockquoteRole,
-    BrowserRole,
-    BusyIndicatorRole,
-    ButtonRole,
-    CanvasRole,
-    CaptionRole,
-    CellRole, 
-    CheckBoxRole,
-    ColorWellRole,
-    ColumnRole,
-    ColumnHeaderRole,
-    ComboBoxRole,
-    DefinitionRole,
-    DescriptionListRole,
-    DescriptionListTermRole,
-    DescriptionListDetailRole,
-    DetailsRole,
-    DirectoryRole,
-    DisclosureTriangleRole,
-    DivRole,
-    DocumentRole,
-    DocumentArticleRole,
-    DocumentMathRole,
-    DocumentNoteRole,
-    DrawerRole,
-    EditableTextRole,
-    FeedRole,
-    FigureRole,
-    FooterRole,
-    FootnoteRole,
-    FormRole,
-    GridRole,
-    GridCellRole,
-    GroupRole,
-    GrowAreaRole,
-    HeadingRole,
-    HelpTagRole,
-    HorizontalRuleRole,
-    IgnoredRole,
-    InlineRole,
-    ImageRole,
-    ImageMapRole,
-    ImageMapLinkRole,
-    IncrementorRole,
-    LabelRole,
-    LandmarkBannerRole,
-    LandmarkComplementaryRole,
-    LandmarkContentInfoRole,
-    LandmarkDocRegionRole,
-    LandmarkMainRole,
-    LandmarkNavigationRole,
-    LandmarkRegionRole,
-    LandmarkSearchRole,
-    LegendRole,
-    LinkRole,
-    ListRole,
-    ListBoxRole,
-    ListBoxOptionRole,
-    ListItemRole,
-    ListMarkerRole,
-    MarkRole,
-    MathElementRole,
-    MatteRole,
-    MenuRole,
-    MenuBarRole,
-    MenuButtonRole,
-    MenuItemRole,
-    MenuItemCheckboxRole,
-    MenuItemRadioRole,
-    MenuListPopupRole,
-    MenuListOptionRole,
-    OutlineRole,
-    ParagraphRole,
-    PopUpButtonRole,
-    PreRole,
-    PresentationalRole,
-    ProgressIndicatorRole,
-    RadioButtonRole,
-    RadioGroupRole,
-    RowHeaderRole,
-    RowRole,
-    RowGroupRole,
-    RubyBaseRole,
-    RubyBlockRole,
-    RubyInlineRole,
-    RubyRunRole,
-    RubyTextRole,
-    RulerRole,
-    RulerMarkerRole,
-    ScrollAreaRole,
-    ScrollBarRole,
-    SearchFieldRole,
-    SheetRole,
-    SliderRole,
-    SliderThumbRole,
-    SpinButtonRole,
-    SpinButtonPartRole,
-    SplitGroupRole,
-    SplitterRole,
-    StaticTextRole,
-    SummaryRole,
-    SwitchRole,
-    SystemWideRole,
-    SVGRootRole,
-    SVGTextRole,
-    SVGTSpanRole,
-    SVGTextPathRole,
-    TabGroupRole,
-    TabListRole,
-    TabPanelRole,            
-    TabRole,
-    TableRole,
-    TableHeaderContainerRole,
-    TextAreaRole,
-    TextGroupRole,
-    TermRole,
-    TimeRole,
-    TreeRole,
-    TreeGridRole,
-    TreeItemRole,
-    TextFieldRole,
-    ToggleButtonRole,
-    ToolbarRole,
-    UnknownRole,
-    UserInterfaceTooltipRole,
-    ValueIndicatorRole,
-    VideoRole,
-    WebApplicationRole,
-    WebAreaRole,
-    WebCoreLinkRole,
-    WindowRole,
+enum class AccessibilityRole {
+    Annotation = 1,
+    Application,
+    ApplicationAlert,
+    ApplicationAlertDialog,
+    ApplicationDialog,
+    ApplicationGroup,
+    ApplicationLog,
+    ApplicationMarquee,
+    ApplicationStatus,
+    ApplicationTextGroup,
+    ApplicationTimer,
+    Audio,
+    Blockquote,
+    Browser,
+    BusyIndicator,
+    Button,
+    Canvas,
+    Caption,
+    Cell,
+    CheckBox,
+    ColorWell,
+    Column,
+    ColumnHeader,
+    ComboBox,
+    Definition,
+    DescriptionList,
+    DescriptionListTerm,
+    DescriptionListDetail,
+    Details,
+    Directory,
+    DisclosureTriangle,
+    Div,
+    Document,
+    DocumentArticle,
+    DocumentMath,
+    DocumentNote,
+    Drawer,
+    EditableText,
+    Feed,
+    Figure,
+    Footer,
+    Footnote,
+    Form,
+    Grid,
+    GridCell,
+    Group,
+    GrowArea,
+    Heading,
+    HelpTag,
+    HorizontalRule,
+    Ignored,
+    Inline,
+    Image,
+    ImageMap,
+    ImageMapLink,
+    Incrementor,
+    Label,
+    LandmarkBanner,
+    LandmarkComplementary,
+    LandmarkContentInfo,
+    LandmarkDocRegion,
+    LandmarkMain,
+    LandmarkNavigation,
+    LandmarkRegion,
+    LandmarkSearch,
+    Legend,
+    Link,
+    List,
+    ListBox,
+    ListBoxOption,
+    ListItem,
+    ListMarker,
+    Mark,
+    MathElement,
+    Matte,
+    Menu,
+    MenuBar,
+    MenuButton,
+    MenuItem,
+    MenuItemCheckbox,
+    MenuItemRadio,
+    MenuListPopup,
+    MenuListOption,
+    Outline,
+    Paragraph,
+    PopUpButton,
+    Pre,
+    Presentational,
+    ProgressIndicator,
+    RadioButton,
+    RadioGroup,
+    RowHeader,
+    Row,
+    RowGroup,
+    RubyBase,
+    RubyBlock,
+    RubyInline,
+    RubyRun,
+    RubyText,
+    Ruler,
+    RulerMarker,
+    ScrollArea,
+    ScrollBar,
+    SearchField,
+    Sheet,
+    Slider,
+    SliderThumb,
+    SpinButton,
+    SpinButtonPart,
+    SplitGroup,
+    Splitter,
+    StaticText,
+    Summary,
+    Switch,
+    SystemWide,
+    SVGRoot,
+    SVGText,
+    SVGTSpan,
+    SVGTextPath,
+    TabGroup,
+    TabList,
+    TabPanel,
+    Tab,
+    Table,
+    TableHeaderContainer,
+    TextArea,
+    TextGroup,
+    Term,
+    Time,
+    Tree,
+    TreeGrid,
+    TreeItem,
+    TextField,
+    ToggleButton,
+    Toolbar,
+    Unknown,
+    UserInterfaceTooltip,
+    ValueIndicator,
+    Video,
+    WebApplication,
+    WebArea,
+    WebCoreLink,
+    Window,
 };
 
-enum AccessibilityTextSource {
-    AlternativeText,
-    ChildrenText,
-    SummaryText,
-    HelpText,
-    VisibleText,
-    TitleTagText,
-    PlaceholderText,
-    LabelByElementText,
-    TitleText,
-    SubtitleText,
-    ActionText,
+enum class AccessibilityTextSource {
+    Alternative,
+    Children,
+    Summary,
+    Help,
+    Visible,
+    TitleTag,
+    Placeholder,
+    LabelByElement,
+    Title,
+    Subtitle,
+    Action,
 };
     
 struct AccessibilityText {
     String text;
     AccessibilityTextSource textSource;
-    Vector<RefPtr<AccessibilityObject>> textElements;
+    Vector<Ref<AccessibilityObject>> textElements;
     
     AccessibilityText(const String& t, const AccessibilityTextSource& s)
-    : text(t)
-    , textSource(s)
+        : text(t)
+        , textSource(s)
     { }
 
-    AccessibilityText(const String& t, const AccessibilityTextSource& s, Vector<RefPtr<AccessibilityObject>> elements)
-    : text(t)
-    , textSource(s)
-    , textElements(WTFMove(elements))
+    AccessibilityText(const String& t, const AccessibilityTextSource& s, Vector<Ref<AccessibilityObject>> elements)
+        : text(t)
+        , textSource(s)
+        , textElements(WTFMove(elements))
     { }
 
-    AccessibilityText(const String& t, const AccessibilityTextSource& s, const RefPtr<AccessibilityObject> element)
-    : text(t)
-    , textSource(s)
+    AccessibilityText(const String& t, const AccessibilityTextSource& s, Ref<AccessibilityObject>&& element)
+        : text(t)
+        , textSource(s)
     {
-        textElements.append(element);
+        textElements.append(WTFMove(element));
     }
 };
 
@@ -291,104 +291,101 @@
         : childrenInclusion(c)
         , includeFocusableContent(i)
         , ignoredChildNode(ignored)
-        { }
+    { }
 };
 
 // Use this struct to store the isIgnored data that depends on the parents, so that in addChildren()
 // we avoid going up the parent chain for each element while traversing the tree with useful information already.
 struct AccessibilityIsIgnoredFromParentData {
-    AccessibilityObject* parent;
-    bool isARIAHidden;
-    bool isPresentationalChildOfAriaRole;
-    bool isDescendantOfBarrenParent;
+    AccessibilityObject* parent { nullptr };
+    bool isARIAHidden { false };
+    bool isPresentationalChildOfAriaRole { false };
+    bool isDescendantOfBarrenParent { false };
     
     AccessibilityIsIgnoredFromParentData(AccessibilityObject* parent = nullptr)
         : parent(parent)
-        , isARIAHidden(false)
-        , isPresentationalChildOfAriaRole(false)
-        , isDescendantOfBarrenParent(false)
-        { }
-    
+    { }
+
     bool isNull() const { return !parent; }
 };
     
-enum AccessibilityOrientation {
-    AccessibilityOrientationVertical,
-    AccessibilityOrientationHorizontal,
-    AccessibilityOrientationUndefined,
+enum class AccessibilityOrientation {
+    Vertical,
+    Horizontal,
+    Undefined,
 };
     
-enum AccessibilityObjectInclusion {
+enum class AccessibilityObjectInclusion {
     IncludeObject,
     IgnoreObject,
     DefaultBehavior,
 };
     
-enum AccessibilityButtonState {
-    ButtonStateOff = 0,
-    ButtonStateOn, 
-    ButtonStateMixed,
+enum class AccessibilityButtonState {
+    Off = 0,
+    On,
+    Mixed,
 };
     
-enum AccessibilitySortDirection {
-    SortDirectionNone,
-    SortDirectionAscending,
-    SortDirectionDescending,
-    SortDirectionOther,
-    SortDirectionInvalid
+enum class AccessibilitySortDirection {
+    None,
+    Ascending,
+    Descending,
+    Other,
+    Invalid,
 };
 
-enum AccessibilitySearchDirection {
-    SearchDirectionNext = 1,
-    SearchDirectionPrevious
+enum class AccessibilitySearchDirection {
+    Next = 1,
+    Previous,
 };
 
-enum AccessibilitySearchKey {
-    AnyTypeSearchKey = 1,
-    ArticleSearchKey,
-    BlockquoteSameLevelSearchKey,
-    BlockquoteSearchKey,
-    BoldFontSearchKey,
-    ButtonSearchKey,
-    CheckBoxSearchKey,
-    ControlSearchKey,
-    DifferentTypeSearchKey,
-    FontChangeSearchKey,
-    FontColorChangeSearchKey,
-    FrameSearchKey,
-    GraphicSearchKey,
-    HeadingLevel1SearchKey,
-    HeadingLevel2SearchKey,
-    HeadingLevel3SearchKey,
-    HeadingLevel4SearchKey,
-    HeadingLevel5SearchKey,
-    HeadingLevel6SearchKey,
-    HeadingSameLevelSearchKey,
-    HeadingSearchKey,
-    HighlightedSearchKey,
-    ItalicFontSearchKey,
-    LandmarkSearchKey,
-    LinkSearchKey,
-    ListSearchKey,
-    LiveRegionSearchKey,
-    MisspelledWordSearchKey,
-    OutlineSearchKey,
-    PlainTextSearchKey,
-    RadioGroupSearchKey,
-    SameTypeSearchKey,
-    StaticTextSearchKey,
-    StyleChangeSearchKey,
-    TableSameLevelSearchKey,
-    TableSearchKey,
-    TextFieldSearchKey,
-    UnderlineSearchKey,
-    UnvisitedLinkSearchKey,
-    VisitedLinkSearchKey
+enum class AccessibilitySearchKey {
+    AnyType = 1,
+    Article,
+    BlockquoteSameLevel,
+    Blockquote,
+    BoldFont,
+    Button,
+    CheckBox,
+    Control,
+    DifferentType,
+    FontChange,
+    FontColorChange,
+    Frame,
+    Graphic,
+    HeadingLevel1,
+    HeadingLevel2,
+    HeadingLevel3,
+    HeadingLevel4,
+    HeadingLevel5,
+    HeadingLevel6,
+    HeadingSameLevel,
+    Heading,
+    Highlighted,
+    ItalicFont,
+    Landmark,
+    Link,
+    List,
+    LiveRegion,
+    MisspelledWord,
+    Outline,
+    PlainText,
+    RadioGroup,
+    SameType,
+    StaticText,
+    StyleChange,
+    TableSameLevel,
+    Table,
+    TextField,
+    Underline,
+    UnvisitedLink,
+    VisitedLink,
 };
 
-enum AccessibilityVisiblePositionForBounds {
-    FirstVisiblePositionForBounds,
-    LastVisiblePositionForBounds
+enum class AccessibilityVisiblePositionForBounds {
+    First,
+    Last,
 };
 
 struct AccessibilitySearchCriteria {
@@ -410,7 +407,7 @@
     { }
 };
     
-enum AccessibilityDetachmentType { CacheDestroyed, ElementDestroyed };
+enum class AccessibilityDetachmentType { CacheDestroyed, ElementDestroyed };
 
 struct VisiblePositionRange {
 
@@ -434,13 +431,10 @@
 
 struct PlainTextRange {
         
-    unsigned start;
-    unsigned length;
+    unsigned start { 0 };
+    unsigned length { 0 };
     
-    PlainTextRange()
-        : start(0)
-        , length(0)
-    { }
+    PlainTextRange() = default;
     
     PlainTextRange(unsigned s, unsigned l)
         : start(s)
@@ -450,18 +444,18 @@
     bool isNull() const { return !start && !length; }
 };
 
-enum AccessibilitySelectTextActivity {
-    FindAndReplaceActivity,
-    FindAndSelectActivity,
+enum class AccessibilitySelectTextActivity {
+    FindAndReplace,
+    FindAndSelect,
     FindAndCapitalize,
     FindAndLowercase,
     FindAndUppercase
 };
 
-enum AccessibilitySelectTextAmbiguityResolution {
-    ClosestAfterSelectionAmbiguityResolution,
-    ClosestBeforeSelectionAmbiguityResolution,
-    ClosestToSelectionAmbiguityResolution
+enum class AccessibilitySelectTextAmbiguityResolution {
+    ClosestAfter,
+    ClosestBefore,
+    ClosestTo
 };
 
 struct AccessibilitySelectTextCriteria {
@@ -477,16 +471,16 @@
     { }
 };
 
-enum AccessibilityMathScriptObjectType { Subscript, Superscript };
-enum AccessibilityMathMultiscriptObjectType { PreSubscript, PreSuperscript, PostSubscript, PostSuperscript };
+enum class AccessibilityMathScriptObjectType { Subscript, Superscript };
+enum class AccessibilityMathMultiscriptObjectType { PreSubscript, PreSuperscript, PostSubscript, PostSuperscript };
 
-enum AccessibilityARIACurrentState { ARIACurrentFalse, ARIACurrentTrue, ARIACurrentPage, ARIACurrentStep, ARIACurrentLocation, ARIACurrentDate, ARIACurrentTime };
+enum class AccessibilityARIACurrentState { False, True, Page, Step, Location, Date, Time };
     
 bool nodeHasPresentationRole(Node*);
     
 class AccessibilityObject : public RefCounted<AccessibilityObject> {
 protected:
-    AccessibilityObject();
+    AccessibilityObject() = default;
     
 public:
     virtual ~AccessibilityObject();
@@ -517,7 +511,7 @@
     virtual bool isHeading() const { return false; }
     virtual bool isLink() const { return false; }
     virtual bool isImage() const { return false; }
-    virtual bool isImageMap() const { return roleValue() == ImageMapRole; }
+    virtual bool isImageMap() const { return roleValue() == AccessibilityRole::ImageMap; }
     virtual bool isNativeImage() const { return false; }
     virtual bool isImageButton() const { return false; }
     virtual bool isPasswordField() const { return false; }
@@ -525,11 +519,11 @@
     virtual AccessibilityObject* passwordFieldOrContainingPasswordField() { return nullptr; }
     virtual bool isNativeTextControl() const { return false; }
     virtual bool isSearchField() const { return false; }
-    bool isWebArea() const { return roleValue() == WebAreaRole; }
-    virtual bool isCheckbox() const { return roleValue() == CheckBoxRole; }
-    virtual bool isRadioButton() const { return roleValue() == RadioButtonRole; }
+    bool isWebArea() const { return roleValue() == AccessibilityRole::WebArea; }
+    virtual bool isCheckbox() const { return roleValue() == AccessibilityRole::CheckBox; }
+    virtual bool isRadioButton() const { return roleValue() == AccessibilityRole::RadioButton; }
     virtual bool isNativeListBox() const { return false; }
-    bool isListBox() const { return roleValue() == ListBoxRole; }
+    bool isListBox() const { return roleValue() == AccessibilityRole::ListBox; }
     virtual bool isListBoxOption() const { return false; }
     virtual bool isAttachment() const { return false; }
     virtual bool isMediaTimeline() const { return false; }
@@ -559,43 +553,43 @@
     virtual bool isMenuList() const { return false; }
     virtual bool isMenuListPopup() const { return false; }
     virtual bool isMenuListOption() const { return false; }
-    virtual bool isSpinButton() const { return roleValue() == SpinButtonRole; }
+    virtual bool isSpinButton() const { return roleValue() == AccessibilityRole::SpinButton; }
     virtual bool isNativeSpinButton() const { return false; }
     virtual bool isSpinButtonPart() const { return false; }
     virtual bool isMockObject() const { return false; }
     virtual bool isMediaControlLabel() const { return false; }
     virtual bool isMediaObject() const { return false; }
-    bool isSwitch() const { return roleValue() == SwitchRole; }
-    bool isToggleButton() const { return roleValue() == ToggleButtonRole; }
+    bool isSwitch() const { return roleValue() == AccessibilityRole::Switch; }
+    bool isToggleButton() const { return roleValue() == AccessibilityRole::ToggleButton; }
     bool isTextControl() const;
     bool isARIATextControl() const;
     bool isNonNativeTextControl() const;
-    bool isTabList() const { return roleValue() == TabListRole; }
-    bool isTabItem() const { return roleValue() == TabRole; }
-    bool isRadioGroup() const { return roleValue() == RadioGroupRole; }
-    bool isComboBox() const { return roleValue() == ComboBoxRole; }
-    bool isTree() const { return roleValue() == TreeRole; }
-    bool isTreeGrid() const { return roleValue() == TreeGridRole; }
-    bool isTreeItem() const { return roleValue() == TreeItemRole; }
-    bool isScrollbar() const { return roleValue() == ScrollBarRole; }
+    bool isTabList() const { return roleValue() == AccessibilityRole::TabList; }
+    bool isTabItem() const { return roleValue() == AccessibilityRole::Tab; }
+    bool isRadioGroup() const { return roleValue() == AccessibilityRole::RadioGroup; }
+    bool isComboBox() const { return roleValue() == AccessibilityRole::ComboBox; }
+    bool isTree() const { return roleValue() == AccessibilityRole::Tree; }
+    bool isTreeGrid() const { return roleValue() == AccessibilityRole::TreeGrid; }
+    bool isTreeItem() const { return roleValue() == AccessibilityRole::TreeItem; }
+    bool isScrollbar() const { return roleValue() == AccessibilityRole::ScrollBar; }
     bool isButton() const;
-    bool isListItem() const { return roleValue() == ListItemRole; }
+    bool isListItem() const { return roleValue() == AccessibilityRole::ListItem; }
     bool isCheckboxOrRadio() const { return isCheckbox() || isRadioButton(); }
-    bool isScrollView() const { return roleValue() == ScrollAreaRole; }
-    bool isCanvas() const { return roleValue() == CanvasRole; }
-    bool isPopUpButton() const { return roleValue() == PopUpButtonRole; }
+    bool isScrollView() const { return roleValue() == AccessibilityRole::ScrollArea; }
+    bool isCanvas() const { return roleValue() == AccessibilityRole::Canvas; }
+    bool isPopUpButton() const { return roleValue() == AccessibilityRole::PopUpButton; }
     bool isBlockquote() const;
     bool isLandmark() const;
-    bool isColorWell() const { return roleValue() == ColorWellRole; }
+    bool isColorWell() const { return roleValue() == AccessibilityRole::ColorWell; }
     bool isRangeControl() const;
     bool isMeter() const;
-    bool isSplitter() const { return roleValue() == SplitterRole; }
-    bool isToolbar() const { return roleValue() == ToolbarRole; }
+    bool isSplitter() const { return roleValue() == AccessibilityRole::Splitter; }
+    bool isToolbar() const { return roleValue() == AccessibilityRole::Toolbar; }
     bool isStyleFormatGroup() const;
     bool isSubscriptStyleGroup() const;
     bool isSuperscriptStyleGroup() const;
     bool isFigureElement() const;
-    bool isSummary() const { return roleValue() == SummaryRole; }
+    bool isSummary() const { return roleValue() == AccessibilityRole::Summary; }
     bool isOutput() const;
     
     virtual bool isChecked() const { return false; }
@@ -628,7 +622,7 @@
     virtual bool hasSameFont(RenderObject*) const { return false; }
     virtual bool hasSameFontColor(RenderObject*) const { return false; }
     virtual bool hasSameStyle(RenderObject*) const { return false; }
-    bool isStaticText() const { return roleValue() == StaticTextRole; }
+    bool isStaticText() const { return roleValue() == AccessibilityRole::StaticText; }
     virtual bool hasUnderline() const { return false; }
     bool hasHighlighting() const;
 
@@ -759,7 +753,7 @@
     virtual AccessibilityObject* correspondingControlForLabelElement() const { return nullptr; }
     virtual AccessibilityObject* scrollBar(AccessibilityOrientation) { return nullptr; }
     
-    virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; }
+    virtual AccessibilityRole ariaRoleAttribute() const { return AccessibilityRole::Unknown; }
     virtual bool isPresentationalChildOfAriaRole() const { return false; }
     virtual bool ariaRoleHasPresentationalChildren() const { return false; }
     virtual bool inheritsPresentationalRole() const { return false; }
@@ -1008,7 +1002,7 @@
     // Scroll this object to a given point in global coordinates of the top-level window.
     virtual void scrollToGlobalPoint(const IntPoint&) const;
     
-    enum ScrollByPageDirection { Up, Down, Left, Right };
+    enum class ScrollByPageDirection { Up, Down, Left, Right };
     bool scrollByPage(ScrollByPageDirection) const;
     IntPoint scrollPosition() const;
     IntSize scrollContentsSize() const;    
@@ -1102,7 +1096,7 @@
     AccessibilityObjectInclusion accessibilityPlatformIncludesObject() const;
 #else
     bool accessibilityIgnoreAttachment() const { return true; }
-    AccessibilityObjectInclusion accessibilityPlatformIncludesObject() const { return DefaultBehavior; }
+    AccessibilityObjectInclusion accessibilityPlatformIncludesObject() const { return AccessibilityObjectInclusion::DefaultBehavior; }
 #endif
 
 #if PLATFORM(IOS)
@@ -1135,14 +1129,14 @@
     void setIsIgnoredFromParentDataForChild(AccessibilityObject*);
     
 protected:
-    AXID m_id;
+    AXID m_id { 0 };
     AccessibilityChildrenVector m_children;
-    mutable bool m_haveChildren;
-    AccessibilityRole m_role;
-    AccessibilityObjectInclusion m_lastKnownIsIgnoredValue;
-    AccessibilityIsIgnoredFromParentData m_isIgnoredFromParentData;
-    bool m_childrenDirty;
-    bool m_subtreeDirty;
+    mutable bool m_haveChildren { false };
+    AccessibilityRole m_role { AccessibilityRole::Unknown };
+    AccessibilityObjectInclusion m_lastKnownIsIgnoredValue { AccessibilityObjectInclusion::DefaultBehavior };
+    AccessibilityIsIgnoredFromParentData m_isIgnoredFromParentData { };
+    bool m_childrenDirty { false };
+    bool m_subtreeDirty { false };
 
     void setIsIgnoredFromParentData(AccessibilityIsIgnoredFromParentData& data) { m_isIgnoredFromParentData = data; }
 
@@ -1180,7 +1174,7 @@
 #elif PLATFORM(WIN)
     COMPtr<AccessibilityObjectWrapper> m_wrapper;
 #elif PLATFORM(GTK)
-    AtkObject* m_wrapper;
+    AtkObject* m_wrapper { nullptr };
 #elif PLATFORM(WPE)
     RefPtr<AccessibilityObjectWrapper> m_wrapper;
 #endif
diff --git a/Source/WebCore/accessibility/AccessibilityProgressIndicator.h b/Source/WebCore/accessibility/AccessibilityProgressIndicator.h
index 3f5cfe0..7c5438a 100644
--- a/Source/WebCore/accessibility/AccessibilityProgressIndicator.h
+++ b/Source/WebCore/accessibility/AccessibilityProgressIndicator.h
@@ -42,7 +42,7 @@
     Element* element() const override;
 
 private:
-    AccessibilityRole roleValue() const override { return ProgressIndicatorRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::ProgressIndicator; }
 
     bool isProgressIndicator() const override { return true; }
 
diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
index e98359f..1f46c31 100644
--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -491,11 +491,11 @@
     if (!m_renderer)
         return nullptr;
     
-    if (ariaRoleAttribute() == MenuBarRole)
+    if (ariaRoleAttribute() == AccessibilityRole::MenuBar)
         return axObjectCache()->getOrCreate(m_renderer->parent());
 
     // menuButton and its corresponding menu are DOM siblings, but Accessibility needs them to be parent/child
-    if (ariaRoleAttribute() == MenuRole) {
+    if (ariaRoleAttribute() == AccessibilityRole::Menu) {
         AccessibilityObject* parent = menuButtonForMenu();
         if (parent)
             return parent;
@@ -524,7 +524,7 @@
     // Widgets are the replaced elements that we represent to AX as attachments
     bool isWidget = renderer->isWidget();
 
-    return isWidget && ariaRoleAttribute() == UnknownRole;
+    return isWidget && ariaRoleAttribute() == AccessibilityRole::Unknown;
 }
 
 bool AccessibilityRenderObject::isFileUploadButton() const
@@ -612,7 +612,7 @@
         // Only take help text from an ancestor element if its a group or an unknown role. If help was 
         // added to those kinds of elements, it is likely it was meant for a child element.
         if (AccessibilityObject* axObj = axObjectCache()->getOrCreate(ancestor)) {
-            if (!axObj->isGroup() && axObj->roleValue() != UnknownRole)
+            if (!axObj->isGroup() && axObj->roleValue() != AccessibilityRole::Unknown)
                 break;
         }
     }
@@ -743,7 +743,7 @@
 
     RenderBoxModelObject* cssBox = renderBoxModelObject();
 
-    if (ariaRoleAttribute() == StaticTextRole) {
+    if (ariaRoleAttribute() == AccessibilityRole::StaticText) {
         String staticText = text();
         if (!staticText.length())
             staticText = textUnderElement();
@@ -961,7 +961,7 @@
 void AccessibilityRenderObject::addRadioButtonGroupChildren(AccessibilityObject* parent, AccessibilityChildrenVector& linkedUIElements) const
 {
     for (const auto& child : parent->children()) {
-        if (child->roleValue() == RadioButtonRole)
+        if (child->roleValue() == AccessibilityRole::RadioButton)
             linkedUIElements.append(child);
         else
             addRadioButtonGroupChildren(child.get(), linkedUIElements);
@@ -970,7 +970,7 @@
     
 void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const
 {
-    if (roleValue() != RadioButtonRole)
+    if (roleValue() != AccessibilityRole::RadioButton)
         return;
     
     Node* node = this->node();
@@ -983,7 +983,7 @@
     } else {
         // If we didn't find any radio button siblings with the traditional naming, lets search for a radio group role and find its children.
         for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
-            if (parent->roleValue() == RadioGroupRole)
+            if (parent->roleValue() == AccessibilityRole::RadioGroup)
                 addRadioButtonGroupChildren(parent, linkedUIElements);
         }
     }
@@ -1001,7 +1001,7 @@
             linkedUIElements.append(linkedAXElement);
     }
 
-    if (roleValue() == RadioButtonRole)
+    if (roleValue() == AccessibilityRole::RadioButton)
         addRadioButtonGroupMembers(linkedUIElements);
 }
 
@@ -1106,7 +1106,7 @@
     bool isInTree = false;
     bool isTreeItemDescendant = false;
     while (axObj) {
-        if (axObj->roleValue() == TreeItemRole)
+        if (axObj->roleValue() == AccessibilityRole::TreeItem)
             isTreeItemDescendant = true;
         if (axObj->isTree()) {
             isInTree = true;
@@ -1118,7 +1118,7 @@
     // If the object is in a tree, only tree items should be exposed (and the children of tree items).
     if (isInTree) {
         AccessibilityRole role = roleValue();
-        if (role != TreeItemRole && role != StaticTextRole && !isTreeItemDescendant)
+        if (role != AccessibilityRole::TreeItem && role != AccessibilityRole::StaticText && !isTreeItemDescendant)
             return false;
     }
     return true;
@@ -1128,13 +1128,13 @@
 {
     // Don't ignore an image that has an alt tag.
     if (!altText.containsOnlyWhitespace())
-        return IncludeObject;
+        return AccessibilityObjectInclusion::IncludeObject;
     
     // The informal standard is to ignore images with zero-length alt strings.
     if (!altText.isNull())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
     
-    return DefaultBehavior;
+    return AccessibilityObjectInclusion::DefaultBehavior;
 }
 
 AccessibilityObjectInclusion AccessibilityRenderObject::defaultObjectInclusion() const
@@ -1142,14 +1142,14 @@
     // The following cases can apply to any element that's a subclass of AccessibilityRenderObject.
     
     if (!m_renderer)
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
 
     if (m_renderer->style().visibility() != VISIBLE) {
         // aria-hidden is meant to override visibility as the determinant in AX hierarchy inclusion.
         if (equalLettersIgnoringASCIICase(getAttribute(aria_hiddenAttr), "false"))
-            return DefaultBehavior;
+            return AccessibilityObjectInclusion::DefaultBehavior;
         
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
     }
 
     return AccessibilityObject::defaultObjectInclusion();
@@ -1179,19 +1179,19 @@
     // Then process other use cases that need to be applied to all the various roles
     // that AccessibilityRenderObjects take on.
     AccessibilityObjectInclusion decision = defaultObjectInclusion();
-    if (decision == IncludeObject)
+    if (decision == AccessibilityObjectInclusion::IncludeObject)
         return false;
-    if (decision == IgnoreObject)
+    if (decision == AccessibilityObjectInclusion::IgnoreObject)
         return true;
     
     // If this element is within a parent that cannot have children, it should not be exposed.
     if (isDescendantOfBarrenParent())
         return true;    
     
-    if (roleValue() == IgnoredRole)
+    if (roleValue() == AccessibilityRole::Ignored)
         return true;
     
-    if (roleValue() == PresentationalRole || inheritsPresentationalRole())
+    if (roleValue() == AccessibilityRole::Presentational || inheritsPresentationalRole())
         return true;
     
     // WebAreas should be ignored if their iframe container is marked as presentational.
@@ -1226,7 +1226,7 @@
     if (is<RenderText>(*m_renderer)) {
         // static text beneath MenuItems and MenuButtons are just reported along with the menu item, so it's ignored on an individual level
         AccessibilityObject* parent = parentObjectUnignored();
-        if (parent && (parent->isMenuItem() || parent->ariaRoleAttribute() == MenuButtonRole))
+        if (parent && (parent->isMenuItem() || parent->ariaRoleAttribute() == AccessibilityRole::MenuButton))
             return true;
         auto& renderText = downcast<RenderText>(*m_renderer);
         if (!renderText.hasRenderedText())
@@ -1234,7 +1234,7 @@
 
         // static text beneath TextControls is reported along with the text control text so it's ignored.
         for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) { 
-            if (parent->roleValue() == TextFieldRole)
+            if (parent->roleValue() == AccessibilityRole::TextField)
                 return true;
         }
         
@@ -1245,9 +1245,9 @@
         // The alt attribute may be set on a text fragment through CSS, which should be honored.
         if (is<RenderTextFragment>(renderText)) {
             AccessibilityObjectInclusion altTextInclusion = objectInclusionFromAltText(downcast<RenderTextFragment>(renderText).altText());
-            if (altTextInclusion == IgnoreObject)
+            if (altTextInclusion == AccessibilityObjectInclusion::IgnoreObject)
                 return true;
-            if (altTextInclusion == IncludeObject)
+            if (altTextInclusion == AccessibilityObjectInclusion::IncludeObject)
                 return false;
             if (downcast<RenderTextFragment>(renderText).firstLetter())
                 return true;
@@ -1274,24 +1274,24 @@
         return false;
 
     switch (roleValue()) {
-    case AudioRole:
-    case DescriptionListTermRole:
-    case DescriptionListDetailRole:
-    case DetailsRole:
-    case DocumentArticleRole:
-    case LandmarkRegionRole:
-    case ListItemRole:
-    case TimeRole:
-    case VideoRole:
+    case AccessibilityRole::Audio:
+    case AccessibilityRole::DescriptionListTerm:
+    case AccessibilityRole::DescriptionListDetail:
+    case AccessibilityRole::Details:
+    case AccessibilityRole::DocumentArticle:
+    case AccessibilityRole::LandmarkRegion:
+    case AccessibilityRole::ListItem:
+    case AccessibilityRole::Time:
+    case AccessibilityRole::Video:
         return false;
     default:
         break;
     }
     
-    if (ariaRoleAttribute() != UnknownRole)
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown)
         return false;
     
-    if (roleValue() == HorizontalRuleRole)
+    if (roleValue() == AccessibilityRole::HorizontalRule)
         return false;
     
     // don't ignore labels, because they serve as TitleUIElements
@@ -1331,16 +1331,16 @@
         
         // First check the RenderImage's altText (which can be set through a style sheet, or come from the Element).
         // However, if this is not a native image, fallback to the attribute on the Element.
-        AccessibilityObjectInclusion altTextInclusion = DefaultBehavior;
+        AccessibilityObjectInclusion altTextInclusion = AccessibilityObjectInclusion::DefaultBehavior;
         bool isRenderImage = is<RenderImage>(renderer());
         if (isRenderImage)
             altTextInclusion = objectInclusionFromAltText(downcast<RenderImage>(*m_renderer).altText());
         else
             altTextInclusion = objectInclusionFromAltText(getAttribute(altAttr).string());
 
-        if (altTextInclusion == IgnoreObject)
+        if (altTextInclusion == AccessibilityObjectInclusion::IgnoreObject)
             return true;
-        if (altTextInclusion == IncludeObject)
+        if (altTextInclusion == AccessibilityObjectInclusion::IncludeObject)
             return false;
         
         // If an image has a title attribute on it, accessibility should be lenient and allow it to appear in the hierarchy (according to WAI-ARIA).
@@ -1403,7 +1403,7 @@
 
     // <span> tags are inline tags and not meant to convey information if they have no other aria
     // information on them. If we don't ignore them, they may emit signals expected to come from
-    // their parent. In addition, because included spans are GroupRole objects, and GroupRole
+    // their parent. In addition, because included spans are AccessibilityRole::Group objects, and AccessibilityRole::Group
     // objects are often containers with meaningful information, the inclusion of a span can have
     // the side effect of causing the immediate parent accessible to be ignored. This is especially
     // problematic for platforms which have distinct roles for textual block elements.
@@ -1528,7 +1528,7 @@
     
     AccessibilityRole ariaRole = ariaRoleAttribute();
     // Use the text control native range if it's a native object and it has no ARIA role (or has a text based ARIA role).
-    if (isNativeTextControl() && (ariaRole == UnknownRole || isARIATextControl())) {
+    if (isNativeTextControl() && (ariaRole == AccessibilityRole::Unknown || isARIATextControl())) {
         HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
         return PlainTextRange(textControl.selectionStart(), textControl.selectionEnd() - textControl.selectionStart());
     }
@@ -1675,7 +1675,7 @@
         AccessibilityObject* tabPanel = cache->getOrCreate(element);
 
         // A tab item should only control tab panels.
-        if (!tabPanel || tabPanel->roleValue() != TabPanelRole)
+        if (!tabPanel || tabPanel->roleValue() != AccessibilityRole::TabPanel)
             continue;
         
         AccessibilityObject* checkFocusElement = focusedElement;
@@ -1704,7 +1704,7 @@
     // A web area is represented by the Document node in the DOM tree, which isn't focusable.
     // Check instead if the frame's selection controller is focused
     if (focusedElement == m_renderer->node()
-        || (roleValue() == WebAreaRole && document.frame()->selection().isFocusedAndActive()))
+        || (roleValue() == AccessibilityRole::WebArea && document.frame()->selection().isFocusedAndActive()))
         return true;
     
     return false;
@@ -1746,7 +1746,7 @@
 {
     // Setting selected only makes sense in trees and tables (and tree-tables).
     AccessibilityRole role = roleValue();
-    if (role != TreeRole && role != TreeGridRole && role != TableRole && role != GridRole)
+    if (role != AccessibilityRole::Tree && role != AccessibilityRole::TreeGrid && role != AccessibilityRole::Table && role != AccessibilityRole::Grid)
         return;
     
     bool isMulti = isMultiSelectable();
@@ -1835,7 +1835,7 @@
         } else {
             auto* parent = current->parentNode();
             if (is<HTMLAreaElement>(*current) && is<HTMLMapElement>(parent)) {
-                auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->getOrCreate(ImageMapLinkRole));
+                auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->getOrCreate(AccessibilityRole::ImageMapLink));
                 HTMLMapElement& map = downcast<HTMLMapElement>(*parent);
                 areaObject.setHTMLAreaElement(downcast<HTMLAreaElement>(current));
                 areaObject.setHTMLMapElement(&map);
@@ -2411,18 +2411,18 @@
 bool AccessibilityRenderObject::shouldFocusActiveDescendant() const
 {
     switch (ariaRoleAttribute()) {
-    case ApplicationGroupRole:
-    case ListBoxRole:
-    case MenuRole:
-    case MenuBarRole:
-    case RadioGroupRole:
-    case RowRole:
-    case PopUpButtonRole:
-    case ProgressIndicatorRole:
-    case ToolbarRole:
-    case OutlineRole:
-    case TreeRole:
-    case GridRole:
+    case AccessibilityRole::ApplicationGroup:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::Menu:
+    case AccessibilityRole::MenuBar:
+    case AccessibilityRole::RadioGroup:
+    case AccessibilityRole::Row:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::Toolbar:
+    case AccessibilityRole::Outline:
+    case AccessibilityRole::Tree:
+    case AccessibilityRole::Grid:
     /* FIXME: replace these with actual roles when they are added to AccessibilityRole
     composite
     alert
@@ -2474,11 +2474,11 @@
         bool foundParent = false;
         
         switch (containerParent->roleValue()) {
-        case TreeRole:
-        case TreeGridRole:
-        case GridRole:
-        case TableRole:
-        case BrowserRole:
+        case AccessibilityRole::Tree:
+        case AccessibilityRole::TreeGrid:
+        case AccessibilityRole::Grid:
+        case AccessibilityRole::Table:
+        case AccessibilityRole::Browser:
             foundParent = true;
             break;
         default:
@@ -2500,7 +2500,7 @@
         cache->postNotification(containerParent, document(), AXObjectCache::AXRowCountChanged);
 
     // Post that the specific row either collapsed or expanded.
-    if (roleValue() == RowRole || roleValue() == TreeItemRole)
+    if (roleValue() == AccessibilityRole::Row || roleValue() == AccessibilityRole::TreeItem)
         cache->postNotification(this, document(), isExpanded() ? AXObjectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed);
     else
         cache->postNotification(this, document(), AXObjectCache::AXExpandedChanged);
@@ -2609,7 +2609,7 @@
 
 bool AccessibilityRenderObject::supportsExpandedTextValue() const
 {
-    if (roleValue() == StaticTextRole) {
+    if (roleValue() == AccessibilityRole::StaticText) {
         if (AccessibilityObject* parent = parentObject())
             return parent->hasTagName(abbrTag) || parent->hasTagName(acronymTag);
     }
@@ -2620,251 +2620,251 @@
 AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
 {
     if (!m_renderer)
-        return UnknownRole;
+        return AccessibilityRole::Unknown;
 
     // Sometimes we need to ignore the attribute role. Like if a tree is malformed,
     // we want to ignore the treeitem's attribute role.
-    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole && !shouldIgnoreAttributeRole())
+    if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown && !shouldIgnoreAttributeRole())
         return m_ariaRole;
     
     Node* node = m_renderer->node();
     RenderBoxModelObject* cssBox = renderBoxModelObject();
 
     if (node && node->isLink())
-        return WebCoreLinkRole;
+        return AccessibilityRole::WebCoreLink;
     if (node && is<HTMLImageElement>(*node) && downcast<HTMLImageElement>(*node).hasAttributeWithoutSynchronization(usemapAttr))
-        return ImageMapRole;
+        return AccessibilityRole::ImageMap;
     if ((cssBox && cssBox->isListItem()) || (node && node->hasTagName(liTag)))
-        return ListItemRole;
+        return AccessibilityRole::ListItem;
     if (m_renderer->isListMarker())
-        return ListMarkerRole;
+        return AccessibilityRole::ListMarker;
     if (node && node->hasTagName(buttonTag))
         return buttonRoleType();
     if (node && node->hasTagName(legendTag))
-        return LegendRole;
+        return AccessibilityRole::Legend;
     if (m_renderer->isText())
-        return StaticTextRole;
+        return AccessibilityRole::StaticText;
     if (cssBox && cssBox->isImage()) {
         if (is<HTMLInputElement>(node))
-            return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
+            return ariaHasPopup() ? AccessibilityRole::PopUpButton : AccessibilityRole::Button;
         if (isSVGImage())
-            return SVGRootRole;
-        return ImageRole;
+            return AccessibilityRole::SVGRoot;
+        return AccessibilityRole::Image;
     }
     
     if (node && node->hasTagName(canvasTag))
-        return CanvasRole;
+        return AccessibilityRole::Canvas;
 
     if (cssBox && cssBox->isRenderView())
-        return WebAreaRole;
+        return AccessibilityRole::WebArea;
     
     if (cssBox && cssBox->isTextField()) {
         if (is<HTMLInputElement>(node))
-            return downcast<HTMLInputElement>(*node).isSearchField() ? SearchFieldRole : TextFieldRole;
+            return downcast<HTMLInputElement>(*node).isSearchField() ? AccessibilityRole::SearchField : AccessibilityRole::TextField;
     }
     
     if (cssBox && cssBox->isTextArea())
-        return TextAreaRole;
+        return AccessibilityRole::TextArea;
 
     if (is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (input.isCheckbox())
-            return CheckBoxRole;
+            return AccessibilityRole::CheckBox;
         if (input.isRadioButton())
-            return RadioButtonRole;
+            return AccessibilityRole::RadioButton;
         if (input.isTextButton())
             return buttonRoleType();
         // On iOS, the date field and time field are popup buttons. On other platforms they are text fields.
 #if PLATFORM(IOS)
         if (input.isDateField() || input.isTimeField())
-            return PopUpButtonRole;
+            return AccessibilityRole::PopUpButton;
 #endif
 #if ENABLE(INPUT_TYPE_COLOR)
         if (input.isColorControl())
-            return ColorWellRole;
+            return AccessibilityRole::ColorWell;
 #endif
     }
     
     if (hasContentEditableAttributeSet())
-        return TextAreaRole;
+        return AccessibilityRole::TextArea;
     
     if (isFileUploadButton())
-        return ButtonRole;
+        return AccessibilityRole::Button;
     
     if (cssBox && cssBox->isMenuList())
-        return PopUpButtonRole;
+        return AccessibilityRole::PopUpButton;
     
     if (headingLevel())
-        return HeadingRole;
+        return AccessibilityRole::Heading;
     
     if (m_renderer->isSVGRoot())
-        return SVGRootRole;
+        return AccessibilityRole::SVGRoot;
     
     if (isStyleFormatGroup())
-        return is<RenderInline>(*m_renderer) ? InlineRole : TextGroupRole;
+        return is<RenderInline>(*m_renderer) ? AccessibilityRole::Inline : AccessibilityRole::TextGroup;
     
     if (node && node->hasTagName(ddTag))
-        return DescriptionListDetailRole;
+        return AccessibilityRole::DescriptionListDetail;
     
     if (node && node->hasTagName(dtTag))
-        return DescriptionListTermRole;
+        return AccessibilityRole::DescriptionListTerm;
 
     if (node && node->hasTagName(dlTag))
-        return DescriptionListRole;
+        return AccessibilityRole::DescriptionList;
 
     if (node && node->hasTagName(fieldsetTag))
-        return GroupRole;
+        return AccessibilityRole::Group;
 
     if (node && node->hasTagName(figureTag))
-        return FigureRole;
+        return AccessibilityRole::Figure;
 
     // Check for Ruby elements
     if (m_renderer->isRubyText())
-        return RubyTextRole;
+        return AccessibilityRole::RubyText;
     if (m_renderer->isRubyBase())
-        return RubyBaseRole;
+        return AccessibilityRole::RubyBase;
     if (m_renderer->isRubyRun())
-        return RubyRunRole;
+        return AccessibilityRole::RubyRun;
     if (m_renderer->isRubyBlock())
-        return RubyBlockRole;
+        return AccessibilityRole::RubyBlock;
     if (m_renderer->isRubyInline())
-        return RubyInlineRole;
+        return AccessibilityRole::RubyInline;
     
     // This return value is what will be used if AccessibilityTableCell determines
     // the cell should not be treated as a cell (e.g. because it is a layout table.
     if (is<RenderTableCell>(renderer()))
-        return TextGroupRole;
+        return AccessibilityRole::TextGroup;
 
     // Table sections should be ignored.
     if (m_renderer->isTableSection())
-        return IgnoredRole;
+        return AccessibilityRole::Ignored;
 
     if (m_renderer->isHR())
-        return HorizontalRuleRole;
+        return AccessibilityRole::HorizontalRule;
 
     if (node && node->hasTagName(pTag))
-        return ParagraphRole;
+        return AccessibilityRole::Paragraph;
 
     if (is<HTMLLabelElement>(node))
-        return LabelRole;
+        return AccessibilityRole::Label;
 
     if (node && node->hasTagName(dfnTag))
-        return DefinitionRole;
+        return AccessibilityRole::Definition;
 
     if (node && node->hasTagName(divTag))
-        return DivRole;
+        return AccessibilityRole::Div;
 
     if (is<HTMLFormElement>(node))
-        return FormRole;
+        return AccessibilityRole::Form;
 
     if (node && node->hasTagName(articleTag))
-        return DocumentArticleRole;
+        return AccessibilityRole::DocumentArticle;
 
     if (node && node->hasTagName(mainTag))
-        return LandmarkMainRole;
+        return AccessibilityRole::LandmarkMain;
 
     if (node && node->hasTagName(navTag))
-        return LandmarkNavigationRole;
+        return AccessibilityRole::LandmarkNavigation;
 
     if (node && node->hasTagName(asideTag))
-        return LandmarkComplementaryRole;
+        return AccessibilityRole::LandmarkComplementary;
 
     // The default role attribute value for the section element, region, became a landmark in ARIA 1.1.
     // The HTML AAM spec says it is "strongly recommended" that ATs only convey and provide navigation
     // for section elements which have names.
     if (node && node->hasTagName(sectionTag))
-        return hasAttribute(aria_labelAttr) || hasAttribute(aria_labelledbyAttr) ? LandmarkRegionRole : TextGroupRole;
+        return hasAttribute(aria_labelAttr) || hasAttribute(aria_labelledbyAttr) ? AccessibilityRole::LandmarkRegion : AccessibilityRole::TextGroup;
 
     if (node && node->hasTagName(addressTag))
-        return LandmarkContentInfoRole;
+        return AccessibilityRole::LandmarkContentInfo;
 
     if (node && node->hasTagName(blockquoteTag))
-        return BlockquoteRole;
+        return AccessibilityRole::Blockquote;
 
     if (node && node->hasTagName(captionTag))
-        return CaptionRole;
+        return AccessibilityRole::Caption;
     
     if (node && node->hasTagName(markTag))
-        return MarkRole;
+        return AccessibilityRole::Mark;
 
     if (node && node->hasTagName(preTag))
-        return PreRole;
+        return AccessibilityRole::Pre;
 
     if (is<HTMLDetailsElement>(node))
-        return DetailsRole;
+        return AccessibilityRole::Details;
     if (is<HTMLSummaryElement>(node))
-        return SummaryRole;
+        return AccessibilityRole::Summary;
     
     // http://rawgit.com/w3c/aria/master/html-aam/html-aam.html
     // Output elements should be mapped to status role.
     if (isOutput())
-        return ApplicationStatusRole;
+        return AccessibilityRole::ApplicationStatus;
 
 #if ENABLE(VIDEO)
     if (is<HTMLVideoElement>(node))
-        return VideoRole;
+        return AccessibilityRole::Video;
     if (is<HTMLAudioElement>(node))
-        return AudioRole;
+        return AccessibilityRole::Audio;
 #endif
     
     // The HTML element should not be exposed as an element. That's what the RenderView element does.
     if (node && node->hasTagName(htmlTag))
-        return IgnoredRole;
+        return AccessibilityRole::Ignored;
 
     // There should only be one banner/contentInfo per page. If header/footer are being used within an article or section
     // then it should not be exposed as whole page's banner/contentInfo
     if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articleTag) && !isDescendantOfElementType(sectionTag))
-        return LandmarkBannerRole;
+        return AccessibilityRole::LandmarkBanner;
     if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articleTag) && !isDescendantOfElementType(sectionTag))
-        return FooterRole;
+        return AccessibilityRole::Footer;
     
     // menu tags with toolbar type should have Toolbar role.
     if (node && node->hasTagName(menuTag) && equalLettersIgnoringASCIICase(getAttribute(typeAttr), "toolbar"))
-        return ToolbarRole;
+        return AccessibilityRole::Toolbar;
     
     if (node && node->hasTagName(timeTag))
-        return TimeRole;
+        return AccessibilityRole::Time;
     
     // If the element does not have role, but it has ARIA attributes, or accepts tab focus, accessibility should fallback to exposing it as a group.
     if (supportsARIAAttributes() || canSetFocusAttribute())
-        return GroupRole;
+        return AccessibilityRole::Group;
 
     if (m_renderer->isRenderBlockFlow())
-        return m_renderer->isAnonymousBlock() ? TextGroupRole : GroupRole;
+        return m_renderer->isAnonymousBlock() ? AccessibilityRole::TextGroup : AccessibilityRole::Group;
     
-    // InlineRole is the final fallback before assigning UnknownRole to an object. It makes it
+    // InlineRole is the final fallback before assigning AccessibilityRole::Unknown to an object. It makes it
     // possible to distinguish truly unknown objects from non-focusable inline text elements
     // which have an event handler or attribute suggesting possible inclusion by the platform.
     if (is<RenderInline>(*m_renderer)
         && (hasAttributesRequiredForInclusion()
             || (node && node->hasEventListeners())
             || (supportsDatetimeAttribute() && !getAttribute(datetimeAttr).isEmpty())))
-        return InlineRole;
+        return AccessibilityRole::Inline;
 
-    return UnknownRole;
+    return AccessibilityRole::Unknown;
 }
 
 AccessibilityOrientation AccessibilityRenderObject::orientation() const
 {
     const AtomicString& ariaOrientation = getAttribute(aria_orientationAttr);
     if (equalLettersIgnoringASCIICase(ariaOrientation, "horizontal"))
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     if (equalLettersIgnoringASCIICase(ariaOrientation, "vertical"))
-        return AccessibilityOrientationVertical;
+        return AccessibilityOrientation::Vertical;
     if (equalLettersIgnoringASCIICase(ariaOrientation, "undefined"))
-        return AccessibilityOrientationUndefined;
+        return AccessibilityOrientation::Undefined;
 
     // In ARIA 1.1, the implicit value of aria-orientation changed from horizontal
     // to undefined on all roles that don't have their own role-specific values. In
     // addition, the implicit value of combobox became undefined.
     if (isComboBox() || isRadioGroup() || isTreeGrid())
-        return AccessibilityOrientationUndefined;
+        return AccessibilityOrientation::Undefined;
 
     if (isScrollbar() || isListBox() || isMenu() || isTree())
-        return AccessibilityOrientationVertical;
+        return AccessibilityOrientation::Vertical;
     
     if (isMenuBar() || isSplitter() || isTabList() || isToolbar() || isSlider())
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     
     return AccessibilityObject::orientation();
 }
@@ -2881,14 +2881,14 @@
 
     const Vector<const HTMLQualifiedName*>* parentTags;
     switch (roleValue()) {
-    case ListItemRole:
-    case ListMarkerRole: {
+    case AccessibilityRole::ListItem:
+    case AccessibilityRole::ListMarker: {
         static const auto listItemParents = makeNeverDestroyed(Vector<const HTMLQualifiedName*> { &dlTag, &olTag, &ulTag });
         parentTags = &listItemParents.get();
         break;
     }
-    case GridCellRole:
-    case CellRole: {
+    case AccessibilityRole::GridCell:
+    case AccessibilityRole::Cell: {
         static const auto tableCellParents = makeNeverDestroyed(Vector<const HTMLQualifiedName*> { &tableTag });
         parentTags = &tableCellParents.get();
         break;
@@ -2910,7 +2910,7 @@
         // based on its presentational status.
         auto& name = downcast<Element>(*node).tagQName();
         if (std::any_of(parentTags->begin(), parentTags->end(), [&name] (auto* possibleName) { return *possibleName == name; }))
-            return parent->roleValue() == PresentationalRole;
+            return parent->roleValue() == AccessibilityRole::Presentational;
     }
 
     return false;
@@ -2929,11 +2929,11 @@
 bool AccessibilityRenderObject::ariaRoleHasPresentationalChildren() const
 {
     switch (m_ariaRole) {
-    case ButtonRole:
-    case SliderRole:
-    case ImageRole:
-    case ProgressIndicatorRole:
-    case SpinButtonRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::Image:
+    case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::SpinButton:
     // case SeparatorRole:
         return true;
     default:
@@ -2943,7 +2943,7 @@
 
 bool AccessibilityRenderObject::canSetExpandedAttribute() const
 {
-    if (roleValue() == DetailsRole)
+    if (roleValue() == AccessibilityRole::Details)
         return true;
     
     // An object can be expanded if it aria-expanded is true or false.
@@ -2997,7 +2997,7 @@
         // add an <area> element for this child if it has a link
         if (!area.isLink())
             continue;
-        auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->getOrCreate(ImageMapLinkRole));
+        auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->getOrCreate(AccessibilityRole::ImageMapLink));
         areaObject.setHTMLAreaElement(&area);
         areaObject.setHTMLMapElement(map);
         areaObject.setParent(this);
@@ -3032,7 +3032,7 @@
     if (!is<SpinButtonElement>(spinButtonElement))
         return;
 
-    auto& axSpinButton = downcast<AccessibilitySpinButton>(*axObjectCache()->getOrCreate(SpinButtonRole));
+    auto& axSpinButton = downcast<AccessibilitySpinButton>(*axObjectCache()->getOrCreate(AccessibilityRole::SpinButton));
     axSpinButton.setSpinButtonElement(downcast<SpinButtonElement>(spinButtonElement));
     axSpinButton.setParent(this);
     m_children.append(&axSpinButton);
@@ -3205,7 +3205,7 @@
 void AccessibilityRenderObject::updateRoleAfterChildrenCreation()
 {
     // If a menu does not have valid menuitem children, it should not be exposed as a menu.
-    if (roleValue() == MenuRole) {
+    if (roleValue() == AccessibilityRole::Menu) {
         // Elements marked as menus must have at least one menu item child.
         size_t menuItemCount = 0;
         for (const auto& child : children()) {
@@ -3216,7 +3216,7 @@
         }
 
         if (!menuItemCount)
-            m_role = GroupRole;
+            m_role = AccessibilityRole::Group;
     }
 }
     
@@ -3290,8 +3290,8 @@
 
     // WAI-ARIA "alert" and "status" roles have an implicit aria-atomic value of true.
     switch (roleValue()) {
-    case ApplicationAlertRole:
-    case ApplicationStatusRole:
+    case AccessibilityRole::ApplicationAlert:
+    case AccessibilityRole::ApplicationStatus:
         return true;
     default:
         return false;
@@ -3307,16 +3307,16 @@
 {
     switch (roleValue()) {
     // These roles are containers whose children support aria-selected:
-    case GridRole:
-    case ListBoxRole:
-    case TabListRole:
-    case TreeRole:
-    case TreeGridRole:
+    case AccessibilityRole::Grid:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::TabList:
+    case AccessibilityRole::Tree:
+    case AccessibilityRole::TreeGrid:
     // These roles are containers whose children are treated as selected by assistive
     // technologies. We can get the "selected" item via aria-activedescendant or the
     // focused element.
-    case MenuRole:
-    case MenuBarRole:
+    case AccessibilityRole::Menu:
+    case AccessibilityRole::MenuBar:
         return true;
     default:
         return false;
@@ -3363,7 +3363,7 @@
 
     for (const auto& child : children()) {
         // Every child should have aria-role option, and if so, check for selected attribute/state.
-        if (child->isSelected() && child->ariaRoleAttribute() == ListBoxOptionRole) {
+        if (child->isSelected() && child->ariaRoleAttribute() == AccessibilityRole::ListBoxOption) {
             result.append(child);
             if (!isMulti)
                 return;
@@ -3379,21 +3379,21 @@
         return;
 
     switch (roleValue()) {
-    case ListBoxRole:
+    case AccessibilityRole::ListBox:
         // native list boxes would be AccessibilityListBoxes, so only check for aria list boxes
         ariaListboxSelectedChildren(result);
         return;
-    case GridRole:
-    case TreeRole:
-    case TreeGridRole:
+    case AccessibilityRole::Grid:
+    case AccessibilityRole::Tree:
+    case AccessibilityRole::TreeGrid:
         ariaSelectedRows(result);
         return;
-    case TabListRole:
+    case AccessibilityRole::TabList:
         if (AccessibilityObject* selectedTab = selectedTabItem())
             result.append(selectedTab);
         return;
-    case MenuRole:
-    case MenuBarRole:
+    case AccessibilityRole::Menu:
+    case AccessibilityRole::MenuBar:
         if (AccessibilityObject* descendant = activeDescendant()) {
             result.append(descendant);
             return;
@@ -3424,7 +3424,8 @@
     ASSERT(result.isEmpty());
         
     // only listboxes are asked for their visible children. 
-    if (ariaRoleAttribute() != ListBoxRole) { // native list boxes would be AccessibilityListBoxes, so only check for aria list boxes
+    if (ariaRoleAttribute() != AccessibilityRole::ListBox) {
+        // native list boxes would be AccessibilityListBoxes, so only check for aria list boxes
         ASSERT_NOT_REACHED();
         return;
     }
@@ -3433,7 +3434,7 @@
  
 void AccessibilityRenderObject::tabChildren(AccessibilityChildrenVector& result)
 {
-    ASSERT(roleValue() == TabListRole);
+    ASSERT(roleValue() == AccessibilityRole::TabList);
     
     for (const auto& child : children()) {
         if (child->isTabItem())
@@ -3453,18 +3454,18 @@
     static NeverDestroyed<const String> linkAction(AXLinkActionVerb());
 
     switch (roleValue()) {
-    case ButtonRole:
-    case ToggleButtonRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::ToggleButton:
         return buttonAction;
-    case TextFieldRole:
-    case TextAreaRole:
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::TextArea:
         return textFieldAction;
-    case RadioButtonRole:
+    case AccessibilityRole::RadioButton:
         return radioButtonAction;
-    case CheckBoxRole:
+    case AccessibilityRole::CheckBox:
         return isChecked() ? checkedCheckBoxAction : uncheckedCheckBoxAction;
-    case LinkRole:
-    case WebCoreLinkRole:
+    case AccessibilityRole::Link:
+    case AccessibilityRole::WebCoreLink:
         return linkAction;
     default:
         return nullAtom();
@@ -3655,25 +3656,25 @@
 static AccessibilityRole msaaRoleForRenderer(const RenderObject* renderer)
 {
     if (!renderer)
-        return UnknownRole;
+        return AccessibilityRole::Unknown;
 
     if (is<RenderText>(*renderer))
-        return EditableTextRole;
+        return AccessibilityRole::EditableText;
 
     if (is<RenderListItem>(*renderer))
-        return ListItemRole;
+        return AccessibilityRole::ListItem;
 
-    return UnknownRole;
+    return AccessibilityRole::Unknown;
 }
 
 AccessibilityRole AccessibilityRenderObject::roleValueForMSAA() const
 {
-    if (m_roleForMSAA != UnknownRole)
+    if (m_roleForMSAA != AccessibilityRole::Unknown)
         return m_roleForMSAA;
 
     m_roleForMSAA = msaaRoleForRenderer(renderer());
 
-    if (m_roleForMSAA == UnknownRole)
+    if (m_roleForMSAA == AccessibilityRole::Unknown)
         m_roleForMSAA = roleValue();
 
     return m_roleForMSAA;
diff --git a/Source/WebCore/accessibility/AccessibilitySVGElement.cpp b/Source/WebCore/accessibility/AccessibilitySVGElement.cpp
index 894a44e..d683c27 100644
--- a/Source/WebCore/accessibility/AccessibilitySVGElement.cpp
+++ b/Source/WebCore/accessibility/AccessibilitySVGElement.cpp
@@ -111,11 +111,11 @@
 {
     String description = accessibilityDescription();
     if (!description.isEmpty())
-        textOrder.append(AccessibilityText(description, AlternativeText));
+        textOrder.append(AccessibilityText(description, AccessibilityTextSource::Alternative));
 
     String helptext = helpText();
     if (!helptext.isEmpty())
-        textOrder.append(AccessibilityText(helptext, HelpText));
+        textOrder.append(AccessibilityText(helptext, AccessibilityTextSource::Help));
 }
 
 String AccessibilitySVGElement::accessibilityDescription() const
@@ -217,7 +217,7 @@
     // * They have an ancestor with Children Presentational: True (covered by Core AAM)
 
     AccessibilityObjectInclusion decision = defaultObjectInclusion();
-    if (decision == IgnoreObject)
+    if (decision == AccessibilityObjectInclusion::IgnoreObject)
         return true;
 
     if (m_renderer->isSVGHiddenContainer())
@@ -230,10 +230,10 @@
             return false;
     }
 
-    if (roleValue() == PresentationalRole || inheritsPresentationalRole())
+    if (roleValue() == AccessibilityRole::Presentational || inheritsPresentationalRole())
         return true;
 
-    if (ariaRoleAttribute() != UnknownRole)
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown)
         return false;
 
     // The SVG AAM states text elements should also be included, if they have content.
@@ -258,12 +258,12 @@
         return false;
 
     AccessibilityRole role = roleValue();
-    if (role != SVGTextPathRole && role != SVGTSpanRole)
+    if (role != AccessibilityRole::SVGTextPath && role != AccessibilityRole::SVGTSpan)
         return false;
 
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
         if (is<AccessibilityRenderObject>(*parent) && parent->element()->hasTagName(SVGNames::textTag))
-            return parent->roleValue() == PresentationalRole;
+            return parent->roleValue() == AccessibilityRole::Presentational;
     }
 
     return false;
@@ -272,7 +272,7 @@
 AccessibilityRole AccessibilitySVGElement::determineAriaRoleAttribute() const
 {
     AccessibilityRole role = AccessibilityRenderObject::determineAriaRoleAttribute();
-    if (role != PresentationalRole)
+    if (role != AccessibilityRole::Presentational)
         return role;
 
     // The presence of a 'title' or 'desc' child element trumps PresentationalRole.
@@ -280,7 +280,7 @@
     // At this time, the presence of a matching 'lang' attribute is not mentioned.
     for (const auto& child : childrenOfType<SVGElement>(*element())) {
         if ((is<SVGTitleElement>(child) || is<SVGDescElement>(child)))
-            return UnknownRole;
+            return AccessibilityRole::Unknown;
     }
 
     return role;
@@ -288,23 +288,23 @@
 
 AccessibilityRole AccessibilitySVGElement::determineAccessibilityRole()
 {
-    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
+    if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown)
         return m_ariaRole;
 
     Element* svgElement = element();
 
     if (m_renderer->isSVGShape() || m_renderer->isSVGPath() || m_renderer->isSVGImage() || is<SVGUseElement>(svgElement))
-        return ImageRole;
+        return AccessibilityRole::Image;
     if (m_renderer->isSVGForeignObject() || is<SVGGElement>(svgElement))
-        return GroupRole;
+        return AccessibilityRole::Group;
     if (m_renderer->isSVGText())
-        return SVGTextRole;
+        return AccessibilityRole::SVGText;
     if (m_renderer->isSVGTextPath())
-        return SVGTextPathRole;
+        return AccessibilityRole::SVGTextPath;
     if (m_renderer->isSVGTSpan())
-        return SVGTSpanRole;
+        return AccessibilityRole::SVGTSpan;
     if (is<SVGAElement>(svgElement))
-        return WebCoreLinkRole;
+        return AccessibilityRole::WebCoreLink;
 
     return AccessibilityRenderObject::determineAccessibilityRole();
 }
diff --git a/Source/WebCore/accessibility/AccessibilitySVGRoot.h b/Source/WebCore/accessibility/AccessibilitySVGRoot.h
index f933194..951eb76 100644
--- a/Source/WebCore/accessibility/AccessibilitySVGRoot.h
+++ b/Source/WebCore/accessibility/AccessibilitySVGRoot.h
@@ -47,7 +47,7 @@
     bool isAccessibilitySVGRoot() const override { return true; }
 
     WeakPtr<AccessibilityRenderObject> m_parent;
-    AccessibilityRole roleValue() const override { return GroupRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::Group; }
 };
     
 } // namespace WebCore 
diff --git a/Source/WebCore/accessibility/AccessibilityScrollView.cpp b/Source/WebCore/accessibility/AccessibilityScrollView.cpp
index 9bbb091..2a62393 100644
--- a/Source/WebCore/accessibility/AccessibilityScrollView.cpp
+++ b/Source/WebCore/accessibility/AccessibilityScrollView.cpp
@@ -65,10 +65,10 @@
     
     switch (orientation) {
     // ARIA 1.1 Elements with the role scrollbar have an implicit aria-orientation value of vertical.
-    case AccessibilityOrientationUndefined:
-    case AccessibilityOrientationVertical:
+    case AccessibilityOrientation::Undefined:
+    case AccessibilityOrientation::Vertical:
         return m_verticalScrollbar ? m_verticalScrollbar.get() : nullptr;
-    case AccessibilityOrientationHorizontal:
+    case AccessibilityOrientation::Horizontal:
         return m_horizontalScrollbar ? m_horizontalScrollbar.get() : nullptr;
     }
     
diff --git a/Source/WebCore/accessibility/AccessibilityScrollView.h b/Source/WebCore/accessibility/AccessibilityScrollView.h
index 0d76f66..9f452cb 100644
--- a/Source/WebCore/accessibility/AccessibilityScrollView.h
+++ b/Source/WebCore/accessibility/AccessibilityScrollView.h
@@ -36,7 +36,7 @@
 class AccessibilityScrollView final : public AccessibilityObject {
 public:
     static Ref<AccessibilityScrollView> create(ScrollView*);
-    AccessibilityRole roleValue() const override { return ScrollAreaRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::ScrollArea; }
     ScrollView* scrollView() const { return m_scrollView; }
 
     virtual ~AccessibilityScrollView();
diff --git a/Source/WebCore/accessibility/AccessibilityScrollbar.cpp b/Source/WebCore/accessibility/AccessibilityScrollbar.cpp
index a46d1b21..c08916a 100644
--- a/Source/WebCore/accessibility/AccessibilityScrollbar.cpp
+++ b/Source/WebCore/accessibility/AccessibilityScrollbar.cpp
@@ -67,14 +67,14 @@
 {
     // ARIA 1.1 Elements with the role scrollbar have an implicit aria-orientation value of vertical.
     if (!m_scrollbar)
-        return AccessibilityOrientationVertical;
+        return AccessibilityOrientation::Vertical;
 
     if (m_scrollbar->orientation() == HorizontalScrollbar)
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     if (m_scrollbar->orientation() == VerticalScrollbar)
-        return AccessibilityOrientationVertical;
+        return AccessibilityOrientation::Vertical;
 
-    return AccessibilityOrientationVertical;
+    return AccessibilityOrientation::Vertical;
 }
 
 bool AccessibilityScrollbar::isEnabled() const
diff --git a/Source/WebCore/accessibility/AccessibilityScrollbar.h b/Source/WebCore/accessibility/AccessibilityScrollbar.h
index 3cc431a..4b0d2e3 100644
--- a/Source/WebCore/accessibility/AccessibilityScrollbar.h
+++ b/Source/WebCore/accessibility/AccessibilityScrollbar.h
@@ -49,7 +49,7 @@
     bool isAccessibilityScrollbar() const override { return true; }
     LayoutRect elementRect() const override;
     
-    AccessibilityRole roleValue() const override { return ScrollBarRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::ScrollBar; }
     AccessibilityOrientation orientation() const override;
     Document* document() const override;
     bool isEnabled() const override;
diff --git a/Source/WebCore/accessibility/AccessibilitySlider.cpp b/Source/WebCore/accessibility/AccessibilitySlider.cpp
index 2e68c8f..12229dc 100644
--- a/Source/WebCore/accessibility/AccessibilitySlider.cpp
+++ b/Source/WebCore/accessibility/AccessibilitySlider.cpp
@@ -54,7 +54,7 @@
 {
     // Default to horizontal in the unknown case.
     if (!m_renderer)
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     
     const RenderStyle& style = m_renderer->style();
 
@@ -64,15 +64,15 @@
     case SliderHorizontalPart:
     case MediaSliderPart:
     case MediaFullScreenVolumeSliderPart:
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     
     case SliderThumbVerticalPart: 
     case SliderVerticalPart:
     case MediaVolumeSliderPart:
-        return AccessibilityOrientationVertical;
+        return AccessibilityOrientation::Vertical;
         
     default:
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientation::Horizontal;
     }
 }
     
@@ -84,7 +84,7 @@
 
     AXObjectCache* cache = m_renderer->document().axObjectCache();
 
-    auto& thumb = downcast<AccessibilitySliderThumb>(*cache->getOrCreate(SliderThumbRole));
+    auto& thumb = downcast<AccessibilitySliderThumb>(*cache->getOrCreate(AccessibilityRole::SliderThumb));
     thumb.setParent(this);
 
     // Before actually adding the value indicator to the hierarchy,
diff --git a/Source/WebCore/accessibility/AccessibilitySlider.h b/Source/WebCore/accessibility/AccessibilitySlider.h
index 672b4ca..f1c78c1 100644
--- a/Source/WebCore/accessibility/AccessibilitySlider.h
+++ b/Source/WebCore/accessibility/AccessibilitySlider.h
@@ -47,7 +47,7 @@
     HTMLInputElement* inputElement() const;
     AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const override;
 
-    AccessibilityRole roleValue() const override { return SliderRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::Slider; }
     bool isSlider() const final { return true; }
     bool isInputSlider() const override { return true; }
     bool isControl() const override { return true; }
@@ -69,7 +69,7 @@
     static Ref<AccessibilitySliderThumb> create();
     virtual ~AccessibilitySliderThumb() = default;
 
-    AccessibilityRole roleValue() const override { return SliderThumbRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::SliderThumb; }
     LayoutRect elementRect() const override;
 
 private:
diff --git a/Source/WebCore/accessibility/AccessibilitySpinButton.cpp b/Source/WebCore/accessibility/AccessibilitySpinButton.cpp
index edcab35..c3cc082 100644
--- a/Source/WebCore/accessibility/AccessibilitySpinButton.cpp
+++ b/Source/WebCore/accessibility/AccessibilitySpinButton.cpp
@@ -88,12 +88,12 @@
     
     m_haveChildren = true;
     
-    auto& incrementor = downcast<AccessibilitySpinButtonPart>(*cache->getOrCreate(SpinButtonPartRole));
+    auto& incrementor = downcast<AccessibilitySpinButtonPart>(*cache->getOrCreate(AccessibilityRole::SpinButtonPart));
     incrementor.setIsIncrementor(true);
     incrementor.setParent(this);
     m_children.append(&incrementor);
 
-    auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->getOrCreate(SpinButtonPartRole));
+    auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->getOrCreate(AccessibilityRole::SpinButtonPart));
     decrementor.setIsIncrementor(false);
     decrementor.setParent(this);
     m_children.append(&decrementor);
diff --git a/Source/WebCore/accessibility/AccessibilitySpinButton.h b/Source/WebCore/accessibility/AccessibilitySpinButton.h
index c1f47b7..63d5f37 100644
--- a/Source/WebCore/accessibility/AccessibilitySpinButton.h
+++ b/Source/WebCore/accessibility/AccessibilitySpinButton.h
@@ -45,7 +45,7 @@
 private:
     AccessibilitySpinButton();
 
-    AccessibilityRole roleValue() const override { return SpinButtonRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::SpinButton; }
     bool isSpinButton() const override { return true; }
     bool isNativeSpinButton() const override { return true; }
     void addChildren() override;
@@ -66,7 +66,7 @@
     AccessibilitySpinButtonPart();
     
     bool press() override;
-    AccessibilityRole roleValue() const override { return ButtonRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::Button; }
     bool isSpinButtonPart() const override { return true; }
     LayoutRect elementRect() const override;
 
diff --git a/Source/WebCore/accessibility/AccessibilityTable.cpp b/Source/WebCore/accessibility/AccessibilityTable.cpp
index 4b1c617..b5adbf5 100644
--- a/Source/WebCore/accessibility/AccessibilityTable.cpp
+++ b/Source/WebCore/accessibility/AccessibilityTable.cpp
@@ -76,7 +76,7 @@
         return false;
     
     AccessibilityRole ariaRole = ariaRoleAttribute();
-    if (ariaRole != UnknownRole)
+    if (ariaRole != AccessibilityRole::Unknown)
         return true;
 
     return false;
@@ -416,7 +416,7 @@
     // make the columns based on the number of columns in the first body
     unsigned length = maxColumnCount;
     for (unsigned i = 0; i < length; ++i) {
-        auto& column = downcast<AccessibilityTableColumn>(*axCache->getOrCreate(ColumnRole));
+        auto& column = downcast<AccessibilityTableColumn>(*axCache->getOrCreate(AccessibilityRole::Column));
         column.setColumnIndex((int)i);
         column.setParent(this);
         m_columns.append(&column);
@@ -505,7 +505,7 @@
     if (m_headerContainer)
         return m_headerContainer.get();
     
-    auto& tableHeader = downcast<AccessibilityMockObject>(*axObjectCache()->getOrCreate(TableHeaderContainerRole));
+    auto& tableHeader = downcast<AccessibilityMockObject>(*axObjectCache()->getOrCreate(AccessibilityRole::TableHeaderContainer));
     tableHeader.setParent(this);
 
     m_headerContainer = &tableHeader;
@@ -647,18 +647,18 @@
         return AccessibilityRenderObject::roleValue();
     
     AccessibilityRole ariaRole = ariaRoleAttribute();
-    if (ariaRole == GridRole || ariaRole == TreeGridRole)
+    if (ariaRole == AccessibilityRole::Grid || ariaRole == AccessibilityRole::TreeGrid)
         return ariaRole;
 
-    return TableRole;
+    return AccessibilityRole::Table;
 }
     
 bool AccessibilityTable::computeAccessibilityIsIgnored() const
 {
     AccessibilityObjectInclusion decision = defaultObjectInclusion();
-    if (decision == IncludeObject)
+    if (decision == AccessibilityObjectInclusion::IncludeObject)
         return false;
-    if (decision == IgnoreObject)
+    if (decision == AccessibilityObjectInclusion::IgnoreObject)
         return true;
     
     if (!isExposableThroughAccessibility())
@@ -671,7 +671,7 @@
 {
     String title = this->title();
     if (!title.isEmpty())
-        textOrder.append(AccessibilityText(title, LabelByElementText));
+        textOrder.append(AccessibilityText(title, AccessibilityTextSource::LabelByElement));
 }
 
 String AccessibilityTable::title() const
diff --git a/Source/WebCore/accessibility/AccessibilityTableCell.cpp b/Source/WebCore/accessibility/AccessibilityTableCell.cpp
index f805139..c311c82 100644
--- a/Source/WebCore/accessibility/AccessibilityTableCell.cpp
+++ b/Source/WebCore/accessibility/AccessibilityTableCell.cpp
@@ -58,9 +58,9 @@
 bool AccessibilityTableCell::computeAccessibilityIsIgnored() const
 {
     AccessibilityObjectInclusion decision = defaultObjectInclusion();
-    if (decision == IncludeObject)
+    if (decision == AccessibilityObjectInclusion::IncludeObject)
         return false;
-    if (decision == IgnoreObject)
+    if (decision == AccessibilityObjectInclusion::IgnoreObject)
         return true;
     
     // Ignore anonymous table cells as long as they're not in a table (ie. when display:table is used).
@@ -128,17 +128,17 @@
     // role, falling back on the role to be used if we determine here that the element
     // should not be exposed as a cell. Thus if we already know it's a cell, return that.
     AccessibilityRole defaultRole = AccessibilityRenderObject::determineAccessibilityRole();
-    if (defaultRole == ColumnHeaderRole || defaultRole == RowHeaderRole || defaultRole == CellRole || defaultRole == GridCellRole)
+    if (defaultRole == AccessibilityRole::ColumnHeader || defaultRole == AccessibilityRole::RowHeader || defaultRole == AccessibilityRole::Cell || defaultRole == AccessibilityRole::GridCell)
         return defaultRole;
 
     if (!isTableCell())
         return defaultRole;
     if (isColumnHeaderCell())
-        return ColumnHeaderRole;
+        return AccessibilityRole::ColumnHeader;
     if (isRowHeaderCell())
-        return RowHeaderRole;
+        return AccessibilityRole::RowHeader;
 
-    return CellRole;
+    return AccessibilityRole::Cell;
 }
     
 bool AccessibilityTableCell::isTableHeaderCell() const
diff --git a/Source/WebCore/accessibility/AccessibilityTableColumn.cpp b/Source/WebCore/accessibility/AccessibilityTableColumn.cpp
index 63c2bb5..d0fec2d 100644
--- a/Source/WebCore/accessibility/AccessibilityTableColumn.cpp
+++ b/Source/WebCore/accessibility/AccessibilityTableColumn.cpp
@@ -87,7 +87,7 @@
     
     if (parentTable.isAriaTable()) {
         for (const auto& cell : children()) {
-            if (cell->ariaRoleAttribute() == ColumnHeaderRole)
+            if (cell->ariaRoleAttribute() == AccessibilityRole::ColumnHeader)
                 return cell.get();
         }
         
diff --git a/Source/WebCore/accessibility/AccessibilityTableColumn.h b/Source/WebCore/accessibility/AccessibilityTableColumn.h
index 6b27f90..9fcdb5c 100644
--- a/Source/WebCore/accessibility/AccessibilityTableColumn.h
+++ b/Source/WebCore/accessibility/AccessibilityTableColumn.h
@@ -43,7 +43,7 @@
     
     AccessibilityObject* headerObject();
         
-    AccessibilityRole roleValue() const override { return ColumnRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::Column; }
     
     void setColumnIndex(int columnIndex) { m_columnIndex = columnIndex; }
     int columnIndex() const { return m_columnIndex; }    
diff --git a/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.h b/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.h
index 16da839..4a6ccbd 100644
--- a/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.h
+++ b/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.h
@@ -39,7 +39,7 @@
     static Ref<AccessibilityTableHeaderContainer> create();
     virtual ~AccessibilityTableHeaderContainer();
     
-    AccessibilityRole roleValue() const override { return TableHeaderContainerRole; }
+    AccessibilityRole roleValue() const override { return AccessibilityRole::TableHeaderContainer; }
     
     void addChildren() override;
     
diff --git a/Source/WebCore/accessibility/AccessibilityTableRow.cpp b/Source/WebCore/accessibility/AccessibilityTableRow.cpp
index b9c6f6c..d27db2c 100644
--- a/Source/WebCore/accessibility/AccessibilityTableRow.cpp
+++ b/Source/WebCore/accessibility/AccessibilityTableRow.cpp
@@ -59,10 +59,10 @@
     if (!isTableRow())
         return AccessibilityRenderObject::determineAccessibilityRole();
 
-    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
+    if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Unknown)
         return m_ariaRole;
 
-    return RowRole;
+    return AccessibilityRole::Row;
 }
 
 bool AccessibilityTableRow::isTableRow() const
@@ -80,9 +80,9 @@
 bool AccessibilityTableRow::computeAccessibilityIsIgnored() const
 {    
     AccessibilityObjectInclusion decision = defaultObjectInclusion();
-    if (decision == IncludeObject)
+    if (decision == AccessibilityObjectInclusion::IncludeObject)
         return false;
-    if (decision == IgnoreObject)
+    if (decision == AccessibilityObjectInclusion::IgnoreObject)
         return true;
     
     if (!isTableRow())
diff --git a/Source/WebCore/accessibility/AccessibilityTree.cpp b/Source/WebCore/accessibility/AccessibilityTree.cpp
index b0e9e7f..a6c5d61 100644
--- a/Source/WebCore/accessibility/AccessibilityTree.cpp
+++ b/Source/WebCore/accessibility/AccessibilityTree.cpp
@@ -59,10 +59,10 @@
 
 AccessibilityRole AccessibilityTree::determineAccessibilityRole()
 {
-    if ((m_ariaRole = determineAriaRoleAttribute()) != TreeRole)
+    if ((m_ariaRole = determineAriaRoleAttribute()) != AccessibilityRole::Tree)
         return AccessibilityRenderObject::determineAccessibilityRole();
 
-    return isTreeValid() ? TreeRole : GroupRole;
+    return isTreeValid() ? AccessibilityRole::Tree : AccessibilityRole::Group;
 }
 
 bool AccessibilityTree::nodeHasTreeItemChild(Node& node) const
diff --git a/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp b/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
index 9659d63..1679f61 100644
--- a/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
+++ b/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
@@ -43,7 +43,7 @@
 
     // If an object is being detached NOT because of the AXObjectCache being destroyed,
     // then it's being removed from the accessibility tree and we should emit a signal.
-    if (detachmentType != CacheDestroyed) {
+    if (detachmentType != AccessibilityDetachmentType::CacheDestroyed) {
         if (obj->document()) {
             // Look for the right object to emit the signal from, but using the implementation
             // of atk_object_get_parent from AtkObject class (which uses a cached pointer if set)
@@ -244,7 +244,7 @@
         break;
 
     case AXCurrentChanged:
-        atk_object_notify_state_change(axObject, ATK_STATE_ACTIVE, coreObject->ariaCurrentState() != ARIACurrentFalse);
+        atk_object_notify_state_change(axObject, ATK_STATE_ACTIVE, coreObject->ariaCurrentState() != AccessibilityARIACurrentState::False);
         break;
 
     case AXRowExpanded:
diff --git a/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp b/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
index 2382484..17566b1 100644
--- a/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
+++ b/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
@@ -43,117 +43,117 @@
 {
     AccessibilityObject* parent = parentObject();
     if (!parent)
-        return DefaultBehavior;
+        return AccessibilityObjectInclusion::DefaultBehavior;
 
     // If the author has provided a role, platform-specific inclusion likely doesn't apply.
-    if (ariaRoleAttribute() != UnknownRole)
-        return DefaultBehavior;
+    if (ariaRoleAttribute() != AccessibilityRole::Unknown)
+        return AccessibilityObjectInclusion::DefaultBehavior;
 
     AccessibilityRole role = roleValue();
     // We expose the slider as a whole but not its value indicator.
-    if (role == SliderThumbRole)
-        return IgnoreObject;
+    if (role == AccessibilityRole::SliderThumb)
+        return AccessibilityObjectInclusion::IgnoreObject;
 
     // When a list item is made up entirely of children (e.g. paragraphs)
     // the list item gets ignored. We need it.
     if (isGroup() && parent->isList())
-        return IncludeObject;
+        return AccessibilityObjectInclusion::IncludeObject;
 
     // Entries and password fields have extraneous children which we want to ignore.
     if (parent->isPasswordField() || parent->isTextControl())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
 
     // Include all tables, even layout tables. The AT can decide what to do with each.
-    if (role == CellRole || role == TableRole || role == ColumnHeaderRole || role == RowHeaderRole)
-        return IncludeObject;
+    if (role == AccessibilityRole::Cell || role == AccessibilityRole::Table || role == AccessibilityRole::ColumnHeader || role == AccessibilityRole::RowHeader)
+        return AccessibilityObjectInclusion::IncludeObject;
 
     // The object containing the text should implement AtkText itself.
     // However, WebCore also maps ARIA's "text" role to the StaticTextRole.
-    if (role == StaticTextRole)
-        return ariaRoleAttribute() != UnknownRole ? DefaultBehavior : IgnoreObject;
+    if (role == AccessibilityRole::StaticText)
+        return ariaRoleAttribute() != AccessibilityRole::Unknown ? AccessibilityObjectInclusion::DefaultBehavior : AccessibilityObjectInclusion::IgnoreObject;
 
     // Include all list items, regardless they have or not inline children
-    if (role == ListItemRole)
-        return IncludeObject;
+    if (role == AccessibilityRole::ListItem)
+        return AccessibilityObjectInclusion::IncludeObject;
 
     // Bullets/numbers for list items shouldn't be exposed as AtkObjects.
-    if (role == ListMarkerRole)
-        return IgnoreObject;
+    if (role == AccessibilityRole::ListMarker)
+        return AccessibilityObjectInclusion::IgnoreObject;
 
     // Never expose an unknown object, since AT's won't know what to
     // do with them. This is what is done on the Mac as well.
-    if (role == UnknownRole)
-        return IgnoreObject;
+    if (role == AccessibilityRole::Unknown)
+        return AccessibilityObjectInclusion::IgnoreObject;
 
-    if (role == InlineRole)
-        return IncludeObject;
+    if (role == AccessibilityRole::Inline)
+        return AccessibilityObjectInclusion::IncludeObject;
 
     // Lines past this point only make sense for AccessibilityRenderObjects.
     RenderObject* renderObject = renderer();
     if (!renderObject)
-        return DefaultBehavior;
+        return AccessibilityObjectInclusion::DefaultBehavior;
 
     // We always want to include paragraphs that have rendered content.
     // WebCore Accessibility does so unless there is a RenderBlock child.
-    if (role == ParagraphRole) {
+    if (role == AccessibilityRole::Paragraph) {
         auto child = childrenOfType<RenderBlock>(downcast<RenderElement>(*renderObject)).first();
-        return child ? IncludeObject : DefaultBehavior;
+        return child ? AccessibilityObjectInclusion::IncludeObject : AccessibilityObjectInclusion::DefaultBehavior;
     }
 
     // We always want to include table cells (layout and CSS) that have rendered text content.
     if (is<RenderTableCell>(renderObject)) {
         for (const auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*renderObject))) {
             if (is<RenderInline>(child) || is<RenderText>(child) || is<HTMLSpanElement>(child.node()))
-                return IncludeObject;
+                return AccessibilityObjectInclusion::IncludeObject;
         }
-        return DefaultBehavior;
+        return AccessibilityObjectInclusion::DefaultBehavior;
     }
 
     if (renderObject->isAnonymousBlock()) {
         // The text displayed by an ARIA menu item is exposed through the accessible name.
         if (parent->isMenuItem())
-            return IgnoreObject;
+            return AccessibilityObjectInclusion::IgnoreObject;
 
         // The text displayed in headings is typically exposed in the heading itself.
         if (parent->isHeading())
-            return IgnoreObject;
+            return AccessibilityObjectInclusion::IgnoreObject;
 
         // The text displayed in list items is typically exposed in the list item itself.
         if (parent->isListItem())
-            return IgnoreObject;
+            return AccessibilityObjectInclusion::IgnoreObject;
 
         // The text displayed in links is typically exposed in the link itself.
         if (parent->isLink())
-            return IgnoreObject;
+            return AccessibilityObjectInclusion::IgnoreObject;
 
         // FIXME: This next one needs some further consideration. But paragraphs are not
         // typically huge (like divs). And ignoring anonymous block children of paragraphs
         // will preserve existing behavior.
-        if (parent->roleValue() == ParagraphRole)
-            return IgnoreObject;
+        if (parent->roleValue() == AccessibilityRole::Paragraph)
+            return AccessibilityObjectInclusion::IgnoreObject;
 
-        return DefaultBehavior;
+        return AccessibilityObjectInclusion::DefaultBehavior;
     }
 
     Node* node = renderObject->node();
     if (!node)
-        return DefaultBehavior;
+        return AccessibilityObjectInclusion::DefaultBehavior;
 
     // We don't want <span> elements to show up in the accessibility hierarchy unless
     // we have good reasons for that (e.g. focusable or visible because of containing
     // a meaningful accessible name, maybe set through ARIA), so we can use
     // atk_component_grab_focus() to set the focus to it.
     if (is<HTMLSpanElement>(node) && !canSetFocusAttribute() && !hasAttributesRequiredForInclusion() && !supportsARIAAttributes())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
 
     // If we include TextControlInnerTextElement children, changes to those children
     // will result in focus and text notifications that suggest the user is no longer
     // in the control. This can be especially problematic for screen reader users with
     // key echo enabled when typing in a password input.
     if (is<TextControlInnerTextElement>(node))
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
 
-    return DefaultBehavior;
+    return AccessibilityObjectInclusion::DefaultBehavior;
 }
 
 AccessibilityObjectWrapper* AccessibilityObject::wrapper() const
@@ -183,7 +183,7 @@
 
     // Check roles as the last fallback mechanism.
     AccessibilityRole role = roleValue();
-    return role == ParagraphRole || role == LabelRole || role == DivRole || role == FormRole || role == PreRole;
+    return role == AccessibilityRole::Paragraph || role == AccessibilityRole::Label || role == AccessibilityRole::Div || role == AccessibilityRole::Form || role == AccessibilityRole::Pre;
 }
 
 unsigned AccessibilityObject::getLengthForTextRange() const
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
index 9e51c5c..59e3946 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
@@ -447,7 +447,7 @@
     AccessibilityObject* coreObject = core(text);
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    if (coreObject->roleValue() == ColorWellRole) {
+    if (coreObject->roleValue() == AccessibilityRole::ColorWell) {
         int r, g, b;
         coreObject->colorValue(r, g, b);
         return g_strdup_printf("rgb %7.5f %7.5f %7.5f 1", r / 255., g / 255., b / 255.);
@@ -465,7 +465,7 @@
 
     // Prefix a item number/bullet if needed
     int actualEndOffset = endOffset == -1 ? ret.length() : endOffset;
-    if (coreObject->roleValue() == ListItemRole) {
+    if (coreObject->roleValue() == AccessibilityRole::ListItem) {
         RenderObject* objRenderer = coreObject->renderer();
         if (is<RenderListItem>(objRenderer)) {
             String markerText = downcast<RenderListItem>(*objRenderer).markerTextWithSuffix();
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp
index 001f9d0..8f993d1 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp
@@ -96,21 +96,21 @@
 
     for (const AccessibilityText& text : textOrder) {
         // Once we encounter visible text, or the text from our children that should be used foremost.
-        if (text.textSource == VisibleText || text.textSource == ChildrenText)
+        if (text.textSource == AccessibilityTextSource::Visible || text.textSource == AccessibilityTextSource::Children)
             return text.text;
 
         // If there's an element that labels this object and it's not exposed, then we should use
         // that text as our title.
-        if (text.textSource == LabelByElementText && !coreObject->exposesTitleUIElement())
+        if (text.textSource == AccessibilityTextSource::LabelByElement && !coreObject->exposesTitleUIElement())
             return text.text;
 
-        // Elements of role ToolbarRole will return its title as AlternativeText.
-        if (coreObject->roleValue() == ToolbarRole && text.textSource == AlternativeText)
+        // Elements of role AccessibilityRole::Toolbar will return its title as AccessibilityTextSource::Alternative.
+        if (coreObject->roleValue() == AccessibilityRole::Toolbar && text.textSource == AccessibilityTextSource::Alternative)
             return text.text;
 
         // FIXME: The title tag is used in certain cases for the title. This usage should
         // probably be in the description field since it's not "visible".
-        if (text.textSource == TitleTagText && !titleTagShouldBeUsedInDescriptionField(coreObject))
+        if (text.textSource == AccessibilityTextSource::TitleTag && !titleTagShouldBeUsedInDescriptionField(coreObject))
             return text.text;
     }
 
@@ -124,19 +124,19 @@
 
     bool visibleTextAvailable = false;
     for (const AccessibilityText& text : textOrder) {
-        if (text.textSource == AlternativeText)
+        if (text.textSource == AccessibilityTextSource::Alternative)
             return text.text;
 
         switch (text.textSource) {
-        case VisibleText:
-        case ChildrenText:
-        case LabelByElementText:
+        case AccessibilityTextSource::Visible:
+        case AccessibilityTextSource::Children:
+        case AccessibilityTextSource::LabelByElement:
             visibleTextAvailable = true;
         default:
             break;
         }
 
-        if (text.textSource == TitleTagText && !visibleTextAvailable)
+        if (text.textSource == AccessibilityTextSource::TitleTag && !visibleTextAvailable)
             return text.text;
     }
 
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
diff --git a/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm b/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm
index efefca1..e0672b0 100644
--- a/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm
+++ b/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm
@@ -66,7 +66,7 @@
     
 AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const
 {
-    return DefaultBehavior;
+    return AccessibilityObjectInclusion::DefaultBehavior;
 }
 
 bool AccessibilityObject::hasTouchEventListener() const
@@ -81,7 +81,7 @@
 bool AccessibilityObject::isInputTypePopupButton() const
 {
     if (is<HTMLInputElement>(node()))
-        return roleValue() == PopUpButtonRole;
+        return roleValue() == AccessibilityRole::PopUpButton;
     return false;
 }
 
diff --git a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
index 7513ef6..41e08be 100644
--- a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
+++ b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
@@ -342,30 +342,30 @@
     AccessibilityRole role = m_object->roleValue();
     // Elements that can be returned when performing fuzzy hit testing.
     switch (role) {
-    case ButtonRole:
-    case CheckBoxRole:
-    case ComboBoxRole:
-    case DisclosureTriangleRole:
-    case HeadingRole:
-    case ImageMapLinkRole:
-    case ImageRole:
-    case LinkRole:
-    case ListBoxRole:
-    case ListBoxOptionRole:
-    case MenuButtonRole:
-    case MenuItemRole:
-    case MenuItemCheckboxRole:
-    case MenuItemRadioRole:
-    case PopUpButtonRole:
-    case RadioButtonRole:
-    case ScrollBarRole:
-    case SearchFieldRole:
-    case SliderRole:
-    case StaticTextRole:
-    case SwitchRole:
-    case TabRole:
-    case TextFieldRole:
-    case ToggleButtonRole:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::DisclosureTriangle:
+    case AccessibilityRole::Heading:
+    case AccessibilityRole::ImageMapLink:
+    case AccessibilityRole::Image:
+    case AccessibilityRole::Link:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::ListBoxOption:
+    case AccessibilityRole::MenuButton:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::ScrollBar:
+    case AccessibilityRole::SearchField:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::StaticText:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::Tab:
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::ToggleButton:
         return !m_object->accessibilityIsIgnored();
     default:
         return false;
@@ -514,24 +514,24 @@
         return NO;
 
     AccessibilityRole roleValue = m_object->roleValue();
-    return roleValue == ApplicationDialogRole || roleValue == ApplicationAlertDialogRole;
+    return roleValue == AccessibilityRole::ApplicationDialog || roleValue == AccessibilityRole::ApplicationAlertDialog;
 }
 
 - (BOOL)_accessibilityIsLandmarkRole:(AccessibilityRole)role
 {
     switch (role) {
-    case DocumentRole:
-    case DocumentArticleRole:
-    case DocumentNoteRole:
-    case FooterRole:
-    case LandmarkBannerRole:
-    case LandmarkComplementaryRole:
-    case LandmarkContentInfoRole:
-    case LandmarkDocRegionRole:
-    case LandmarkMainRole:
-    case LandmarkNavigationRole:
-    case LandmarkRegionRole:
-    case LandmarkSearchRole:
+    case AccessibilityRole::Document:
+    case AccessibilityRole::DocumentArticle:
+    case AccessibilityRole::DocumentNote:
+    case AccessibilityRole::Footer:
+    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 YES;
     default:
         return NO;
@@ -542,7 +542,7 @@
 {
     auto matchFunc = [] (const AccessibilityObject& object) {
         AccessibilityRole role = object.roleValue();
-        return role == TreeRole;
+        return role == AccessibilityRole::Tree;
     };
     
     if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*m_object, false, WTFMove(matchFunc)))
@@ -554,7 +554,7 @@
 {
     auto matchFunc = [] (const AccessibilityObject& object) {
         AccessibilityRole role = object.roleValue();
-        return role == ListRole || role == ListBoxRole;
+        return role == AccessibilityRole::List || role == AccessibilityRole::ListBox;
     };
     
     if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*m_object, false, WTFMove(matchFunc)))
@@ -565,7 +565,7 @@
 - (AccessibilityObjectWrapper*)_accessibilityArticleAncestor
 {
     if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*m_object, false, [] (const AccessibilityObject& object) {
-        return object.roleValue() == DocumentArticleRole;
+        return object.roleValue() == AccessibilityRole::DocumentArticle;
     }))
         return parent->wrapper();
     return nil;
@@ -618,48 +618,47 @@
     // The parentObject is needed instead of the unignoredParentObject, because a table might be ignored, but information still needs to be gathered from it.    
     for (AccessibilityObject* parent = m_object->parentObject(); parent != nil; parent = parent->parentObject()) {
         AccessibilityRole parentRole = parent->roleValue();
-        if (parentRole == WebAreaRole)
+        if (parentRole == AccessibilityRole::WebArea)
             break;
         
         switch (parentRole) {
-            case LinkRole:
-            case WebCoreLinkRole:
-                traits |= [self _axLinkTrait];
-                if (parent->isVisited())
-                    traits |= [self _axVisitedTrait];
-                break;
-            case HeadingRole:
-            {
-                traits |= [self _axHeaderTrait];
-                // If this object has the header trait, we should set the value
-                // to the heading level. If it was a static text element, we need to store
-                // the value as the label, because the heading level needs to the value.
-                AccessibilityObjectWrapper* wrapper = parent->wrapper();
-                if (role == StaticTextRole) {
-                    // We should only set the text value as the label when there's no
-                    // alternate text on the heading parent.
-                    NSString *headingLabel = [wrapper baseAccessibilityDescription];
-                    if (![headingLabel length])
-                        [self setAccessibilityLabel:m_object->stringValue()];
-                    else
-                        [self setAccessibilityLabel:headingLabel];
-                }
-                [self setAccessibilityValue:[wrapper accessibilityValue]];
-                break;
+        case AccessibilityRole::Link:
+        case AccessibilityRole::WebCoreLink:
+            traits |= [self _axLinkTrait];
+            if (parent->isVisited())
+                traits |= [self _axVisitedTrait];
+            break;
+        case AccessibilityRole::Heading: {
+            traits |= [self _axHeaderTrait];
+            // If this object has the header trait, we should set the value
+            // to the heading level. If it was a static text element, we need to store
+            // the value as the label, because the heading level needs to the value.
+            AccessibilityObjectWrapper* wrapper = parent->wrapper();
+            if (role == AccessibilityRole::StaticText) {
+                // We should only set the text value as the label when there's no
+                // alternate text on the heading parent.
+                NSString *headingLabel = [wrapper baseAccessibilityDescription];
+                if (![headingLabel length])
+                    [self setAccessibilityLabel:m_object->stringValue()];
+                else
+                    [self setAccessibilityLabel:headingLabel];
             }
-            case ListBoxRole:
-            case ListRole:
-                traits |= [self _axContainedByListTrait];
-                break;
-            case GridRole:
-            case TableRole:
-            case TreeGridRole:
-                traits |= [self _axContainedByTableTrait];
-                break;
-            default:
-                if ([self _accessibilityIsLandmarkRole:parentRole])
-                    traits |= [self _axContainedByLandmarkTrait];
-                break;
+            [self setAccessibilityValue:[wrapper accessibilityValue]];
+            break;
+        }
+        case AccessibilityRole::ListBox:
+        case AccessibilityRole::List:
+            traits |= [self _axContainedByListTrait];
+            break;
+        case AccessibilityRole::Grid:
+        case AccessibilityRole::Table:
+        case AccessibilityRole::TreeGrid:
+            traits |= [self _axContainedByTableTrait];
+            break;
+        default:
+            if ([self _accessibilityIsLandmarkRole:parentRole])
+                traits |= [self _axContainedByLandmarkTrait];
+            break;
         }
         
         // If this object has fieldset parent, we should add containedByFieldsetTrait to it.
@@ -676,7 +675,7 @@
         return NO;
     
     // Only make the video object interactive if it plays inline and has no native controls.
-    if (m_object->roleValue() != VideoRole || !is<AccessibilityMediaObject>(m_object))
+    if (m_object->roleValue() != AccessibilityRole::Video || !is<AccessibilityMediaObject>(m_object))
         return NO;
     
     AccessibilityMediaObject* mediaObject = downcast<AccessibilityMediaObject>(m_object);
@@ -741,9 +740,9 @@
         traits |= ([self _axHasTextCursorTrait] | [self _axTextOperationsAvailableTrait]);
     if (m_object->isPasswordField())
         traits |= [self _axSecureTextFieldTrait];
-    if (m_object->roleValue() == SearchFieldRole)
+    if (m_object->roleValue() == AccessibilityRole::SearchField)
         traits |= [self _axSearchFieldTrait];
-    if (m_object->roleValue() == TextAreaRole)
+    if (m_object->roleValue() == AccessibilityRole::TextArea)
         traits |= [self _axTextAreaTrait];
     return traits;
 }
@@ -756,58 +755,58 @@
     AccessibilityRole role = m_object->roleValue();
     uint64_t traits = [self _axWebContentTrait];
     switch (role) {
-        case LinkRole:
-        case WebCoreLinkRole:
-            traits |= [self _axLinkTrait];
-            if (m_object->isVisited())
-                traits |= [self _axVisitedTrait];
-            break;
-        case TextFieldRole:
-        case SearchFieldRole:
-        case TextAreaRole:
-            traits |= [self _accessibilityTextEntryTraits];
-            break;
-        case ImageRole:
-            traits |= [self _axImageTrait];
-            break;
-        case TabRole:
-            traits |= [self _axTabButtonTrait];
-            break;
-        case ButtonRole:
-            traits |= [self _axButtonTrait];
-            if (m_object->isPressed())
-                traits |= [self _axToggleTrait];
-            break;
-        case PopUpButtonRole:
-            traits |= [self _axPopupButtonTrait];
-            break;
-        case RadioButtonRole:
-            traits |= [self _axRadioButtonTrait] | [self _axToggleTrait];
-            break;
-        case ToggleButtonRole:
-        case CheckBoxRole:
-        case SwitchRole:
-            traits |= ([self _axButtonTrait] | [self _axToggleTrait]);
-            break;
-        case HeadingRole:
-            traits |= [self _axHeaderTrait];
-            break;
-        case StaticTextRole:
-            traits |= [self _axStaticTextTrait];
-            break;
-        case SliderRole:
-            traits |= [self _axAdjustableTrait];
-            break;
-        case MenuButtonRole:
-        case MenuItemRole:
-            traits |= [self _axMenuItemTrait];
-            break;
-        case MenuItemCheckboxRole:
-        case MenuItemRadioRole:
-            traits |= ([self _axMenuItemTrait] | [self _axToggleTrait]);
-            break;
-        default:
-            break;
+    case AccessibilityRole::Link:
+    case AccessibilityRole::WebCoreLink:
+        traits |= [self _axLinkTrait];
+        if (m_object->isVisited())
+            traits |= [self _axVisitedTrait];
+        break;
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::SearchField:
+    case AccessibilityRole::TextArea:
+        traits |= [self _accessibilityTextEntryTraits];
+        break;
+    case AccessibilityRole::Image:
+        traits |= [self _axImageTrait];
+        break;
+    case AccessibilityRole::Tab:
+        traits |= [self _axTabButtonTrait];
+        break;
+    case AccessibilityRole::Button:
+        traits |= [self _axButtonTrait];
+        if (m_object->isPressed())
+            traits |= [self _axToggleTrait];
+        break;
+    case AccessibilityRole::PopUpButton:
+        traits |= [self _axPopupButtonTrait];
+        break;
+    case AccessibilityRole::RadioButton:
+        traits |= [self _axRadioButtonTrait] | [self _axToggleTrait];
+        break;
+    case AccessibilityRole::ToggleButton:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::Switch:
+        traits |= ([self _axButtonTrait] | [self _axToggleTrait]);
+        break;
+    case AccessibilityRole::Heading:
+        traits |= [self _axHeaderTrait];
+        break;
+    case AccessibilityRole::StaticText:
+        traits |= [self _axStaticTextTrait];
+        break;
+    case AccessibilityRole::Slider:
+        traits |= [self _axAdjustableTrait];
+        break;
+    case AccessibilityRole::MenuButton:
+    case AccessibilityRole::MenuItem:
+        traits |= [self _axMenuItemTrait];
+        break;
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+        traits |= ([self _axMenuItemTrait] | [self _axToggleTrait]);
+        break;
+    default:
+        break;
     }
 
     if (m_object->isAttachmentElement())
@@ -849,178 +848,177 @@
     m_object->updateBackingStore();
     
     switch (m_object->roleValue()) {
-        case TextFieldRole:
-        case TextAreaRole:
-        case ButtonRole:
-        case ToggleButtonRole:
-        case PopUpButtonRole:
-        case CheckBoxRole:
-        case RadioButtonRole:
-        case SliderRole:
-        case MenuButtonRole:
-        case ValueIndicatorRole:
-        case ImageRole:
-        case ImageMapLinkRole:
-        case ProgressIndicatorRole:
-        case MenuItemRole:
-        case MenuItemCheckboxRole:
-        case MenuItemRadioRole:
-        case IncrementorRole:
-        case ComboBoxRole:
-        case DisclosureTriangleRole:
-        case ImageMapRole:
-        case ListMarkerRole:
-        case ListBoxOptionRole:
-        case TabRole:
-        case DocumentMathRole:
-        case HorizontalRuleRole:
-        case SliderThumbRole:
-        case SwitchRole:
-        case SearchFieldRole:
-        case SpinButtonRole:
-            return true;
-        case StaticTextRole:
-        {
-            // Many text elements only contain a space.
-            if (![[[self accessibilityLabel] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length])
-                return false;
+    case AccessibilityRole::TextField:
+    case AccessibilityRole::TextArea:
+    case AccessibilityRole::Button:
+    case AccessibilityRole::ToggleButton:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::MenuButton:
+    case AccessibilityRole::ValueIndicator:
+    case AccessibilityRole::Image:
+    case AccessibilityRole::ImageMapLink:
+    case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::MenuItem:
+    case AccessibilityRole::MenuItemCheckbox:
+    case AccessibilityRole::MenuItemRadio:
+    case AccessibilityRole::Incrementor:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::DisclosureTriangle:
+    case AccessibilityRole::ImageMap:
+    case AccessibilityRole::ListMarker:
+    case AccessibilityRole::ListBoxOption:
+    case AccessibilityRole::Tab:
+    case AccessibilityRole::DocumentMath:
+    case AccessibilityRole::HorizontalRule:
+    case AccessibilityRole::SliderThumb:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::SearchField:
+    case AccessibilityRole::SpinButton:
+        return true;
+    case AccessibilityRole::StaticText: {
+        // Many text elements only contain a space.
+        if (![[[self accessibilityLabel] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length])
+            return false;
 
-            // Text elements that are just pieces of links or headers should not be exposed.
-            if ([AccessibilityUnignoredAncestor([self accessibilityContainer]) containsUnnaturallySegmentedChildren])
-                return false;
+        // Text elements that are just pieces of links or headers should not be exposed.
+        if ([AccessibilityUnignoredAncestor([self accessibilityContainer]) containsUnnaturallySegmentedChildren])
+            return false;
+        return true;
+    }
+        
+    // Don't expose headers as elements; instead expose their children as elements, with the header trait (unless they have no children)
+    case AccessibilityRole::Heading:
+        if (![self accessibilityElementCount])
             return true;
-        }
-            
-        // Don't expose headers as elements; instead expose their children as elements, with the header trait (unless they have no children)
-        case HeadingRole:
-            if (![self accessibilityElementCount])
-                return true;
-            return false;
-            
-        case VideoRole:
-            return [self accessibilityIsWebInteractiveVideo];
-            
-        // Links can sometimes be elements (when they only contain static text or don't contain anything).
-        // They should not be elements when containing text and other types.
-        case WebCoreLinkRole:
-        case LinkRole:
-            if ([self containsUnnaturallySegmentedChildren] || ![self accessibilityElementCount])
-                return true;
-            return false;
-        case GroupRole:
-            if ([self isSVGGroupElement])
-                return true;
-            FALLTHROUGH;
-        // All other elements are ignored on the iphone.
-        case AnnotationRole:
-        case ApplicationRole:
-        case ApplicationAlertRole:
-        case ApplicationAlertDialogRole:
-        case ApplicationDialogRole:
-        case ApplicationGroupRole:
-        case ApplicationLogRole:
-        case ApplicationMarqueeRole:
-        case ApplicationStatusRole:
-        case ApplicationTextGroupRole:
-        case ApplicationTimerRole:
-        case AudioRole:
-        case BlockquoteRole:
-        case BrowserRole:
-        case BusyIndicatorRole:
-        case CanvasRole:
-        case CaptionRole:
-        case CellRole:
-        case ColorWellRole:
-        case ColumnRole:
-        case ColumnHeaderRole:
-        case DefinitionRole:
-        case DescriptionListRole:
-        case DescriptionListTermRole:
-        case DescriptionListDetailRole:
-        case DetailsRole:
-        case DirectoryRole:
-        case DivRole:
-        case DocumentRole:
-        case DocumentArticleRole:
-        case DocumentNoteRole:
-        case DrawerRole:
-        case EditableTextRole:
-        case FeedRole:
-        case FigureRole:
-        case FooterRole:
-        case FootnoteRole:
-        case FormRole:
-        case GridRole:
-        case GridCellRole:
-        case GrowAreaRole:
-        case HelpTagRole:
-        case IgnoredRole:
-        case InlineRole:
-        case LabelRole:
-        case LandmarkBannerRole:
-        case LandmarkComplementaryRole:
-        case LandmarkContentInfoRole:
-        case LandmarkDocRegionRole:
-        case LandmarkMainRole:
-        case LandmarkNavigationRole:
-        case LandmarkRegionRole:
-        case LandmarkSearchRole:
-        case LegendRole:
-        case ListRole:
-        case ListBoxRole:
-        case ListItemRole:
-        case MarkRole:
-        case MathElementRole:
-        case MatteRole:
-        case MenuRole:
-        case MenuBarRole:
-        case MenuListPopupRole:
-        case MenuListOptionRole:
-        case OutlineRole:
-        case ParagraphRole:
-        case PreRole:
-        case PresentationalRole:
-        case RadioGroupRole:
-        case RowHeaderRole:
-        case RowRole:
-        case RubyBaseRole:
-        case RubyBlockRole:
-        case RubyInlineRole:
-        case RubyRunRole:
-        case RubyTextRole:
-        case RulerRole:
-        case RulerMarkerRole:
-        case ScrollAreaRole:
-        case ScrollBarRole:
-        case SheetRole:
-        case SpinButtonPartRole:
-        case SplitGroupRole:
-        case SplitterRole:
-        case SummaryRole:
-        case SystemWideRole:
-        case SVGRootRole:
-        case SVGTextPathRole:
-        case SVGTextRole:
-        case SVGTSpanRole:
-        case TabGroupRole:
-        case TabListRole:
-        case TabPanelRole:
-        case TableRole:
-        case TableHeaderContainerRole:
-        case TermRole:
-        case TextGroupRole:
-        case TimeRole:
-        case TreeRole:
-        case TreeItemRole:
-        case TreeGridRole:
-        case ToolbarRole:
-        case UnknownRole:
-        case UserInterfaceTooltipRole:
-        case WebApplicationRole:
-        case WebAreaRole:
-        case WindowRole:
-        case RowGroupRole:
-            return false;
+        return false;
+        
+    case AccessibilityRole::Video:
+        return [self accessibilityIsWebInteractiveVideo];
+        
+    // Links can sometimes be elements (when they only contain static text or don't contain anything).
+    // They should not be elements when containing text and other types.
+    case AccessibilityRole::WebCoreLink:
+    case AccessibilityRole::Link:
+        if ([self containsUnnaturallySegmentedChildren] || ![self accessibilityElementCount])
+            return true;
+        return false;
+    case AccessibilityRole::Group:
+        if ([self isSVGGroupElement])
+            return true;
+        FALLTHROUGH;
+    // All other elements are ignored on the iphone.
+    case AccessibilityRole::Annotation:
+    case AccessibilityRole::Application:
+    case AccessibilityRole::ApplicationAlert:
+    case AccessibilityRole::ApplicationAlertDialog:
+    case AccessibilityRole::ApplicationDialog:
+    case AccessibilityRole::ApplicationGroup:
+    case AccessibilityRole::ApplicationLog:
+    case AccessibilityRole::ApplicationMarquee:
+    case AccessibilityRole::ApplicationStatus:
+    case AccessibilityRole::ApplicationTextGroup:
+    case AccessibilityRole::ApplicationTimer:
+    case AccessibilityRole::Audio:
+    case AccessibilityRole::Blockquote:
+    case AccessibilityRole::Browser:
+    case AccessibilityRole::BusyIndicator:
+    case AccessibilityRole::Canvas:
+    case AccessibilityRole::Caption:
+    case AccessibilityRole::Cell:
+    case AccessibilityRole::ColorWell:
+    case AccessibilityRole::Column:
+    case AccessibilityRole::ColumnHeader:
+    case AccessibilityRole::Definition:
+    case AccessibilityRole::DescriptionList:
+    case AccessibilityRole::DescriptionListTerm:
+    case AccessibilityRole::DescriptionListDetail:
+    case AccessibilityRole::Details:
+    case AccessibilityRole::Directory:
+    case AccessibilityRole::Div:
+    case AccessibilityRole::Document:
+    case AccessibilityRole::DocumentArticle:
+    case AccessibilityRole::DocumentNote:
+    case AccessibilityRole::Drawer:
+    case AccessibilityRole::EditableText:
+    case AccessibilityRole::Feed:
+    case AccessibilityRole::Figure:
+    case AccessibilityRole::Footer:
+    case AccessibilityRole::Footnote:
+    case AccessibilityRole::Form:
+    case AccessibilityRole::Grid:
+    case AccessibilityRole::GridCell:
+    case AccessibilityRole::GrowArea:
+    case AccessibilityRole::HelpTag:
+    case AccessibilityRole::Ignored:
+    case AccessibilityRole::Inline:
+    case AccessibilityRole::Label:
+    case AccessibilityRole::LandmarkBanner:
+    case AccessibilityRole::LandmarkComplementary:
+    case AccessibilityRole::LandmarkContentInfo:
+    case AccessibilityRole::LandmarkDocRegion:
+    case AccessibilityRole::LandmarkMain:
+    case AccessibilityRole::LandmarkNavigation:
+    case AccessibilityRole::LandmarkRegion:
+    case AccessibilityRole::LandmarkSearch:
+    case AccessibilityRole::Legend:
+    case AccessibilityRole::List:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::ListItem:
+    case AccessibilityRole::Mark:
+    case AccessibilityRole::MathElement:
+    case AccessibilityRole::Matte:
+    case AccessibilityRole::Menu:
+    case AccessibilityRole::MenuBar:
+    case AccessibilityRole::MenuListPopup:
+    case AccessibilityRole::MenuListOption:
+    case AccessibilityRole::Outline:
+    case AccessibilityRole::Paragraph:
+    case AccessibilityRole::Pre:
+    case AccessibilityRole::Presentational:
+    case AccessibilityRole::RadioGroup:
+    case AccessibilityRole::RowHeader:
+    case AccessibilityRole::Row:
+    case AccessibilityRole::RubyBase:
+    case AccessibilityRole::RubyBlock:
+    case AccessibilityRole::RubyInline:
+    case AccessibilityRole::RubyRun:
+    case AccessibilityRole::RubyText:
+    case AccessibilityRole::Ruler:
+    case AccessibilityRole::RulerMarker:
+    case AccessibilityRole::ScrollArea:
+    case AccessibilityRole::ScrollBar:
+    case AccessibilityRole::Sheet:
+    case AccessibilityRole::SpinButtonPart:
+    case AccessibilityRole::SplitGroup:
+    case AccessibilityRole::Splitter:
+    case AccessibilityRole::Summary:
+    case AccessibilityRole::SystemWide:
+    case AccessibilityRole::SVGRoot:
+    case AccessibilityRole::SVGTextPath:
+    case AccessibilityRole::SVGText:
+    case AccessibilityRole::SVGTSpan:
+    case AccessibilityRole::TabGroup:
+    case AccessibilityRole::TabList:
+    case AccessibilityRole::TabPanel:
+    case AccessibilityRole::Table:
+    case AccessibilityRole::TableHeaderContainer:
+    case AccessibilityRole::Term:
+    case AccessibilityRole::TextGroup:
+    case AccessibilityRole::Time:
+    case AccessibilityRole::Tree:
+    case AccessibilityRole::TreeItem:
+    case AccessibilityRole::TreeGrid:
+    case AccessibilityRole::Toolbar:
+    case AccessibilityRole::Unknown:
+    case AccessibilityRole::UserInterfaceTooltip:
+    case AccessibilityRole::WebApplication:
+    case AccessibilityRole::WebArea:
+    case AccessibilityRole::Window:
+    case AccessibilityRole::RowGroup:
+        return false;
     }
     
     ASSERT_NOT_REACHED();
@@ -1042,7 +1040,7 @@
 {
     if (m_object->isTextControl())
         return NO;
-    if (m_object->roleValue() == PopUpButtonRole)
+    if (m_object->roleValue() == AccessibilityRole::PopUpButton)
         return NO;
     if (m_object->isFileUploadButton())
         return NO;
@@ -1126,13 +1124,13 @@
         axTitle = nil;
 
     // Footer is not considered a landmark, but we want the role description.
-    if (m_object->roleValue() == FooterRole)
+    if (m_object->roleValue() == AccessibilityRole::Footer)
         landmarkDescription = AXFooterRoleDescriptionText();
 
     NSMutableString *result = [NSMutableString string];
-    if (m_object->roleValue() == HorizontalRuleRole)
+    if (m_object->roleValue() == AccessibilityRole::HorizontalRule)
         appendStringToResult(result, AXHorizontalRuleDescriptionText());
-        
+
     appendStringToResult(result, axTitle);
     appendStringToResult(result, axDescription);
     if ([self stringValueShouldBeUsedInLabel]) {
@@ -1390,13 +1388,13 @@
         return value;
     
     AccessibilityRole role = m_object->roleValue();
-    if (m_object->isCheckboxOrRadio() || role == MenuItemCheckboxRole || role == MenuItemRadioRole) {
+    if (m_object->isCheckboxOrRadio() || role == AccessibilityRole::MenuItemCheckbox || role == AccessibilityRole::MenuItemRadio) {
         switch (m_object->checkboxOrRadioValue()) {
-        case ButtonStateOff:
+        case AccessibilityButtonState::Off:
             return [NSString stringWithFormat:@"%d", 0];
-        case ButtonStateOn:
+        case AccessibilityButtonState::On:
             return [NSString stringWithFormat:@"%d", 1];
-        case ButtonStateMixed:
+        case AccessibilityButtonState::Mixed:
             return [NSString stringWithFormat:@"%d", 2];
         }
         ASSERT_NOT_REACHED();
@@ -1450,7 +1448,7 @@
     if (![self _prepareAccessibilityCall])
         return NO;
 
-    return m_object->roleValue() == ComboBoxRole;
+    return m_object->roleValue() == AccessibilityRole::ComboBox;
 }
 
 - (NSString *)accessibilityHint
@@ -1670,7 +1668,7 @@
         return NO;
     
     AccessibilityRole role = m_object->roleValue();
-    if (role != LinkRole && role != WebCoreLinkRole)
+    if (role != AccessibilityRole::Link && role != AccessibilityRole::WebCoreLink)
         return NO;
     
     const auto& children = m_object->children();
@@ -1682,7 +1680,7 @@
     
     for (unsigned i = 0; i < childrenSize; ++i) {
         AccessibilityRole role = children[i]->roleValue();
-        if (role != StaticTextRole && role != ImageRole && role != GroupRole && role != TextGroupRole)
+        if (role != AccessibilityRole::StaticText && role != AccessibilityRole::Image && role != AccessibilityRole::Group && role != AccessibilityRole::TextGroup)
             return NO;
     }
     
@@ -1826,7 +1824,7 @@
     
     // If this static text inside of a link, it should use its parent's linked element.
     AccessibilityObject* element = m_object;
-    if (m_object->roleValue() == StaticTextRole && m_object->parentObjectUnignored()->isLink())
+    if (m_object->roleValue() == AccessibilityRole::StaticText && m_object->parentObjectUnignored()->isLink())
         element = m_object->parentObjectUnignored();
     
     AccessibilityObject::AccessibilityChildrenVector children;
@@ -2000,7 +1998,7 @@
 {
     // Use this to check if an object is inside a treeitem object.
     if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*object, true, [] (const AccessibilityObject& object) {
-        return object.roleValue() == TreeItemRole;
+        return object.roleValue() == AccessibilityRole::TreeItem;
     }))
         return const_cast<AccessibilityObject*>(parent);
     return nil;
@@ -2022,7 +2020,7 @@
     // The focused VoiceOver element might be the text inside a link.
     // In those cases we should focus on the link itself.
     for (AccessibilityObject* object = m_object; object != nil; object = object->parentObject()) {
-        if (object->roleValue() == WebAreaRole)
+        if (object->roleValue() == AccessibilityRole::WebArea)
             break;
 
         if (object->canSetFocusAttribute()) {
@@ -2971,20 +2969,19 @@
         return nil;
     
     switch (m_object->ariaCurrentState()) {
-    case ARIACurrentFalse:
+    case AccessibilityARIACurrentState::False:
         return @"false";
-    case ARIACurrentPage:
+    case AccessibilityARIACurrentState::Page:
         return @"page";
-    case ARIACurrentStep:
+    case AccessibilityARIACurrentState::Step:
         return @"step";
-    case ARIACurrentLocation:
+    case AccessibilityARIACurrentState::Location:
         return @"location";
-    case ARIACurrentTime:
+    case AccessibilityARIACurrentState::Time:
         return @"time";
-    case ARIACurrentDate:
+    case AccessibilityARIACurrentState::Date:
         return @"date";
-    default:
-    case ARIACurrentTrue:
+    case AccessibilityARIACurrentState::True:
         return @"true";
     }
 }
@@ -2995,14 +2992,14 @@
         return nil;
     
     switch (m_object->sortDirection()) {
-    case SortDirectionAscending:
+    case AccessibilitySortDirection::Ascending:
         return @"ascending";
-    case SortDirectionDescending:
+    case AccessibilitySortDirection::Descending:
         return @"descending";
-    case SortDirectionOther:
+    case AccessibilitySortDirection::Other:
         return @"other";
-    default:
-    case SortDirectionNone:
+    case AccessibilitySortDirection::Invalid:
+    case AccessibilitySortDirection::None:
         return nil;
     }
 }
@@ -3126,7 +3123,7 @@
     if (![self _prepareAccessibilityCall])
         return NO;
 
-    return m_object->roleValue() == DocumentMathRole;
+    return m_object->roleValue() == AccessibilityRole::DocumentMath;
 }
 
 - (NSInteger)accessibilityMathLineThickness
@@ -3142,7 +3139,7 @@
     if (![self _prepareAccessibilityCall])
         return nil;
 
-    if (m_object->roleValue() == MathElementRole) {
+    if (m_object->roleValue() == AccessibilityRole::MathElement) {
         if (m_object->isMathFraction())
             return @"AXMathFraction";
         if (m_object->isMathFenced())
diff --git a/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm b/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
index 0b9ba72..2b83da4 100644
--- a/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
+++ b/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
@@ -82,32 +82,32 @@
 AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const
 {
     if (isMenuListPopup() || isMenuListOption())
-        return IgnoreObject;
+        return AccessibilityObjectInclusion::IgnoreObject;
 
-    if (roleValue() == CaptionRole)
-        return IgnoreObject;
+    if (roleValue() == AccessibilityRole::Caption)
+        return AccessibilityObjectInclusion::IgnoreObject;
     
-    if (roleValue() == MarkRole)
-        return IncludeObject;
+    if (roleValue() == AccessibilityRole::Mark)
+        return AccessibilityObjectInclusion::IncludeObject;
 
     // Never expose an unknown object on the Mac. Clients of the AX API will not know what to do with it.
     // Special case is when the unknown object is actually an attachment.
-    if (roleValue() == UnknownRole && !isAttachment())
-        return IgnoreObject;
+    if (roleValue() == AccessibilityRole::Unknown && !isAttachment())
+        return AccessibilityObjectInclusion::IgnoreObject;
     
-    if (roleValue() == InlineRole && !isStyleFormatGroup())
-        return IgnoreObject;
+    if (roleValue() == AccessibilityRole::Inline && !isStyleFormatGroup())
+        return AccessibilityObjectInclusion::IgnoreObject;
 
     if (RenderObject* renderer = this->renderer()) {
         // The legend element is ignored if it lives inside of a fieldset element that uses it to generate alternative text.
         if (renderer->isLegend()) {
             Element* element = this->element();
             if (element && ancestorsOfType<HTMLFieldSetElement>(*element).first())
-                return IgnoreObject;
+                return AccessibilityObjectInclusion::IgnoreObject;
         }
     }
     
-    return DefaultBehavior;
+    return AccessibilityObjectInclusion::DefaultBehavior;
 }
     
 bool AccessibilityObject::caretBrowsingEnabled() const
diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
index 8728c78..42cd019 100644
--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
+++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
@@ -326,7 +326,7 @@
 - (NSString *)baseAccessibilityTitle
 {
     // Static text objects should not have a title. Its content is communicated in its AXValue.
-    if (m_object->roleValue() == StaticTextRole)
+    if (m_object->roleValue() == AccessibilityRole::StaticText)
         return [NSString string];
 
     // A file upload button presents a challenge because it has button text and a value, but the
@@ -340,16 +340,16 @@
     
     for (const auto& text : textOrder) {
         // If we have alternative text, then we should not expose a title.
-        if (text.textSource == AlternativeText)
+        if (text.textSource == AccessibilityTextSource::Alternative)
             break;
         
         // Once we encounter visible text, or the text from our children that should be used foremost.
-        if (text.textSource == VisibleText || text.textSource == ChildrenText)
+        if (text.textSource == AccessibilityTextSource::Visible || text.textSource == AccessibilityTextSource::Children)
             return text.text;
         
         // If there's an element that labels this object and it's not exposed, then we should use
         // that text as our title.
-        if (text.textSource == LabelByElementText && !m_object->exposesTitleUIElement())
+        if (text.textSource == AccessibilityTextSource::LabelByElement && !m_object->exposesTitleUIElement())
             return text.text;
     }
     
@@ -360,7 +360,7 @@
 {
     // Static text objects should not have a description. Its content is communicated in its AXValue.
     // One exception is the media control labels that have a value and a description. Those are set programatically.
-    if (m_object->roleValue() == StaticTextRole && !m_object->isMediaControlLabel())
+    if (m_object->roleValue() == AccessibilityRole::StaticText && !m_object->isMediaControlLabel())
         return [NSString string];
     
     Vector<AccessibilityText> textOrder;
@@ -369,16 +369,16 @@
     NSMutableString *returnText = [NSMutableString string];
     bool visibleTextAvailable = false;
     for (const auto& text : textOrder) {
-        if (text.textSource == AlternativeText) {
+        if (text.textSource == AccessibilityTextSource::Alternative) {
             [returnText appendString:text.text];
             break;
         }
         
         switch (text.textSource) {
         // These are sub-components of one element (Attachment) that are re-combined in OSX and iOS.
-        case TitleText:
-        case SubtitleText:
-        case ActionText: {
+        case AccessibilityTextSource::Title:
+        case AccessibilityTextSource::Subtitle:
+        case AccessibilityTextSource::Action: {
             if (!text.text.length())
                 break;
             if ([returnText length])
@@ -386,16 +386,16 @@
             [returnText appendString:text.text];
             break;
         }
-        case VisibleText:
-        case ChildrenText:
-        case LabelByElementText:
+        case AccessibilityTextSource::Visible:
+        case AccessibilityTextSource::Children:
+        case AccessibilityTextSource::LabelByElement:
             visibleTextAvailable = true;
             break;
         default:
             break;
         }
         
-        if (text.textSource == TitleTagText && !visibleTextAvailable) {
+        if (text.textSource == AccessibilityTextSource::TitleTag && !visibleTextAvailable) {
             [returnText appendString:text.text];
             break;
         }
@@ -411,23 +411,23 @@
     
     bool descriptiveTextAvailable = false;
     for (const auto& text : textOrder) {
-        if (text.textSource == HelpText || text.textSource == SummaryText)
+        if (text.textSource == AccessibilityTextSource::Help || text.textSource == AccessibilityTextSource::Summary)
             return text.text;
         
         // If an element does NOT have other descriptive text the title tag should be used as its descriptive text.
         // But, if those ARE available, then the title tag should be used for help text instead.
         switch (text.textSource) {
-        case AlternativeText:
-        case VisibleText:
-        case ChildrenText:
-        case LabelByElementText:
+        case AccessibilityTextSource::Alternative:
+        case AccessibilityTextSource::Visible:
+        case AccessibilityTextSource::Children:
+        case AccessibilityTextSource::LabelByElement:
             descriptiveTextAvailable = true;
             break;
         default:
             break;
         }
         
-        if (text.textSource == TitleTagText && descriptiveTextAvailable)
+        if (text.textSource == AccessibilityTextSource::TitleTag && descriptiveTextAvailable)
             return text.text;
     }
     
@@ -498,48 +498,48 @@
 - (NSString *)ariaLandmarkRoleDescription
 {
     switch (m_object->roleValue()) {
-    case LandmarkBannerRole:
+    case AccessibilityRole::LandmarkBanner:
         return AXARIAContentGroupText(@"ARIALandmarkBanner");
-    case LandmarkComplementaryRole:
+    case AccessibilityRole::LandmarkComplementary:
         return AXARIAContentGroupText(@"ARIALandmarkComplementary");
-    case LandmarkContentInfoRole:
+    case AccessibilityRole::LandmarkContentInfo:
         return AXARIAContentGroupText(@"ARIALandmarkContentInfo");
-    case LandmarkMainRole:
+    case AccessibilityRole::LandmarkMain:
         return AXARIAContentGroupText(@"ARIALandmarkMain");
-    case LandmarkNavigationRole:
+    case AccessibilityRole::LandmarkNavigation:
         return AXARIAContentGroupText(@"ARIALandmarkNavigation");
-    case LandmarkDocRegionRole:
-    case LandmarkRegionRole:
+    case AccessibilityRole::LandmarkDocRegion:
+    case AccessibilityRole::LandmarkRegion:
         return AXARIAContentGroupText(@"ARIALandmarkRegion");
-    case LandmarkSearchRole:
+    case AccessibilityRole::LandmarkSearch:
         return AXARIAContentGroupText(@"ARIALandmarkSearch");
-    case ApplicationAlertRole:
+    case AccessibilityRole::ApplicationAlert:
         return AXARIAContentGroupText(@"ARIAApplicationAlert");
-    case ApplicationAlertDialogRole:
+    case AccessibilityRole::ApplicationAlertDialog:
         return AXARIAContentGroupText(@"ARIAApplicationAlertDialog");
-    case ApplicationDialogRole:
+    case AccessibilityRole::ApplicationDialog:
         return AXARIAContentGroupText(@"ARIAApplicationDialog");
-    case ApplicationLogRole:
+    case AccessibilityRole::ApplicationLog:
         return AXARIAContentGroupText(@"ARIAApplicationLog");
-    case ApplicationMarqueeRole:
+    case AccessibilityRole::ApplicationMarquee:
         return AXARIAContentGroupText(@"ARIAApplicationMarquee");
-    case ApplicationStatusRole:
+    case AccessibilityRole::ApplicationStatus:
         return AXARIAContentGroupText(@"ARIAApplicationStatus");
-    case ApplicationTimerRole:
+    case AccessibilityRole::ApplicationTimer:
         return AXARIAContentGroupText(@"ARIAApplicationTimer");
-    case DocumentRole:
+    case AccessibilityRole::Document:
         return AXARIAContentGroupText(@"ARIADocument");
-    case DocumentArticleRole:
+    case AccessibilityRole::DocumentArticle:
         return AXARIAContentGroupText(@"ARIADocumentArticle");
-    case DocumentMathRole:
+    case AccessibilityRole::DocumentMath:
         return AXARIAContentGroupText(@"ARIADocumentMath");
-    case DocumentNoteRole:
+    case AccessibilityRole::DocumentNote:
         return AXARIAContentGroupText(@"ARIADocumentNote");
-    case UserInterfaceTooltipRole:
+    case AccessibilityRole::UserInterfaceTooltip:
         return AXARIAContentGroupText(@"ARIAUserInterfaceTooltip");
-    case TabPanelRole:
+    case AccessibilityRole::TabPanel:
         return AXARIAContentGroupText(@"ARIATabPanel");
-    case WebApplicationRole:
+    case AccessibilityRole::WebApplication:
         return AXARIAContentGroupText(@"ARIAWebApplication");
     default:
         return nil;
@@ -652,46 +652,46 @@
 static AccessibilitySearchKeyMap* createAccessibilitySearchKeyMap()
 {
     const SearchKeyEntry searchKeys[] = {
-        { NSAccessibilityAnyTypeSearchKey, AnyTypeSearchKey },
-        { NSAccessibilityArticleSearchKey, ArticleSearchKey },
-        { NSAccessibilityBlockquoteSameLevelSearchKey, BlockquoteSameLevelSearchKey },
-        { NSAccessibilityBlockquoteSearchKey, BlockquoteSearchKey },
-        { NSAccessibilityBoldFontSearchKey, BoldFontSearchKey },
-        { NSAccessibilityButtonSearchKey, ButtonSearchKey },
-        { NSAccessibilityCheckBoxSearchKey, CheckBoxSearchKey },
-        { NSAccessibilityControlSearchKey, ControlSearchKey },
-        { NSAccessibilityDifferentTypeSearchKey, DifferentTypeSearchKey },
-        { NSAccessibilityFontChangeSearchKey, FontChangeSearchKey },
-        { NSAccessibilityFontColorChangeSearchKey, FontColorChangeSearchKey },
-        { NSAccessibilityFrameSearchKey, FrameSearchKey },
-        { NSAccessibilityGraphicSearchKey, GraphicSearchKey },
-        { NSAccessibilityHeadingLevel1SearchKey, HeadingLevel1SearchKey },
-        { NSAccessibilityHeadingLevel2SearchKey, HeadingLevel2SearchKey },
-        { NSAccessibilityHeadingLevel3SearchKey, HeadingLevel3SearchKey },
-        { NSAccessibilityHeadingLevel4SearchKey, HeadingLevel4SearchKey },
-        { NSAccessibilityHeadingLevel5SearchKey, HeadingLevel5SearchKey },
-        { NSAccessibilityHeadingLevel6SearchKey, HeadingLevel6SearchKey },
-        { NSAccessibilityHeadingSameLevelSearchKey, HeadingSameLevelSearchKey },
-        { NSAccessibilityHeadingSearchKey, HeadingSearchKey },
-        { NSAccessibilityHighlightedSearchKey, HighlightedSearchKey },
-        { NSAccessibilityItalicFontSearchKey, ItalicFontSearchKey },
-        { NSAccessibilityLandmarkSearchKey, LandmarkSearchKey },
-        { NSAccessibilityLinkSearchKey, LinkSearchKey },
-        { NSAccessibilityListSearchKey, ListSearchKey },
-        { NSAccessibilityLiveRegionSearchKey, LiveRegionSearchKey },
-        { NSAccessibilityMisspelledWordSearchKey, MisspelledWordSearchKey },
-        { NSAccessibilityOutlineSearchKey, OutlineSearchKey },
-        { NSAccessibilityPlainTextSearchKey, PlainTextSearchKey },
-        { NSAccessibilityRadioGroupSearchKey, RadioGroupSearchKey },
-        { NSAccessibilitySameTypeSearchKey, SameTypeSearchKey },
-        { NSAccessibilityStaticTextSearchKey, StaticTextSearchKey },
-        { NSAccessibilityStyleChangeSearchKey, StyleChangeSearchKey },
-        { NSAccessibilityTableSameLevelSearchKey, TableSameLevelSearchKey },
-        { NSAccessibilityTableSearchKey, TableSearchKey },
-        { NSAccessibilityTextFieldSearchKey, TextFieldSearchKey },
-        { NSAccessibilityUnderlineSearchKey, UnderlineSearchKey },
-        { NSAccessibilityUnvisitedLinkSearchKey, UnvisitedLinkSearchKey },
-        { NSAccessibilityVisitedLinkSearchKey, VisitedLinkSearchKey }
+        { NSAccessibilityAnyTypeSearchKey, AccessibilitySearchKey::AnyType },
+        { NSAccessibilityArticleSearchKey, AccessibilitySearchKey::Article },
+        { NSAccessibilityBlockquoteSameLevelSearchKey, AccessibilitySearchKey::BlockquoteSameLevel },
+        { NSAccessibilityBlockquoteSearchKey, AccessibilitySearchKey::Blockquote },
+        { NSAccessibilityBoldFontSearchKey, AccessibilitySearchKey::BoldFont },
+        { NSAccessibilityButtonSearchKey, AccessibilitySearchKey::Button },
+        { NSAccessibilityCheckBoxSearchKey, AccessibilitySearchKey::CheckBox },
+        { NSAccessibilityControlSearchKey, AccessibilitySearchKey::Control },
+        { NSAccessibilityDifferentTypeSearchKey, AccessibilitySearchKey::DifferentType },
+        { NSAccessibilityFontChangeSearchKey, AccessibilitySearchKey::FontChange },
+        { NSAccessibilityFontColorChangeSearchKey, AccessibilitySearchKey::FontColorChange },
+        { NSAccessibilityFrameSearchKey, AccessibilitySearchKey::Frame },
+        { NSAccessibilityGraphicSearchKey, AccessibilitySearchKey::Graphic },
+        { NSAccessibilityHeadingLevel1SearchKey, AccessibilitySearchKey::HeadingLevel1 },
+        { NSAccessibilityHeadingLevel2SearchKey, AccessibilitySearchKey::HeadingLevel2 },
+        { NSAccessibilityHeadingLevel3SearchKey, AccessibilitySearchKey::HeadingLevel3 },
+        { NSAccessibilityHeadingLevel4SearchKey, AccessibilitySearchKey::HeadingLevel4 },
+        { NSAccessibilityHeadingLevel5SearchKey, AccessibilitySearchKey::HeadingLevel5 },
+        { NSAccessibilityHeadingLevel6SearchKey, AccessibilitySearchKey::HeadingLevel6 },
+        { NSAccessibilityHeadingSameLevelSearchKey, AccessibilitySearchKey::HeadingSameLevel },
+        { NSAccessibilityHeadingSearchKey, AccessibilitySearchKey::Heading },
+        { NSAccessibilityHighlightedSearchKey, AccessibilitySearchKey::Highlighted },
+        { NSAccessibilityItalicFontSearchKey, AccessibilitySearchKey::ItalicFont },
+        { NSAccessibilityLandmarkSearchKey, AccessibilitySearchKey::Landmark },
+        { NSAccessibilityLinkSearchKey, AccessibilitySearchKey::Link },
+        { NSAccessibilityListSearchKey, AccessibilitySearchKey::List },
+        { NSAccessibilityLiveRegionSearchKey, AccessibilitySearchKey::LiveRegion },
+        { NSAccessibilityMisspelledWordSearchKey, AccessibilitySearchKey::MisspelledWord },
+        { NSAccessibilityOutlineSearchKey, AccessibilitySearchKey::Outline },
+        { NSAccessibilityPlainTextSearchKey, AccessibilitySearchKey::PlainText },
+        { NSAccessibilityRadioGroupSearchKey, AccessibilitySearchKey::RadioGroup },
+        { NSAccessibilitySameTypeSearchKey, AccessibilitySearchKey::SameType },
+        { NSAccessibilityStaticTextSearchKey, AccessibilitySearchKey::StaticText },
+        { NSAccessibilityStyleChangeSearchKey, AccessibilitySearchKey::StyleChange },
+        { NSAccessibilityTableSameLevelSearchKey, AccessibilitySearchKey::TableSameLevel },
+        { NSAccessibilityTableSearchKey, AccessibilitySearchKey::Table },
+        { NSAccessibilityTextFieldSearchKey, AccessibilitySearchKey::TextField },
+        { NSAccessibilityUnderlineSearchKey, AccessibilitySearchKey::Underline },
+        { NSAccessibilityUnvisitedLinkSearchKey, AccessibilitySearchKey::UnvisitedLink },
+        { NSAccessibilityVisitedLinkSearchKey, AccessibilitySearchKey::VisitedLink }
     };
     
     AccessibilitySearchKeyMap* searchKeyMap = new AccessibilitySearchKeyMap;
@@ -704,11 +704,11 @@
 static AccessibilitySearchKey accessibilitySearchKeyForString(const String& value)
 {
     if (value.isEmpty())
-        return AnyTypeSearchKey;
+        return AccessibilitySearchKey::AnyType;
     
     static const AccessibilitySearchKeyMap* searchKeyMap = createAccessibilitySearchKeyMap();
     AccessibilitySearchKey searchKey = searchKeyMap->get(value);    
-    return searchKey ? searchKey : AnyTypeSearchKey;
+    return static_cast<int>(searchKey) ? searchKey : AccessibilitySearchKey::AnyType;
 }
 
 AccessibilitySearchCriteria accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(const NSDictionary *parameterizedAttribute)
@@ -721,9 +721,9 @@
     NSNumber *visibleOnlyParameter = [parameterizedAttribute objectForKey:@"AXVisibleOnly"];
     id searchKeyParameter = [parameterizedAttribute objectForKey:@"AXSearchKey"];
     
-    AccessibilitySearchDirection direction = SearchDirectionNext;
+    AccessibilitySearchDirection direction = AccessibilitySearchDirection::Next;
     if ([directionParameter isKindOfClass:[NSString class]])
-        direction = [directionParameter isEqualToString:@"AXDirectionNext"] ? SearchDirectionNext : SearchDirectionPrevious;
+        direction = [directionParameter isEqualToString:@"AXDirectionNext"] ? AccessibilitySearchDirection::Next : AccessibilitySearchDirection::Previous;
     
     bool immediateDescendantsOnly = false;
     if ([immediateDescendantsOnlyParameter isKindOfClass:[NSNumber class]])
diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
index 18d1a9b..58d52a8 100644
--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
+++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
@@ -494,24 +494,24 @@
     NSString *replacementStringParameter = [parameterizedAttribute objectForKey:NSAccessibilitySelectTextReplacementString];
     NSArray *searchStringsParameter = [parameterizedAttribute objectForKey:NSAccessibilitySelectTextSearchStrings];
     
-    AccessibilitySelectTextActivity activity = FindAndSelectActivity;
+    AccessibilitySelectTextActivity activity = AccessibilitySelectTextActivity::FindAndSelect;
     if ([activityParameter isKindOfClass:[NSString class]]) {
         if ([activityParameter isEqualToString:NSAccessibilitySelectTextActivityFindAndReplace])
-            activity = FindAndReplaceActivity;
+            activity = AccessibilitySelectTextActivity::FindAndReplace;
         else if ([activityParameter isEqualToString:kAXSelectTextActivityFindAndCapitalize])
-            activity = FindAndCapitalize;
+            activity = AccessibilitySelectTextActivity::FindAndCapitalize;
         else if ([activityParameter isEqualToString:kAXSelectTextActivityFindAndLowercase])
-            activity = FindAndLowercase;
+            activity = AccessibilitySelectTextActivity::FindAndLowercase;
         else if ([activityParameter isEqualToString:kAXSelectTextActivityFindAndUppercase])
-            activity = FindAndUppercase;
+            activity = AccessibilitySelectTextActivity::FindAndUppercase;
     }
     
-    AccessibilitySelectTextAmbiguityResolution ambiguityResolution = ClosestToSelectionAmbiguityResolution;
+    AccessibilitySelectTextAmbiguityResolution ambiguityResolution = AccessibilitySelectTextAmbiguityResolution::ClosestTo;
     if ([ambiguityResolutionParameter isKindOfClass:[NSString class]]) {
         if ([ambiguityResolutionParameter isEqualToString:NSAccessibilitySelectTextAmbiguityResolutionClosestAfterSelection])
-            ambiguityResolution = ClosestAfterSelectionAmbiguityResolution;
+            ambiguityResolution = AccessibilitySelectTextAmbiguityResolution::ClosestAfter;
         else if ([ambiguityResolutionParameter isEqualToString:NSAccessibilitySelectTextAmbiguityResolutionClosestBeforeSelection])
-            ambiguityResolution = ClosestBeforeSelectionAmbiguityResolution;
+            ambiguityResolution = AccessibilitySelectTextAmbiguityResolution::ClosestBefore;
     }
     
     String replacementString;
@@ -1198,7 +1198,7 @@
         [additional addObject:NSAccessibilityARIAPosInSetAttribute];
     
     AccessibilitySortDirection sortDirection = m_object->sortDirection();
-    if (sortDirection != SortDirectionNone && sortDirection != SortDirectionInvalid)
+    if (sortDirection != AccessibilitySortDirection::None && sortDirection != AccessibilitySortDirection::Invalid)
         [additional addObject:NSAccessibilitySortDirectionAttribute];
     
     // If an object is a child of a live region, then add these
@@ -1661,7 +1661,7 @@
         objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:additionalAttributes];
     
     // Only expose AXARIACurrent attribute when the element is set to be current item.
-    if (m_object->ariaCurrentState() != ARIACurrentFalse)
+    if (m_object->ariaCurrentState() != AccessibilityARIACurrentState::False)
         objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:@[ NSAccessibilityARIACurrentAttribute ]];
     
     return objectAttributes;
@@ -1849,154 +1849,154 @@
     };
     
     static const RoleEntry roles[] = {
-        { UnknownRole, NSAccessibilityUnknownRole },
-        { ButtonRole, NSAccessibilityButtonRole },
-        { RadioButtonRole, NSAccessibilityRadioButtonRole },
-        { CheckBoxRole, NSAccessibilityCheckBoxRole },
-        { SliderRole, NSAccessibilitySliderRole },
-        { TabGroupRole, NSAccessibilityTabGroupRole },
-        { TextFieldRole, NSAccessibilityTextFieldRole },
-        { StaticTextRole, NSAccessibilityStaticTextRole },
-        { TextAreaRole, NSAccessibilityTextAreaRole },
-        { ScrollAreaRole, NSAccessibilityScrollAreaRole },
-        { PopUpButtonRole, NSAccessibilityPopUpButtonRole },
-        { MenuButtonRole, NSAccessibilityMenuButtonRole },
-        { TableRole, NSAccessibilityTableRole },
-        { ApplicationRole, NSAccessibilityApplicationRole },
-        { GroupRole, NSAccessibilityGroupRole },
-        { TextGroupRole, NSAccessibilityGroupRole },
-        { RadioGroupRole, NSAccessibilityRadioGroupRole },
-        { ListRole, NSAccessibilityListRole },
-        { DirectoryRole, NSAccessibilityListRole },
-        { ScrollBarRole, NSAccessibilityScrollBarRole },
-        { ValueIndicatorRole, NSAccessibilityValueIndicatorRole },
-        { ImageRole, NSAccessibilityImageRole },
-        { MenuBarRole, NSAccessibilityMenuBarRole },
-        { MenuRole, NSAccessibilityMenuRole },
-        { MenuItemRole, NSAccessibilityMenuItemRole },
-        { MenuItemCheckboxRole, NSAccessibilityMenuItemRole },
-        { MenuItemRadioRole, NSAccessibilityMenuItemRole },
-        { ColumnRole, NSAccessibilityColumnRole },
-        { RowRole, NSAccessibilityRowRole },
-        { ToolbarRole, NSAccessibilityToolbarRole },
-        { BusyIndicatorRole, NSAccessibilityBusyIndicatorRole },
-        { ProgressIndicatorRole, NSAccessibilityProgressIndicatorRole },
-        { WindowRole, NSAccessibilityWindowRole },
-        { DrawerRole, NSAccessibilityDrawerRole },
-        { SystemWideRole, NSAccessibilitySystemWideRole },
-        { OutlineRole, NSAccessibilityOutlineRole },
-        { IncrementorRole, NSAccessibilityIncrementorRole },
-        { BrowserRole, NSAccessibilityBrowserRole },
-        { ComboBoxRole, NSAccessibilityComboBoxRole },
-        { SplitGroupRole, NSAccessibilitySplitGroupRole },
-        { SplitterRole, NSAccessibilitySplitterRole },
-        { ColorWellRole, NSAccessibilityColorWellRole },
-        { GrowAreaRole, NSAccessibilityGrowAreaRole },
-        { SheetRole, NSAccessibilitySheetRole },
-        { HelpTagRole, NSAccessibilityHelpTagRole },
-        { MatteRole, NSAccessibilityMatteRole },
-        { RulerRole, NSAccessibilityRulerRole },
-        { RulerMarkerRole, NSAccessibilityRulerMarkerRole },
-        { LinkRole, NSAccessibilityLinkRole },
-        { DisclosureTriangleRole, NSAccessibilityDisclosureTriangleRole },
-        { GridRole, NSAccessibilityTableRole },
-        { TreeGridRole, NSAccessibilityTableRole },
-        { WebCoreLinkRole, NSAccessibilityLinkRole },
-        { ImageMapLinkRole, NSAccessibilityLinkRole },
-        { ImageMapRole, @"AXImageMap" },
-        { ListMarkerRole, @"AXListMarker" },
-        { WebAreaRole, @"AXWebArea" },
-        { HeadingRole, @"AXHeading" },
-        { ListBoxRole, NSAccessibilityListRole },
-        { ListBoxOptionRole, NSAccessibilityStaticTextRole },
-        { CellRole, NSAccessibilityCellRole },
-        { GridCellRole, NSAccessibilityCellRole },
-        { TableHeaderContainerRole, NSAccessibilityGroupRole },
-        { ColumnHeaderRole, NSAccessibilityCellRole },
-        { RowHeaderRole, NSAccessibilityCellRole },
-        { DefinitionRole, NSAccessibilityGroupRole },
-        { DescriptionListDetailRole, NSAccessibilityGroupRole },
-        { DescriptionListTermRole, NSAccessibilityGroupRole },
-        { TermRole, NSAccessibilityGroupRole },
-        { DescriptionListRole, NSAccessibilityListRole },
-        { SliderThumbRole, NSAccessibilityValueIndicatorRole },
-        { WebApplicationRole, NSAccessibilityGroupRole },
-        { LandmarkBannerRole, NSAccessibilityGroupRole },
-        { LandmarkComplementaryRole, NSAccessibilityGroupRole },
-        { LandmarkDocRegionRole, NSAccessibilityGroupRole },
-        { LandmarkContentInfoRole, NSAccessibilityGroupRole },
-        { LandmarkMainRole, NSAccessibilityGroupRole },
-        { LandmarkNavigationRole, NSAccessibilityGroupRole },
-        { LandmarkRegionRole, NSAccessibilityGroupRole },
-        { LandmarkSearchRole, NSAccessibilityGroupRole },
-        { ApplicationAlertRole, NSAccessibilityGroupRole },
-        { ApplicationAlertDialogRole, NSAccessibilityGroupRole },
-        { ApplicationDialogRole, NSAccessibilityGroupRole },
-        { ApplicationGroupRole, NSAccessibilityGroupRole },
-        { ApplicationTextGroupRole, NSAccessibilityGroupRole },
-        { ApplicationLogRole, NSAccessibilityGroupRole },
-        { ApplicationMarqueeRole, NSAccessibilityGroupRole },
-        { ApplicationStatusRole, NSAccessibilityGroupRole },
-        { ApplicationTimerRole, NSAccessibilityGroupRole },
-        { DocumentRole, NSAccessibilityGroupRole },
-        { DocumentArticleRole, NSAccessibilityGroupRole },
-        { DocumentMathRole, NSAccessibilityGroupRole },
-        { DocumentNoteRole, NSAccessibilityGroupRole },
-        { UserInterfaceTooltipRole, NSAccessibilityGroupRole },
-        { TabRole, NSAccessibilityRadioButtonRole },
-        { TabListRole, NSAccessibilityTabGroupRole },
-        { TabPanelRole, NSAccessibilityGroupRole },
-        { TreeRole, NSAccessibilityOutlineRole },
-        { TreeItemRole, NSAccessibilityRowRole },
-        { ListItemRole, NSAccessibilityGroupRole },
-        { ParagraphRole, NSAccessibilityGroupRole },
-        { LabelRole, NSAccessibilityGroupRole },
-        { DivRole, NSAccessibilityGroupRole },
-        { FormRole, NSAccessibilityGroupRole },
-        { SpinButtonRole, NSAccessibilityIncrementorRole },
-        { FooterRole, NSAccessibilityGroupRole },
-        { ToggleButtonRole, NSAccessibilityCheckBoxRole },
-        { CanvasRole, NSAccessibilityImageRole },
-        { SVGRootRole, NSAccessibilityGroupRole },
-        { LegendRole, NSAccessibilityGroupRole },
-        { MathElementRole, NSAccessibilityGroupRole },
-        { AudioRole, NSAccessibilityGroupRole },
-        { VideoRole, NSAccessibilityGroupRole },
-        { HorizontalRuleRole, NSAccessibilitySplitterRole },
-        { BlockquoteRole, NSAccessibilityGroupRole },
-        { SwitchRole, NSAccessibilityCheckBoxRole },
-        { SearchFieldRole, NSAccessibilityTextFieldRole },
-        { PreRole, NSAccessibilityGroupRole },
-        { RubyBaseRole, NSAccessibilityGroupRole },
-        { RubyBlockRole, NSAccessibilityGroupRole },
-        { RubyInlineRole, NSAccessibilityGroupRole },
-        { RubyRunRole, NSAccessibilityGroupRole },
-        { RubyTextRole, NSAccessibilityGroupRole },
-        { DetailsRole, NSAccessibilityGroupRole },
-        { SummaryRole, NSAccessibilityButtonRole },
-        { SVGTextPathRole, NSAccessibilityGroupRole },
-        { SVGTextRole, NSAccessibilityGroupRole },
-        { SVGTSpanRole, NSAccessibilityGroupRole },
-        { InlineRole, NSAccessibilityGroupRole },
-        { MarkRole, NSAccessibilityGroupRole },
-        { TimeRole, NSAccessibilityGroupRole },
-        { FeedRole, NSAccessibilityGroupRole },
-        { FigureRole, NSAccessibilityGroupRole },
-        { FootnoteRole, NSAccessibilityGroupRole },
+        { AccessibilityRole::Unknown, NSAccessibilityUnknownRole },
+        { AccessibilityRole::Button, NSAccessibilityButtonRole },
+        { AccessibilityRole::RadioButton, NSAccessibilityRadioButtonRole },
+        { AccessibilityRole::CheckBox, NSAccessibilityCheckBoxRole },
+        { AccessibilityRole::Slider, NSAccessibilitySliderRole },
+        { AccessibilityRole::TabGroup, NSAccessibilityTabGroupRole },
+        { AccessibilityRole::TextField, NSAccessibilityTextFieldRole },
+        { AccessibilityRole::StaticText, NSAccessibilityStaticTextRole },
+        { AccessibilityRole::TextArea, NSAccessibilityTextAreaRole },
+        { AccessibilityRole::ScrollArea, NSAccessibilityScrollAreaRole },
+        { AccessibilityRole::PopUpButton, NSAccessibilityPopUpButtonRole },
+        { AccessibilityRole::MenuButton, NSAccessibilityMenuButtonRole },
+        { AccessibilityRole::Table, NSAccessibilityTableRole },
+        { AccessibilityRole::Application, NSAccessibilityApplicationRole },
+        { AccessibilityRole::Group, NSAccessibilityGroupRole },
+        { AccessibilityRole::TextGroup, NSAccessibilityGroupRole },
+        { AccessibilityRole::RadioGroup, NSAccessibilityRadioGroupRole },
+        { AccessibilityRole::List, NSAccessibilityListRole },
+        { AccessibilityRole::Directory, NSAccessibilityListRole },
+        { AccessibilityRole::ScrollBar, NSAccessibilityScrollBarRole },
+        { AccessibilityRole::ValueIndicator, NSAccessibilityValueIndicatorRole },
+        { AccessibilityRole::Image, NSAccessibilityImageRole },
+        { AccessibilityRole::MenuBar, NSAccessibilityMenuBarRole },
+        { AccessibilityRole::Menu, NSAccessibilityMenuRole },
+        { AccessibilityRole::MenuItem, NSAccessibilityMenuItemRole },
+        { AccessibilityRole::MenuItemCheckbox, NSAccessibilityMenuItemRole },
+        { AccessibilityRole::MenuItemRadio, NSAccessibilityMenuItemRole },
+        { AccessibilityRole::Column, NSAccessibilityColumnRole },
+        { AccessibilityRole::Row, NSAccessibilityRowRole },
+        { AccessibilityRole::Toolbar, NSAccessibilityToolbarRole },
+        { AccessibilityRole::BusyIndicator, NSAccessibilityBusyIndicatorRole },
+        { AccessibilityRole::ProgressIndicator, NSAccessibilityProgressIndicatorRole },
+        { AccessibilityRole::Window, NSAccessibilityWindowRole },
+        { AccessibilityRole::Drawer, NSAccessibilityDrawerRole },
+        { AccessibilityRole::SystemWide, NSAccessibilitySystemWideRole },
+        { AccessibilityRole::Outline, NSAccessibilityOutlineRole },
+        { AccessibilityRole::Incrementor, NSAccessibilityIncrementorRole },
+        { AccessibilityRole::Browser, NSAccessibilityBrowserRole },
+        { AccessibilityRole::ComboBox, NSAccessibilityComboBoxRole },
+        { AccessibilityRole::SplitGroup, NSAccessibilitySplitGroupRole },
+        { AccessibilityRole::Splitter, NSAccessibilitySplitterRole },
+        { AccessibilityRole::ColorWell, NSAccessibilityColorWellRole },
+        { AccessibilityRole::GrowArea, NSAccessibilityGrowAreaRole },
+        { AccessibilityRole::Sheet, NSAccessibilitySheetRole },
+        { AccessibilityRole::HelpTag, NSAccessibilityHelpTagRole },
+        { AccessibilityRole::Matte, NSAccessibilityMatteRole },
+        { AccessibilityRole::Ruler, NSAccessibilityRulerRole },
+        { AccessibilityRole::RulerMarker, NSAccessibilityRulerMarkerRole },
+        { AccessibilityRole::Link, NSAccessibilityLinkRole },
+        { AccessibilityRole::DisclosureTriangle, NSAccessibilityDisclosureTriangleRole },
+        { AccessibilityRole::Grid, NSAccessibilityTableRole },
+        { AccessibilityRole::TreeGrid, NSAccessibilityTableRole },
+        { AccessibilityRole::WebCoreLink, NSAccessibilityLinkRole },
+        { AccessibilityRole::ImageMapLink, NSAccessibilityLinkRole },
+        { AccessibilityRole::ImageMap, @"AXImageMap" },
+        { AccessibilityRole::ListMarker, @"AXListMarker" },
+        { AccessibilityRole::WebArea, @"AXWebArea" },
+        { AccessibilityRole::Heading, @"AXHeading" },
+        { AccessibilityRole::ListBox, NSAccessibilityListRole },
+        { AccessibilityRole::ListBoxOption, NSAccessibilityStaticTextRole },
+        { AccessibilityRole::Cell, NSAccessibilityCellRole },
+        { AccessibilityRole::GridCell, NSAccessibilityCellRole },
+        { AccessibilityRole::TableHeaderContainer, NSAccessibilityGroupRole },
+        { AccessibilityRole::ColumnHeader, NSAccessibilityCellRole },
+        { AccessibilityRole::RowHeader, NSAccessibilityCellRole },
+        { AccessibilityRole::Definition, NSAccessibilityGroupRole },
+        { AccessibilityRole::DescriptionListDetail, NSAccessibilityGroupRole },
+        { AccessibilityRole::DescriptionListTerm, NSAccessibilityGroupRole },
+        { AccessibilityRole::Term, NSAccessibilityGroupRole },
+        { AccessibilityRole::DescriptionList, NSAccessibilityListRole },
+        { AccessibilityRole::SliderThumb, NSAccessibilityValueIndicatorRole },
+        { AccessibilityRole::WebApplication, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkBanner, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkComplementary, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkDocRegion, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkContentInfo, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkMain, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkNavigation, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkRegion, NSAccessibilityGroupRole },
+        { AccessibilityRole::LandmarkSearch, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationAlert, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationAlertDialog, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationDialog, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationGroup, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationTextGroup, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationLog, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationMarquee, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationStatus, NSAccessibilityGroupRole },
+        { AccessibilityRole::ApplicationTimer, NSAccessibilityGroupRole },
+        { AccessibilityRole::Document, NSAccessibilityGroupRole },
+        { AccessibilityRole::DocumentArticle, NSAccessibilityGroupRole },
+        { AccessibilityRole::DocumentMath, NSAccessibilityGroupRole },
+        { AccessibilityRole::DocumentNote, NSAccessibilityGroupRole },
+        { AccessibilityRole::UserInterfaceTooltip, NSAccessibilityGroupRole },
+        { AccessibilityRole::Tab, NSAccessibilityRadioButtonRole },
+        { AccessibilityRole::TabList, NSAccessibilityTabGroupRole },
+        { AccessibilityRole::TabPanel, NSAccessibilityGroupRole },
+        { AccessibilityRole::Tree, NSAccessibilityOutlineRole },
+        { AccessibilityRole::TreeItem, NSAccessibilityRowRole },
+        { AccessibilityRole::ListItem, NSAccessibilityGroupRole },
+        { AccessibilityRole::Paragraph, NSAccessibilityGroupRole },
+        { AccessibilityRole::Label, NSAccessibilityGroupRole },
+        { AccessibilityRole::Div, NSAccessibilityGroupRole },
+        { AccessibilityRole::Form, NSAccessibilityGroupRole },
+        { AccessibilityRole::SpinButton, NSAccessibilityIncrementorRole },
+        { AccessibilityRole::Footer, NSAccessibilityGroupRole },
+        { AccessibilityRole::ToggleButton, NSAccessibilityCheckBoxRole },
+        { AccessibilityRole::Canvas, NSAccessibilityImageRole },
+        { AccessibilityRole::SVGRoot, NSAccessibilityGroupRole },
+        { AccessibilityRole::Legend, NSAccessibilityGroupRole },
+        { AccessibilityRole::MathElement, NSAccessibilityGroupRole },
+        { AccessibilityRole::Audio, NSAccessibilityGroupRole },
+        { AccessibilityRole::Video, NSAccessibilityGroupRole },
+        { AccessibilityRole::HorizontalRule, NSAccessibilitySplitterRole },
+        { AccessibilityRole::Blockquote, NSAccessibilityGroupRole },
+        { AccessibilityRole::Switch, NSAccessibilityCheckBoxRole },
+        { AccessibilityRole::SearchField, NSAccessibilityTextFieldRole },
+        { AccessibilityRole::Pre, NSAccessibilityGroupRole },
+        { AccessibilityRole::RubyBase, NSAccessibilityGroupRole },
+        { AccessibilityRole::RubyBlock, NSAccessibilityGroupRole },
+        { AccessibilityRole::RubyInline, NSAccessibilityGroupRole },
+        { AccessibilityRole::RubyRun, NSAccessibilityGroupRole },
+        { AccessibilityRole::RubyText, NSAccessibilityGroupRole },
+        { AccessibilityRole::Details, NSAccessibilityGroupRole },
+        { AccessibilityRole::Summary, NSAccessibilityButtonRole },
+        { AccessibilityRole::SVGTextPath, NSAccessibilityGroupRole },
+        { AccessibilityRole::SVGText, NSAccessibilityGroupRole },
+        { AccessibilityRole::SVGTSpan, NSAccessibilityGroupRole },
+        { AccessibilityRole::Inline, NSAccessibilityGroupRole },
+        { AccessibilityRole::Mark, NSAccessibilityGroupRole },
+        { AccessibilityRole::Time, NSAccessibilityGroupRole },
+        { AccessibilityRole::Feed, NSAccessibilityGroupRole },
+        { AccessibilityRole::Figure, NSAccessibilityGroupRole },
+        { AccessibilityRole::Footnote, NSAccessibilityGroupRole },
     };
     AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
     
     const unsigned numRoles = sizeof(roles) / sizeof(roles[0]);
     for (unsigned i = 0; i < numRoles; ++i)
-        roleMap.set(roles[i].value, roles[i].string);
+        roleMap.set(static_cast<int>(roles[i].value), roles[i].string);
     return roleMap;
 }
 
 static NSString* roleValueToNSString(AccessibilityRole value)
 {
-    ASSERT(value);
+    ASSERT(static_cast<int>(value));
     static const AccessibilityRoleMap& roleMap = createAccessibilityRoleMap();
-    return roleMap.get(value);
+    return roleMap.get(static_cast<int>(value));
 }
 
 - (NSString*)role
@@ -2008,17 +2008,17 @@
 #pragma clang diagnostic pop
     AccessibilityRole role = m_object->roleValue();
 
-    if (role == LabelRole && is<AccessibilityLabel>(*m_object) && downcast<AccessibilityLabel>(*m_object).containsOnlyStaticText())
-        role = StaticTextRole;
+    if (role == AccessibilityRole::Label && is<AccessibilityLabel>(*m_object) && downcast<AccessibilityLabel>(*m_object).containsOnlyStaticText())
+        role = AccessibilityRole::StaticText;
 
     // The mfenced element creates anonymous RenderMathMLOperators with no RenderText
     // descendants. Because these anonymous renderers are the only accessible objects
-    // containing the operator, assign StaticTextRole.
+    // containing the operator, assign AccessibilityRole::StaticText.
     if (m_object->isAnonymousMathOperator())
-        role = StaticTextRole;
+        role = AccessibilityRole::StaticText;
 
-    if (role == CanvasRole && m_object->canvasHasFallbackContent())
-        role = GroupRole;
+    if (role == AccessibilityRole::Canvas && m_object->canvasHasFallbackContent())
+        role = AccessibilityRole::Group;
     NSString* string = roleValueToNSString(role);
     if (string != nil)
         return string;
@@ -2041,9 +2041,9 @@
     }
     
     AccessibilityRole role = m_object->roleValue();
-    if (role == HorizontalRuleRole)
+    if (role == AccessibilityRole::HorizontalRule)
         return NSAccessibilityContentSeparatorSubrole;
-    if (role == ToggleButtonRole)
+    if (role == AccessibilityRole::ToggleButton)
         return NSAccessibilityToggleSubrole;
     
     if (is<AccessibilitySpinButtonPart>(*m_object)) {
@@ -2073,69 +2073,69 @@
     
     // ARIA content subroles.
     switch (role) {
-        case LandmarkBannerRole:
-            return @"AXLandmarkBanner";
-        case LandmarkComplementaryRole:
-            return @"AXLandmarkComplementary";
-            // Footer roles should appear as content info types.
-        case FooterRole:
-        case LandmarkContentInfoRole:
-            return @"AXLandmarkContentInfo";
-        case LandmarkMainRole:
-            return @"AXLandmarkMain";
-        case LandmarkNavigationRole:
-            return @"AXLandmarkNavigation";
-        case LandmarkDocRegionRole:
-        case LandmarkRegionRole:
-            return @"AXLandmarkRegion";
-        case LandmarkSearchRole:
-            return @"AXLandmarkSearch";
-        case ApplicationAlertRole:
-            return @"AXApplicationAlert";
-        case ApplicationAlertDialogRole:
-            return @"AXApplicationAlertDialog";
-        case ApplicationDialogRole:
-            return @"AXApplicationDialog";
-        case ApplicationGroupRole:
-        case ApplicationTextGroupRole:
-        case FeedRole:
-        case FootnoteRole:
-            return @"AXApplicationGroup";
-        case ApplicationLogRole:
-            return @"AXApplicationLog";
-        case ApplicationMarqueeRole:
-            return @"AXApplicationMarquee";
-        case ApplicationStatusRole:
-            return @"AXApplicationStatus";
-        case ApplicationTimerRole:
-            return @"AXApplicationTimer";
-        case DocumentRole:
-            return @"AXDocument";
-        case DocumentArticleRole:
-            return @"AXDocumentArticle";
-        case DocumentMathRole:
-            return @"AXDocumentMath";
-        case DocumentNoteRole:
-            return @"AXDocumentNote";
-        case UserInterfaceTooltipRole:
-            return @"AXUserInterfaceTooltip";
-        case TabPanelRole:
-            return @"AXTabPanel";
-        case DefinitionRole:
-            return @"AXDefinition";
-        case DescriptionListTermRole:
-        case TermRole:
-            return @"AXTerm";
-        case DescriptionListDetailRole:
-            return @"AXDescription";
-        case WebApplicationRole:
-            return @"AXWebApplication";
-            // Default doesn't return anything, so roles defined below can be chosen.
-        default:
-            break;
+    case AccessibilityRole::LandmarkBanner:
+        return @"AXLandmarkBanner";
+    case AccessibilityRole::LandmarkComplementary:
+        return @"AXLandmarkComplementary";
+    // Footer roles should appear as content info types.
+    case AccessibilityRole::Footer:
+    case AccessibilityRole::LandmarkContentInfo:
+        return @"AXLandmarkContentInfo";
+    case AccessibilityRole::LandmarkMain:
+        return @"AXLandmarkMain";
+    case AccessibilityRole::LandmarkNavigation:
+        return @"AXLandmarkNavigation";
+    case AccessibilityRole::LandmarkDocRegion:
+    case AccessibilityRole::LandmarkRegion:
+        return @"AXLandmarkRegion";
+    case AccessibilityRole::LandmarkSearch:
+        return @"AXLandmarkSearch";
+    case AccessibilityRole::ApplicationAlert:
+        return @"AXApplicationAlert";
+    case AccessibilityRole::ApplicationAlertDialog:
+        return @"AXApplicationAlertDialog";
+    case AccessibilityRole::ApplicationDialog:
+        return @"AXApplicationDialog";
+    case AccessibilityRole::ApplicationGroup:
+    case AccessibilityRole::ApplicationTextGroup:
+    case AccessibilityRole::Feed:
+    case AccessibilityRole::Footnote:
+        return @"AXApplicationGroup";
+    case AccessibilityRole::ApplicationLog:
+        return @"AXApplicationLog";
+    case AccessibilityRole::ApplicationMarquee:
+        return @"AXApplicationMarquee";
+    case AccessibilityRole::ApplicationStatus:
+        return @"AXApplicationStatus";
+    case AccessibilityRole::ApplicationTimer:
+        return @"AXApplicationTimer";
+    case AccessibilityRole::Document:
+        return @"AXDocument";
+    case AccessibilityRole::DocumentArticle:
+        return @"AXDocumentArticle";
+    case AccessibilityRole::DocumentMath:
+        return @"AXDocumentMath";
+    case AccessibilityRole::DocumentNote:
+        return @"AXDocumentNote";
+    case AccessibilityRole::UserInterfaceTooltip:
+        return @"AXUserInterfaceTooltip";
+    case AccessibilityRole::TabPanel:
+        return @"AXTabPanel";
+    case AccessibilityRole::Definition:
+        return @"AXDefinition";
+    case AccessibilityRole::DescriptionListTerm:
+    case AccessibilityRole::Term:
+        return @"AXTerm";
+    case AccessibilityRole::DescriptionListDetail:
+        return @"AXDescription";
+    case AccessibilityRole::WebApplication:
+        return @"AXWebApplication";
+        // Default doesn't return anything, so roles defined below can be chosen.
+    default:
+        break;
     }
     
-    if (role == MathElementRole) {
+    if (role == AccessibilityRole::MathElement) {
         if (m_object->isMathFraction())
             return @"AXMathFraction";
         if (m_object->isMathFenced())
@@ -2172,15 +2172,15 @@
             return @"AXMathMultiscript";
     }
     
-    if (role == VideoRole)
+    if (role == AccessibilityRole::Video)
         return @"AXVideo";
-    if (role == AudioRole)
+    if (role == AccessibilityRole::Audio)
         return @"AXAudio";
-    if (role == DetailsRole)
+    if (role == AccessibilityRole::Details)
         return @"AXDetails";
-    if (role == SummaryRole)
+    if (role == AccessibilityRole::Summary)
         return @"AXSummary";
-    if (role == TimeRole)
+    if (role == AccessibilityRole::Time)
         return @"AXTimeGroup";
 
     if (m_object->isMediaTimeline())
@@ -2216,15 +2216,15 @@
     
     // Ruby subroles
     switch (role) {
-    case RubyBaseRole:
+    case AccessibilityRole::RubyBase:
         return NSAccessibilityRubyBaseSubrole;
-    case RubyBlockRole:
+    case AccessibilityRole::RubyBlock:
         return NSAccessibilityRubyBlockSubrole;
-    case RubyInlineRole:
+    case AccessibilityRole::RubyInline:
         return NSAccessibilityRubyInlineSubrole;
-    case RubyRunRole:
+    case AccessibilityRole::RubyRun:
         return NSAccessibilityRubyRunSubrole;
-    case RubyTextRole:
+    case AccessibilityRole::RubyText:
         return NSAccessibilityRubyTextSubrole;
     default:
         break;
@@ -2262,26 +2262,26 @@
             return ariaLandmarkRoleDescription;
         
         switch (m_object->roleValue()) {
-        case AudioRole:
+        case AccessibilityRole::Audio:
             return localizedMediaControlElementString("AudioElement");
-        case DefinitionRole:
+        case AccessibilityRole::Definition:
             return AXDefinitionText();
-        case DescriptionListTermRole:
-        case TermRole:
+        case AccessibilityRole::DescriptionListTerm:
+        case AccessibilityRole::Term:
             return AXDescriptionListTermText();
-        case DescriptionListDetailRole:
+        case AccessibilityRole::DescriptionListDetail:
             return AXDescriptionListDetailText();
-        case DetailsRole:
+        case AccessibilityRole::Details:
             return AXDetailsText();
-        case FeedRole:
+        case AccessibilityRole::Feed:
             return AXFeedText();
-        case FigureRole:
+        case AccessibilityRole::Figure:
             return AXFigureText();
-        case FooterRole:
+        case AccessibilityRole::Footer:
             return AXFooterRoleDescriptionText();
-        case MarkRole:
+        case AccessibilityRole::Mark:
             return AXMarkText();
-        case VideoRole:
+        case AccessibilityRole::Video:
             return localizedMediaControlElementString("VideoElement");
         default:
             return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, [self subrole]);
@@ -2341,7 +2341,7 @@
             return AXDescriptionListText();
     }
     
-    if (m_object->roleValue() == HorizontalRuleRole)
+    if (m_object->roleValue() == AccessibilityRole::HorizontalRule)
         return AXHorizontalRuleDescriptionText();
     
     // AppKit also returns AXTab for the role description for a tab item.
@@ -2618,19 +2618,19 @@
         }
         if (m_object->supportsRangeValue())
             return [NSNumber numberWithFloat:m_object->valueForRange()];
-        if (m_object->roleValue() == SliderThumbRole)
+        if (m_object->roleValue() == AccessibilityRole::SliderThumb)
             return [NSNumber numberWithFloat:m_object->parentObject()->valueForRange()];
         if (m_object->isHeading())
             return [NSNumber numberWithInt:m_object->headingLevel()];
         
         if (m_object->isCheckboxOrRadio() || m_object->isMenuItem() || m_object->isSwitch() || m_object->isToggleButton()) {
             switch (m_object->checkboxOrRadioValue()) {
-                case ButtonStateOff:
-                    return [NSNumber numberWithInt:0];
-                case ButtonStateOn:
-                    return [NSNumber numberWithInt:1];
-                case ButtonStateMixed:
-                    return [NSNumber numberWithInt:2];
+            case AccessibilityButtonState::Off:
+                return [NSNumber numberWithInt:0];
+            case AccessibilityButtonState::On:
+                return [NSNumber numberWithInt:1];
+            case AccessibilityButtonState::Mixed:
+                return [NSNumber numberWithInt:2];
             }
         }
         
@@ -2668,14 +2668,14 @@
     
     if ([attributeName isEqualToString: NSAccessibilityMinValueAttribute]) {
         // Indeterminate progress indicator should return 0.
-        if (m_object->ariaRoleAttribute() == ProgressIndicatorRole && !m_object->hasAttribute(aria_valuenowAttr))
+        if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasAttribute(aria_valuenowAttr))
             return @0;
         return [NSNumber numberWithFloat:m_object->minValueForRange()];
     }
     
     if ([attributeName isEqualToString: NSAccessibilityMaxValueAttribute]) {
         // Indeterminate progress indicator should return 0.
-        if (m_object->ariaRoleAttribute() == ProgressIndicatorRole && !m_object->hasAttribute(aria_valuenowAttr))
+        if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasAttribute(aria_valuenowAttr))
             return @0;
         return [NSNumber numberWithFloat:m_object->maxValueForRange()];
     }
@@ -3005,23 +3005,23 @@
     
     if ([attributeName isEqualToString:NSAccessibilityOrientationAttribute]) {
         AccessibilityOrientation elementOrientation = m_object->orientation();
-        if (elementOrientation == AccessibilityOrientationVertical)
+        if (elementOrientation == AccessibilityOrientation::Vertical)
             return NSAccessibilityVerticalOrientationValue;
-        if (elementOrientation == AccessibilityOrientationHorizontal)
+        if (elementOrientation == AccessibilityOrientation::Horizontal)
             return NSAccessibilityHorizontalOrientationValue;
-        if (elementOrientation == AccessibilityOrientationUndefined)
+        if (elementOrientation == AccessibilityOrientation::Undefined)
             return NSAccessibilityUnknownOrientationValue;
         return nil;
     }
     
     if ([attributeName isEqualToString:NSAccessibilityHorizontalScrollBarAttribute]) {
-        AccessibilityObject* scrollBar = m_object->scrollBar(AccessibilityOrientationHorizontal);
+        AccessibilityObject* scrollBar = m_object->scrollBar(AccessibilityOrientation::Horizontal);
         if (scrollBar)
             return scrollBar->wrapper();
         return nil;
     }
     if ([attributeName isEqualToString:NSAccessibilityVerticalScrollBarAttribute]) {
-        AccessibilityObject* scrollBar = m_object->scrollBar(AccessibilityOrientationVertical);
+        AccessibilityObject* scrollBar = m_object->scrollBar(AccessibilityOrientation::Vertical);
         if (scrollBar)
             return scrollBar->wrapper();
         return nil;
@@ -3029,12 +3029,12 @@
     
     if ([attributeName isEqualToString:NSAccessibilitySortDirectionAttribute]) {
         switch (m_object->sortDirection()) {
-            case SortDirectionAscending:
-                return NSAccessibilityAscendingSortDirectionValue;
-            case SortDirectionDescending:
-                return NSAccessibilityDescendingSortDirectionValue;
-            default:
-                return NSAccessibilityUnknownSortDirectionValue;
+        case AccessibilitySortDirection::Ascending:
+            return NSAccessibilityAscendingSortDirectionValue;
+        case AccessibilitySortDirection::Descending:
+            return NSAccessibilityDescendingSortDirectionValue;
+        default:
+            return NSAccessibilityUnknownSortDirectionValue;
         }
     }
     
@@ -3481,7 +3481,7 @@
 
 - (void)accessibilityPerformShowMenuAction
 {
-    if (m_object->roleValue() == ComboBoxRole)
+    if (m_object->roleValue() == AccessibilityRole::ComboBox)
         m_object->setIsExpanded(true);
     else {
         // This needs to be performed in an iteration of the run loop that did not start from an AX call.
@@ -3629,7 +3629,9 @@
             return;
         m_object->setSelected([number boolValue]);
     } else if ([attributeName isEqualToString: NSAccessibilitySelectedChildrenAttribute]) {
-        if (!array || m_object->roleValue() != ListBoxRole)
+        if (!array)
+            return;
+        if (m_object->roleValue() != AccessibilityRole::ListBox)
             return;
         AccessibilityObject::AccessibilityChildrenVector selectedChildren;
         convertToVector(array, selectedChildren);