|
1 /* |
|
2 * Copyright (C) 2008 Apple Ltd. |
|
3 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
|
4 * |
|
5 * This library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Library General Public |
|
7 * License as published by the Free Software Foundation; either |
|
8 * version 2 of the License, or (at your option) any later version. |
|
9 * |
|
10 * This library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Library General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Library General Public License |
|
16 * along with this library; see the file COPYING.LIB. If not, write to |
|
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 * Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 #include "AccessibilityObject.h" |
|
23 |
|
24 #include <glib-object.h> |
|
25 |
|
26 #if HAVE(ACCESSIBILITY) |
|
27 |
|
28 namespace WebCore { |
|
29 |
|
30 bool AccessibilityObject::accessibilityIgnoreAttachment() const |
|
31 { |
|
32 return false; |
|
33 } |
|
34 |
|
35 AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const |
|
36 { |
|
37 AccessibilityObject* parent = parentObject(); |
|
38 if (!parent) |
|
39 return DefaultBehavior; |
|
40 |
|
41 if (roleValue() == SplitterRole) |
|
42 return IncludeObject; |
|
43 |
|
44 if (isGroup()) { |
|
45 // When a list item is made up entirely of children (e.g. paragraphs) |
|
46 // the list item gets ignored. We need it. |
|
47 if (parent->isList()) |
|
48 return IncludeObject; |
|
49 |
|
50 // We expect the parent of a table cell to be a table. |
|
51 AccessibilityObject* child = firstChild(); |
|
52 if (child && child->roleValue() == CellRole) |
|
53 return IgnoreObject; |
|
54 } |
|
55 |
|
56 // Entries and password fields have extraneous children which we want to ignore. |
|
57 if (parent->isPasswordField() || parent->isTextControl()) |
|
58 return IgnoreObject; |
|
59 |
|
60 AccessibilityRole role = roleValue(); |
|
61 |
|
62 // Include all tables, even layout tables. The AT can decide what to do with each. |
|
63 if (role == CellRole || role == TableRole) |
|
64 return IncludeObject; |
|
65 |
|
66 // We at some point might have a need to expose a table row; but it's not standard Gtk+. |
|
67 if (role == RowRole) |
|
68 return IgnoreObject; |
|
69 |
|
70 // The object containing the text should implement AtkText itself. |
|
71 if (role == StaticTextRole) |
|
72 return IgnoreObject; |
|
73 |
|
74 return DefaultBehavior; |
|
75 } |
|
76 |
|
77 AccessibilityObjectWrapper* AccessibilityObject::wrapper() const |
|
78 { |
|
79 return m_wrapper; |
|
80 } |
|
81 |
|
82 void AccessibilityObject::setWrapper(AccessibilityObjectWrapper* wrapper) |
|
83 { |
|
84 if (wrapper == m_wrapper) |
|
85 return; |
|
86 |
|
87 if (m_wrapper) |
|
88 g_object_unref(m_wrapper); |
|
89 |
|
90 m_wrapper = wrapper; |
|
91 |
|
92 if (m_wrapper) |
|
93 g_object_ref(m_wrapper); |
|
94 } |
|
95 |
|
96 } // namespace WebCore |
|
97 |
|
98 #endif // HAVE(ACCESSIBILITY) |