Title: [265248] trunk
Revision
265248
Author
andresg...@apple.com
Date
2020-08-04 09:56:34 -0700 (Tue, 04 Aug 2020)

Log Message

Add the ability of comparing the accessibility tree with isolated tree mode on and off.
https://bugs.webkit.org/show_bug.cgi?id=215000

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/mac/isolated-tree-mode-on-off.html

Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing
purposes, so that layout tests can determine whether an object is
isolated or not. It should not be used by real clients since there
should be no difference in behavior of a WebAccessibilityObjectWrapper
from a client point of view, regardless the underlying object being
isolated or not.

* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase isIsolatedObject]):

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR::AccessibilityController::setIsolatedTreeMode):
(WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode.
* WebKitTestRunner/InjectedBundle/AccessibilityController.h:
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:
Exposes setIsolatedTreeMode to _javascript_ code so that it can be turned
on and off in a layout tests.
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
Exposes isIsolatedObject to _javascript_ code so that layout tests can
check whether the underlying accessibility object is an AXIsolatedObject
or an AXObject.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting): Rename.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::isIsolatedObject const):

LayoutTests:

* accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added.
* accessibility/mac/isolated-tree-mode-on-off.html: Added.
* resources/accessibility-helper.js:
(dumpAccessibilityTree): In addition to dumping the accessibility tree
into an element with id="tree", it returns a string representation of
the accessibility tree.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265247 => 265248)


--- trunk/LayoutTests/ChangeLog	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/LayoutTests/ChangeLog	2020-08-04 16:56:34 UTC (rev 265248)
@@ -1,3 +1,17 @@
+2020-08-04  Andres Gonzalez  <andresg...@apple.com>
+
+        Add the ability of comparing the accessibility tree with isolated tree mode on and off.
+        https://bugs.webkit.org/show_bug.cgi?id=215000
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added.
+        * accessibility/mac/isolated-tree-mode-on-off.html: Added.
+        * resources/accessibility-helper.js:
+        (dumpAccessibilityTree): In addition to dumping the accessibility tree
+        into an element with id="tree", it returns a string representation of
+        the accessibility tree.
+
 2020-08-04  Chris Dumez  <cdu...@apple.com>
 
         Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface

Added: trunk/LayoutTests/accessibility/mac/isolated-tree-mode-on-off-expected.txt (0 => 265248)


--- trunk/LayoutTests/accessibility/mac/isolated-tree-mode-on-off-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/isolated-tree-mode-on-off-expected.txt	2020-08-04 16:56:34 UTC (rev 265248)
@@ -0,0 +1,25 @@
+Hello World!
+First paragraph.
+
+AXRole: AXGroup AXSubrole: AXApplicationGroup AXValue:
+    AXRole: AXGroup AXSubrole:  AXValue:
+        AXRole: AXStaticText AXSubrole:  AXValue: Hello World!
+    AXRole: AXGroup AXSubrole:  AXValue:
+        AXRole: AXStaticText AXSubrole:  AXValue: First paragraph.
+AXRole: AXGroup AXSubrole: AXApplicationGroup AXValue:
+    AXRole: AXGroup AXSubrole:  AXValue:
+        AXRole: AXStaticText AXSubrole:  AXValue: Hello World!
+    AXRole: AXGroup AXSubrole:  AXValue:
+        AXRole: AXStaticText AXSubrole:  AXValue: First paragraph.
+This tests that for the given HTML content, the accessibility trees in isolated tree mode on and off are identical.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS content.isIsolatedObject is false
+PASS content.isIsolatedObject is true
+PASS isolatedTreeOff[1] == isolatedTreeOn[1] is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/isolated-tree-mode-on-off.html (0 => 265248)


