Title: [287455] trunk/Source/WebCore
Revision
287455
Author
[email protected]
Date
2021-12-26 23:36:06 -0800 (Sun, 26 Dec 2021)

Log Message

[GTK][a11y] Test /webkit/WebKitAccessibility/selection/listbox is flaky with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=234665

Reviewed by Adrian Perez de Castro.

The problem is that selection-changed can be called multiple times for list boxes. When the notification is
deferred by the AXObject cache, it's ensured to be called only one for every element in the following run loop
iteration, but when not deferred the signal is emitted for every notification.

* accessibility/atspi/AccessibilityObjectAtspi.h:
* accessibility/atspi/AccessibilityObjectSelectionAtspi.cpp:
(WebCore::AccessibilityObjectAtspi::selectionChanged): Ensure we don't emit the selection-changed signal more
than once in the same run loop iteration.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287454 => 287455)


--- trunk/Source/WebCore/ChangeLog	2021-12-27 07:34:58 UTC (rev 287454)
+++ trunk/Source/WebCore/ChangeLog	2021-12-27 07:36:06 UTC (rev 287455)
@@ -1,3 +1,19 @@
+2021-12-26  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][a11y] Test /webkit/WebKitAccessibility/selection/listbox is flaky with ATSPI
+        https://bugs.webkit.org/show_bug.cgi?id=234665
+
+        Reviewed by Adrian Perez de Castro.
+
+        The problem is that selection-changed can be called multiple times for list boxes. When the notification is
+        deferred by the AXObject cache, it's ensured to be called only one for every element in the following run loop
+        iteration, but when not deferred the signal is emitted for every notification.
+
+        * accessibility/atspi/AccessibilityObjectAtspi.h:
+        * accessibility/atspi/AccessibilityObjectSelectionAtspi.cpp:
+        (WebCore::AccessibilityObjectAtspi::selectionChanged): Ensure we don't emit the selection-changed signal more
+        than once in the same run loop iteration.
+
 2021-12-26  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Do not trim the hanging trailing content

Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h (287454 => 287455)


--- trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h	2021-12-27 07:34:58 UTC (rev 287454)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h	2021-12-27 07:36:06 UTC (rev 287455)
@@ -246,6 +246,7 @@
     Atomic<bool> m_isRegistered { false };
     String m_path;
     String m_hyperlinkPath;
+    int64_t m_lastSelectionChangedTime { -1 };
     mutable std::atomic<bool> m_hasListMarkerAtStart;
     mutable int m_indexInParent { -1 };
     mutable Lock m_rootLock;

Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectSelectionAtspi.cpp (287454 => 287455)


--- trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectSelectionAtspi.cpp	2021-12-27 07:34:58 UTC (rev 287454)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectSelectionAtspi.cpp	2021-12-27 07:36:06 UTC (rev 287455)
@@ -224,6 +224,15 @@
 void AccessibilityObjectAtspi::selectionChanged()
 {
     RELEASE_ASSERT(isMainThread());
+
+    // selectionChanged can be called multiple times by WebCore, so ensure we don't
+    // emit it if the last one happened in the same run loop iteration.
+    auto* source = g_main_current_source();
+    int64_t sourceTime = source ? g_source_get_time(source) : -1;
+    if (sourceTime <= m_lastSelectionChangedTime)
+        return;
+
+    m_lastSelectionChangedTime = sourceTime;
     m_root.atspi().selectionChanged(*this);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to