diff options
Diffstat (limited to 'Source/WebCore/accessibility/AccessibilityNodeObject.cpp')
-rw-r--r-- | Source/WebCore/accessibility/AccessibilityNodeObject.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp index 1e3a91518..5be294ff0 100644 --- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp @@ -1354,7 +1354,6 @@ void AccessibilityNodeObject::visibleText(Vector<AccessibilityText>& textOrder) case RadioButtonRole: case SwitchRole: case TabRole: - case ProgressIndicatorRole: useTextUnderElement = true; break; default: @@ -1395,9 +1394,17 @@ void AccessibilityNodeObject::helpText(Vector<AccessibilityText>& textOrder) con textOrder.append(AccessibilityText(summary, SummaryText)); // The title attribute should be used as help text unless it is already being used as descriptive text. + // However, when the title attribute is the only text alternative provided, it may be exposed as the + // descriptive text. This is problematic in the case of meters because the HTML spec suggests authors + // can expose units through this attribute. Therefore, if the element is a meter, change its source + // type to HelpText. const AtomicString& title = getAttribute(titleAttr); - if (!title.isEmpty()) - textOrder.append(AccessibilityText(title, TitleTagText)); + if (!title.isEmpty()) { + if (!isMeter()) + textOrder.append(AccessibilityText(title, TitleTagText)); + else + textOrder.append(AccessibilityText(title, HelpText)); + } } void AccessibilityNodeObject::accessibilityText(Vector<AccessibilityText>& textOrder) @@ -1893,6 +1900,32 @@ static String accessibleNameForNode(Node* node, Node* labelledbyNode) return String(); } +String AccessibilityNodeObject::accessibilityDescriptionForChildren() const +{ + Node* node = this->node(); + if (!node) + return String(); + + AXObjectCache* cache = axObjectCache(); + if (!cache) + return String(); + + StringBuilder builder; + for (Node* child = node->firstChild(); child; child = child->nextSibling()) { + if (!is<Element>(child)) + continue; + + if (AccessibilityObject* axObject = cache->getOrCreate(child)) { + String description = axObject->ariaLabeledByAttribute(); + if (description.isEmpty()) + description = accessibleNameForNode(child); + appendNameToStringBuilder(builder, description); + } + } + + return builder.toString(); +} + String AccessibilityNodeObject::accessibilityDescriptionForElements(Vector<Element*> &elements) const { StringBuilder builder; |