--- trunk/LayoutTests/accessibility/mac/isolated-tree-mode-on-off.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/isolated-tree-mode-on-off.html	2020-08-04 16:56:34 UTC (rev 265248)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="content" role="group">
+    Hello World!
+    <p>First paragraph.</p>
+</div>
+
+<pre id="tree"></pre>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that for the given HTML content, the accessibility trees in isolated tree mode on and off are identical.");
+
+    if (window.accessibilityController) {
+        accessibilityController.setIsolatedTreeMode(false);
+        content = accessibilityController.accessibleElementById("content");
+        shouldBeFalse("content.isIsolatedObject");
+        isolatedTreeOff = dumpAccessibilityTree(content, null, 0, true, false, true);
+
+        accessibilityController.setIsolatedTreeMode(true);
+        content = accessibilityController.accessibleElementById("content");
+        shouldBeTrue("content.isIsolatedObject");
+        isolatedTreeOn = dumpAccessibilityTree(content, null, 0, true, false, true);
+
+        shouldBeTrue("isolatedTreeOff[1] == isolatedTreeOn[1]");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (265247 => 265248)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-08-04 16:56:34 UTC (rev 265248)
@@ -948,6 +948,7 @@
 webkit.org/b/210198 webgl/2.0.0/conformance2/attribs/gl-vertexattribipointer.html [ Slow ]
 
 webkit.org/b/208477 accessibility/mac/text-marker-for-index.html [ Skip ]
+accessibility/mac/isolated-tree-mode-on-off.html [ Skip ]
 
 webkit.org/b/211923 imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.html [ Pass Crash ]
 

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (265247 => 265248)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-08-04 16:56:34 UTC (rev 265248)
@@ -482,6 +482,9 @@
 ### END OF (6) New WebKit2-only failures in Yosemite
 ########################################
 
+# Accessibility isolated tree mode is enabled in Big Sur and beyond, no in Catalina and before.
+[ Mojave Catalina ] accessibility/mac/isolated-tree-mode-on-off.html [ Skip ]
+
 # Content Extensions tests must be enabled explicitly on mac-wk2.
 http/tests/contentextensions [ Pass ]
 http/tests/inspector/network/contentextensions [ Pass ]

Modified: trunk/LayoutTests/resources/accessibility-helper.js (265247 => 265248)


--- trunk/LayoutTests/resources/accessibility-helper.js	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/LayoutTests/resources/accessibility-helper.js	2020-08-04 16:56:34 UTC (rev 265248)
@@ -1,3 +1,8 @@
+// Dumps the accessibility tree hierarchy for the given accessibilityObject into
+// an element with id="tree", e.g., <pre id="tree"></pre>. In addition, it
+// returns a two element array with the first element [0] being false if the
+// traversal of the tree was stopped at the stopElement, and second element [1],
+// the string representing the accessibility tree.
 function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle, includeSubrole) {
     var str = "";
     var i = 0;
@@ -11,18 +16,22 @@
     str += allAttributesIfNeeded && accessibilityObject.role == '' ? accessibilityObject.allAttributes() : '';
     str += "\n";
 
-    document.getElementById("tree").innerText += str;
+    var outputTree = document.getElementById("tree");
+    if (outputTree)
+        outputTree.innerText += str;
 
     if (stopElement && stopElement.isEqual(accessibilityObject))
-        return;
+        return [false, str];
 
     var count = accessibilityObject.childrenCount;
     for (i = 0; i < count; ++i) {
-        if (!dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle, includeSubrole))
-            return false;
+        childRet = dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle, includeSubrole);
+        if (!childRet[0])
+            return [false, str];
+        str += childRet[1];
     }
 
-    return true;
+    return [true, str];
 }
 
 function touchAccessibilityTree(accessibilityObject) {

Modified: trunk/Source/WebCore/ChangeLog (265247 => 265248)


--- trunk/Source/WebCore/ChangeLog	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Source/WebCore/ChangeLog	2020-08-04 16:56:34 UTC (rev 265248)
@@ -1,3 +1,22 @@
+2020-08-04  Andres Gonzalez  <andresg...@apple.com>
+
+        Add the ability of comparing the accessibility tree with isolated tree mode on and off.
+        https://bugs.webkit.org/show_bug.cgi?id=215000
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/mac/isolated-tree-mode-on-off.html
+
+        Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing
+        purposes, so that layout tests can determine whether an object is
+        isolated or not. It should not be used by real clients since there
+        should be no difference in behavior of a WebAccessibilityObjectWrapper
+        from a client point of view, regardless the underlying object being
+        isolated or not.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
+        (-[WebAccessibilityObjectWrapperBase isIsolatedObject]):
+
 2020-08-04  Chris Dumez  <cdu...@apple.com>
 
         Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm (265247 => 265248)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm	2020-08-04 16:56:34 UTC (rev 265248)
@@ -372,6 +372,16 @@
     return m_axObject;
 }
 
+- (BOOL)isIsolatedObject
+{
+#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
+    auto* backingObject = self.axBackingObject;
+    return backingObject && backingObject->isAXIsolatedObjectInstance();
+#else
+    return NO;
+#endif
+}
+
 - (NSString *)baseAccessibilityDescription
 {
     return self.axBackingObject->descriptionAttributeValue();

Modified: trunk/Tools/ChangeLog (265247 => 265248)


--- trunk/Tools/ChangeLog	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/ChangeLog	2020-08-04 16:56:34 UTC (rev 265248)
@@ -1,3 +1,27 @@
+2020-08-04  Andres Gonzalez  <andresg...@apple.com>
+
+        Add the ability of comparing the accessibility tree with isolated tree mode on and off.
+        https://bugs.webkit.org/show_bug.cgi?id=215000
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
+        (WTR::AccessibilityController::setIsolatedTreeMode):
+        (WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode.
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.h:
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:
+        Exposes setIsolatedTreeMode to _javascript_ code so that it can be turned
+        on and off in a layout tests.
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        Exposes isIsolatedObject to _javascript_ code so that layout tests can
+        check whether the underlying accessibility object is an AXIsolatedObject
+        or an AXObject.
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting): Rename.
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::isIsolatedObject const):
+
 2020-08-04  Aakash Jain  <aakash_j...@apple.com>
 
         [ews] Apple Silicon builder should skip non-relevant patches

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2020-08-04 16:56:34 UTC (rev 265248)
@@ -55,15 +55,17 @@
 {
 }
 
