[WPE] Add initial accessibility support using ATK
https://bugs.webkit.org/show_bug.cgi?id=197413

Reviewed by Michael Catanzaro.

.:

Add ENABLE_ACCESSIBILITY public option to WPE.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebCore:

Use USE(ATK) instead of PLATFORM(GTK) for ATK related code and use ATK when available for WPE port too.

* PlatformWPE.cmake:
* SourcesWPE.txt:
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityList.cpp:
(WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canSetValueAttribute const):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::textIteratorBehaviorForTextRange const):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::indexForVisiblePosition const):
(WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
* accessibility/AccessibilityTableColumn.cpp:
(WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored const):
* accessibility/AccessibilityTableHeaderContainer.cpp:
(WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored const):
* accessibility/atk/WebKitAccessible.cpp:
(webkitAccessibleGetAttributes):
* accessibility/wpe/AXObjectCacheWPE.cpp: Removed.
* accessibility/wpe/AccessibilityObjectWPE.cpp: Removed.
* editing/FrameSelection.h:

Source/WebKit:

Rename WebKitWebViewBaseAccessible as WebKitWebViewAccessible and move it to glib removing its dependency on
GTK. WPEView now implements get_accessible to return its associated WebKitWebViewAccessible.

* PlatformWPE.cmake:
* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/API/glib/WebKitWebViewAccessible.cpp: Added.
(webkitWebViewAccessibleInitialize):
(webkitWebViewAccessibleRefStateSet):
(webkitWebViewAccessibleGetIndexInParent):
(webkit_web_view_accessible_class_init):
(webkitWebViewAccessibleNew):
(webkitWebViewAccessibleSetWebView):
* UIProcess/API/glib/WebKitWebViewAccessible.h: Added.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseDispose):
(webkitWebViewBaseGetAccessible):
* UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp: Removed.
* UIProcess/API/gtk/WebKitWebViewBaseAccessible.h: Removed.
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::accessible):
* UIProcess/API/wpe/PageClientImpl.h:
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
(WKWPE::View::~View):
(WKWPE::View::accessible):
* UIProcess/API/wpe/WPEView.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree): Call atk_socket_embed() with the given plug ID.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::platformInitialize): Create the WebKitWebPageAccessibilityObject and send
BindAccessibilityTree message to the UI process.
* WebProcess/wpe/WebProcessMainWPE.cpp:
(WebKit::initializeAccessibility): Implement AtkUtil interface and initialize the atk bridge.

Tools:

Add accessibility support in MiniBrowser and backends used by MiniBrowser and tests.

* MiniBrowser/wpe/CMakeLists.txt:
* MiniBrowser/wpe/main.cpp:
(main):
* TestWebKitAPI/PlatformWPE.cmake:
* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
* WebKitTestRunner/InjectedBundle/AccessibilityController.h:
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
(WTR::AccessibilityNotificationHandler::setNotificationFunctionCallback):
(WTR::AccessibilityNotificationHandler::removeAccessibilityNotificationHandler):
* WebKitTestRunner/InjectedBundle/wpe/AccessibilityControllerWPE.cpp: Removed.
* WebKitTestRunner/InjectedBundle/wpe/AccessibilityUIElementWPE.cpp: Removed.
* WebKitTestRunner/PlatformWPE.cmake:
* wpe/backends/CMakeLists.txt:
* wpe/backends/HeadlessViewBackend.cpp:
(WPEToolingBackends::HeadlessViewBackend::HeadlessViewBackend):
* wpe/backends/ViewBackend.cpp:
(WPEToolingBackends::addKeyEventListener):
(WPEToolingBackends::removeKeyEventListener):
(WPEToolingBackends::notifyAccessibilityKeyEventListeners):
(WPEToolingBackends::ViewBackend::initialize):
(WPEToolingBackends::ViewBackend::initializeAccessibility):
(WPEToolingBackends::ViewBackend::updateAccessibilityState):
(WPEToolingBackends::ViewBackend::setAccessibleChild):
(WPEToolingBackends::ViewBackend::addActivityState):
(WPEToolingBackends::ViewBackend::removeActivityState):
(WPEToolingBackends::ViewBackend::dispatchInputKeyboardEvent):
* wpe/backends/ViewBackend.h:
* wpe/backends/WebKitAccessibleApplication.cpp: Added.
(webkitAccessibleApplicationWindowInterfaceInit):
(webkitAccessibleApplicationFinalize):
(webkitAccessibleApplicationInitialize):
(webkitAccessibleApplicationGetNChildren):
(webkitAccessibleApplicationRefChild):
(webkitAccessibleApplicationGetName):
(webkit_accessible_application_class_init):
(webkit_accessible_application_init):
(webkitAccessibleApplicationNew):
(webkitAccessibleApplicationSetChild):
* wpe/backends/WebKitAccessibleApplication.h: Added.
* wpe/backends/WindowViewBackend.cpp:
(WPEToolingBackends::WindowViewBackend::WindowViewBackend):
* wpe/jhbuild.modules:

LayoutTests:

Unskip accessibility tests that are passing now and add platform specific results.

* platform/wpe/TestExpectations:
* platform/wpe/accessibility/add-children-pseudo-element-expected.txt: Added.
* platform/wpe/accessibility/aria-fallback-roles-expected.txt: Added.
* platform/wpe/accessibility/aria-hidden-negates-no-visibility-expected.txt: Added.
* platform/wpe/accessibility/aria-label-on-label-element-expected.txt: Added.
* platform/wpe/accessibility/aria-labelledby-overrides-aria-label-expected.txt: Added.
* platform/wpe/accessibility/aria-labelledby-overrides-label-expected.txt: Added.
* platform/wpe/accessibility/aria-option-role-expected.txt: Added.
* platform/wpe/accessibility/aria-roledescription-expected.txt: Added.
* platform/wpe/accessibility/aria-switch-sends-notification-expected.txt: Added.
* platform/wpe/accessibility/aria-tab-roles-expected.txt: Added.
* platform/wpe/accessibility/aria-table-attributes-expected.txt: Added.
* platform/wpe/accessibility/aria-table-content-expected.txt: Added.
* platform/wpe/accessibility/aria-toggle-button-with-title-expected.txt: Added.
* platform/wpe/accessibility/auto-fill-crash-expected.txt: Added.
* platform/wpe/accessibility/button-with-aria-haspopup-role-expected.txt: Added.
* platform/wpe/accessibility/color-well-expected.txt: Added.
* platform/wpe/accessibility/deleting-iframe-destroys-axcache-expected.txt: Added.
* platform/wpe/accessibility/dimensions-include-descendants-expected.txt: Added.
* platform/wpe/accessibility/double-nested-inline-element-missing-from-tree-expected.txt: Added.
* platform/wpe/accessibility/empty-image-with-title-expected.txt: Added.
* platform/wpe/accessibility/file-upload-button-stringvalue-expected.txt: Added.
* platform/wpe/accessibility/help-text-expected.txt: Added.
* platform/wpe/accessibility/image-link-expected.txt: Added.
* platform/wpe/accessibility/image-map1-expected.txt: Added.
* platform/wpe/accessibility/image-map2-expected.txt: Added.
* platform/wpe/accessibility/inline-continuations-expected.txt: Added.
* platform/wpe/accessibility/label-with-pseudo-elements-expected.txt: Added.
* platform/wpe/accessibility/list-detection-expected.txt: Added.
* platform/wpe/accessibility/lists-expected.txt: Added.
* platform/wpe/accessibility/math-multiscript-attributes-expected.txt: Added.
* platform/wpe/accessibility/media-emits-object-replacement-expected.txt: Added.
* platform/wpe/accessibility/menu-list-crash2-expected.txt: Added.
* platform/wpe/accessibility/minimal-table-with-aria-is-data-table-expected.txt: Added.
* platform/wpe/accessibility/press-targets-center-point-expected.txt: Added.
* platform/wpe/accessibility/radio-button-title-label-expected.txt: Added.
* platform/wpe/accessibility/render-counter-text-expected.txt: Added.
* platform/wpe/accessibility/roles-computedRoleString-expected.txt: Added.
* platform/wpe/accessibility/roles-exposed-expected.txt: Added.
* platform/wpe/accessibility/set-selected-text-range-contenteditable-expected.txt: Added.
* platform/wpe/accessibility/svg-remote-element-expected.txt: Added.
* platform/wpe/accessibility/tabindex-elements-are-accessible-expected.txt: Added.
* platform/wpe/accessibility/table-attributes-expected.txt: Added.
* platform/wpe/accessibility/table-cell-spans-expected.txt: Added.
* platform/wpe/accessibility/table-cells-expected.txt: Added.
* platform/wpe/accessibility/table-cells-roles-expected.txt: Added.
* platform/wpe/accessibility/table-column-headers-with-captions-expected.txt: Added.
* platform/wpe/accessibility/table-one-cell-expected.txt: Added.
* platform/wpe/accessibility/table-roles-hierarchy-expected.txt: Added.
* platform/wpe/accessibility/table-sections-expected.txt: Added.
* platform/wpe/accessibility/table-with-rules-expected.txt: Added.
* platform/wpe/accessibility/text-alternative-calculation-hidden-nodes-expected.txt: Added.
* platform/wpe/accessibility/transformed-element-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessible.cpp b/Source/WebCore/accessibility/atk/WebKitAccessible.cpp
index ef5b9ef..63b0382 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessible.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessible.cpp
@@ -394,6 +394,8 @@
     AtkAttributeSet* attributeSet = nullptr;
 #if PLATFORM(GTK)
     attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WebKitGtk");
+#elif PLATFORM(WPE)
+    attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WPEWebKit");
 #endif
 
     auto* coreObject = accessible->priv->object;