Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp

Issue 2872133003: Remove dependency of WebNode.cpp on AXObjectImpl (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
index cdc1ec6e7efc22da4e1ad83e254b9e6342daecc0..bef8d97b56ab45d5616b710b737dc53bdf7f33d6 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
@@ -58,7 +58,6 @@ using namespace HTMLNames;
namespace {
typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
-typedef HashSet<String, CaseFoldingHash> ARIAWidgetSet;
struct RoleEntry {
const char* aria_role;
@@ -315,32 +314,6 @@ static Vector<AtomicString>* CreateInternalRoleNameVector() {
return internal_role_name_vector;
}
-const char* g_aria_widgets[] = {
- // From http://www.w3.org/TR/wai-aria/roles#widget_roles
- "alert", "alertdialog", "button", "checkbox", "dialog", "gridcell", "link",
- "log", "marquee", "menuitem", "menuitemcheckbox", "menuitemradio", "option",
- "progressbar", "radio", "scrollbar", "slider", "spinbutton", "status",
- "tab", "tabpanel", "textbox", "timer", "tooltip", "treeitem",
- // Composite user interface widgets.
- // This list is also from the w3.org site referenced above.
- "combobox", "grid", "listbox", "menu", "menubar", "radiogroup", "tablist",
- "tree", "treegrid"};
-
-static ARIAWidgetSet* CreateARIARoleWidgetSet() {
- ARIAWidgetSet* widget_set = new HashSet<String, CaseFoldingHash>();
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(g_aria_widgets); ++i)
- widget_set->insert(String(g_aria_widgets[i]));
- return widget_set;
-}
-
-const char* g_aria_interactive_widget_attributes[] = {
- // These attributes implicitly indicate the given widget is interactive.
- // From http://www.w3.org/TR/wai-aria/states_and_properties#attrs_widgets
- "aria-activedescendant", "aria-checked", "aria-controls",
- "aria-disabled", // If it's disabled, it can be made interactive.
- "aria-expanded", "aria-haspopup", "aria-multiselectable",
- "aria-pressed", "aria-required", "aria-selected"};
-
HTMLDialogElement* GetActiveDialogElement(Node* node) {
return node->GetDocument().ActiveModalDialog();
}
@@ -1907,48 +1880,6 @@ AccessibilityRole AXObjectImpl::AriaRoleToWebCoreRole(const String& value) {
return role;
}
-bool AXObjectImpl::IsInsideFocusableElementOrARIAWidget(const Node& node) {
- const Node* cur_node = &node;
- do {
- if (cur_node->IsElementNode()) {
- const Element* element = ToElement(cur_node);
- if (element->IsFocusable())
- return true;
- String role = element->getAttribute("role");
- if (!role.IsEmpty() && AXObjectImpl::IncludesARIAWidgetRole(role))
- return true;
- if (HasInteractiveARIAAttribute(*element))
- return true;
- }
- cur_node = cur_node->parentNode();
- } while (cur_node && !isHTMLBodyElement(node));
- return false;
-}
-
-bool AXObjectImpl::HasInteractiveARIAAttribute(const Element& element) {
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(g_aria_interactive_widget_attributes);
- ++i) {
- const char* attribute = g_aria_interactive_widget_attributes[i];
- if (element.hasAttribute(attribute)) {
- return true;
- }
- }
- return false;
-}
-
-bool AXObjectImpl::IncludesARIAWidgetRole(const String& role) {
- static const HashSet<String, CaseFoldingHash>* role_set =
- CreateARIARoleWidgetSet();
-
- Vector<String> role_vector;
- role.Split(' ', role_vector);
- for (const auto& child : role_vector) {
- if (role_set->Contains(child))
- return true;
- }
- return false;
-}
-
bool AXObjectImpl::NameFromContents(bool recursive) const {
// ARIA 1.1, section 5.2.7.5.
bool result = false;

Powered by Google App Engine
This is Rietveld 408576698