+void AccessibilityController::setIsolatedTreeMode(bool flag)
+{
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
-void AccessibilityController::setAccessibilityIsolatedTreeMode(bool flag)
-{
     if (m_accessibilityIsolatedTreeMode != flag) {
         m_accessibilityIsolatedTreeMode = flag;
         updateIsolatedTreeMode();
     }
+#endif
 }
 
+#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
 void AccessibilityController::updateIsolatedTreeMode()
 {
     // Override to set identifier to VoiceOver so that requests are handled in isolated mode.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h	2020-08-04 16:56:34 UTC (rev 265248)
@@ -52,10 +52,8 @@
     void enableEnhancedAccessibility(bool);
     bool enhancedAccessibilityEnabled();
 
-#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
-    void setAccessibilityIsolatedTreeMode(bool);
-#endif
-    
+    void setIsolatedTreeMode(bool);
+
     JSRetainPtr<JSStringRef> platformName();
 
     // Controller Methods - platform-independent implementations.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2020-08-04 16:56:34 UTC (rev 265248)
@@ -55,6 +55,13 @@
     return m_element;            
 }
 
+#if !ENABLE(ACCESSIBILITY_ISOLATED_TREE)
+bool AccessibilityUIElement::isIsolatedObject() const
+{
+    return false;
+}
+#endif
+
 // iOS specific methods
 #if !PLATFORM(IOS_FAMILY)
 JSRetainPtr<JSStringRef> AccessibilityUIElement::identifier() { return nullptr; }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2020-08-04 16:56:34 UTC (rev 265248)
@@ -364,7 +364,8 @@
     // Fieldset
     bool hasContainedByFieldsetTrait();
     RefPtr<AccessibilityUIElement> fieldsetAncestorElement();
-    
+
+    bool isIsolatedObject() const;
 private:
     AccessibilityUIElement(PlatformUIElement);
     AccessibilityUIElement(const AccessibilityUIElement&);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl	2020-08-04 16:56:34 UTC (rev 265248)
@@ -28,7 +28,7 @@
 ] interface AccessibilityController {
     void enableEnhancedAccessibility(boolean enable);
     readonly attribute boolean enhancedAccessibilityEnabled;
-
+    void setIsolatedTreeMode(boolean enable);
     readonly attribute DOMString platformName;
     readonly attribute AccessibilityUIElement rootElement;
     readonly attribute AccessibilityUIElement focusedElement;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2020-08-04 16:56:34 UTC (rev 265248)
@@ -27,6 +27,7 @@
     Conditional=ACCESSIBILITY,
 ] interface AccessibilityUIElement {
     boolean isEqual(AccessibilityUIElement otherElement);
+    readonly attribute boolean isIsolatedObject;
 
     // Document information
     readonly attribute DOMString documentEncoding;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2020-08-04 16:56:34 UTC (rev 265248)
@@ -572,7 +572,7 @@
 #if HAVE(ACCESSIBILITY)
     m_accessibilityController = AccessibilityController::create();
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
-    m_accessibilityController->setAccessibilityIsolatedTreeMode(m_accessibilityIsolatedTreeMode);
+    m_accessibilityController->setIsolatedTreeMode(m_accessibilityIsolatedTreeMode);
 #endif
 #endif
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (265247 => 265248)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2020-08-04 16:53:26 UTC (rev 265247)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2020-08-04 16:56:34 UTC (rev 265248)
@@ -74,6 +74,7 @@
 typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
 
 @interface NSObject (WebKitAccessibilityAdditions)
+- (BOOL)isIsolatedObject;
 - (BOOL)accessibilityReplaceRange:(NSRange)range withText:(NSString *)string;
 - (BOOL)accessibilityInsertText:(NSString *)text;
 - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
@@ -117,6 +118,13 @@
     return platformUIElement() == otherElement->platformUIElement();
 }
 
+#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
+bool AccessibilityUIElement::isIsolatedObject() const
+{
+    return [m_element isIsolatedObject];
+}
+#endif
+
 RetainPtr<NSArray> supportedAttributes(id element)
 {
     RetainPtr<NSArray> attributes;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to