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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 1939303002: Enable accessible name of a control to include multiple <label> elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't modify visited set when computing aria-labelledby Created 4 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 | « third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp ('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) 2008, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Apple 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 AXObjectSet visited; 741 AXObjectSet visited;
742 AXNameFrom tmpNameFrom; 742 AXNameFrom tmpNameFrom;
743 AXRelatedObjectVector tmpRelatedObjects; 743 AXRelatedObjectVector tmpRelatedObjects;
744 String text = textAlternative(false, false, visited, tmpNameFrom, &tmpRelate dObjects, nameSources); 744 String text = textAlternative(false, false, visited, tmpNameFrom, &tmpRelate dObjects, nameSources);
745 text = text.simplifyWhiteSpace(isHTMLSpace<UChar>); 745 text = text.simplifyWhiteSpace(isHTMLSpace<UChar>);
746 return text; 746 return text;
747 } 747 }
748 748
749 String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabe lledByTraversal, AXObjectSet& visited) 749 String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabe lledByTraversal, AXObjectSet& visited)
750 { 750 {
751 if (visited.contains(&axObj) && !inAriaLabelledByTraversal)
752 return String();
753
751 AXNameFrom tmpNameFrom; 754 AXNameFrom tmpNameFrom;
752 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa meFrom, nullptr, nullptr); 755 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa meFrom, nullptr, nullptr);
753 } 756 }
754 757
755 bool AXObject::isHiddenForTextAlternativeCalculation() const 758 bool AXObject::isHiddenForTextAlternativeCalculation() const
756 { 759 {
757 if (equalIgnoringCase(getAttribute(aria_hiddenAttr), "false")) 760 if (equalIgnoringCase(getAttribute(aria_hiddenAttr), "false"))
758 return false; 761 return false;
759 762
760 if (getLayoutObject()) 763 if (getLayoutObject())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 if (nameSources) { 798 if (nameSources) {
796 nameSources->append(NameSource(*foundTextAlternative, attr)); 799 nameSources->append(NameSource(*foundTextAlternative, attr));
797 nameSources->last().type = nameFrom; 800 nameSources->last().type = nameFrom;
798 } 801 }
799 802
800 const AtomicString& ariaLabelledby = getAttribute(attr); 803 const AtomicString& ariaLabelledby = getAttribute(attr);
801 if (!ariaLabelledby.isNull()) { 804 if (!ariaLabelledby.isNull()) {
802 if (nameSources) 805 if (nameSources)
803 nameSources->last().attributeValue = ariaLabelledby; 806 nameSources->last().attributeValue = ariaLabelledby;
804 807
805 textAlternative = textFromAriaLabelledby(visited, relatedObjects); 808 // Operate on a copy of |visited| so that if |nameSources| is not nu ll,
806 809 // the set of visited objects is preserved unmodified for future cal culations.
810 AXObjectSet visitedCopy = visited;
811 textAlternative = textFromAriaLabelledby(visitedCopy, relatedObjects );
807 if (!textAlternative.isNull()) { 812 if (!textAlternative.isNull()) {
808 if (nameSources) { 813 if (nameSources) {
809 NameSource& source = nameSources->last(); 814 NameSource& source = nameSources->last();
810 source.type = nameFrom; 815 source.type = nameFrom;
811 source.relatedObjects = *relatedObjects; 816 source.relatedObjects = *relatedObjects;
812 source.text = textAlternative; 817 source.text = textAlternative;
813 *foundTextAlternative = true; 818 *foundTextAlternative = true;
814 } else { 819 } else {
815 *foundTextAlternative = true; 820 *foundTextAlternative = true;
816 return textAlternative; 821 return textAlternative;
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 1736
1732 DEFINE_TRACE(AXObject) 1737 DEFINE_TRACE(AXObject)
1733 { 1738 {
1734 visitor->trace(m_children); 1739 visitor->trace(m_children);
1735 visitor->trace(m_parent); 1740 visitor->trace(m_parent);
1736 visitor->trace(m_cachedLiveRegionRoot); 1741 visitor->trace(m_cachedLiveRegionRoot);
1737 visitor->trace(m_axObjectCache); 1742 visitor->trace(m_axObjectCache);
1738 } 1743 }
1739 1744
1740 } // namespace blink 1745 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698