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

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

Issue 1076453004: Show reasons why nodes are ignored in accessibility sidebar (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: pfeldman review comments (take 3) Created 5 years, 8 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/AXNodeObject.cpp
diff --git a/Source/modules/accessibility/AXNodeObject.cpp b/Source/modules/accessibility/AXNodeObject.cpp
index 95bb285944bb55a94d5305a67b80532964ccdd9f..b73f8d559e4d0953a80bff144f107207e08639b6 100644
--- a/Source/modules/accessibility/AXNodeObject.cpp
+++ b/Source/modules/accessibility/AXNodeObject.cpp
@@ -167,15 +167,33 @@ bool AXNodeObject::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReasons)
#endif
// If this element is within a parent that cannot have children, it should not be exposed.
- if (isDescendantOfLeafNode())
+ if (isDescendantOfLeafNode()) {
+ if (ignoredReasons)
+ ignoredReasons->append(IgnoredReason(AXAncestorIsLeafNode, leafNodeAncestor()));
return true;
+ }
// Ignore labels that are already referenced by a control's title UI element.
AXObject* controlObject = correspondingControlForLabelElement();
- if (controlObject && !controlObject->deprecatedExposesTitleUIElement() && controlObject->isCheckboxOrRadio())
+ if (controlObject && !controlObject->deprecatedExposesTitleUIElement() && controlObject->isCheckboxOrRadio()) {
+ if (ignoredReasons) {
+ HTMLLabelElement* label = labelElementContainer();
+ if (label && !label->isSameNode(node())) {
+ AXObject* labelAXObject = axObjectCache()->getOrCreate(label);
+ ignoredReasons->append(IgnoredReason(AXLabelContainer, labelAXObject));
+ }
+
+ ignoredReasons->append(IgnoredReason(AXLabelFor, controlObject));
+ }
return true;
+ }
- return m_role == UnknownRole;
+ if (m_role == UnknownRole) {
+ if (ignoredReasons)
+ ignoredReasons->append(IgnoredReason(AXUninteresting));
+ return true;
+ }
+ return false;
}
static bool isListElement(Node* node)

Powered by Google App Engine
This is Rietveld 408576698