<!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>[286189] 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/286189">286189</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2021-11-27 08:41:21 -0800 (Sat, 27 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK][a11y] Signal state-changed:selected is not emitted for listbox elements when building with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=233521

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Post a selected change notification for option elements when the state changes.

* accessibility/atspi/AXObjectCacheAtspi.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::setSelectedState):

Tools:

Add test cases to check that the signal is now emitted as expected.

* TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp:
(AccessibilityTest::isSelected):
(testAccessibleStateChanged):
(testSelectionListBox):
(testSelectionMenuList):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityatspiAXObjectCacheAtspicpp">trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLOptionElementcpp">trunk/Source/WebCore/html/HTMLOptionElement.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitGtkTestWebKitAccessibilitycpp">trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286188 => 286189)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-11-27 09:44:59 UTC (rev 286188)
+++ trunk/Source/WebCore/ChangeLog      2021-11-27 16:41:21 UTC (rev 286189)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-11-27  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK][a11y] Signal state-changed:selected is not emitted for listbox elements when building with ATSPI
+        https://bugs.webkit.org/show_bug.cgi?id=233521
+
+        Reviewed by Adrian Perez de Castro.
+
+        Post a selected change notification for option elements when the state changes.
+
+        * accessibility/atspi/AXObjectCacheAtspi.cpp:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::setSelectedState):
+
</ins><span class="cx"> 2021-11-27  Antti Koivisto  <antti@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [:has() pseudo-class] Invalidation support for adding and removing elements
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityatspiAXObjectCacheAtspicpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp (286188 => 286189)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp  2021-11-27 09:44:59 UTC (rev 286188)
+++ trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp     2021-11-27 16:41:21 UTC (rev 286189)
</span><span class="lines">@@ -80,9 +80,15 @@
</span><span class="cx">             wrapper->stateChanged("checked", coreObject->isChecked());
</span><span class="cx">         break;
</span><span class="cx">     case AXSelectedStateChanged:
</span><del>-    case AXMenuListItemSelected:
</del><span class="cx">         wrapper->stateChanged("selected", coreObject->isSelected());
</span><span class="cx">         break;
</span><ins>+    case AXMenuListItemSelected: {
+        // Menu list popup items are handled by AXSelectedStateChanged.
+        auto* parent = coreObject->parentObjectUnignored();
+        if (parent && !parent->isMenuListPopup())
+            wrapper->stateChanged("selected", coreObject->isSelected());
+        break;
+    }
</ins><span class="cx">     case AXSelectedChildrenChanged:
</span><span class="cx">         wrapper->selectionChanged();
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLOptionElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLOptionElement.cpp (286188 => 286189)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLOptionElement.cpp  2021-11-27 09:44:59 UTC (rev 286188)
+++ trunk/Source/WebCore/html/HTMLOptionElement.cpp     2021-11-27 16:41:21 UTC (rev 286189)
</span><span class="lines">@@ -27,7 +27,9 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "HTMLOptionElement.h"
</span><span class="cx"> 
</span><ins>+#include "AXObjectCache.h"
</ins><span class="cx"> #include "Document.h"
</span><ins>+#include "DocumentInlines.h"
</ins><span class="cx"> #include "ElementAncestorIterator.h"
</span><span class="cx"> #include "HTMLDataListElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="lines">@@ -234,6 +236,11 @@
</span><span class="cx"> 
</span><span class="cx">     m_isSelected = selected;
</span><span class="cx">     invalidateStyleForSubtree();
</span><ins>+
+#if ENABLE(ACCESSIBILITY) && USE(ATSPI)
+    if (auto* cache = document().existingAXObjectCache())
+        cache->postNotification(this, AXObjectCache::AXSelectedStateChanged);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLOptionElement::childrenChanged(const ChildChange& change)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (286188 => 286189)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-11-27 09:44:59 UTC (rev 286188)
+++ trunk/Tools/ChangeLog       2021-11-27 16:41:21 UTC (rev 286189)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2021-11-27  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK][a11y] Signal state-changed:selected is not emitted for listbox elements when building with ATSPI
+        https://bugs.webkit.org/show_bug.cgi?id=233521
+
+        Reviewed by Adrian Perez de Castro.
+
+        Add test cases to check that the signal is now emitted as expected.
+
+        * TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp:
+        (AccessibilityTest::isSelected):
+        (testAccessibleStateChanged):
+        (testSelectionListBox):
+        (testSelectionMenuList):
+
</ins><span class="cx"> 2021-11-26  Lauro Moura  <lmoura@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GTK] Gardening API test WebKit.OnDeviceChangedCrash as flaky timeout
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitGtkTestWebKitAccessibilitycpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp (286188 => 286189)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp    2021-11-27 09:44:59 UTC (rev 286188)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp       2021-11-27 16:41:21 UTC (rev 286189)
</span><span class="lines">@@ -152,6 +152,12 @@
</span><span class="cx">         return length;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static bool isSelected(AtspiAccessible* element)
+    {
+        GRefPtr<AtspiStateSet> set = adoptGRef(atspi_accessible_get_state_set(element));
+        return atspi_state_set_contains(set.get(), ATSPI_STATE_SELECTED);
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     AtspiAccessible* m_eventSource { nullptr };
</span><span class="cx"> 
</span><span class="lines">@@ -668,7 +674,7 @@
</span><span class="cx"> 
</span><span class="cx"> static void testAccessibleStateChanged(AccessibilityTest* test, gconstpointer)
</span><span class="cx"> {
</span><del>-    test->showInWindow();
</del><ins>+    test->showInWindow(800, 600);
</ins><span class="cx">     test->loadHtml(
</span><span class="cx">         "<html>"
</span><span class="cx">         "  <body>"
</span><span class="lines">@@ -675,6 +681,8 @@
</span><span class="cx">         "    <input id='check' type='checkbox'/>Checkbox"
</span><span class="cx">         "    <button id='toggle' aria-pressed='true'>Toggle button</button>"
</span><span class="cx">         "    <input id='entry' value='Entry'>"
</span><ins>+        "    <select id='list' size='2'><option>1</option><option>2</option></select>"
+        "    <select id='combo'><option>1</option><option>2</option></select>"
</ins><span class="cx">         "  </body>"
</span><span class="cx">         "</html>",
</span><span class="cx">         nullptr);
</span><span class="lines">@@ -689,7 +697,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto section = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 0, nullptr));
</span><span class="cx">     g_assert_true(ATSPI_IS_ACCESSIBLE(section.get()));
</span><del>-    g_assert_cmpint(atspi_accessible_get_child_count(section.get(), nullptr), ==, 3);
</del><ins>+    g_assert_cmpint(atspi_accessible_get_child_count(section.get(), nullptr), ==, 5);
</ins><span class="cx"> 
</span><span class="cx">     unsigned nextChild = 0;
</span><span class="cx">     auto checkbox = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr));
</span><span class="lines">@@ -741,6 +749,66 @@
</span><span class="cx">     } else
</span><span class="cx">         g_assert_not_reached();
</span><span class="cx">     events = { };
</span><ins>+
+#if USE(ATSPI)
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('list').focus();", nullptr);
+    auto listBox = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(listBox.get()));
+    auto option1 = adoptGRef(atspi_accessible_get_child_at_index(listBox.get(), 0, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(option1.get()));
+    auto option2 = adoptGRef(atspi_accessible_get_child_at_index(listBox.get(), 1, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(option2.get()));
+    g_assert_false(AccessibilityTest::isSelected(option1.get()));
+    g_assert_false(AccessibilityTest::isSelected(option2.get()));
+    test->startEventMonitor(option1.get(), { "object:state-changed" });
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('list').selectedIndex = 0;", nullptr);
+    events = test->stopEventMonitor(1);
+    g_assert_cmpuint(events.size(), ==, 1);
+    g_assert_cmpstr(events[0]->type, ==, "object:state-changed:selected");
+    g_assert_cmpuint(events[0]->detail1, ==, 1);
+    events = { };
+    g_assert_true(AccessibilityTest::isSelected(option1.get()));
+    g_assert_false(AccessibilityTest::isSelected(option2.get()));
+    test->startEventMonitor(option1.get(), { "object:state-changed" });
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('list').selectedIndex = 1;", nullptr);
+    events = test->stopEventMonitor(1);
+    g_assert_cmpuint(events.size(), ==, 1);
+    g_assert_cmpstr(events[0]->type, ==, "object:state-changed:selected");
+    g_assert_cmpuint(events[0]->detail1, ==, 0);
+    events = { };
+    g_assert_false(AccessibilityTest::isSelected(option1.get()));
+    g_assert_true(AccessibilityTest::isSelected(option2.get()));
+
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('combo').focus();", nullptr);
+    auto combo = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(combo.get()));
+    auto menuList = adoptGRef(atspi_accessible_get_child_at_index(combo.get(), 0, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(menuList.get()));
+    option1 = adoptGRef(atspi_accessible_get_child_at_index(menuList.get(), 0, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(option1.get()));
+    option2 = adoptGRef(atspi_accessible_get_child_at_index(menuList.get(), 1, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(option2.get()));
+    g_assert_true(AccessibilityTest::isSelected(option1.get()));
+    g_assert_false(AccessibilityTest::isSelected(option2.get()));
+    test->startEventMonitor(option2.get(), { "object:state-changed" });
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('combo').selectedIndex = 1;", nullptr);
+    events = test->stopEventMonitor(1);
+    g_assert_cmpuint(events.size(), ==, 1);
+    g_assert_cmpstr(events[0]->type, ==, "object:state-changed:selected");
+    g_assert_cmpuint(events[0]->detail1, ==, 1);
+    events = { };
+    g_assert_true(AccessibilityTest::isSelected(option2.get()));
+    g_assert_false(AccessibilityTest::isSelected(option1.get()));
+    test->startEventMonitor(option2.get(), { "object:state-changed" });
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('combo').selectedIndex = 0", nullptr);
+    events = test->stopEventMonitor(1);
+    g_assert_cmpuint(events.size(), ==, 1);
+    g_assert_cmpstr(events[0]->type, ==, "object:state-changed:selected");
+    g_assert_cmpuint(events[0]->detail1, ==, 0);
+    events = { };
+    g_assert_true(AccessibilityTest::isSelected(option1.get()));
+    g_assert_false(AccessibilityTest::isSelected(option2.get()));
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void testComponentHitTest(AccessibilityTest* test, gconstpointer)
</span><span class="lines">@@ -2104,6 +2172,7 @@
</span><span class="cx">     g_assert_true(ATSPI_IS_ACCESSIBLE(selectedChild.get()));
</span><span class="cx">     auto option1 = adoptGRef(atspi_accessible_get_child_at_index(listBox.get(), 0, nullptr));
</span><span class="cx">     g_assert_true(selectedChild.get() == option1.get());
</span><ins>+    g_assert_true(AccessibilityTest::isSelected(option1.get()));
</ins><span class="cx">     test->startEventMonitor(listBox.get(), { "object:selection-changed" });
</span><span class="cx">     g_assert_true(atspi_selection_select_child(ATSPI_SELECTION(listBox.get()), 2, nullptr));
</span><span class="cx">     events = test->stopEventMonitor(1);
</span><span class="lines">@@ -2116,6 +2185,8 @@
</span><span class="cx">     g_assert_true(ATSPI_IS_ACCESSIBLE(selectedChild.get()));
</span><span class="cx">     auto option3 = adoptGRef(atspi_accessible_get_child_at_index(listBox.get(), 2, nullptr));
</span><span class="cx">     g_assert_true(selectedChild.get() == option3.get());
</span><ins>+    g_assert_true(AccessibilityTest::isSelected(option3.get()));
+    g_assert_false(AccessibilityTest::isSelected(option1.get()));
</ins><span class="cx">     g_assert_false(atspi_selection_deselect_selected_child(ATSPI_SELECTION(listBox.get()), 1, nullptr));
</span><span class="cx">     g_assert_cmpint(atspi_selection_get_n_selected_children(ATSPI_SELECTION(listBox.get()), nullptr), ==, 1);
</span><span class="cx">     g_assert_true(atspi_selection_deselect_selected_child(ATSPI_SELECTION(listBox.get()), 0, nullptr));
</span><span class="lines">@@ -2122,6 +2193,8 @@
</span><span class="cx">     g_assert_cmpint(atspi_selection_get_n_selected_children(ATSPI_SELECTION(listBox.get()), nullptr), ==, 0);
</span><span class="cx">     g_assert_false(atspi_selection_is_child_selected(ATSPI_SELECTION(listBox.get()), 2, nullptr));
</span><span class="cx">     g_assert_false(atspi_selection_select_all(ATSPI_SELECTION(listBox.get()), nullptr));
</span><ins>+    g_assert_false(AccessibilityTest::isSelected(option1.get()));
+    g_assert_false(AccessibilityTest::isSelected(option3.get()));
</ins><span class="cx">     g_assert_true(atspi_selection_select_child(ATSPI_SELECTION(listBox.get()), 0, nullptr));
</span><span class="cx">     g_assert_cmpint(atspi_selection_get_n_selected_children(ATSPI_SELECTION(listBox.get()), nullptr), ==, 1);
</span><span class="cx">     g_assert_true(atspi_selection_is_child_selected(ATSPI_SELECTION(listBox.get()), 0, nullptr));
</span><span class="lines">@@ -2148,6 +2221,7 @@
</span><span class="cx">     g_assert_true(ATSPI_IS_ACCESSIBLE(selectedChild.get()));
</span><span class="cx">     auto option2 = adoptGRef(atspi_accessible_get_child_at_index(listBox.get(), 1, nullptr));
</span><span class="cx">     g_assert_true(selectedChild.get() == option2.get());
</span><ins>+    g_assert_true(AccessibilityTest::isSelected(option2.get()));
</ins><span class="cx">     g_assert_true(atspi_selection_select_child(ATSPI_SELECTION(listBox.get()), 0, nullptr));
</span><span class="cx">     g_assert_cmpint(atspi_selection_get_n_selected_children(ATSPI_SELECTION(listBox.get()), nullptr), ==, 2);
</span><span class="cx">     g_assert_true(atspi_selection_is_child_selected(ATSPI_SELECTION(listBox.get()), 0, nullptr));
</span><span class="lines">@@ -2155,6 +2229,8 @@
</span><span class="cx">     selectedChild = adoptGRef(atspi_selection_get_selected_child(ATSPI_SELECTION(listBox.get()), 0, nullptr));
</span><span class="cx">     option1 = adoptGRef(atspi_accessible_get_child_at_index(listBox.get(), 0, nullptr));
</span><span class="cx">     g_assert_true(selectedChild.get() == option1.get());
</span><ins>+    g_assert_true(AccessibilityTest::isSelected(option1.get()));
+    g_assert_true(AccessibilityTest::isSelected(option2.get()));
</ins><span class="cx">     selectedChild = adoptGRef(atspi_selection_get_selected_child(ATSPI_SELECTION(listBox.get()), 1, nullptr));
</span><span class="cx">     g_assert_true(selectedChild.get() == option2.get());
</span><span class="cx">     g_assert_true(atspi_selection_deselect_child(ATSPI_SELECTION(listBox.get()), 1, nullptr));
</span><span class="lines">@@ -2211,6 +2287,8 @@
</span><span class="cx">     g_assert_cmpint(atspi_accessible_get_role(panel.get(), nullptr), ==, ATSPI_ROLE_PANEL);
</span><span class="cx">     g_assert_cmpint(atspi_accessible_get_child_count(panel.get(), nullptr), ==, 1);
</span><span class="cx"> 
</span><ins>+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('combo').focus();", nullptr);
+
</ins><span class="cx">     auto combo = adoptGRef(atspi_accessible_get_child_at_index(panel.get(), 0, nullptr));
</span><span class="cx">     g_assert_true(ATSPI_IS_ACCESSIBLE(combo.get()));
</span><span class="cx">     g_assert_cmpint(atspi_accessible_get_role(combo.get(), nullptr), ==, ATSPI_ROLE_COMBO_BOX);
</span><span class="lines">@@ -2231,6 +2309,9 @@
</span><span class="cx">     g_assert_true(ATSPI_IS_ACCESSIBLE(selectedChild.get()));
</span><span class="cx">     auto option2 = adoptGRef(atspi_accessible_get_child_at_index(menuList.get(), 1, nullptr));
</span><span class="cx">     g_assert_true(selectedChild.get() == option2.get());
</span><ins>+    g_assert_true(AccessibilityTest::isSelected(option2.get()));
+    auto option1 = adoptGRef(atspi_accessible_get_child_at_index(menuList.get(), 0, nullptr));
+    g_assert_false(AccessibilityTest::isSelected(option1.get()));
</ins><span class="cx">     g_assert_false(atspi_selection_select_child(ATSPI_SELECTION(menuList.get()), 3, nullptr));
</span><span class="cx">     test->startEventMonitor(menuList.get(), { "object:selection-changed" });
</span><span class="cx">     g_assert_true(atspi_selection_select_child(ATSPI_SELECTION(menuList.get()), 0, nullptr));
</span><span class="lines">@@ -2239,6 +2320,11 @@
</span><span class="cx">     g_assert_cmpstr(events[0]->type, ==, "object:selection-changed");
</span><span class="cx">     events = { };
</span><span class="cx">     g_assert_true(atspi_selection_is_child_selected(ATSPI_SELECTION(menuList.get()), 0, nullptr));
</span><ins>+    selectedChild = adoptGRef(atspi_selection_get_selected_child(ATSPI_SELECTION(menuList.get()), 0, nullptr));
+    g_assert_true(ATSPI_IS_ACCESSIBLE(selectedChild.get()));
+    g_assert_true(selectedChild.get() == option1.get());
+    g_assert_true(AccessibilityTest::isSelected(option1.get()));
+    g_assert_false(AccessibilityTest::isSelected(option2.get()));
</ins><span class="cx">     g_assert_false(atspi_selection_deselect_selected_child(ATSPI_SELECTION(menuList.get()), 0, nullptr));
</span><span class="cx">     g_assert_false(atspi_selection_deselect_child(ATSPI_SELECTION(menuList.get()), 0, nullptr));
</span><span class="cx">     g_assert_false(atspi_selection_select_all(ATSPI_SELECTION(menuList.get()), nullptr));
</span></span></pre>
</div>
</div>

</body>
</html>