OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/platform/Timer.h" | 30 #include "core/platform/Timer.h" |
31 #include "wtf/Forward.h" | 31 #include "wtf/Forward.h" |
32 #include "wtf/HashMap.h" | 32 #include "wtf/HashMap.h" |
33 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
34 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class Document; | 38 class Document; |
39 class HTMLAreaElement; | 39 class HTMLAreaElement; |
| 40 class InlineTextBox; |
40 class Node; | 41 class Node; |
41 class Page; | 42 class Page; |
42 class RenderObject; | 43 class RenderObject; |
43 class ScrollView; | 44 class ScrollView; |
44 class VisiblePosition; | 45 class VisiblePosition; |
45 class Widget; | 46 class Widget; |
46 | 47 |
47 struct TextMarkerData { | 48 struct TextMarkerData { |
48 AXID axID; | 49 AXID axID; |
49 Node* node; | 50 Node* node; |
(...skipping 30 matching lines...) Expand all Loading... |
80 | 81 |
81 static AccessibilityObject* focusedUIElementForPage(const Page*); | 82 static AccessibilityObject* focusedUIElementForPage(const Page*); |
82 | 83 |
83 // Returns the root object for the entire document. | 84 // Returns the root object for the entire document. |
84 AccessibilityObject* rootObject(); | 85 AccessibilityObject* rootObject(); |
85 | 86 |
86 // For AX objects with elements that back them. | 87 // For AX objects with elements that back them. |
87 AccessibilityObject* getOrCreate(RenderObject*); | 88 AccessibilityObject* getOrCreate(RenderObject*); |
88 AccessibilityObject* getOrCreate(Widget*); | 89 AccessibilityObject* getOrCreate(Widget*); |
89 AccessibilityObject* getOrCreate(Node*); | 90 AccessibilityObject* getOrCreate(Node*); |
| 91 AccessibilityObject* getOrCreate(InlineTextBox*); |
90 | 92 |
91 // used for objects without backing elements | 93 // used for objects without backing elements |
92 AccessibilityObject* getOrCreate(AccessibilityRole); | 94 AccessibilityObject* getOrCreate(AccessibilityRole); |
93 | 95 |
94 // will only return the AccessibilityObject if it already exists | 96 // will only return the AccessibilityObject if it already exists |
95 AccessibilityObject* get(RenderObject*); | 97 AccessibilityObject* get(RenderObject*); |
96 AccessibilityObject* get(Widget*); | 98 AccessibilityObject* get(Widget*); |
97 AccessibilityObject* get(Node*); | 99 AccessibilityObject* get(Node*); |
| 100 AccessibilityObject* get(InlineTextBox*); |
98 | 101 |
99 void remove(RenderObject*); | 102 void remove(RenderObject*); |
100 void remove(Node*); | 103 void remove(Node*); |
101 void remove(Widget*); | 104 void remove(Widget*); |
| 105 void remove(InlineTextBox*); |
102 void remove(AXID); | 106 void remove(AXID); |
103 | 107 |
104 void detachWrapper(AccessibilityObject*); | 108 void detachWrapper(AccessibilityObject*); |
105 void attachWrapper(AccessibilityObject*); | 109 void attachWrapper(AccessibilityObject*); |
106 void childrenChanged(Node*); | 110 void childrenChanged(Node*); |
107 void childrenChanged(RenderObject*); | 111 void childrenChanged(RenderObject*); |
108 void childrenChanged(AccessibilityObject*); | 112 void childrenChanged(AccessibilityObject*); |
109 void checkedStateChanged(Node*); | 113 void checkedStateChanged(Node*); |
110 void selectedChildrenChanged(Node*); | 114 void selectedChildrenChanged(Node*); |
111 void selectedChildrenChanged(RenderObject*); | 115 void selectedChildrenChanged(RenderObject*); |
(...skipping 10 matching lines...) Expand all Loading... |
122 void handleScrolledToAnchor(const Node* anchorNode); | 126 void handleScrolledToAnchor(const Node* anchorNode); |
123 void handleAriaExpandedChange(Node*); | 127 void handleAriaExpandedChange(Node*); |
124 void handleScrollbarUpdate(ScrollView*); | 128 void handleScrollbarUpdate(ScrollView*); |
125 | 129 |
126 void handleAttributeChanged(const QualifiedName& attrName, Element*); | 130 void handleAttributeChanged(const QualifiedName& attrName, Element*); |
127 void recomputeIsIgnored(RenderObject* renderer); | 131 void recomputeIsIgnored(RenderObject* renderer); |
128 | 132 |
129 #if HAVE(ACCESSIBILITY) | 133 #if HAVE(ACCESSIBILITY) |
130 static void enableAccessibility() { gAccessibilityEnabled = true; } | 134 static void enableAccessibility() { gAccessibilityEnabled = true; } |
131 static bool accessibilityEnabled() { return gAccessibilityEnabled; } | 135 static bool accessibilityEnabled() { return gAccessibilityEnabled; } |
| 136 static void setInlineTextBoxAccessibility(bool flag) { gInlineTextBoxAccessi
bility = flag; } |
| 137 static bool inlineTextBoxAccessibility() { return gInlineTextBoxAccessibilit
y; } |
132 #else | 138 #else |
133 static void enableAccessibility() { } | 139 static void enableAccessibility() { } |
| 140 static void setInlineTextBoxAccessibility(bool) { } |
134 static bool accessibilityEnabled() { return false; } | 141 static bool accessibilityEnabled() { return false; } |
| 142 static bool inlineTextBoxAccessibility() { return false; } |
135 #endif | 143 #endif |
136 | 144 |
137 void removeAXID(AccessibilityObject*); | 145 void removeAXID(AccessibilityObject*); |
138 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } | 146 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } |
139 | 147 |
140 Element* rootAXEditableElement(Node*); | 148 Element* rootAXEditableElement(Node*); |
141 const Element* rootAXEditableElement(const Node*); | 149 const Element* rootAXEditableElement(const Node*); |
142 bool nodeIsTextControl(const Node*); | 150 bool nodeIsTextControl(const Node*); |
143 | 151 |
144 AXID platformGenerateAXID() const; | 152 AXID platformGenerateAXID() const; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } | 206 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } |
199 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } | 207 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } |
200 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } | 208 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } |
201 | 209 |
202 private: | 210 private: |
203 Document* m_document; | 211 Document* m_document; |
204 HashMap<AXID, RefPtr<AccessibilityObject> > m_objects; | 212 HashMap<AXID, RefPtr<AccessibilityObject> > m_objects; |
205 HashMap<RenderObject*, AXID> m_renderObjectMapping; | 213 HashMap<RenderObject*, AXID> m_renderObjectMapping; |
206 HashMap<Widget*, AXID> m_widgetObjectMapping; | 214 HashMap<Widget*, AXID> m_widgetObjectMapping; |
207 HashMap<Node*, AXID> m_nodeObjectMapping; | 215 HashMap<Node*, AXID> m_nodeObjectMapping; |
| 216 HashMap<InlineTextBox*, AXID> m_inlineTextBoxObjectMapping; |
208 HashSet<Node*> m_textMarkerNodes; | 217 HashSet<Node*> m_textMarkerNodes; |
209 OwnPtr<AXComputedObjectAttributeCache> m_computedObjectAttributeCache; | 218 OwnPtr<AXComputedObjectAttributeCache> m_computedObjectAttributeCache; |
210 static bool gAccessibilityEnabled; | 219 static bool gAccessibilityEnabled; |
| 220 static bool gInlineTextBoxAccessibility; |
211 | 221 |
212 HashSet<AXID> m_idsInUse; | 222 HashSet<AXID> m_idsInUse; |
213 | 223 |
214 Timer<AXObjectCache> m_notificationPostTimer; | 224 Timer<AXObjectCache> m_notificationPostTimer; |
215 Vector<pair<RefPtr<AccessibilityObject>, AXNotification> > m_notificationsTo
Post; | 225 Vector<pair<RefPtr<AccessibilityObject>, AXNotification> > m_notificationsTo
Post; |
216 void notificationPostTimerFired(Timer<AXObjectCache>*); | 226 void notificationPostTimerFired(Timer<AXObjectCache>*); |
217 | 227 |
218 static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*); | 228 static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*); |
219 | 229 |
220 AXID getAXID(AccessibilityObject*); | 230 AXID getAXID(AccessibilityObject*); |
221 }; | 231 }; |
222 | 232 |
223 bool nodeHasRole(Node*, const String& role); | 233 bool nodeHasRole(Node*, const String& role); |
224 // This will let you know if aria-hidden was explicitly set to false. | 234 // This will let you know if aria-hidden was explicitly set to false. |
225 bool isNodeAriaVisible(Node*); | 235 bool isNodeAriaVisible(Node*); |
226 | 236 |
227 #if !HAVE(ACCESSIBILITY) | 237 #if !HAVE(ACCESSIBILITY) |
228 inline AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(A
XID) const { return DefaultBehavior; } | 238 inline AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(A
XID) const { return DefaultBehavior; } |
229 inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObject
Inclusion) { } | 239 inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObject
Inclusion) { } |
230 inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast
<Document*>(doc)), m_notificationPostTimer(this, 0) { } | 240 inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast
<Document*>(doc)), m_notificationPostTimer(this, 0) { } |
231 inline AXObjectCache::~AXObjectCache() { } | 241 inline AXObjectCache::~AXObjectCache() { } |
232 inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*)
{ return 0; } | 242 inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*)
{ return 0; } |
233 inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return 0; } | 243 inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return 0; } |
234 inline AccessibilityObject* AXObjectCache::get(Node*) { return 0; } | 244 inline AccessibilityObject* AXObjectCache::get(Node*) { return 0; } |
235 inline AccessibilityObject* AXObjectCache::get(Widget*) { return 0; } | 245 inline AccessibilityObject* AXObjectCache::get(Widget*) { return 0; } |
| 246 inline AccessibilityObject* AXObjectCache::get(InlineTextBox*) { return 0; } |
236 inline AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole) { retu
rn 0; } | 247 inline AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole) { retu
rn 0; } |
237 inline AccessibilityObject* AXObjectCache::getOrCreate(RenderObject*) { return 0
; } | 248 inline AccessibilityObject* AXObjectCache::getOrCreate(RenderObject*) { return 0
; } |
238 inline AccessibilityObject* AXObjectCache::getOrCreate(Node*) { return 0; } | 249 inline AccessibilityObject* AXObjectCache::getOrCreate(Node*) { return 0; } |
239 inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return 0; } | 250 inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return 0; } |
| 251 inline AccessibilityObject* AXObjectCache::getOrCreate(InlineTextBox*) { return
0; } |
240 inline AccessibilityObject* AXObjectCache::rootObject() { return 0; } | 252 inline AccessibilityObject* AXObjectCache::rootObject() { return 0; } |
241 inline Element* AXObjectCache::rootAXEditableElement(Node*) { return 0; } | 253 inline Element* AXObjectCache::rootAXEditableElement(Node*) { return 0; } |
242 inline bool nodeHasRole(Node*, const String&) { return false; } | 254 inline bool nodeHasRole(Node*, const String&) { return false; } |
243 inline void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates(
) { } | 255 inline void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates(
) { } |
244 inline void AXObjectCache::stopCachingComputedObjectAttributes() { } | 256 inline void AXObjectCache::stopCachingComputedObjectAttributes() { } |
245 inline bool isNodeAriaVisible(Node*) { return true; } | 257 inline bool isNodeAriaVisible(Node*) { return true; } |
246 inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return
0; } | 258 inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return
0; } |
247 inline void AXObjectCache::attachWrapper(AccessibilityObject*) { } | 259 inline void AXObjectCache::attachWrapper(AccessibilityObject*) { } |
248 inline void AXObjectCache::checkedStateChanged(Node*) { } | 260 inline void AXObjectCache::checkedStateChanged(Node*) { } |
249 inline void AXObjectCache::childrenChanged(RenderObject*) { } | 261 inline void AXObjectCache::childrenChanged(RenderObject*) { } |
(...skipping 15 matching lines...) Expand all Loading... |
265 inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsig
ned, const String&) { } | 277 inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsig
ned, const String&) { } |
266 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObjec
t*, AXTextChange, unsigned, const String&) { } | 278 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObjec
t*, AXTextChange, unsigned, const String&) { } |
267 inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXN
otification, bool, PostType) { } | 279 inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXN
otification, bool, PostType) { } |
268 inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool,
PostType) { } | 280 inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool,
PostType) { } |
269 inline void AXObjectCache::postNotification(Node*, AXNotification, bool, PostTyp
e) { } | 281 inline void AXObjectCache::postNotification(Node*, AXNotification, bool, PostTyp
e) { } |
270 inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNoti
fication) { } | 282 inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNoti
fication) { } |
271 inline void AXObjectCache::remove(AXID) { } | 283 inline void AXObjectCache::remove(AXID) { } |
272 inline void AXObjectCache::remove(RenderObject*) { } | 284 inline void AXObjectCache::remove(RenderObject*) { } |
273 inline void AXObjectCache::remove(Node*) { } | 285 inline void AXObjectCache::remove(Node*) { } |
274 inline void AXObjectCache::remove(Widget*) { } | 286 inline void AXObjectCache::remove(Widget*) { } |
| 287 inline void AXObjectCache::remove(InlineTextBox*) { } |
275 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { } | 288 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { } |
276 inline void AXObjectCache::selectedChildrenChanged(Node*) { } | 289 inline void AXObjectCache::selectedChildrenChanged(Node*) { } |
277 #endif | 290 #endif |
278 | 291 |
279 } | 292 } |
280 | 293 |
281 #endif | 294 #endif |
OLD | NEW |