<!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>[286530] trunk/LayoutTests</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/286530">286530</a></dd>
<dt>Author</dt> <dd>tyler_w@apple.com</dd>
<dt>Date</dt> <dd>2021-12-04 07:22:57 -0800 (Sat, 04 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Make ellipsis-text.html, aria-roledescription.html, and aria-switch-checked.html pass in isolated tree mode
https://bugs.webkit.org/show_bug.cgi?id=233790

Reviewed by Chris Fleizach.

* accessibility/aria-roledescription-expected.txt:
* accessibility/aria-roledescription.html:
* accessibility/aria-switch-checked-expected.txt:
* accessibility/aria-switch-checked.html:
Make these tests async. They must be made async to pass in
isolated tree mode as they dynamically change page content using JS.

* accessibility/ellipsis-text.html:
Make this test isolated-tree-friendly by selecting elements with accessibleElementById instead
`document.getElementById("id").focus()` and `accessibilityController.focusedElement`

* platform/glib/accessibility/aria-roledescription-expected.txt:
Update platform-specfic expectation for the new version of this test.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariaroledescriptionexpectedtxt">trunk/LayoutTests/accessibility/aria-roledescription-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariaroledescriptionhtml">trunk/LayoutTests/accessibility/aria-roledescription.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariaswitchcheckedexpectedtxt">trunk/LayoutTests/accessibility/aria-switch-checked-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariaswitchcheckedhtml">trunk/LayoutTests/accessibility/aria-switch-checked.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilityellipsistexthtml">trunk/LayoutTests/accessibility/ellipsis-text.html</a></li>
<li><a href="#trunkLayoutTestsplatformglibaccessibilityariaroledescriptionexpectedtxt">trunk/LayoutTests/platform/glib/accessibility/aria-roledescription-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/ChangeLog 2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2021-12-04  Tyler Wilcock  <tyler_w@apple.com>
+
+        AX: Make ellipsis-text.html, aria-roledescription.html, and aria-switch-checked.html pass in isolated tree mode
+        https://bugs.webkit.org/show_bug.cgi?id=233790
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-roledescription-expected.txt:
+        * accessibility/aria-roledescription.html:
+        * accessibility/aria-switch-checked-expected.txt:
+        * accessibility/aria-switch-checked.html:
+        Make these tests async. They must be made async to pass in
+        isolated tree mode as they dynamically change page content using JS.
+
+        * accessibility/ellipsis-text.html:
+        Make this test isolated-tree-friendly by selecting elements with accessibleElementById instead
+        `document.getElementById("id").focus()` and `accessibilityController.focusedElement`
+
+        * platform/glib/accessibility/aria-roledescription-expected.txt:
+        Update platform-specfic expectation for the new version of this test.
+
</ins><span class="cx"> 2021-12-03  Said Abou-Hallawa  <said@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [GPU Process] (REGRESSION r285597): Fix SVGFilter clamping calculation
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariaroledescriptionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-roledescription-expected.txt (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-roledescription-expected.txt        2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/accessibility/aria-roledescription-expected.txt   2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><del>-text
</del><span class="cx"> This tests that aria-roledescription works.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-Role description: AXRoleDescription: Super Button.
-Role description: AXRoleDescription: button.
-Role description: AXRoleDescription: button.
-Role description: AXRoleDescription: Super Button.
-Role description: AXRoleDescription: button.
</del><ins>+PASS axButton.roleDescription is 'AXRoleDescription: Super Button'
+PASS Got default role description: AXRoleDescription: button
+PASS axButton.roleDescription === 'AXRoleDescription: Super Button'
+PASS Got default role description: AXRoleDescription: button
+PASS axButton.roleDescription === 'AXRoleDescription: Super Button'
+PASS Got default role description: AXRoleDescription: button
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span><del>-
</del><ins>+text
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariaroledescriptionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-roledescription.html (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-roledescription.html        2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/accessibility/aria-roledescription.html   2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -1,45 +1,62 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
</ins><span class="cx"> <html>
</span><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><span class="cx"> <body>
</span><span class="cx"> 
</span><span class="cx"> <div id="btn" role="button" aria-roledescription="Super Button">text</div>
</span><span class="cx"> 
</span><del>-<p id="description"></p>
-<div id="console"></div>
-
</del><span class="cx"> <script>
</span><del>-
-function runTest() {
</del><span class="cx">     description("This tests that aria-roledescription works.");
</span><span class="cx"> 
</span><span class="cx">     if (window.accessibilityController) {
</span><ins>+        window.jsTestIsAsync = true;
</ins><span class="cx"> 
</span><del>-        // Confirm we can override our role description.
-        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
</del><ins>+        var domButton = document.getElementById("btn");
+        var axButton = accessibilityController.accessibleElementById("btn");
</ins><span class="cx"> 
</span><del>-        // Confirm our role description returns to default when set to zero length.
-        document.getElementById("btn").setAttribute("aria-roledescription", "");
-        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
</del><ins>+        async function waitForDefaultRoleDescription(element) {
+            await waitFor(() => {
+                let roleDescription = element.roleDescription;
+                // The default role description differs per-platform, so wait for the lack of "Super Button".
+                return roleDescription && !roleDescription.includes("Super Button");
+            });
+            debug(`PASS Got default role description: ${element.roleDescription}`)
+        }
</ins><span class="cx"> 
</span><del>-        // Confirm our role description returns to default when set to whitespace only.
-        document.getElementById("btn").setAttribute("aria-roledescription", "     ");
-        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
</del><ins>+        setTimeout(async function() {
+            // Confirm we can override our role description.
+            shouldBe("axButton.roleDescription", "'AXRoleDescription: Super Button'");
</ins><span class="cx"> 
</span><del>-        // Confirm our role description strips extraneous whitespace characters.
-        document.getElementById("btn").setAttribute("aria-roledescription", "          Super Button          ");
-        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
</del><ins>+            // Confirm our role description returns to default when set to zero length.
+            domButton.setAttribute("aria-roledescription", "");
+            await waitForDefaultRoleDescription(axButton);
</ins><span class="cx"> 
</span><del>-        // Confirm our role description returns to default when removed.
-        document.getElementById("btn").removeAttribute("aria-roledescription");
-        debug("Role description: " + accessibilityController.accessibleElementById("btn").roleDescription + ".");
</del><ins>+            // Confirm our role description strips extraneous whitespace characters.
+            domButton.setAttribute("aria-roledescription", "          Super Button          ");
+            await expectAsyncExpression("axButton.roleDescription", "'AXRoleDescription: Super Button'")
+
+            // Confirm our role description returns to default when set to whitespace only.
+            domButton.setAttribute("aria-roledescription", "     ");
+            await waitForDefaultRoleDescription(axButton);
+
+            // Confirm our role description strips extraneous whitespace (including new line) characters.
+            domButton.setAttribute("aria-roledescription", `          Super Button          
+
+
+
+            `);
+            await expectAsyncExpression("axButton.roleDescription", "'AXRoleDescription: Super Button'")
+
+            // Confirm our role description returns to default when removed.
+            domButton.removeAttribute("aria-roledescription");
+            await waitForDefaultRoleDescription(axButton);
+
+            finishJSTest();
+        }, 0);
</ins><span class="cx">     }
</span><del>-}
-
-runTest();
</del><span class="cx"> </script>
</span><del>-
</del><span class="cx"> </body>
</span><del>-<script src="../resources/js-test-post.js"></script>
</del><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariaswitchcheckedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-switch-checked-expected.txt (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-switch-checked-expected.txt 2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/accessibility/aria-switch-checked-expected.txt    2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -1,16 +1,13 @@
</span><del>-X
-X
-X
</del><span class="cx"> This tests that ARIA switches correctly handle the aria-checked attribute.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS widget.isChecked is false
-PASS widget.isChecked is true
-PASS widget.isChecked is false
-PASS widget.isChecked is true
-PASS widget.isChecked is false
</del><ins>+PASS switch1.isChecked is false
+PASS switch2.isChecked is true
+PASS switch3.isChecked is false
+PASS switch3.isChecked === true
+PASS switch3.isChecked === false
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariaswitchcheckedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-switch-checked.html (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-switch-checked.html 2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/accessibility/aria-switch-checked.html    2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -1,43 +1,52 @@
</span><span class="cx"> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
</span><span class="cx"> <html>
</span><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">
-<div role="switch" id="switch1">X</div>
-<div role="switch" id="switch2" aria-checked="true">X</div>
-<div role="switch" id="switch3" aria-checked="false">X</div>
-<p id="description"></p>
-<div id="console"></div>
</del><ins>+<body>
+
+<div id="content">
+    <div role="switch" id="switch1">X</div>
+    <div role="switch" id="switch2" aria-checked="true">X</div>
+    <div role="switch" id="switch3" aria-checked="false">X</div>
+</div>
+
</ins><span class="cx"> <script>
</span><del>-
</del><span class="cx">     description("This tests that ARIA switches correctly handle the aria-checked attribute.");
</span><span class="cx"> 
</span><span class="cx">     if (window.accessibilityController) {
</span><del>-        // If aria-checked is absent, it should be not checked.
-        var widget = accessibilityController.accessibleElementById("switch1");
-        shouldBeFalse("widget.isChecked");
</del><ins>+        window.jsTestIsAsync = true;
</ins><span class="cx"> 
</span><del>-        // If aria-checked is present and true, it's clearly checked.
-        widget = accessibilityController.accessibleElementById("switch2");
-        shouldBeTrue("widget.isChecked");
</del><ins>+        var switch1, switch2, switch3;
+        setTimeout(async function() {
+            // If aria-checked is absent, it should be not checked.
+            switch1 = accessibilityController.accessibleElementById("switch1");
+            shouldBeFalse("switch1.isChecked");
</ins><span class="cx"> 
</span><del>-        // If aria-checked is present and false, it's clearly not checked.
-        widget = accessibilityController.accessibleElementById("switch3");
-        shouldBeFalse("widget.isChecked");
</del><ins>+            // If aria-checked is present and true, it's clearly checked.
+            switch2 = accessibilityController.accessibleElementById("switch2");
+            shouldBeTrue("switch2.isChecked");
</ins><span class="cx"> 
</span><del>-        // Change the value on the element and be sure we see the change
-        var element = document.getElementById("switch3");
-        element.setAttribute("aria-checked", "true");
-        shouldBeTrue("widget.isChecked");
</del><ins>+            // If aria-checked is present and false, it's clearly not checked.
+            switch3 = accessibilityController.accessibleElementById("switch3");
+            shouldBeFalse("switch3.isChecked");
</ins><span class="cx"> 
</span><del>-        // Remove the attribute from the element and be sure we see the change
-        element.removeAttribute("aria-checked");
-        shouldBeFalse("widget.isChecked");
</del><ins>+            let domSwitch3 = document.getElementById("switch3");
+            // Change the value on the element and be sure we see the change.
+            domSwitch3.setAttribute("aria-checked", "true");
+            await expectAsyncExpression("switch3.isChecked", "true");
+
+            // Remove the attribute from the element and be sure we see the change.
+            domSwitch3.removeAttribute("aria-checked");
+            await expectAsyncExpression("switch3.isChecked", "false");
+
+            document.getElementById("content").style.visibility = "hidden";
+
+            finishJSTest();
+        }, 0);
</ins><span class="cx">     }
</span><del>-
</del><span class="cx"> </script>
</span><del>-
-<script src="../resources/js-test-post.js"></script>
</del><span class="cx"> </body>
</span><span class="cx"> </html>
</span><ins>+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityellipsistexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/ellipsis-text.html (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/ellipsis-text.html       2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/accessibility/ellipsis-text.html  2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -18,14 +18,12 @@
</span><span class="cx">             description("This test makes sure that the bounds of text that overflows with ellipsis is correct (shortened to the ellipsis that is).");
</span><span class="cx"> 
</span><span class="cx">             // The width of the ellipsis text should be short.
</span><del>-            document.getElementById("text-ellipsis").focus();
-            var textContainer = accessibilityController.focusedElement;
</del><ins>+            var textContainer = accessibilityController.accessibleElementById("text-ellipsis");
</ins><span class="cx">             var textNode = textContainer.childrenCount ? textContainer.childAtIndex(0) : textContainer;
</span><span class="cx">             var clippedWidth = textNode.width;
</span><span class="cx"> 
</span><span class="cx">             // The width of non-ellipsis'd text should be longer.
</span><del>-            document.getElementById("text-noellipsis").focus();
-            textContainer = accessibilityController.focusedElement;
</del><ins>+            textContainer = accessibilityController.accessibleElementById("text-noellipsis");
</ins><span class="cx">             textNode = textContainer.childrenCount ? textContainer.childAtIndex(0) : textContainer;
</span><span class="cx">             var fullWidth = textNode.width;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformglibaccessibilityariaroledescriptionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/glib/accessibility/aria-roledescription-expected.txt (286529 => 286530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/glib/accessibility/aria-roledescription-expected.txt  2021-12-04 13:52:55 UTC (rev 286529)
+++ trunk/LayoutTests/platform/glib/accessibility/aria-roledescription-expected.txt     2021-12-04 15:22:57 UTC (rev 286530)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><del>-text
</del><span class="cx"> This tests that aria-roledescription works.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-Role description: AXRoleDescription: Super Button.
-Role description: AXRoleDescription: .
-Role description: AXRoleDescription: .
-Role description: AXRoleDescription: Super Button.
-Role description: AXRoleDescription: .
</del><ins>+PASS axButton.roleDescription is 'AXRoleDescription: Super Button'
+PASS Got default role description: AXRoleDescription:
+PASS axButton.roleDescription === 'AXRoleDescription: Super Button'
+PASS Got default role description: AXRoleDescription:
+PASS axButton.roleDescription === 'AXRoleDescription: Super Button'
+PASS Got default role description: AXRoleDescription:
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span><del>-
</del><ins>+text
</ins></span></pre>
</div>
</div>

</body>
</html>