[GTK] Refactor GTK's accessibilitity code to be more modular
https://bugs.webkit.org/show_bug.cgi?id=76783
Reviewed by Martin Robinson.
New files for the implementation of the AtkAction interface,
containing the related code from WebKitAccessibleWrapperAtk.cpp.
* accessibility/gtk/WebKitAccessibleInterfaceAction.cpp: Added.
(core):
(webkitAccessibleActionInterfaceInit):
(webkitAccessibleActionDoAction):
(webkitAccessibleActionGetNActions):
(webkitAccessibleActionGetDescription):
(webkitAccessibleActionGetKeybinding):
(webkitAccessibleActionGetName):
* accessibility/gtk/WebKitAccessibleInterfaceAction.h: Added.
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove code
related to the implementation of the AtkAction interface.
Add new files to build files.
* GNUmakefile.list.am: Add WebKitAccessibleInterfaceAction.[h|cpp].
* WebCore.gypi: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
index fbc426d..eb83a14 100644
--- a/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
@@ -63,6 +63,7 @@
#include "TextEncoding.h"
#include "TextIterator.h"
#include "WebKitAccessibleHyperlink.h"
+#include "WebKitAccessibleInterfaceAction.h"
#include "WebKitAccessibleUtil.h"
#include "htmlediting.h"
#include "visible_units.h"
@@ -109,11 +110,6 @@
return core(WEBKIT_ACCESSIBLE(object));
}
-static AccessibilityObject* core(AtkAction* action)
-{
- return core(ATK_OBJECT(action));
-}
-
static AccessibilityObject* core(AtkSelection* selection)
{
return core(ATK_OBJECT(selection));
@@ -868,47 +864,6 @@
return type_volatile;
}
-static gboolean webkit_accessible_action_do_action(AtkAction* action, gint i)
-{
- g_return_val_if_fail(!i, FALSE);
- return core(action)->performDefaultAction();
-}
-
-static gint webkit_accessible_action_get_n_actions(AtkAction* action)
-{
- return 1;
-}
-
-static const gchar* webkit_accessible_action_get_description(AtkAction* action, gint i)
-{
- g_return_val_if_fail(!i, 0);
- // TODO: Need a way to provide/localize action descriptions.
- notImplemented();
- return "";
-}
-
-static const gchar* webkit_accessible_action_get_keybinding(AtkAction* action, gint i)
-{
- g_return_val_if_fail(!i, 0);
- // FIXME: Construct a proper keybinding string.
- return returnString(core(action)->accessKey().string());
-}
-
-static const gchar* webkit_accessible_action_get_name(AtkAction* action, gint i)
-{
- g_return_val_if_fail(!i, 0);
- return returnString(core(action)->actionVerb());
-}
-
-static void atk_action_interface_init(AtkActionIface* iface)
-{
- iface->do_action = webkit_accessible_action_do_action;
- iface->get_n_actions = webkit_accessible_action_get_n_actions;
- iface->get_description = webkit_accessible_action_get_description;
- iface->get_keybinding = webkit_accessible_action_get_keybinding;
- iface->get_name = webkit_accessible_action_get_name;
-}
-
// Selection (for controls)
static AccessibilityObject* listObjectForSelection(AtkSelection* selection)
@@ -2484,8 +2439,7 @@
}
static const GInterfaceInfo AtkInterfacesInitFunctions[] = {
- {(GInterfaceInitFunc)atk_action_interface_init,
- (GInterfaceFinalizeFunc) 0, 0},
+ {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleActionInterfaceInit), 0, 0},
{(GInterfaceInitFunc)atk_selection_interface_init,
(GInterfaceFinalizeFunc) 0, 0},
{(GInterfaceInitFunc)atk_editable_text_interface_init,