OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2008 Nuanti Ltd. | |
3 * Copyright (C) 2009 Jan Alonzo | |
4 * Copyright (C) 2009, 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 "WebKitAccessibleInterfaceImage.h" | |
34 | |
35 #if HAVE(ACCESSIBILITY) | |
36 | |
37 #include "AccessibilityObject.h" | |
38 #include "IntRect.h" | |
39 #include "WebKitAccessibleUtil.h" | |
40 #include "WebKitAccessibleWrapperAtk.h" | |
41 | |
42 using namespace WebCore; | |
43 | |
44 static AccessibilityObject* core(AtkImage* image) | |
45 { | |
46 if (!WEBKIT_IS_ACCESSIBLE(image)) | |
47 return 0; | |
48 | |
49 return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(image)); | |
50 } | |
51 | |
52 static void webkitAccessibleImageGetImagePosition(AtkImage* image, gint* x, gint
* y, AtkCoordType coordType) | |
53 { | |
54 IntRect rect = pixelSnappedIntRect(core(image)->elementRect()); | |
55 contentsRelativeToAtkCoordinateType(core(image), coordType, rect, x, y); | |
56 } | |
57 | |
58 static const gchar* webkitAccessibleImageGetImageDescription(AtkImage* image) | |
59 { | |
60 return cacheAndReturnAtkProperty(ATK_OBJECT(image), AtkCachedImageDescriptio
n, accessibilityDescription(core(image))); | |
61 } | |
62 | |
63 static void webkitAccessibleImageGetImageSize(AtkImage* image, gint* width, gint
* height) | |
64 { | |
65 IntSize size = core(image)->pixelSnappedSize(); | |
66 | |
67 if (width) | |
68 *width = size.width(); | |
69 if (height) | |
70 *height = size.height(); | |
71 } | |
72 | |
73 void webkitAccessibleImageInterfaceInit(AtkImageIface* iface) | |
74 { | |
75 iface->get_image_position = webkitAccessibleImageGetImagePosition; | |
76 iface->get_image_description = webkitAccessibleImageGetImageDescription; | |
77 iface->get_image_size = webkitAccessibleImageGetImageSize; | |
78 } | |
79 | |
80 #endif | |
OLD | NEW |