OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2008 Nuanti Ltd. | |
3 * Copyright (C) 2009 Jan Alonzo | |
4 * Copyright (C) 2012 Igalia S.L. | |
5 * Copyright (C) 2013 Samsung Electronics | |
6 * | |
7 * Portions from Mozilla a11y, copyright as follows: | |
8 * | |
9 * The Original Code is mozilla.org code. | |
10 * | |
11 * The Initial Developer of the Original Code is | |
12 * Sun Microsystems, Inc. | |
13 * Portions created by the Initial Developer are Copyright (C) 2002 | |
14 * the Initial Developer. All Rights Reserved. | |
15 * | |
16 * This library is free software; you can redistribute it and/or | |
17 * modify it under the terms of the GNU Library General Public | |
18 * License as published by the Free Software Foundation; either | |
19 * version 2 of the License, or (at your option) any later version. | |
20 * | |
21 * This library is distributed in the hope that it will be useful, | |
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
24 * Library General Public License for more details. | |
25 * | |
26 * You should have received a copy of the GNU Library General Public License | |
27 * along with this library; see the file COPYING.LIB. If not, write to | |
28 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
29 * Boston, MA 02110-1301, USA. | |
30 */ | |
31 | |
32 #include "config.h" | |
33 #include "WebKitAccessibleInterfaceAction.h" | |
34 | |
35 #if HAVE(ACCESSIBILITY) | |
36 | |
37 #include "AccessibilityObject.h" | |
38 #include "NotImplemented.h" | |
39 #include "WebKitAccessibleUtil.h" | |
40 #include "WebKitAccessibleWrapperAtk.h" | |
41 | |
42 using namespace WebCore; | |
43 | |
44 static AccessibilityObject* core(AtkAction* action) | |
45 { | |
46 if (!WEBKIT_IS_ACCESSIBLE(action)) | |
47 return 0; | |
48 | |
49 return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(action)); | |
50 } | |
51 | |
52 static gboolean webkitAccessibleActionDoAction(AtkAction* action, gint index) | |
53 { | |
54 g_return_val_if_fail(!index, FALSE); | |
55 return core(action)->performDefaultAction(); | |
56 } | |
57 | |
58 static gint webkitAccessibleActionGetNActions(AtkAction*) | |
59 { | |
60 return 1; | |
61 } | |
62 | |
63 static const gchar* webkitAccessibleActionGetDescription(AtkAction*, gint) | |
64 { | |
65 // TODO: Need a way to provide/localize action descriptions. | |
66 notImplemented(); | |
67 return ""; | |
68 } | |
69 | |
70 static const gchar* webkitAccessibleActionGetKeybinding(AtkAction* action, gint
index) | |
71 { | |
72 g_return_val_if_fail(!index, 0); | |
73 // FIXME: Construct a proper keybinding string. | |
74 return cacheAndReturnAtkProperty(ATK_OBJECT(action), AtkCachedActionKeyBindi
ng, core(action)->accessKey().string()); | |
75 } | |
76 | |
77 static const gchar* webkitAccessibleActionGetName(AtkAction* action, gint index) | |
78 { | |
79 g_return_val_if_fail(!index, 0); | |
80 return cacheAndReturnAtkProperty(ATK_OBJECT(action), AtkCachedActionName, co
re(action)->actionVerb()); | |
81 } | |
82 | |
83 void webkitAccessibleActionInterfaceInit(AtkActionIface* iface) | |
84 { | |
85 iface->do_action = webkitAccessibleActionDoAction; | |
86 iface->get_n_actions = webkitAccessibleActionGetNActions; | |
87 iface->get_description = webkitAccessibleActionGetDescription; | |
88 iface->get_keybinding = webkitAccessibleActionGetKeybinding; | |
89 iface->get_name = webkitAccessibleActionGetName; | |
90 } | |
91 | |
92 #endif | |
OLD | NEW |