[GTK] Missing DRT AccessibilityController::addNotificationListener implementation
https://bugs.webkit.org/show_bug.cgi?id=70606
Patch by Denis Nomiyama <d.nomiyama@samsung.com> on 2013-09-10
Reviewed by Mario Sanchez Prada.
Implemented the global notification listener for
AccessibilityController. The signal is generated by
AXObjectCache::postPlatformNotification() and received by
axObjectEventListener(). axObjectEventListener will then invoke
JSObjectCallAsFunction() with the respective callback function.
There is no additional test for this patch since its implementation will
be tested by a11y layout tests that are currently skipped (e.g. bug
98370).
* DumpRenderTree/AccessibilityController.h: Added a global notification
handler for GTK+.
* DumpRenderTree/atk/AccessibilityControllerAtk.cpp:
(AccessibilityController::AccessibilityController): Initializes the
global handler with 0.
(AccessibilityController::addNotificationListener): Creates the
notification handler and sets the notification function callback.
(AccessibilityController::removeNotificationListener): Removes the
global handler.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155448 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index b05d4d7..a774153 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,30 @@
+2013-09-10 Denis Nomiyama <d.nomiyama@samsung.com>
+
+ [GTK] Missing DRT AccessibilityController::addNotificationListener implementation
+ https://bugs.webkit.org/show_bug.cgi?id=70606
+
+ Reviewed by Mario Sanchez Prada.
+
+ Implemented the global notification listener for
+ AccessibilityController. The signal is generated by
+ AXObjectCache::postPlatformNotification() and received by
+ axObjectEventListener(). axObjectEventListener will then invoke
+ JSObjectCallAsFunction() with the respective callback function.
+
+ There is no additional test for this patch since its implementation will
+ be tested by a11y layout tests that are currently skipped (e.g. bug
+ 98370).
+
+ * DumpRenderTree/AccessibilityController.h: Added a global notification
+ handler for GTK+.
+ * DumpRenderTree/atk/AccessibilityControllerAtk.cpp:
+ (AccessibilityController::AccessibilityController): Initializes the
+ global handler with 0.
+ (AccessibilityController::addNotificationListener): Creates the
+ notification handler and sets the notification function callback.
+ (AccessibilityController::removeNotificationListener): Removes the
+ global handler.
+
2013-09-10 Krzysztof Czech <k.czech@samsung.com>
[ATK] Incorrect type for holding float value
diff --git a/Tools/DumpRenderTree/AccessibilityController.h b/Tools/DumpRenderTree/AccessibilityController.h
index 1bb066f..0c1b6f6 100644
--- a/Tools/DumpRenderTree/AccessibilityController.h
+++ b/Tools/DumpRenderTree/AccessibilityController.h
@@ -35,6 +35,7 @@
#include <windows.h>
#endif
#if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
+#include "AccessibilityNotificationHandlerAtk.h"
#include <atk/atk.h>
#endif
@@ -88,6 +89,10 @@
#if PLATFORM(MAC)
RetainPtr<NotificationHandler> m_globalNotificationHandler;
#endif
+
+#if PLATFORM(GTK) || PLATFORM(EFL)
+ RefPtr<AccessibilityNotificationHandler> m_globalNotificationHandler;
+#endif
};
#endif // AccessibilityController_h
diff --git a/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp b/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp
index 48c6dd6..e500357 100644
--- a/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp
+++ b/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp
@@ -38,6 +38,7 @@
bool loggingAccessibilityEvents = false;
AccessibilityController::AccessibilityController()
+ : m_globalNotificationHandler(0)
{
}
@@ -79,13 +80,27 @@
loggingAccessibilityEvents = true;
}
-bool AccessibilityController::addNotificationListener(JSObjectRef)
+bool AccessibilityController::addNotificationListener(JSObjectRef functionCallback)
{
- return false;
+ if (!functionCallback)
+ return false;
+
+ // Only one global notification listener.
+ if (m_globalNotificationHandler)
+ return false;
+
+ m_globalNotificationHandler = AccessibilityNotificationHandler::create();
+ m_globalNotificationHandler->setNotificationFunctionCallback(functionCallback);
+
+ return true;
}
void AccessibilityController::removeNotificationListener()
{
+ // Programmers should not be trying to remove a listener that's already removed.
+ ASSERT(m_globalNotificationHandler);
+
+ m_globalNotificationHandler = 0;
}
AtkObject* AccessibilityController::childElementById(AtkObject* parent, const char* id)