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

Unified Diff: Source/modules/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 code on the latest source tree 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
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXNodeObject.cpp
diff --git a/Source/modules/accessibility/AXNodeObject.cpp b/Source/modules/accessibility/AXNodeObject.cpp
index c2aea7bad3cc4e9facf1e4a5612e3f7506380e58..97cbf483acc76bc1c5673ec2c6ae2f4695cbf35f 100644
--- a/Source/modules/accessibility/AXNodeObject.cpp
+++ b/Source/modules/accessibility/AXNodeObject.cpp
@@ -1188,6 +1188,16 @@ String AXNodeObject::textUnderElement() const
return builder.toString();
}
+AXObject* AXNodeObject::findChildWithTagName(const HTMLQualifiedName& tagName) const
+{
+ for (AXObject* child = firstChild(); child; child = child->nextSibling()) {
+ Node* childNode = child->node();
+ if (childNode && childNode->hasTagName(tagName))
+ return child;
+ }
+ return 0;
+}
+
String AXNodeObject::accessibilityDescription() const
{
// Static text should not have a description, it should only have a stringValue.
@@ -1213,6 +1223,12 @@ String AXNodeObject::accessibilityDescription() const
if (title().isEmpty())
return getAttribute(titleAttr);
+ if (roleValue() == FigureRole) {
+ AXObject* figcaption = findChildWithTagName(figcaptionTag);
+ if (figcaption)
+ return figcaption->accessibilityDescription();
+ }
+
return String();
}
@@ -1259,6 +1275,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 = findChildWithTagName(figcaptionTag);
+ if (figcaption)
+ return figcaption->textUnderElement();
+ }
default:
break;
}
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698