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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 bool AXNodeObject::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReasons) const 161 bool AXNodeObject::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReasons) const
162 { 162 {
163 #if ENABLE(ASSERT) 163 #if ENABLE(ASSERT)
164 // Double-check that an AXObject is never accessed before 164 // Double-check that an AXObject is never accessed before
165 // it's been initialized. 165 // it's been initialized.
166 ASSERT(m_initialized); 166 ASSERT(m_initialized);
167 #endif 167 #endif
168 168
169 // If this element is within a parent that cannot have children, it should n ot be exposed. 169 // If this element is within a parent that cannot have children, it should n ot be exposed.
170 if (isDescendantOfLeafNode()) 170 if (isDescendantOfLeafNode()) {
171 if (ignoredReasons)
172 ignoredReasons->append(IgnoredReason(AXAncestorIsLeafNode, leafNodeA ncestor()));
171 return true; 173 return true;
174 }
172 175
173 // Ignore labels that are already referenced by a control's title UI element . 176 // Ignore labels that are already referenced by a control's title UI element .
174 AXObject* controlObject = correspondingControlForLabelElement(); 177 AXObject* controlObject = correspondingControlForLabelElement();
175 if (controlObject && !controlObject->deprecatedExposesTitleUIElement() && co ntrolObject->isCheckboxOrRadio()) 178 if (controlObject && !controlObject->deprecatedExposesTitleUIElement() && co ntrolObject->isCheckboxOrRadio()) {
179 if (ignoredReasons) {
180 HTMLLabelElement* label = labelElementContainer();
181 if (label && !label->isSameNode(node())) {
182 AXObject* labelAXObject = axObjectCache()->getOrCreate(label);
183 ignoredReasons->append(IgnoredReason(AXLabelContainer, labelAXOb ject));
184 }
185
186 ignoredReasons->append(IgnoredReason(AXLabelFor, controlObject));
187 }
176 return true; 188 return true;
189 }
177 190
178 return m_role == UnknownRole; 191 if (m_role == UnknownRole) {
192 if (ignoredReasons)
193 ignoredReasons->append(IgnoredReason(AXUninteresting));
194 return true;
195 }
196 return false;
179 } 197 }
180 198
181 static bool isListElement(Node* node) 199 static bool isListElement(Node* node)
182 { 200 {
183 return isHTMLUListElement(*node) || isHTMLOListElement(*node) || isHTMLDList Element(*node); 201 return isHTMLUListElement(*node) || isHTMLOListElement(*node) || isHTMLDList Element(*node);
184 } 202 }
185 203
186 static bool isPresentationRoleInTable(AXObject* parent, Node* child) 204 static bool isPresentationRoleInTable(AXObject* parent, Node* child)
187 { 205 {
188 Node* parentNode = parent->node(); 206 Node* parentNode = parent->node();
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 ariaLabeledByElements(elements); 2230 ariaLabeledByElements(elements);
2213 2231
2214 for (const auto& element : elements) { 2232 for (const auto& element : elements) {
2215 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); 2233 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element);
2216 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement)); 2234 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement));
2217 } 2235 }
2218 } 2236 }
2219 } 2237 }
2220 2238
2221 } // namespace blink 2239 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698