Diff
Modified: trunk/Source/WebCore/ChangeLog (288402 => 288403)
--- trunk/Source/WebCore/ChangeLog 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/ChangeLog 2022-01-22 09:31:27 UTC (rev 288403)
@@ -1,3 +1,31 @@
+2022-01-22 Carlos Garcia Campos <[email protected]>
+
+ [GTK][a11y] Stop registering the tree when clients are connected with ATSPI
+ https://bugs.webkit.org/show_bug.cgi?id=235313
+
+ Reviewed by Adrian Perez de Castro.
+
+ That was needed with the isolated tree mode, now we can go back to register objects on demand.
+
+ * accessibility/atspi/AXObjectCacheAtspi.cpp:
+ (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate):
+ * accessibility/atspi/AccessibilityAtspi.cpp:
+ (WebCore::AccessibilityAtspi::addClient):
+ (WebCore::AccessibilityAtspi::parentChanged):
+ (WebCore::AccessibilityAtspi::childrenChanged):
+ (WebCore::AccessibilityAtspi::cacheClearTimerFired):
+ * accessibility/atspi/AccessibilityObjectAtspi.cpp:
+ (WebCore::AccessibilityObjectAtspi::isTreeRegistered const): Deleted.
+ * accessibility/atspi/AccessibilityObjectAtspi.h:
+ * accessibility/atspi/AccessibilityRootAtspi.cpp:
+ (WebCore::AccessibilityRootAtspi::embedded):
+ (WebCore::AccessibilityRootAtspi::child const):
+ (WebCore::AccessibilityRootAtspi::childAdded):
+ (WebCore::registerSubtree): Deleted.
+ (WebCore::AccessibilityRootAtspi::registerTree): Deleted.
+ (WebCore::AccessibilityRootAtspi::didUnregisterTree): Deleted.
+ * accessibility/atspi/AccessibilityRootAtspi.h:
+
2022-01-21 Tim Horton <[email protected]>
GraphicsContextStateChange logging doesn't dump shadow color
Modified: trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp (288402 => 288403)
--- trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp 2022-01-22 09:31:27 UTC (rev 288403)
@@ -39,12 +39,6 @@
auto wrapper = AccessibilityObjectAtspi::create(axObject, atspiRoot);
axObject->setWrapper(wrapper.ptr());
- // Handle the root earlier here, since we know it only has one child.
- if (!axObject->parentObjectUnignored() && axObject->isScrollView() && axObject->scrollView() == document().view() && atspiRoot) {
- wrapper->setParent(nullptr); // nullptr means root.
- return;
- }
-
m_deferredParentChangedList.add(axObject);
m_performCacheUpdateTimer.startOneShot(0_s);
}
@@ -57,8 +51,11 @@
return;
auto* axParent = axObject.parentObjectUnignored();
- if (!axParent)
+ if (!axParent) {
+ if (axObject.isScrollView() && axObject.scrollView() == document().view())
+ wrapper->setParent(nullptr); // nullptr means root.
return;
+ }
if (auto* axParentWrapper = axParent->wrapper())
wrapper->setParent(axParentWrapper);
Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp (288402 => 288403)
--- trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp 2022-01-22 09:31:27 UTC (rev 288403)
@@ -184,10 +184,8 @@
void AccessibilityAtspi::addClient(const char* dbusName)
{
- if (m_clients.isEmpty()) {
- for (auto* rootObject : m_rootObjects.keys())
- rootObject->registerTree();
- }
+ if (m_clients.isEmpty())
+ AXObjectCache::enableAccessibility();
auto addResult = m_clients.add(dbusName, 0);
if (!addResult.isNewEntry)
@@ -375,8 +373,8 @@
if (!m_connection)
return;
- // Always emit parentChanged when the tree is registered because the atspi cache always consumes it.
- if (!atspiObject.isTreeRegistered())
+ // Always emit parentChanged when there are clients because the atspi cache always consumes it.
+ if (!m_clients.isEmpty())
return;
// Emit parentChanged only if the object is already registered, otherwise register the object,
@@ -395,6 +393,10 @@
if (!m_connection)
return;
+ // Always emit parentChanged when there are clients because the atspi cache always consumes it.
+ if (m_clients.isEmpty())
+ return;
+
g_dbus_connection_emit_signal(m_connection.get(), nullptr, rootObject.path().utf8().data(), "org.a11y.atspi.Event.Object", "PropertyChange",
g_variant_new("(siiva{sv})", "accessible-parent", 0, 0, rootObject.parentReference(), nullptr), nullptr);
}
@@ -408,8 +410,8 @@
if (!m_connection)
return;
- // Always emit ChildrenChanged when the tree is registered because the atspi cache always consumes it.
- if (!atspiObject.isTreeRegistered())
+ // Always emit ChildrenChanged when there are clients because the atspi cache always consumes it.
+ if (m_clients.isEmpty())
return;
addToCacheIfPending(atspiObject);
@@ -425,6 +427,10 @@
if (!m_connection)
return;
+ // Always emit ChildrenChanged when there are clients because the atspi cache always consumes it.
+ if (m_clients.isEmpty())
+ return;
+
addToCacheIfPending(child);
g_dbus_connection_emit_signal(m_connection.get(), nullptr, rootObject.path().utf8().data(), "org.a11y.atspi.Event.Object", "ChildrenChanged",
@@ -837,10 +843,6 @@
it.key->didUnregisterObject();
}
m_atspiObjects.clear();
-
- for (auto* rootObject : m_rootObjects.keys())
- rootObject->didUnregisterTree();
-
m_cache.clear();
RELEASE_ASSERT(m_cacheUpdateList.isEmpty());
Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp (288402 => 288403)
--- trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp 2022-01-22 09:31:27 UTC (rev 288403)
@@ -476,11 +476,6 @@
return m_root;
}
-bool AccessibilityObjectAtspi::isTreeRegistered() const
-{
- return m_root ? m_root->isTreeRegistered() : false;
-}
-
bool AccessibilityObjectAtspi::registerObject()
{
if (!m_path.isNull())
Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h (288402 => 288403)
--- trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.h 2022-01-22 09:31:27 UTC (rev 288403)
@@ -41,7 +41,6 @@
~AccessibilityObjectAtspi() = default;
bool registerObject();
- bool isTreeRegistered() const;
void didUnregisterObject();
enum class Interface : uint16_t {
Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.cpp (288402 => 288403)
--- trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.cpp 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.cpp 2022-01-22 09:31:27 UTC (rev 288403)
@@ -30,7 +30,6 @@
#include "FrameView.h"
#include "Page.h"
#include <glib/gi18n-lib.h>
-#include <wtf/SetForScope.h>
namespace WebCore {
@@ -169,36 +168,6 @@
m_page->setAccessibilityRootObject(nullptr);
}
-static void registerSubtree(AccessibilityObjectAtspi* atspiObject)
-{
- if (!atspiObject)
- return;
-
- if (!atspiObject->registerObject())
- return;
-
- atspiObject->updateBackingStore();
- for (auto& child : atspiObject->children())
- registerSubtree(child.get());
-}
-
-void AccessibilityRootAtspi::registerTree()
-{
- if (m_parentUniqueName.isNull())
- return;
-
- if (m_isTreeRegistered)
- return;
-
- registerSubtree(child());
- m_isTreeRegistered = true;
-}
-
-void AccessibilityRootAtspi::didUnregisterTree()
-{
- m_isTreeRegistered = false;
-}
-
void AccessibilityRootAtspi::setPath(String&& path)
{
m_path = WTFMove(path);
@@ -209,8 +178,6 @@
m_parentUniqueName = parentUniqueName;
m_parentPath = parentPath;
AccessibilityAtspi::singleton().parentChanged(*this);
- if (AccessibilityAtspi::singleton().hasClients())
- registerTree();
}
GVariant* AccessibilityRootAtspi::applicationReference() const
@@ -239,8 +206,6 @@
if (!frame.document())
return nullptr;
- SetForScope<bool> inChild(m_inChild, true);
-
AXObjectCache::enableAccessibility();
AXObjectCache* cache = frame.document()->axObjectCache();
if (!cache)
@@ -252,13 +217,6 @@
void AccessibilityRootAtspi::childAdded(AccessibilityObjectAtspi& child)
{
- // Don't emit children changed when called from child() because that means the tree is being populated.
- if (m_inChild || !m_isTreeRegistered)
- return;
-
- if (this->child() != &child)
- return;
-
AccessibilityAtspi::singleton().childrenChanged(*this, child, AccessibilityAtspi::ChildrenChanged::Added);
}
Modified: trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.h (288402 => 288403)
--- trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.h 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Source/WebCore/accessibility/atspi/AccessibilityRootAtspi.h 2022-01-22 09:31:27 UTC (rev 288403)
@@ -40,9 +40,6 @@
void registerObject(CompletionHandler<void(const String&)>&&);
void unregisterObject();
- void registerTree();
- void didUnregisterTree();
- bool isTreeRegistered() const { return m_isTreeRegistered; }
void setPath(String&&);
const String& path() const { return m_path; }
@@ -69,8 +66,6 @@
String m_path;
String m_parentUniqueName;
String m_parentPath;
- bool m_isTreeRegistered { false };
- mutable bool m_inChild { false };
};
} // namespace WebCore
Modified: trunk/Tools/ChangeLog (288402 => 288403)
--- trunk/Tools/ChangeLog 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Tools/ChangeLog 2022-01-22 09:31:27 UTC (rev 288403)
@@ -1,3 +1,14 @@
+2022-01-22 Carlos Garcia Campos <[email protected]>
+
+ [GTK][a11y] Stop registering the tree when clients are connected with ATSPI
+ https://bugs.webkit.org/show_bug.cgi?id=235313
+
+ Reviewed by Adrian Perez de Castro.
+
+ * TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp:
+ (testDocumentLoadEvents): Now we don't get the initial event from previous document web because it happens
+ before the first client is connected.
+
2022-01-21 Jonathan Bedard <[email protected]>
[EWS] Support pull-requests in ValidateChange (Follow-up fix)
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp (288402 => 288403)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp 2022-01-22 07:39:40 UTC (rev 288402)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp 2022-01-22 09:31:27 UTC (rev 288403)
@@ -2393,17 +2393,14 @@
"</html>",
nullptr);
test->waitUntilLoadFinished();
- auto events = test->stopEventMonitor(3);
- g_assert_cmpuint(events.size(), ==, 3);
+ auto events = test->stopEventMonitor(2);
+ g_assert_cmpuint(events.size(), ==, 2);
g_assert_cmpstr(events[0]->type, ==, "object:state-changed:busy");
- g_assert_cmpuint(events[0]->detail1, ==, 1);
- g_assert_cmpstr(events[1]->type, ==, "object:state-changed:busy");
- g_assert_cmpuint(events[1]->detail1, ==, 0);
- g_assert_false(events[0]->source == events[1]->source);
+ g_assert_cmpuint(events[0]->detail1, ==, 0);
g_assert_true(ATSPI_IS_ACCESSIBLE(events[0]->source));
g_assert_cmpint(atspi_accessible_get_role(events[0]->source, nullptr), ==, ATSPI_ROLE_DOCUMENT_WEB);
- g_assert_cmpstr(events[2]->type, ==, "document:load-complete");
- g_assert_true(events[1]->source == events[2]->source);
+ g_assert_cmpstr(events[1]->type, ==, "document:load-complete");
+ g_assert_true(events[0]->source == events[1]->source);
g_assert_true(ATSPI_IS_ACCESSIBLE(events[1]->source));
g_assert_cmpint(atspi_accessible_get_role(events[1]->source, nullptr), ==, ATSPI_ROLE_DOCUMENT_WEB);
events = { };