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

Side by Side Diff: Source/modules/accessibility/AXNodeObject.cpp

Issue 1160793007: Include aria-label in acc name calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missing y Created 5 years, 6 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
« no previous file with comments | « LayoutTests/accessibility/name-calc-aria-label.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 if (!result.isEmpty()) { 1834 if (!result.isEmpty()) {
1835 if (!accumulatedText.isEmpty()) 1835 if (!accumulatedText.isEmpty())
1836 accumulatedText.append(" "); 1836 accumulatedText.append(" ");
1837 accumulatedText.append(result); 1837 accumulatedText.append(result);
1838 } 1838 }
1839 } 1839 }
1840 } 1840 }
1841 return accumulatedText.toString(); 1841 return accumulatedText.toString();
1842 } 1842 }
1843 1843
1844 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1
1845 if (hasAttribute(aria_labelAttr)) {
1846 const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
1847 if (!ariaLabel.isEmpty()) {
1848 if (nameFrom)
1849 *nameFrom = AXNameFromAttribute;
1850 return ariaLabel;
1851 }
1852 }
1853
1844 // Step 2F / 2G from: http://www.w3.org/TR/accname-aam-1.1 1854 // Step 2F / 2G from: http://www.w3.org/TR/accname-aam-1.1
1845 if (recursive || nameFromContents()) { 1855 if (recursive || nameFromContents()) {
1846 if (nameFrom) 1856 if (nameFrom)
1847 *nameFrom = AXNameFromContents; 1857 *nameFrom = AXNameFromContents;
1848 1858
1849 Node* node = this->node(); 1859 Node* node = this->node();
1850 if (node && node->isTextNode()) 1860 if (node && node->isTextNode())
1851 return toText(node)->wholeText(); 1861 return toText(node)->wholeText();
1852 1862
1853 StringBuilder accumulatedText; 1863 StringBuilder accumulatedText;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 ariaLabeledByElements(elements); 2382 ariaLabeledByElements(elements);
2373 2383
2374 for (const auto& element : elements) { 2384 for (const auto& element : elements) {
2375 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); 2385 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element);
2376 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement)); 2386 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement));
2377 } 2387 }
2378 } 2388 }
2379 } 2389 }
2380 2390
2381 } // namespace blink 2391 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/accessibility/name-calc-aria-label.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698