<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285776] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285776">285776</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-11-13 10:38:12 -0800 (Sat, 13 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Make accessibility/mac/header.html test async to fix it for isolated tree mode
https://bugs.webkit.org/show_bug.cgi?id=233017

Patch by Tyler Wilcock <tyler_w@apple.com> on 2021-11-13
Reviewed by Andres Gonzalez.

Tools:

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.

LayoutTests:

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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacheaderexpectedtxt">trunk/LayoutTests/accessibility/mac/header-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacheaderhtml">trunk/LayoutTests/accessibility/mac/header.html</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeAccessibilityUIElementcpp">trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeAccessibilityUIElementh">trunk/Tools/DumpRenderTree/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsDumpRenderTreeiosAccessibilityUIElementIOSmm">trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm">trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreewinAccessibilityUIElementWincpp">trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/LayoutTests/ChangeLog 2021-11-13 18:38:12 UTC (rev 285776)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2021-11-13  Tyler Wilcock  <tyler_w@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.
+
</ins><span class="cx"> 2021-11-12  Said Abou-Hallawa  <said@apple.com>
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r285481): Infinite recursion with cyclic filter reference
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacheaderexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/header-expected.txt (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -10,4 +10,3 @@
</span><span class="cx"> Header outside section and article elements.
</span><span class="cx"> Header inside an article.
</span><span class="cx"> Header inside a section.
</span><del>-
</del></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacheaderhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/header.html (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,36 +1,45 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
</ins><span class="cx"> <html>
</span><del>-<html>
</del><span class="cx"> <head>
</span><del>-<script src='../../resources/js-test-pre.js'></script>
</del><ins>+<script src="../../resources/js-test.js"></script>
+<script src="../../resources/accessibility-helper.js"></script>
</ins><span class="cx"> </head>
</span><del>-<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));
-        }
</del><ins>+<body>
</ins><span class="cx"> 
</span><del>-        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);
-        }
</del><ins>+<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>
</ins><span class="cx"> 
</span><del>-        expectRole('AXGroup', 'banner', '#header01');
-        expectRole('AXGroup', 'group', '#header02');
-        expectRole('AXGroup', 'group', '#header03');
-    </script>
-<script src='../../resources/js-test-post.js'></script>
</del><ins>+<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>
+
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span><ins>+
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-11-13 16:44:06 UTC (rev 285775)
+++ trunk/Tools/ChangeLog       2021-11-13 18:38:12 UTC (rev 285776)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2021-11-13  Tyler Wilcock  <tyler_w@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.
+
</ins><span class="cx"> 2021-11-12  Jonathan Bedard  <jbedard@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [webkitpy] Symlink daemons into simulator runtime root
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1168,6 +1168,12 @@
</span><span class="cx">     return JSValueMakeString(context, classList.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static JSValueRef domIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    auto domIdentifier = toAXElement(thisObject)->domIdentifier();
+    return JSValueMakeString(context, domIdentifier.get());
+}
+
</ins><span class="cx"> static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
</span><span class="cx"> {
</span><span class="cx">     return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed());
</span><span class="lines">@@ -1945,6 +1951,7 @@
</span><span class="cx">         { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { "classList", getClassListCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+        { "domIdentifier", domIdentifierCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx">         { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { "speakAs", speakAsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -175,6 +175,7 @@
</span><span class="cx">     JSRetainPtr<JSStringRef> documentURI();
</span><span class="cx">     JSRetainPtr<JSStringRef> url();
</span><span class="cx">     JSRetainPtr<JSStringRef> classList() const;
</span><ins>+    JSRetainPtr<JSStringRef> domIdentifier() const;
</ins><span class="cx"> 
</span><span class="cx">     // CSS3-speech properties.
</span><span class="cx">     JSRetainPtr<JSStringRef> speakAs();
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosAccessibilityUIElementIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -94,6 +94,7 @@
</span><span class="cx"> - (BOOL)_accessibilityIsInTableCell;
</span><span class="cx"> - (NSString *)_accessibilityPhotoDescription;
</span><span class="cx"> - (BOOL)accessibilityPerformEscape;
</span><ins>+- (NSString *)accessibilityDOMIdentifier;
</ins><span class="cx"> 
</span><span class="cx"> // TextMarker related
</span><span class="cx"> - (NSArray *)textMarkerRange;
</span><span class="lines">@@ -1226,6 +1227,11 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
+{
+    return [[m_element accessibilityDOMIdentifier] createJSStringRef];
+}
+
</ins><span class="cx"> void AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef, Vector<AccessibilityUIElement>&) const
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -38,6 +38,10 @@
</span><span class="cx"> #import <wtf/Vector.h>
</span><span class="cx"> #import <wtf/cocoa/VectorCocoa.h>
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilityDOMIdentifierAttribute
+#define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
+#endif
+
</ins><span class="cx"> #ifndef NSAccessibilityOwnsAttribute
</span><span class="cx"> #define NSAccessibilityOwnsAttribute @"AXOwns"
</span><span class="cx"> #endif
</span><span class="lines">@@ -660,6 +664,17 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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;
+}
+
</ins><span class="cx"> JSRetainPtr<JSStringRef> AccessibilityUIElement::orientation() const
</span><span class="cx"> {
</span><span class="cx">     BEGIN_AX_OBJC_EXCEPTIONS
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinAccessibilityUIElementWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp (285775 => 285776)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -990,6 +990,12 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
+{
+    // FIXME: implement
+    return 0;
+}
+
</ins><span class="cx"> unsigned AccessibilityUIElement::selectedChildrenCount() const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: implement
</span></span></pre>
</div>
</div>

</body>
</html>