Diff
Modified: trunk/LayoutTests/ChangeLog (164634 => 164635)
--- trunk/LayoutTests/ChangeLog 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/LayoutTests/ChangeLog 2014-02-25 08:08:17 UTC (rev 164635)
@@ -1,3 +1,13 @@
+2014-02-24 Chris Fleizach <[email protected]>
+
+ AX: Support abbr, acronym
+ https://bugs.webkit.org/show_bug.cgi?id=128860
+
+ Reviewed by Mario Sanchez Prada.
+
+ * platform/mac/accessibility/abbr-acronym-tags-expected.txt: Added.
+ * platform/mac/accessibility/abbr-acronym-tags.html: Added.
+
2014-02-24 Oliver Hunt <[email protected]>
Spread operator has a bad time when applied to call function
Added: trunk/LayoutTests/platform/mac/accessibility/abbr-acronym-tags-expected.txt (0 => 164635)
--- trunk/LayoutTests/platform/mac/accessibility/abbr-acronym-tags-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/abbr-acronym-tags-expected.txt 2014-02-25 08:08:17 UTC (rev 164635)
@@ -0,0 +1,18 @@
+WWW
+WK2
+Longer Test
+test
+This tests that 'alternate text' for certain tags works correctly, including abbr tag, acronym tag and abbr attribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS abbr.stringAttributeValue('AXExpandedTextValue') is 'World Wide Web'
+PASS content.attributedStringForTextMarkerRangeContainsAttribute('AXExpandedTextValue', markerRange) is true
+PASS acronym.stringAttributeValue('AXExpandedTextValue') is 'WebKit2'
+PASS content.attributedStringForTextMarkerRangeContainsAttribute('AXExpandedTextValue', markerRange) is true
+PASS headerCell.stringAttributeValue('AXExpandedTextValue') is 'Test'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/abbr-acronym-tags.html (0 => 164635)
--- trunk/LayoutTests/platform/mac/accessibility/abbr-acronym-tags.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/abbr-acronym-tags.html 2014-02-25 08:08:17 UTC (rev 164635)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="content1">
+<abbr title="World Wide Web">WWW</abbr>
+</div>
+
+<div id="content2">
+<acronym title="WebKit2">WK2</acronym>
+</div>
+
+<table border=1>
+<tr><th id="cell" abbr="Test">Longer Test</th></tr>
+<tr><td>test</td></tr>
+</table>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that 'alternate text' for certain tags works correctly, including abbr tag, acronym tag and abbr attribute.");
+
+ if (window.accessibilityController) {
+
+ var content = accessibilityController.accessibleElementById("content1");
+ var abbr = content.childAtIndex(0);
+ shouldBe("abbr.stringAttributeValue('AXExpandedTextValue')", "'World Wide Web'");
+ var markerRange = content.textMarkerRangeForElement(content);
+ shouldBeTrue("content.attributedStringForTextMarkerRangeContainsAttribute('AXExpandedTextValue', markerRange)");
+
+ content = accessibilityController.accessibleElementById("content2");
+ var acronym = content.childAtIndex(0);
+ shouldBe("acronym.stringAttributeValue('AXExpandedTextValue')", "'WebKit2'");
+ markerRange = content.textMarkerRangeForElement(content);
+ shouldBeTrue("content.attributedStringForTextMarkerRangeContainsAttribute('AXExpandedTextValue', markerRange)");
+
+ var headerCell = accessibilityController.accessibleElementById("cell");
+ shouldBe("headerCell.stringAttributeValue('AXExpandedTextValue')", "'Test'");
+
+
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (164634 => 164635)
--- trunk/Source/WebCore/ChangeLog 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/ChangeLog 2014-02-25 08:08:17 UTC (rev 164635)
@@ -1,3 +1,34 @@
+2014-02-24 Chris Fleizach <[email protected]>
+
+ AX: Support abbr, acronym
+ https://bugs.webkit.org/show_bug.cgi?id=128860
+
+ Reviewed by Mario Sanchez Prada.
+
+ Expose the data in <abbr>, <acronym> and <th abbr=""> as an
+ alternateTextValue() parameter.
+
+ Test: platform/mac/accessibility/abbr-acronym-tags.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::hasTagName):
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::alternateTextValue):
+ (WebCore::AccessibilityObject::supportsAlternateTextValue):
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::alternateTextValue):
+ (WebCore::AccessibilityRenderObject::supportsAlternateTextValue):
+ * accessibility/AccessibilityRenderObject.h:
+ * accessibility/AccessibilityTableCell.cpp:
+ (WebCore::AccessibilityTableCell::alternateTextValue):
+ (WebCore::AccessibilityTableCell::supportsAlternateTextValue):
+ * accessibility/AccessibilityTableCell.h:
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (AXAttributeStringSetAlternateTextValue):
+ (AXAttributedStringAppendText):
+ (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
2014-02-24 Martin Robinson <[email protected]>
[GTK] generate-gtkdoc should not generate documentation for source files for unbuilt source files
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (164634 => 164635)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2014-02-25 08:08:17 UTC (rev 164635)
@@ -1548,6 +1548,13 @@
return invalidStatusTrue;
}
+bool AccessibilityObject::hasTagName(const QualifiedName& tagName) const
+{
+ if (Node* node = this->node())
+ return node->hasTagName(tagName);
+ return false;
+}
+
bool AccessibilityObject::hasAttribute(const QualifiedName& attribute) const
{
Node* elementNode = node();
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (164634 => 164635)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2014-02-25 08:08:17 UTC (rev 164635)
@@ -659,7 +659,11 @@
virtual String ariaLabeledByAttribute() const { return String(); }
virtual String ariaDescribedByAttribute() const { return String(); }
const AtomicString& placeholderValue() const;
-
+
+ // Abbreviations
+ virtual String expandedTextValue() const { return String(); }
+ virtual bool supportsExpandedTextValue() const { return false; }
+
void elementsFromAttribute(Vector<Element*>&, const QualifiedName&) const;
// Only if isColorWell()
@@ -757,6 +761,7 @@
static AccessibilityRole ariaRoleToWebCoreRole(const String&);
bool hasAttribute(const QualifiedName&) const;
const AtomicString& getAttribute(const QualifiedName&) const;
+ bool hasTagName(const QualifiedName&) const;
virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); }
virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const { return VisiblePositionRange(); }
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (164634 => 164635)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-02-25 08:08:17 UTC (rev 164635)
@@ -2431,7 +2431,27 @@
}
return false;
}
+
+String AccessibilityRenderObject::expandedTextValue() const
+{
+ if (AccessibilityObject* parent = parentObject()) {
+ if (parent->hasTagName(abbrTag) || parent->hasTagName(acronymTag))
+ return parent->getAttribute(titleAttr);
+ }
+
+ return String();
+}
+bool AccessibilityRenderObject::supportsExpandedTextValue() const
+{
+ if (roleValue() == StaticTextRole) {
+ if (AccessibilityObject* parent = parentObject())
+ return parent->hasTagName(abbrTag) || parent->hasTagName(acronymTag);
+ }
+
+ return false;
+}
+
AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
{
if (!m_renderer)
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (164634 => 164635)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2014-02-25 08:08:17 UTC (rev 164635)
@@ -267,6 +267,8 @@
#if PLATFORM(COCOA)
void updateAttachmentViewParents();
#endif
+ virtual String expandedTextValue() const;
+ virtual bool supportsExpandedTextValue() const;
void ariaSelectedRows(AccessibilityChildrenVector&);
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (164634 => 164635)
--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp 2014-02-25 08:08:17 UTC (rev 164635)
@@ -142,6 +142,16 @@
return false;
}
+String AccessibilityTableCell::expandedTextValue() const
+{
+ return getAttribute(abbrAttr);
+}
+
+bool AccessibilityTableCell::supportsExpandedTextValue() const
+{
+ return isTableHeaderCell() && hasAttribute(abbrAttr);
+}
+
void AccessibilityTableCell::columnHeaders(AccessibilityChildrenVector& headers)
{
AccessibilityTable* parent = parentTable();
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.h (164634 => 164635)
--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.h 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.h 2014-02-25 08:08:17 UTC (rev 164635)
@@ -64,7 +64,9 @@
virtual AccessibilityObject* titleUIElement() const override;
virtual bool exposesTitleUIElement() const override { return true; }
virtual bool computeAccessibilityIsIgnored() const override;
-
+ virtual String expandedTextValue() const;
+ virtual bool supportsExpandedTextValue() const;
+
bool isTableCellInSameRowGroup(AccessibilityTableCell*);
bool isTableCellInSameColGroup(AccessibilityTableCell*);
};
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (164634 => 164635)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2014-02-25 07:51:14 UTC (rev 164634)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2014-02-25 08:08:17 UTC (rev 164635)
@@ -197,6 +197,10 @@
#define NSAccessibilityPathAttribute @"AXPath"
#endif
+#ifndef NSAccessibilityExpandedTextValueAttribute
+#define NSAccessibilityExpandedTextValueAttribute @"AXExpandedTextValue"
+#endif
+
#define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
#define NSAccessibilityDOMClassListAttribute @"AXDOMClassList"
@@ -919,6 +923,17 @@
}
}
+static void AXAttributeStringSetexpandedTextValue(NSMutableAttributedString *attrString, RenderObject* renderer, NSRange range)
+{
+ if (!renderer || !AXAttributedStringRangeIsValid(attrString, range))
+ return;
+ AccessibilityObject* axObject = renderer->document().axObjectCache()->getOrCreate(renderer);
+ if (axObject->supportsExpandedTextValue())
+ [attrString addAttribute:NSAccessibilityExpandedTextValueAttribute value:axObject->expandedTextValue() range:range];
+ else
+ [attrString removeAttribute:NSAccessibilityExpandedTextValueAttribute range:range];
+}
+
static void AXAttributeStringSetHeadingLevel(NSMutableAttributedString* attrString, RenderObject* renderer, NSRange range)
{
if (!renderer)
@@ -971,7 +986,8 @@
static void AXAttributedStringAppendText(NSMutableAttributedString* attrString, Node* node, StringView text)
{
// skip invisible text
- if (!node->renderer())
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
return;
// easier to calculate the range before appending the string
@@ -993,9 +1009,10 @@
[attrString removeAttribute:NSAccessibilityMisspelledTextAttribute range:attrStringRange];
// set new attributes
- AXAttributeStringSetStyle(attrString, node->renderer(), attrStringRange);
- AXAttributeStringSetHeadingLevel(attrString, node->renderer(), attrStringRange);
- AXAttributeStringSetBlockquoteLevel(attrString, node->renderer(), attrStringRange);
+ AXAttributeStringSetStyle(attrString, renderer, attrStringRange);
+ AXAttributeStringSetHeadingLevel(attrString, renderer, attrStringRange);
+ AXAttributeStringSetBlockquoteLevel(attrString, renderer, attrStringRange);
+ AXAttributeStringSetexpandedTextValue(attrString, renderer, attrStringRange);
AXAttributeStringSetElement(attrString, NSAccessibilityLinkTextAttribute, AccessibilityObject::anchorElementForNode(node), attrStringRange);
// do spelling last because it tends to break up the range
@@ -1214,6 +1231,9 @@
if (m_object->supportsPath())
[additional addObject:NSAccessibilityPathAttribute];
+ if (m_object->supportsExpandedTextValue())
+ [additional addObject:NSAccessibilityExpandedTextValueAttribute];
+
return additional;
}
@@ -2848,6 +2868,9 @@
return [self accessibilityMathPrescriptPairs];
}
+ if ([attributeName isEqualToString:NSAccessibilityExpandedTextValueAttribute])
+ return m_object->expandedTextValue();
+
if ([attributeName isEqualToString:NSAccessibilityDOMIdentifierAttribute])
return m_object->identifierAttribute();
if ([attributeName isEqualToString:NSAccessibilityDOMClassListAttribute]) {