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

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

Issue 1039873002: AX presentation role should be inherited to its required owned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved code to AXNodeObject Created 5 years, 9 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: Source/modules/accessibility/AXListBoxOption.cpp
diff --git a/Source/modules/accessibility/AXListBoxOption.cpp b/Source/modules/accessibility/AXListBoxOption.cpp
index 58a91d3a8961d74c081a87413373c69a193e9678..bf9f587692d36b4386bab86cfa3aab97967128ab 100644
--- a/Source/modules/accessibility/AXListBoxOption.cpp
+++ b/Source/modules/accessibility/AXListBoxOption.cpp
@@ -58,9 +58,37 @@ AccessibilityRole AXListBoxOption::roleValue() const
AccessibilityRole ariaRole = ariaRoleAttribute();
if (ariaRole != UnknownRole)
return ariaRole;
+
+ // Generally, the presentation role is handled in computeAccessibilityIsIgnored().
+ // In case of ListBoxOption, if it just marked as ignored in computeAccessibilityIsIgnored(),
+ // we can't see listboxoption on tree without any text.
+ // http://www.w3.org/TR/wai-aria/complete#presentation
+ // ARIA spec says that the presentation role causes a given element to be treated
+ // as having no role or to be removed from the accessibility tree, but does not cause the
+ // content contained within the element to be removed from the accessibility tree.
+ if (isParentPresentationRole())
+ return StaticTextRole;
+
return ListBoxOptionRole;
}
+bool AXListBoxOption::isParentPresentationRole() const
+{
+ AXObject* parent = parentObject();
+ if (!parent)
+ return false;
+
+ // The parent should be a listbox in order to be Required Owned Elements and
+ // have a presentation role.
+ Node* parentNode = parent->node();
+ if (isHTMLSelectElement(parentNode)) {
+ HTMLSelectElement& selectElement = toHTMLSelectElement(*parentNode);
+ if (selectElement.multiple() && isPresentationRole(parent))
dmazzoni 2015/03/31 16:35:23 selectElement.multiple() isn't the same as a selec
je_julie(Not used) 2015/04/01 12:51:28 I updated it with layoutObject->isListBox().
+ return true;
+ }
+ return false;
+}
+
bool AXListBoxOption::isEnabled() const
{
if (!node())

Powered by Google App Engine
This is Rietveld 408576698