AX: Expose link rel type to voiceover
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2018 01:21:15 +0000 (01:21 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2018 01:21:15 +0000 (01:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186084
<rdar://problem/40640871>

Reviewed by Sam Weinig.

Source/WebCore:

Make the link rel attribute available to accessibility clients.

Test: accessibility/mac/linkrel.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::linkRelValue const):
* accessibility/AccessibilityObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityLinkRelationshipType]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

* accessibility/image-link-expected.txt:
* accessibility/image-map2-expected.txt:
* accessibility/mac/document-links-expected.txt:
* accessibility/mac/linkrel-expected.txt: Added.
* accessibility/mac/linkrel.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232326 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/image-link-expected.txt
LayoutTests/accessibility/image-map2-expected.txt
LayoutTests/accessibility/mac/document-links-expected.txt
LayoutTests/accessibility/mac/linkrel-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/linkrel.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index c39d7d4..e7e3a72 100644 (file)
@@ -1,3 +1,17 @@
+2018-05-30  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Expose link rel type to voiceover
+        https://bugs.webkit.org/show_bug.cgi?id=186084
+        <rdar://problem/40640871>
+
+        Reviewed by Sam Weinig.
+
+        * accessibility/image-link-expected.txt:
+        * accessibility/image-map2-expected.txt:
+        * accessibility/mac/document-links-expected.txt:
+        * accessibility/mac/linkrel-expected.txt: Added.
+        * accessibility/mac/linkrel.html: Added.
+
 2018-05-30  Ryan Haddad  <ryanhaddad@apple.com>
 
         Rebaseline http/wpt/service-workers/header-filtering.https.html after r232310.
index 7400744..e548697 100644 (file)
@@ -32,6 +32,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: http://www.wowhead.com/?item=33924
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 
 
@@ -65,6 +66,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: LayoutTests/accessibility/resources/cake.png
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 
 
index 39e1939..0607bbd 100644 (file)
@@ -59,6 +59,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: http://www.apple.com/
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 AXPath: <AXLink>
 
@@ -92,6 +93,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: http://www.apple.com/
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 AXPath: <AXLink>
 
index 16c7b48..bc9b5d6 100644 (file)
@@ -29,6 +29,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: http://www.apple.com/
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 AXPath: <AXLink>
 
@@ -62,6 +63,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: http://www.apple.com/
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 AXPath: <AXLink>
 
@@ -95,6 +97,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: http://webkit.org/
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 
 ------------
@@ -127,6 +130,7 @@ AXEditableAncestor: (null)
 AXHighestEditableAncestor: (null)
 AXURL: LayoutTests/accessibility/mac/document-links.html#asdf
 AXAccessKey: (null)
+AXLinkRelationshipType: 
 AXElementBusy: 0
 
 ------------
diff --git a/LayoutTests/accessibility/mac/linkrel-expected.txt b/LayoutTests/accessibility/mac/linkrel-expected.txt
new file mode 100644 (file)
index 0000000..5610bc0
--- /dev/null
@@ -0,0 +1,10 @@
+This tests that the relationship type of a link can be determined.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS relType is 'copyright'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/linkrel.html b/LayoutTests/accessibility/mac/linkrel.html
new file mode 100644 (file)
index 0000000..e4b16d5
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<a href="#" rel="copyright" id="link1">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that the relationship type of a link can be determined.");
+    if (window.accessibilityController) {
+       var link = accessibilityController.accessibleElementById("link1");
+
+        var relType = link.stringAttributeValue('AXLinkRelationshipType');
+        shouldBe("relType", "'copyright'");
+    }
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 669883a..4224566 100644 (file)
@@ -1,3 +1,24 @@
+2018-05-30  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Expose link rel type to voiceover
+        https://bugs.webkit.org/show_bug.cgi?id=186084
+        <rdar://problem/40640871>
+
+        Reviewed by Sam Weinig.
+
+        Make the link rel attribute available to accessibility clients.
+
+        Test: accessibility/mac/linkrel.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::linkRelValue const):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityLinkRelationshipType]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2018-05-30  Brady Eidson  <beidson@apple.com>
 
         REGRESSION (r224684): User-agent seen by page does not change when modified by the develop menu options after reloading.
index a867603..6e49c80 100644 (file)
@@ -2527,6 +2527,11 @@ const AtomicString& AccessibilityObject::datetimeAttributeValue() const
     return getAttribute(datetimeAttr);
 }
     
+const AtomicString& AccessibilityObject::linkRelValue() const
+{
+    return getAttribute(relAttr);
+}
+    
 const String AccessibilityObject::keyShortcutsValue() const
 {
     return getAttribute(aria_keyshortcutsAttr);
index f72845f..47d5da7 100644 (file)
@@ -708,6 +708,7 @@ public:
     virtual bool canvasHasFallbackContent() const { return false; }
     bool supportsRangeValue() const;
     const AtomicString& identifierAttribute() const;
+    const AtomicString& linkRelValue() const;
     void classList(Vector<String>&) const;
     virtual String roleDescription() const;
     AccessibilityCurrentState currentState() const;
index 9519ebe..02a4084 100644 (file)
@@ -1823,6 +1823,14 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
     return m_object->canSetValueAttribute();
 }
 
+- (NSString *)accessibilityLinkRelationshipType
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+    
+    return m_object->linkRelValue();
+}
+
 - (BOOL)accessibilityRequired
 {
     if (![self _prepareAccessibilityCall])
index 3f07417..d1a2095 100644 (file)
@@ -408,6 +408,10 @@ using namespace HTMLNames;
 #define NSAccessibilityHighestEditableAncestorAttribute @"AXHighestEditableAncestor"
 #endif
 
+#ifndef NSAccessibilityLinkRelationshipTypeAttribute
+#define NSAccessibilityLinkRelationshipTypeAttribute @"AXLinkRelationshipType"
+#endif
+
 extern "C" AXUIElementRef NSAccessibilityCreateAXUIElementRef(id element);
 
 @implementation WebAccessibilityObjectWrapper
@@ -1329,6 +1333,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache* cache, const Visibl
         tempArray = [[NSMutableArray alloc] initWithArray:attributes];
         [tempArray addObject:NSAccessibilityURLAttribute];
         [tempArray addObject:NSAccessibilityAccessKeyAttribute];
+        [tempArray addObject:NSAccessibilityLinkRelationshipTypeAttribute];
         anchorAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -2736,6 +2741,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return accessKey;
     }
     
+    if ([attributeName isEqualToString:NSAccessibilityLinkRelationshipTypeAttribute])
+        return m_object->linkRelValue();
+    
     if ([attributeName isEqualToString:NSAccessibilityTabsAttribute]) {
         if (m_object->isTabList()) {
             AccessibilityObject::AccessibilityChildrenVector tabsChildren;