Diff
Modified: trunk/LayoutTests/ChangeLog (285775 => 285776)
--- trunk/LayoutTests/ChangeLog 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/LayoutTests/ChangeLog 2021-11-13 18:38:12 UTC (rev 285776)
@@ -1,3 +1,20 @@
+2021-11-13 Tyler Wilcock <tyle...@apple.com>
+
+ AX: Make accessibility/mac/header.html test async to fix it for isolated tree mode
+ https://bugs.webkit.org/show_bug.cgi?id=233017
+
+ Reviewed by Andres Gonzalez.
+
+ This test needs to be made async, as we need to wait for
+ accessibilityController.focusedElement to be synced with the DOM
+ focused element before running our expectations. This fixes the
+ test in isolated tree mode.
+
+ * accessibility/mac/header-expected.txt:
+ Remove extra newline at end of the file.
+ * accessibility/mac/header.html:
+ Make test async.
+
2021-11-12 Said Abou-Hallawa <s...@apple.com>
REGRESSION(r285481): Infinite recursion with cyclic filter reference
Modified: trunk/LayoutTests/accessibility/mac/header-expected.txt (285775 => 285776)
--- trunk/LayoutTests/accessibility/mac/header-expected.txt 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/LayoutTests/accessibility/mac/header-expected.txt 2021-11-13 18:38:12 UTC (rev 285776)
@@ -10,4 +10,3 @@
Header outside section and article elements.
Header inside an article.
Header inside a section.
-
Modified: trunk/LayoutTests/accessibility/mac/header.html (285775 => 285776)
--- trunk/LayoutTests/accessibility/mac/header.html 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/LayoutTests/accessibility/mac/header.html 2021-11-13 18:38:12 UTC (rev 285776)
@@ -1,36 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
-<html>
<head>
-<script src=''></script>
+<script src=""
+<script src=""
</head>
-<body id='body'>
- <header tabindex='0' id='header01'>Header outside section and article elements.</header>
- <article>
- <header tabindex='0' id='header02'>Header inside an article.</header>
- </article>
- <section>
- <header tabindex='0' id='header03'>Header inside a section.</header>
- </section>
- <pre id='result'></pre>
- <script>
- function log(str) {
- var result = document.querySelector('#result');
- result.appendChild(document.createTextNode(str));
- }
+<body>
- function expectRole(expectedRole, expectedDescription, id) {
- if (!window.accessibilityController)
- return;
- var el = document.querySelector(id);
- el.focus();
- shouldBeEqualToString('accessibilityController.focusedElement.role', "AXRole: " + expectedRole);
- shouldBeEqualToString('accessibilityController.focusedElement.roleDescription', "AXRoleDescription: " + expectedDescription);
- }
+<header tabindex="0" id="header01">Header outside section and article elements.</header>
+<article>
+ <header tabindex="0" id="header02">Header inside an article.</header>
+</article>
+<section>
+ <header tabindex="0" id="header03">Header inside a section.</header>
+</section>
- expectRole('AXGroup', 'banner', '#header01');
- expectRole('AXGroup', 'group', '#header02');
- expectRole('AXGroup', 'group', '#header03');
- </script>
-<script src=''></script>
+<script>
+ async function expectRole(expectedRole, expectedDescription, id) {
+ document.getElementById(id).focus();
+
+ await waitFor(() => {
+ const focusedElement = accessibilityController.focusedElement;
+ return focusedElement && focusedElement.domIdentifier === id;
+ });
+
+ shouldBeEqualToString("accessibilityController.focusedElement.role", "AXRole: " + expectedRole);
+ shouldBeEqualToString("accessibilityController.focusedElement.roleDescription", "AXRoleDescription: " + expectedDescription);
+ }
+
+ if (window.accessibilityController) {
+ window.jsTestIsAsync = true;
+
+ setTimeout(async function() {
+ await expectRole("AXGroup", "banner", "header01");
+ await expectRole("AXGroup", "group", "header02");
+ await expectRole("AXGroup", "group", "header03");
+
+ finishJSTest();
+ }, 0);
+ }
+</script>
+
</body>
</html>
+
Modified: trunk/Tools/ChangeLog (285775 => 285776)
--- trunk/Tools/ChangeLog 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/ChangeLog 2021-11-13 18:38:12 UTC (rev 285776)
@@ -1,3 +1,28 @@
+2021-11-13 Tyler Wilcock <tyle...@apple.com>
+
+ AX: Make accessibility/mac/header.html test async to fix it for isolated tree mode
+ https://bugs.webkit.org/show_bug.cgi?id=233017
+
+ Reviewed by Andres Gonzalez.
+
+ This patch implements the `domIdentifier` attribute for DumpRenderTree
+ elements. When making this test async, I wanted to use this attribute,
+ hence the implementation in this patch.
+
+ * DumpRenderTree/AccessibilityUIElement.cpp:
+ (domIdentifierCallback): Added.
+ (AccessibilityUIElement::getJSClass):
+ Add "domIdentifer" entry to `staticValues[]`.
+
+ * DumpRenderTree/AccessibilityUIElement.h:
+ Add AccessibilityUIElement::domIdentifier const definition.
+ * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+ (AccessibilityUIElement::domIdentifier const): Added.
+ * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+ (AccessibilityUIElement::domIdentifier const): Added.
+ * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+ (AccessibilityUIElement::domIdentifier const):Added.
+
2021-11-12 Jonathan Bedard <jbed...@apple.com>
[webkitpy] Symlink daemons into simulator runtime root
Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (285775 => 285776)
--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp 2021-11-13 18:38:12 UTC (rev 285776)
@@ -1168,6 +1168,12 @@
return JSValueMakeString(context, classList.get());
}
+static JSValueRef domIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ auto domIdentifier = toAXElement(thisObject)->domIdentifier();
+ return JSValueMakeString(context, domIdentifier.get());
+}
+
static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed());
@@ -1945,6 +1951,7 @@
{ "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "classList", getClassListCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "domIdentifier", domIdentifierCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "speakAs", speakAsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (285775 => 285776)
--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.h 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.h 2021-11-13 18:38:12 UTC (rev 285776)
@@ -175,6 +175,7 @@
JSRetainPtr<JSStringRef> documentURI();
JSRetainPtr<JSStringRef> url();
JSRetainPtr<JSStringRef> classList() const;
+ JSRetainPtr<JSStringRef> domIdentifier() const;
// CSS3-speech properties.
JSRetainPtr<JSStringRef> speakAs();
Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (285775 => 285776)
--- trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm 2021-11-13 18:38:12 UTC (rev 285776)
@@ -94,6 +94,7 @@
- (BOOL)_accessibilityIsInTableCell;
- (NSString *)_accessibilityPhotoDescription;
- (BOOL)accessibilityPerformEscape;
+- (NSString *)accessibilityDOMIdentifier;
// TextMarker related
- (NSArray *)textMarkerRange;
@@ -1226,6 +1227,11 @@
return nullptr;
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
+{
+ return [[m_element accessibilityDOMIdentifier] createJSStringRef];
+}
+
void AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef, Vector<AccessibilityUIElement>&) const
{
}
Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (285775 => 285776)
--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm 2021-11-13 18:38:12 UTC (rev 285776)
@@ -38,6 +38,10 @@
#import <wtf/Vector.h>
#import <wtf/cocoa/VectorCocoa.h>
+#ifndef NSAccessibilityDOMIdentifierAttribute
+#define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
+#endif
+
#ifndef NSAccessibilityOwnsAttribute
#define NSAccessibilityOwnsAttribute @"AXOwns"
#endif
@@ -660,6 +664,17 @@
return nullptr;
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ id value = [m_element accessibilityAttributeValue:NSAccessibilityDOMIdentifierAttribute];
+ if ([value isKindOfClass:[NSString class]])
+ return [value createJSStringRef];
+ END_AX_OBJC_EXCEPTIONS
+
+ return nullptr;
+}
+
JSRetainPtr<JSStringRef> AccessibilityUIElement::orientation() const
{
BEGIN_AX_OBJC_EXCEPTIONS
Modified: trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp (285775 => 285776)
--- trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp 2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp 2021-11-13 18:38:12 UTC (rev 285776)
@@ -990,6 +990,12 @@
return 0;
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
+{
+ // FIXME: implement
+ return 0;
+}
+
unsigned AccessibilityUIElement::selectedChildrenCount() const
{
// FIXME: implement