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

Unified Diff: Source/modules/accessibility/AXNodeObject.cpp

Issue 762783002: Adding a11y support for HTML5 <datalist> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding support to expose link element which is inside a label element Created 6 years 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
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXRenderObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXNodeObject.cpp
diff --git a/Source/modules/accessibility/AXNodeObject.cpp b/Source/modules/accessibility/AXNodeObject.cpp
index 151bb67176eda090b410c3d42c3c3fd1d72b8158..774c6c5d3e8967806ec9d284785151a0f8f9f1d1 100644
--- a/Source/modules/accessibility/AXNodeObject.cpp
+++ b/Source/modules/accessibility/AXNodeObject.cpp
@@ -177,18 +177,12 @@ bool AXNodeObject::computeAccessibilityIsIgnored() const
return m_role == UnknownRole;
}
-AccessibilityRole AXNodeObject::determineAccessibilityRole()
+AccessibilityRole AXNodeObject::determineAccessibilityRoleUtil()
{
if (!node())
return UnknownRole;
-
- if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
- return m_ariaRole;
-
if (node()->isLink())
return LinkRole;
- if (node()->isTextNode())
- return StaticTextRole;
if (isHTMLButtonElement(*node()))
return buttonRoleType();
if (isHTMLDetailsElement(*node()))
@@ -202,6 +196,8 @@ AccessibilityRole AXNodeObject::determineAccessibilityRole()
if (isHTMLInputElement(*node())) {
HTMLInputElement& input = toHTMLInputElement(*node());
const AtomicString& type = input.type();
+ if (input.dataList())
+ return ComboBoxRole;
if (type == InputTypeNames::button) {
if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode())) || (parentObject() && parentObject()->roleValue() == MenuRole))
return MenuItemRole;
@@ -219,6 +215,8 @@ AccessibilityRole AXNodeObject::determineAccessibilityRole()
|| type == InputTypeNames::month
|| type == InputTypeNames::week)
return DateTimeRole;
+ if (type == InputTypeNames::file)
+ return ButtonRole;
if (type == InputTypeNames::radio) {
if ((node()->parentNode() && isHTMLMenuElement(node()->parentNode())) || (parentObject() && parentObject()->roleValue() == MenuRole))
return MenuItemRadioRole;
@@ -264,15 +262,30 @@ AccessibilityRole AXNodeObject::determineAccessibilityRole()
return FigcaptionRole;
if (node()->isElementNode() && node()->hasTagName(figureTag))
return FigureRole;
- if (node()->isElementNode() && toElement(node())->isFocusable())
- return GroupRole;
if (isHTMLAnchorElement(*node()) && isClickable())
return LinkRole;
if (isHTMLIFrameElement(*node()))
return IframeRole;
if (isEmbeddedObject())
return EmbeddedObjectRole;
+ return UnknownRole;
+}
+
+AccessibilityRole AXNodeObject::determineAccessibilityRole()
+{
+ if (!node())
+ return UnknownRole;
+ if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
+ return m_ariaRole;
+ if (node()->isTextNode())
+ return StaticTextRole;
+
+ AccessibilityRole role = determineAccessibilityRoleUtil();
+ if (role != UnknownRole)
+ return role;
+ if (node()->isElementNode() && toElement(node())->isFocusable())
+ return GroupRole;
return UnknownRole;
}
@@ -1624,6 +1637,10 @@ HTMLLabelElement* AXNodeObject::labelElementContainer() const
if (isControl())
return 0;
+ // the link element should not be considered part of the label
+ if (isLink())
+ return 0;
+
// find if this has a ancestor that is a label
return Traversal<HTMLLabelElement>::firstAncestorOrSelf(*node());
}
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698