Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: Source/core/accessibility/AXObjectCache.h

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unused include Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef AXObjectCache_h 26 #ifndef AXObjectCache_h
27 #define AXObjectCache_h 27 #define AXObjectCache_h
28 28
29 #include "core/accessibility/AccessibilityObject.h" 29 #include "core/accessibility/AccessibilityObject.h"
30 #include "core/platform/Timer.h" 30 #include "core/platform/Timer.h"
31 #include "core/rendering/RenderText.h"
31 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
32 #include "wtf/HashMap.h" 33 #include "wtf/HashMap.h"
33 #include "wtf/HashSet.h" 34 #include "wtf/HashSet.h"
34 #include "wtf/RefPtr.h" 35 #include "wtf/RefPtr.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 class Document; 39 class Document;
39 class HTMLAreaElement; 40 class HTMLAreaElement;
40 class Node; 41 class Node;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 static AccessibilityObject* focusedUIElementForPage(const Page*); 84 static AccessibilityObject* focusedUIElementForPage(const Page*);
84 85
85 // Returns the root object for the entire document. 86 // Returns the root object for the entire document.
86 AccessibilityObject* rootObject(); 87 AccessibilityObject* rootObject();
87 88
88 // For AX objects with elements that back them. 89 // For AX objects with elements that back them.
89 AccessibilityObject* getOrCreate(RenderObject*); 90 AccessibilityObject* getOrCreate(RenderObject*);
90 AccessibilityObject* getOrCreate(Widget*); 91 AccessibilityObject* getOrCreate(Widget*);
91 AccessibilityObject* getOrCreate(Node*); 92 AccessibilityObject* getOrCreate(Node*);
93 AccessibilityObject* getOrCreate(RenderText*, RenderText::AbstractInlineText Box*);
92 94
93 // used for objects without backing elements 95 // used for objects without backing elements
94 AccessibilityObject* getOrCreate(AccessibilityRole); 96 AccessibilityObject* getOrCreate(AccessibilityRole);
95 97
96 // will only return the AccessibilityObject if it already exists 98 // will only return the AccessibilityObject if it already exists
97 AccessibilityObject* get(RenderObject*); 99 AccessibilityObject* get(RenderObject*);
98 AccessibilityObject* get(Widget*); 100 AccessibilityObject* get(Widget*);
99 AccessibilityObject* get(Node*); 101 AccessibilityObject* get(Node*);
102 AccessibilityObject* get(RenderText::AbstractInlineTextBox*);
100 103
101 void remove(RenderObject*); 104 void remove(RenderObject*);
102 void remove(Node*); 105 void remove(Node*);
103 void remove(Widget*); 106 void remove(Widget*);
107 void remove(RenderText::AbstractInlineTextBox*);
104 void remove(AXID); 108 void remove(AXID);
105 109
106 void detachWrapper(AccessibilityObject*); 110 void detachWrapper(AccessibilityObject*);
107 void attachWrapper(AccessibilityObject*); 111 void attachWrapper(AccessibilityObject*);
108 void childrenChanged(Node*); 112 void childrenChanged(Node*);
109 void childrenChanged(RenderObject*); 113 void childrenChanged(RenderObject*);
110 void childrenChanged(AccessibilityObject*); 114 void childrenChanged(AccessibilityObject*);
111 void checkedStateChanged(Node*); 115 void checkedStateChanged(Node*);
112 void selectedChildrenChanged(Node*); 116 void selectedChildrenChanged(Node*);
113 void selectedChildrenChanged(RenderObject*); 117 void selectedChildrenChanged(RenderObject*);
(...skipping 10 matching lines...) Expand all
124 void handleScrolledToAnchor(const Node* anchorNode); 128 void handleScrolledToAnchor(const Node* anchorNode);
125 void handleAriaExpandedChange(Node*); 129 void handleAriaExpandedChange(Node*);
126 void handleScrollbarUpdate(ScrollView*); 130 void handleScrollbarUpdate(ScrollView*);
127 131
128 void handleAttributeChanged(const QualifiedName& attrName, Element*); 132 void handleAttributeChanged(const QualifiedName& attrName, Element*);
129 void recomputeIsIgnored(RenderObject* renderer); 133 void recomputeIsIgnored(RenderObject* renderer);
130 134
131 #if HAVE(ACCESSIBILITY) 135 #if HAVE(ACCESSIBILITY)
132 static void enableAccessibility() { gAccessibilityEnabled = true; } 136 static void enableAccessibility() { gAccessibilityEnabled = true; }
133 static bool accessibilityEnabled() { return gAccessibilityEnabled; } 137 static bool accessibilityEnabled() { return gAccessibilityEnabled; }
138 static void setInlineTextBoxAccessibility(bool flag) { gInlineTextBoxAccessi bility = flag; }
139 static bool inlineTextBoxAccessibility() { return gInlineTextBoxAccessibilit y; }
134 #else 140 #else
135 static void enableAccessibility() { } 141 static void enableAccessibility() { }
142 static void setInlineTextBoxAccessibility(bool) { }
136 static bool accessibilityEnabled() { return false; } 143 static bool accessibilityEnabled() { return false; }
144 static bool inlineTextBoxAccessibility() { return false; }
137 #endif 145 #endif
138 146
139 void removeAXID(AccessibilityObject*); 147 void removeAXID(AccessibilityObject*);
140 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } 148 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); }
141 149
142 Element* rootAXEditableElement(Node*); 150 Element* rootAXEditableElement(Node*);
143 const Element* rootAXEditableElement(const Node*); 151 const Element* rootAXEditableElement(const Node*);
144 bool nodeIsTextControl(const Node*); 152 bool nodeIsTextControl(const Node*);
145 153
146 AXID platformGenerateAXID() const; 154 AXID platformGenerateAXID() const;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } 208 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); }
201 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } 209 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); }
202 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } 210 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
203 211
204 private: 212 private:
205 Document* m_document; 213 Document* m_document;
206 HashMap<AXID, RefPtr<AccessibilityObject> > m_objects; 214 HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
207 HashMap<RenderObject*, AXID> m_renderObjectMapping; 215 HashMap<RenderObject*, AXID> m_renderObjectMapping;
208 HashMap<Widget*, AXID> m_widgetObjectMapping; 216 HashMap<Widget*, AXID> m_widgetObjectMapping;
209 HashMap<Node*, AXID> m_nodeObjectMapping; 217 HashMap<Node*, AXID> m_nodeObjectMapping;
218 HashMap<RenderText::AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMappi ng;
210 HashSet<Node*> m_textMarkerNodes; 219 HashSet<Node*> m_textMarkerNodes;
211 OwnPtr<AXComputedObjectAttributeCache> m_computedObjectAttributeCache; 220 OwnPtr<AXComputedObjectAttributeCache> m_computedObjectAttributeCache;
212 static bool gAccessibilityEnabled; 221 static bool gAccessibilityEnabled;
222 static bool gInlineTextBoxAccessibility;
213 223
214 HashSet<AXID> m_idsInUse; 224 HashSet<AXID> m_idsInUse;
215 225
216 Timer<AXObjectCache> m_notificationPostTimer; 226 Timer<AXObjectCache> m_notificationPostTimer;
217 Vector<pair<RefPtr<AccessibilityObject>, AXNotification> > m_notificationsTo Post; 227 Vector<pair<RefPtr<AccessibilityObject>, AXNotification> > m_notificationsTo Post;
218 void notificationPostTimerFired(Timer<AXObjectCache>*); 228 void notificationPostTimerFired(Timer<AXObjectCache>*);
219 229
220 static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*); 230 static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*);
221 231
222 AXID getAXID(AccessibilityObject*); 232 AXID getAXID(AccessibilityObject*);
223 }; 233 };
224 234
225 bool nodeHasRole(Node*, const String& role); 235 bool nodeHasRole(Node*, const String& role);
226 // This will let you know if aria-hidden was explicitly set to false. 236 // This will let you know if aria-hidden was explicitly set to false.
227 bool isNodeAriaVisible(Node*); 237 bool isNodeAriaVisible(Node*);
228 238
229 #if !HAVE(ACCESSIBILITY) 239 #if !HAVE(ACCESSIBILITY)
230 inline AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(A XID) const { return DefaultBehavior; } 240 inline AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(A XID) const { return DefaultBehavior; }
231 inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObject Inclusion) { } 241 inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObject Inclusion) { }
232 inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast <Document*>(doc)), m_notificationPostTimer(this, 0) { } 242 inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast <Document*>(doc)), m_notificationPostTimer(this, 0) { }
233 inline AXObjectCache::~AXObjectCache() { } 243 inline AXObjectCache::~AXObjectCache() { }
234 inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*) { return 0; } 244 inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*) { return 0; }
235 inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return 0; } 245 inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return 0; }
236 inline AccessibilityObject* AXObjectCache::get(Node*) { return 0; } 246 inline AccessibilityObject* AXObjectCache::get(Node*) { return 0; }
237 inline AccessibilityObject* AXObjectCache::get(Widget*) { return 0; } 247 inline AccessibilityObject* AXObjectCache::get(Widget*) { return 0; }
248 inline AccessibilityObject* AXObjectCache::get(InlineTextBox*) { return 0; }
238 inline AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole) { retu rn 0; } 249 inline AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole) { retu rn 0; }
239 inline AccessibilityObject* AXObjectCache::getOrCreate(RenderObject*) { return 0 ; } 250 inline AccessibilityObject* AXObjectCache::getOrCreate(RenderObject*) { return 0 ; }
240 inline AccessibilityObject* AXObjectCache::getOrCreate(Node*) { return 0; } 251 inline AccessibilityObject* AXObjectCache::getOrCreate(Node*) { return 0; }
241 inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return 0; } 252 inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return 0; }
253 inline AccessibilityObject* AXObjectCache::getOrCreate(RenderText::AbstractInlin eTextBox*) { return 0; }
242 inline AccessibilityObject* AXObjectCache::rootObject() { return 0; } 254 inline AccessibilityObject* AXObjectCache::rootObject() { return 0; }
243 inline Element* AXObjectCache::rootAXEditableElement(Node*) { return 0; } 255 inline Element* AXObjectCache::rootAXEditableElement(Node*) { return 0; }
244 inline bool nodeHasRole(Node*, const String&) { return false; } 256 inline bool nodeHasRole(Node*, const String&) { return false; }
245 inline void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates( ) { } 257 inline void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates( ) { }
246 inline void AXObjectCache::stopCachingComputedObjectAttributes() { } 258 inline void AXObjectCache::stopCachingComputedObjectAttributes() { }
247 inline bool isNodeAriaVisible(Node*) { return true; } 259 inline bool isNodeAriaVisible(Node*) { return true; }
248 inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; } 260 inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; }
249 inline void AXObjectCache::attachWrapper(AccessibilityObject*) { } 261 inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
250 inline void AXObjectCache::checkedStateChanged(Node*) { } 262 inline void AXObjectCache::checkedStateChanged(Node*) { }
251 inline void AXObjectCache::childrenChanged(RenderObject*) { } 263 inline void AXObjectCache::childrenChanged(RenderObject*) { }
(...skipping 15 matching lines...) Expand all
267 inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsig ned, const String&) { } 279 inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsig ned, const String&) { }
268 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObjec t*, AXTextChange, unsigned, const String&) { } 280 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObjec t*, AXTextChange, unsigned, const String&) { }
269 inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXN otification, bool, PostType) { } 281 inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXN otification, bool, PostType) { }
270 inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool, PostType) { } 282 inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool, PostType) { }
271 inline void AXObjectCache::postNotification(Node*, AXNotification, bool, PostTyp e) { } 283 inline void AXObjectCache::postNotification(Node*, AXNotification, bool, PostTyp e) { }
272 inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNoti fication) { } 284 inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNoti fication) { }
273 inline void AXObjectCache::remove(AXID) { } 285 inline void AXObjectCache::remove(AXID) { }
274 inline void AXObjectCache::remove(RenderObject*) { } 286 inline void AXObjectCache::remove(RenderObject*) { }
275 inline void AXObjectCache::remove(Node*) { } 287 inline void AXObjectCache::remove(Node*) { }
276 inline void AXObjectCache::remove(Widget*) { } 288 inline void AXObjectCache::remove(Widget*) { }
289 inline void AXObjectCache::remove(RenderText::AbstractInlineTextBox*) { }
277 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { } 290 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
278 inline void AXObjectCache::selectedChildrenChanged(Node*) { } 291 inline void AXObjectCache::selectedChildrenChanged(Node*) { }
279 #endif 292 #endif
280 293
281 } 294 }
282 295
283 #endif 296 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698