OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014, Google Inc. All rights reserved. | 2 * Copyright (C) 2014, Google 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 // Called when the scroll offset changes. | 97 // Called when the scroll offset changes. |
98 virtual void handleScrollPositionChanged(FrameView*) override; | 98 virtual void handleScrollPositionChanged(FrameView*) override; |
99 virtual void handleScrollPositionChanged(RenderObject*) override; | 99 virtual void handleScrollPositionChanged(RenderObject*) override; |
100 | 100 |
101 // Called when scroll bars are added / removed (as the view resizes). | 101 // Called when scroll bars are added / removed (as the view resizes). |
102 void handleScrollbarUpdate(FrameView*) override; | 102 void handleScrollbarUpdate(FrameView*) override; |
103 void handleLayoutComplete(RenderObject*) override; | 103 void handleLayoutComplete(RenderObject*) override; |
104 void handleScrolledToAnchor(const Node* anchorNode) override; | 104 void handleScrolledToAnchor(const Node* anchorNode) override; |
105 | 105 |
| 106 virtual PublicAXObject* publicAXObjectForNode(Node*) override; |
| 107 |
106 // Returns the root object for the entire document. | 108 // Returns the root object for the entire document. |
107 AXObject* rootObject(); | 109 AXObject* rootObject(); |
108 | 110 |
109 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } | 111 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } |
110 AXObject* root(); | 112 AXObject* root(); |
111 | 113 |
112 // used for objects without backing elements | 114 // used for objects without backing elements |
113 AXObject* getOrCreate(AccessibilityRole); | 115 AXObject* getOrCreate(AccessibilityRole); |
114 AXObject* getOrCreate(RenderObject*); | 116 AXObject* getOrCreate(RenderObject*); |
115 AXObject* getOrCreate(Widget*); | 117 AXObject* getOrCreate(Widget*); |
(...skipping 19 matching lines...) Expand all Loading... |
135 void recomputeIsIgnored(RenderObject* renderer); | 137 void recomputeIsIgnored(RenderObject* renderer); |
136 | 138 |
137 bool accessibilityEnabled(); | 139 bool accessibilityEnabled(); |
138 bool inlineTextBoxAccessibilityEnabled(); | 140 bool inlineTextBoxAccessibilityEnabled(); |
139 | 141 |
140 void removeAXID(AXObject*); | 142 void removeAXID(AXObject*); |
141 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } | 143 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } |
142 | 144 |
143 AXID platformGenerateAXID() const; | 145 AXID platformGenerateAXID() const; |
144 | 146 |
145 bool nodeHasRole(Node*, const AtomicString& role); | |
146 | |
147 // Counts the number of times the document has been modified. Some attribute
values are cached | 147 // Counts the number of times the document has been modified. Some attribute
values are cached |
148 // as long as the modification count hasn't changed. | 148 // as long as the modification count hasn't changed. |
149 int modificationCount() const { return m_modificationCount; } | 149 int modificationCount() const { return m_modificationCount; } |
150 | 150 |
151 void postNotification(RenderObject*, AXNotification, bool postToElement); | 151 void postNotification(RenderObject*, AXNotification, bool postToElement); |
152 void postNotification(Node*, AXNotification, bool postToElement); | 152 void postNotification(Node*, AXNotification, bool postToElement); |
153 void postNotification(AXObject*, Document*, AXNotification, bool postToEleme
nt); | 153 void postNotification(AXObject*, Document*, AXNotification, bool postToEleme
nt); |
154 | 154 |
155 protected: | 155 protected: |
156 void postPlatformNotification(AXObject*, AXNotification); | 156 void postPlatformNotification(AXObject*, AXNotification); |
157 void textChanged(AXObject*); | 157 void textChanged(AXObject*); |
158 void labelChanged(Element*); | 158 void labelChanged(Element*); |
159 | 159 |
160 // This is a weak reference cache for knowing if Nodes used by TextMarkers a
re valid. | 160 // This is a weak reference cache for knowing if Nodes used by TextMarkers a
re valid. |
161 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } | 161 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } |
162 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } | 162 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } |
163 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } | 163 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } |
164 | 164 |
| 165 PassRefPtr<AXObject> createFromRenderer(RenderObject*); |
| 166 PassRefPtr<AXObject> createFromNode(Node*); |
| 167 PassRefPtr<AXObject> createFromInlineTextBox(AbstractInlineTextBox*); |
| 168 |
165 private: | 169 private: |
166 Document& m_document; | 170 Document& m_document; |
167 HashMap<AXID, RefPtr<AXObject> > m_objects; | 171 HashMap<AXID, RefPtr<AXObject> > m_objects; |
168 HashMap<RenderObject*, AXID> m_renderObjectMapping; | 172 HashMap<RenderObject*, AXID> m_renderObjectMapping; |
169 HashMap<Widget*, AXID> m_widgetObjectMapping; | 173 HashMap<Widget*, AXID> m_widgetObjectMapping; |
170 HashMap<Node*, AXID> m_nodeObjectMapping; | 174 HashMap<Node*, AXID> m_nodeObjectMapping; |
171 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; | 175 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; |
172 HashSet<Node*> m_textMarkerNodes; | 176 HashSet<Node*> m_textMarkerNodes; |
173 int m_modificationCount; | 177 int m_modificationCount; |
174 | 178 |
175 HashSet<AXID> m_idsInUse; | 179 HashSet<AXID> m_idsInUse; |
176 | 180 |
177 Timer<AXObjectCacheImpl> m_notificationPostTimer; | 181 Timer<AXObjectCacheImpl> m_notificationPostTimer; |
178 Vector<pair<RefPtr<AXObject>, AXNotification> > m_notificationsToPost; | 182 Vector<pair<RefPtr<AXObject>, AXNotification> > m_notificationsToPost; |
179 void notificationPostTimerFired(Timer<AXObjectCacheImpl>*); | 183 void notificationPostTimerFired(Timer<AXObjectCacheImpl>*); |
180 | 184 |
181 static AXObject* focusedImageMapUIElement(HTMLAreaElement*); | 185 static AXObject* focusedImageMapUIElement(HTMLAreaElement*); |
182 | 186 |
183 AXID getAXID(AXObject*); | 187 AXID getAXID(AXObject*); |
184 | 188 |
185 void textChanged(Node*); | 189 void textChanged(Node*); |
186 bool nodeIsTextControl(const Node*); | 190 bool nodeIsTextControl(const Node*); |
187 | 191 |
188 Settings* settings(); | 192 Settings* settings(); |
189 }; | 193 }; |
190 | 194 |
191 // This is the only subclass of AXObjectCache. | 195 // This is the only subclass of AXObjectCache. |
192 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); | 196 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); |
193 | 197 |
| 198 class PublicAXObjectImpl : public PublicAXObject { |
| 199 public: |
| 200 explicit PublicAXObjectImpl(AXObject*); |
| 201 ~PublicAXObjectImpl(); |
| 202 |
| 203 virtual const AtomicString& computedRole(); |
| 204 virtual const String computedText(); |
| 205 |
| 206 private: |
| 207 RefPtr<AXObject> m_object; |
| 208 }; |
| 209 |
194 bool nodeHasRole(Node*, const String& role); | 210 bool nodeHasRole(Node*, const String& role); |
195 // This will let you know if aria-hidden was explicitly set to false. | 211 // This will let you know if aria-hidden was explicitly set to false. |
196 bool isNodeAriaVisible(Node*); | 212 bool isNodeAriaVisible(Node*); |
197 | |
198 } | 213 } |
199 | 214 |
200 #endif | 215 #endif |
OLD | NEW |