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

Unified Diff: Source/core/accessibility/AXNodeObject.cpp

Issue 713873002: Add the case for figure in title() and accessibilityDescription(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update accessibilityDescription for figcaption Created 6 years, 1 month 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
Index: Source/core/accessibility/AXNodeObject.cpp
diff --git a/Source/core/accessibility/AXNodeObject.cpp b/Source/core/accessibility/AXNodeObject.cpp
index 917f64a04c8d02f4d37d2d1937f2474c6f17f19c..3ff828f7b4515ae0a62ce1f3e52bd097e375ecbf 100644
--- a/Source/core/accessibility/AXNodeObject.cpp
+++ b/Source/core/accessibility/AXNodeObject.cpp
@@ -1181,6 +1181,16 @@ String AXNodeObject::textUnderElement() const
return builder.toString();
}
+AXObject* AXNodeObject::searchAXObjectFromChild(const HTMLQualifiedName& node) const
dmazzoni 2014/11/12 06:03:03 The argument name should be tagName instead of nod
je_julie(Not used) 2014/11/12 13:07:04 You're right. I updated the parameter name.
+{
+ for (AXObject* child = firstChild(); child; child = child->nextSibling()) {
+ Node* childNode = child->node();
+ if (childNode && childNode->hasTagName(node))
+ return child;
+ }
+ return 0;
+}
+
String AXNodeObject::accessibilityDescription() const
{
// Static text should not have a description, it should only have a stringValue.
@@ -1206,6 +1216,12 @@ String AXNodeObject::accessibilityDescription() const
if (title().isEmpty())
return getAttribute(titleAttr);
+ if (roleValue() == FigureRole) {
+ AXObject* figcaption = searchAXObjectFromChild(figcaptionTag);
+ if (figcaption)
+ return figcaption->accessibilityDescription();
+ }
+
return String();
}
@@ -1251,6 +1267,11 @@ String AXNodeObject::title() const
// SVGRoots should not use the text under itself as a title. That could include the text of objects like <text>.
case SVGRootRole:
return String();
+ case FigureRole: {
+ AXObject* figcaption = searchAXObjectFromChild(figcaptionTag);
+ if (figcaption)
+ return figcaption->textUnderElement();
+ }
default:
break;
}
« Source/core/accessibility/AXNodeObject.h ('K') | « Source/core/accessibility/AXNodeObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698