AX[macOS]: Expose Inline property as an accessibility attribute
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jun 2017 00:12:29 +0000 (00:12 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jun 2017 00:12:29 +0000 (00:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173131
<rdar://problem/32667686>

Reviewed by Joanmarie Diggs.

Source/WebCore:

Expose whether a renderer is inline so that VoiceOver can make better use of that data when deciding what to output.

Test: accessibility/mac/inline-text-attribute.html

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

* accessibility/mac/inline-text-attribute.html: Added.
* accessibility/mac/inline-text-attribute-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/inline-text-attribute-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/inline-text-attribute.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 212fc98..069f6d6 100644 (file)
@@ -1,3 +1,14 @@
+2017-06-13  Chris Fleizach  <cfleizach@apple.com>
+
+        AX[macOS]: Expose Inline property as an accessibility attribute
+        https://bugs.webkit.org/show_bug.cgi?id=173131
+        <rdar://problem/32667686>
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/mac/inline-text-attribute.html: Added.
+        * accessibility/mac/inline-text-attribute-expected.txt: Added.
+
 2017-06-13  Joseph Pecoraro  <pecoraro@apple.com>
 
         Debugger has unexpected effect on program correctness
diff --git a/LayoutTests/accessibility/mac/inline-text-attribute-expected.txt b/LayoutTests/accessibility/mac/inline-text-attribute-expected.txt
new file mode 100644 (file)
index 0000000..ef1a44b
--- /dev/null
@@ -0,0 +1,14 @@
+a b c 
+d
+e f
+This tests that objects return whether they are inline or not.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Span is inline: 1
+Div is inline: 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/inline-text-attribute.html b/LayoutTests/accessibility/mac/inline-text-attribute.html
new file mode 100644 (file)
index 0000000..17dc9e9
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+a <span id="span" role="group"> b </span> c
+<br>
+
+d <div id="div" role="group"> e </span> f
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that objects return whether they are inline or not.");
+
+    if (window.accessibilityController) {
+
+          var span = accessibilityController.accessibleElementById("span");
+          debug("Span is inline: " + span.numberAttributeValue('AXInlineText'));
+
+          var div = accessibilityController.accessibleElementById("div");
+          debug("Div is inline: " + div.numberAttributeValue('AXInlineText'));
+    }
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index cb671c2..d02eef8 100644 (file)
@@ -1,3 +1,18 @@
+2017-06-13  Chris Fleizach  <cfleizach@apple.com>
+
+        AX[macOS]: Expose Inline property as an accessibility attribute
+        https://bugs.webkit.org/show_bug.cgi?id=173131
+        <rdar://problem/32667686>
+
+        Reviewed by Joanmarie Diggs.
+
+        Expose whether a renderer is inline so that VoiceOver can make better use of that data when deciding what to output.
+
+        Test: accessibility/mac/inline-text-attribute.html
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2017-06-13  Jon Davis  <jond@apple.com>
 
         Update Subresource Integrity status to Supported In Preview
index adb80df..dd42ef9 100644 (file)
@@ -65,6 +65,7 @@
 #import "Page.h"
 #import "PluginDocument.h"
 #import "PluginViewBase.h"
+#import "RenderInline.h"
 #import "RenderTextControl.h"
 #import "RenderView.h"
 #import "RenderWidget.h"
@@ -192,6 +193,10 @@ using namespace HTMLNames;
 #define NSAccessibilityDatetimeValueAttribute @"AXDateTimeValue"
 #endif
 
+#ifndef NSAccessibilityInlineTextAttribute
+#define NSAccessibilityInlineTextAttribute @"AXInlineText"
+#endif
+
 #ifndef NSAccessibilityDropEffectsAttribute
 #define NSAccessibilityDropEffectsAttribute @"AXDropEffects"
 #endif
@@ -3056,7 +3061,10 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
     if ([attributeName isEqualToString:NSAccessibilityDatetimeValueAttribute])
         return m_object->datetimeAttributeValue();
-
+    
+    if ([attributeName isEqualToString:NSAccessibilityInlineTextAttribute])
+        return @(m_object->renderer() && is<RenderInline>(m_object->renderer()));
+    
     // ARIA Live region attributes.
     if ([attributeName isEqualToString:NSAccessibilityARIALiveAttribute])
         return m_object->ariaLiveRegionStatus();
@@ -4269,3 +4277,4 @@ static void formatForDebugger(const VisiblePositionRange& range, char* buffer, u
 @end
 
 #endif // HAVE(ACCESSIBILITY)
+