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; |
} |