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

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: Add a catch-all return to ignoredReasonName 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 isPresentationalInTable(AXObject* parent, HTMLElement* currentElemen t) 204 static bool isPresentationalInTable(AXObject* parent, HTMLElement* currentElemen t)
187 { 205 {
188 if (!currentElement) 206 if (!currentElement)
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 ariaLabeledByElements(elements); 2236 ariaLabeledByElements(elements);
2219 2237
2220 for (const auto& element : elements) { 2238 for (const auto& element : elements) {
2221 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); 2239 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element);
2222 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement)); 2240 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement));
2223 } 2241 }
2224 } 2242 }
2225 } 2243 }
2226 2244
2227 } // namespace blink 2245 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXLayoutObject.cpp ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698