AX: Provide a way for VoiceOver to uniquely identify a web session
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 17:37:24 +0000 (17:37 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 17:37:24 +0000 (17:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181894

Reviewed by Joanmarie Diggs.

Source/WebCore:

Add a way for VoiceOver to uniquely track a web page session.

Test: accessibility/mac/session-id.html

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

LayoutTests:

* accessibility/mac/document-attributes-expected.txt:
* accessibility/mac/session-id-expected.txt: Added.
* accessibility/mac/session-id.html: Added.
* platform/mac/accessibility/parent-delete-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/document-attributes-expected.txt
LayoutTests/accessibility/mac/session-id-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/session-id.html [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/parent-delete-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index a909e75..b73f3a8 100644 (file)
@@ -1,3 +1,15 @@
+2018-01-24  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Provide a way for VoiceOver to uniquely identify a web session
+        https://bugs.webkit.org/show_bug.cgi?id=181894
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/mac/document-attributes-expected.txt:
+        * accessibility/mac/session-id-expected.txt: Added.
+        * accessibility/mac/session-id.html: Added.
+        * platform/mac/accessibility/parent-delete-expected.txt: Added.
+
 2018-01-24  Ms2ger  <Ms2ger@igalia.com>
 
         [GTK] Fix some test failures in ATK selection handling.
index 41446dd..caf576a 100644 (file)
@@ -28,6 +28,7 @@ AXLoadingProgress: 1
 AXURL: LayoutTests/accessibility/mac/document-attributes.html
 AXCaretBrowsingEnabled: 0
 AXPreventKeyboardDOMEventDispatch: 0
+AXWebSessionID: 1
 AXElementBusy: 0
 
 
diff --git a/LayoutTests/accessibility/mac/session-id-expected.txt b/LayoutTests/accessibility/mac/session-id-expected.txt
new file mode 100644 (file)
index 0000000..63cd1e2
--- /dev/null
@@ -0,0 +1,11 @@
+This tests that we can receive the page ID from the web area element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS webArea.role is 'AXRole: AXWebArea'
+PASS webArea.numberAttributeValue('AXWebSessionID') >= 1 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/session-id.html b/LayoutTests/accessibility/mac/session-id.html
new file mode 100644 (file)
index 0000000..dea65fb
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that we can receive the page ID from the web area element.");
+
+    if (window.accessibilityController) {
+
+          var webArea = accessibilityController.rootElement.childAtIndex(0);
+          shouldBe("webArea.role", "'AXRole: AXWebArea'");
+          shouldBeTrue("webArea.numberAttributeValue('AXWebSessionID') >= 1");
+    }
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/accessibility/parent-delete-expected.txt b/LayoutTests/platform/mac/accessibility/parent-delete-expected.txt
new file mode 100644 (file)
index 0000000..1d8ea57
--- /dev/null
@@ -0,0 +1,34 @@
+This test passes if there is no crash.
+AXRole: AXWebArea
+AXRoleDescription: HTML content
+AXChildren: <array of size 1>
+AXHelp: 
+AXParent: <AXWebArea>
+AXSize: NSSize: {800, 600}
+AXTitle: 
+AXDescription: 
+AXValue: 
+AXFocused: 0
+AXEnabled: 1
+AXWindow: <AXWebArea>
+AXSelectedTextMarkerRange: (null)
+AXStartTextMarker: <AXWebArea>
+AXEndTextMarker: <AXWebArea>
+AXVisited: 0
+AXLinkedUIElements: <array of size 0>
+AXSelected: 0
+AXBlockQuoteLevel: 0
+AXTopLevelUIElement: <AXWebArea>
+AXLanguage: 
+AXDOMIdentifier: 
+AXDOMClassList: <array of size 0>
+AXLinkUIElements: <array of size 0>
+AXLoaded: 1
+AXLayoutCount: 2
+AXLoadingProgress: 1
+AXURL: LayoutTests/accessibility/parent-delete.html
+AXCaretBrowsingEnabled: 0
+AXPreventKeyboardDOMEventDispatch: 0
+AXWebSessionID: 1
+AXElementBusy: 0
+
index a09e640..7574e24 100644 (file)
@@ -1,3 +1,18 @@
+2018-01-24  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Provide a way for VoiceOver to uniquely identify a web session
+        https://bugs.webkit.org/show_bug.cgi?id=181894
+
+        Reviewed by Joanmarie Diggs.
+
+        Add a way for VoiceOver to uniquely track a web page session.
+
+        Test: accessibility/mac/session-id.html
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2018-01-24  Antti Koivisto  <antti@apple.com>
 
         RenderBlockRareData::m_enclosingFragmentedFlow should be WeakPtr
index 7a14337..1a9a99b 100644 (file)
@@ -393,6 +393,10 @@ using namespace HTMLNames;
 #define NSAccessibilityCaretBrowsingEnabledAttribute @"AXCaretBrowsingEnabled"
 #endif
 
+#ifndef NSAccessibilityWebSessionIDAttribute
+#define NSAccessibilityWebSessionIDAttribute @"AXWebSessionID"
+#endif
+
 #ifndef NSAccessibilitFocusableAncestorAttribute
 #define NSAccessibilityFocusableAncestorAttribute @"AXFocusableAncestor"
 #endif
@@ -1359,6 +1363,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache* cache, const Visibl
         [tempArray addObject:NSAccessibilityURLAttribute];
         [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute];
         [tempArray addObject:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute];
+        [tempArray addObject:NSAccessibilityWebSessionIDAttribute];
         webAreaAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -2535,6 +2540,14 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             return [NSNumber numberWithInt:m_object->layoutCount()];
         if ([attributeName isEqualToString:NSAccessibilityLoadingProgressAttribute])
             return [NSNumber numberWithDouble:m_object->estimatedLoadingProgress()];
+        if ([attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute])
+            return [NSNumber numberWithBool:m_object->preventKeyboardDOMEventDispatch()];
+        if ([attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+            return [NSNumber numberWithBool:m_object->caretBrowsingEnabled()];
+        if ([attributeName isEqualToString:NSAccessibilityWebSessionIDAttribute]) {
+            if (Document* doc = m_object->topDocument())
+                return [NSNumber numberWithUnsignedLongLong:doc->sessionID().sessionID()];
+        }
     }
     
     if (m_object->isTextControl()) {
@@ -3214,12 +3227,6 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return convertToNSArray(errorMessages);
     }
 
-    if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute])
-        return [NSNumber numberWithBool:m_object->preventKeyboardDOMEventDispatch()];
-    
-    if (m_object->isWebArea() && [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
-        return [NSNumber numberWithBool:m_object->caretBrowsingEnabled()];
-    
     // Multi-selectable
     if ([attributeName isEqualToString:NSAccessibilityIsMultiSelectableAttribute])
         return [NSNumber numberWithBool:m_object->isMultiSelectable()];