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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/accessibility/AXObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
index da4d72af218316f257065688ce9d7808d3255574..b84837dbe22b10ad763ea87de56e9c7fffa131a0 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -748,6 +748,9 @@ String AXObject::name(NameSources* nameSources) const
String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabelledByTraversal, AXObjectSet& visited)
{
+ if (visited.contains(&axObj) && !inAriaLabelledByTraversal)
+ return String();
+
AXNameFrom tmpNameFrom;
return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNameFrom, nullptr, nullptr);
}
@@ -802,8 +805,10 @@ String AXObject::ariaTextAlternative(bool recursive, bool inAriaLabelledByTraver
if (nameSources)
nameSources->last().attributeValue = ariaLabelledby;
- textAlternative = textFromAriaLabelledby(visited, relatedObjects);
-
+ // Operate on a copy of |visited| so that if |nameSources| is not null,
+ // the set of visited objects is preserved unmodified for future calculations.
+ AXObjectSet visitedCopy = visited;
+ textAlternative = textFromAriaLabelledby(visitedCopy, relatedObjects);
if (!textAlternative.isNull()) {
if (nameSources) {
NameSource& source = nameSources->last();
« 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