[GTK][a11y] Connect UI process a11y tree with the web process when building with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=230255

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Add AccessibilityAtspi class to connect to the ATSPI DBus service using the address provided. Also add
AccessibilityRootAtspi class that will be the parent object of the accessibility root wrapper, and the children
of the UI process web view. In ATK the AtkSocket and AtkPlug use a private DBus message to send the unique name
of the UI process connection to the web process. That's not possible with GDBus, so we wait for the first
GetState message to be received (which is called right after atk_socket_embed() is called in the UI process) to
get the unique name of the UI process connection. PlatformDisplay has now API to get the DBus address of the
ATSPI service. This is used only in the UI process that sends the address to the web process, so that we don't
need to get it on every web process again.

* PlatformGTK.cmake:
* SourcesGTK.txt:
* accessibility/atspi/AccessibilityAtspi.cpp: Added.
(WebCore::AccessibilityAtspi::AccessibilityAtspi):
(WebCore::AccessibilityAtspi::uniqueName const):
(WebCore::AccessibilityAtspi::nullReference const):
(WebCore::AccessibilityAtspi::registerRoot):
* accessibility/atspi/AccessibilityAtspi.h: Added.
* accessibility/atspi/AccessibilityRootAtspi.cpp: Added.
(WebCore::AccessibilityRootAtspi::create):
(WebCore::AccessibilityRootAtspi::AccessibilityRootAtspi):
(WebCore::AccessibilityRootAtspi::registerObject):
(WebCore::AccessibilityRootAtspi::setPath):
(WebCore::AccessibilityRootAtspi::setParentPath):
(WebCore::AccessibilityRootAtspi::applicationReference const):
(WebCore::AccessibilityRootAtspi::reference const):
* accessibility/atspi/AccessibilityRootAtspi.h: Added.
(WebCore::AccessibilityRootAtspi::atspi const):
* accessibility/atspi/xml/Accessibility.xml: Added.
* accessibility/atspi/xml/Accessible.xml: Added.
* accessibility/atspi/xml/Action.xml: Added.
* accessibility/atspi/xml/Application.xml: Added.
* accessibility/atspi/xml/Cache.xml: Added.
* accessibility/atspi/xml/Collection.xml: Added.
* accessibility/atspi/xml/Component.xml: Added.
* accessibility/atspi/xml/DeviceEventController.xml: Added.
* accessibility/atspi/xml/DeviceEventListener.xml: Added.
* accessibility/atspi/xml/Document.xml: Added.
* accessibility/atspi/xml/EditableText.xml: Added.
* accessibility/atspi/xml/Event.xml: Added.
* accessibility/atspi/xml/Hyperlink.xml: Added.
* accessibility/atspi/xml/Hypertext.xml: Added.
* accessibility/atspi/xml/Image.xml: Added.
* accessibility/atspi/xml/Registry.xml: Added.
* accessibility/atspi/xml/Selection.xml: Added.
* accessibility/atspi/xml/Socket.xml: Added.
* accessibility/atspi/xml/Table.xml: Added.
* accessibility/atspi/xml/TableCell.xml: Added.
* accessibility/atspi/xml/Text.xml: Added.
* accessibility/atspi/xml/Value.xml: Added.
* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::createPlatformDisplay):
(WebCore::PlatformDisplay::accessibilityBusAddress const):
* platform/graphics/PlatformDisplay.h:
(WebCore::PlatformDisplay::setAccessibilityBusAddress):
(WebCore::PlatformDisplay::plartformAccessibilityBusAddress const):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::plartformAccessibilityBusAddress const):
* platform/graphics/x11/PlatformDisplayX11.h:

Source/WebKit:

Change BindAccessibilityTree IPC message API to have an async reply. When using ATSPI the UI process replies to
the message including the object path of the AtkSocket, to be used by the web process root object as its parent
property (building the reference with the UI process unique name we get from GetState message).

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const): Encode accessibilityBusAddress.
(WebKit::WebProcessCreationParameters::decode): Decode accessibilityBusAddress.
* Shared/WebProcessCreationParameters.h:
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bindA11y): Set the accessibilityBusAddress to the shared PlatformDisplay so that it doesn't need to be
get again.
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::bindAccessibilityTree):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
* UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::CompletionHandler<void):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToProvisionalPage):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess): Set the accessibilityBusAddress parameter.
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree): Call atk_object_ref_state_set() right after atk_socket_embed() to
make sure that's the first GetState message received by the web process root object. Then build the AtkSocket
path and send the async reply.
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::accessibilityRootObject const):
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize): Create the root object and send BindAccessibilityTree to the UI process,
setting the root object parent path using the socket path received from the UI process.
* WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::accessibilityAtspi const):
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Create the AccessibilityAtspi instance for the given address.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@283304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/SourcesGTK.txt b/Source/WebCore/SourcesGTK.txt
index 8973012..b01c001 100644
--- a/Source/WebCore/SourcesGTK.txt
+++ b/Source/WebCore/SourcesGTK.txt
@@ -39,7 +39,9 @@
 accessibility/atk/WebKitAccessibleInterfaceValue.cpp
 accessibility/atk/WebKitAccessibleUtil.cpp
 
+accessibility/atspi/AccessibilityAtspi.cpp
 accessibility/atspi/AccessibilityObjectAtspi.cpp
+accessibility/atspi/AccessibilityRootAtspi.cpp
 accessibility/atspi/AXObjectCacheAtspi.cpp
 
 accessibility/isolatedtree/atspi/AXIsolatedObjectAtspi.cpp