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

Side by Side Diff: Source/modules/accessibility/AXObjectCacheImpl.h

Issue 1072273006: Oilpan: Prepare moving AXObject to heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual void childrenChanged(Node*) override; 71 virtual void childrenChanged(Node*) override;
72 virtual void childrenChanged(LayoutObject*) override; 72 virtual void childrenChanged(LayoutObject*) override;
73 virtual void checkedStateChanged(Node*) override; 73 virtual void checkedStateChanged(Node*) override;
74 virtual void listboxOptionStateChanged(HTMLOptionElement*); 74 virtual void listboxOptionStateChanged(HTMLOptionElement*);
75 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); 75 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*);
76 virtual void listboxActiveIndexChanged(HTMLSelectElement*); 76 virtual void listboxActiveIndexChanged(HTMLSelectElement*);
77 77
78 virtual void remove(LayoutObject*) override; 78 virtual void remove(LayoutObject*) override;
79 virtual void remove(Node*) override; 79 virtual void remove(Node*) override;
80 virtual void remove(Widget*) override; 80 virtual void remove(Widget*) override;
81 virtual void remove(AbstractInlineTextBox*) override;
81 82
82 virtual const Element* rootAXEditableElement(const Node*) override; 83 virtual const Element* rootAXEditableElement(const Node*) override;
83 84
84 // Called by a node when text or a text equivalent (e.g. alt) attribute is c hanged. 85 // Called by a node when text or a text equivalent (e.g. alt) attribute is c hanged.
85 virtual void textChanged(LayoutObject*) override; 86 virtual void textChanged(LayoutObject*) override;
86 // Called when a node has just been attached, so we can make sure we have th e right subclass of AXObject. 87 // Called when a node has just been attached, so we can make sure we have th e right subclass of AXObject.
87 virtual void updateCacheAfterNodeIsAttached(Node*) override; 88 virtual void updateCacheAfterNodeIsAttached(Node*) override;
88 89
89 virtual void handleAttributeChanged(const QualifiedName& attrName, Element*) override; 90 virtual void handleAttributeChanged(const QualifiedName& attrName, Element*) override;
90 virtual void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFo cusedNode) override; 91 virtual void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFo cusedNode) override;
91 virtual void handleInitialFocus() override; 92 virtual void handleInitialFocus() override;
92 virtual void handleTextFormControlChanged(Node*) override; 93 virtual void handleTextFormControlChanged(Node*) override;
93 virtual void handleEditableTextContentChanged(Node*) override; 94 virtual void handleEditableTextContentChanged(Node*) override;
94 virtual void handleValueChanged(Node*) override; 95 virtual void handleValueChanged(Node*) override;
95 virtual void handleUpdateActiveMenuOption(LayoutMenuList*, int optionIndex) override; 96 virtual void handleUpdateActiveMenuOption(LayoutMenuList*, int optionIndex) override;
96 virtual void didShowMenuListPopup(LayoutMenuList*) override; 97 virtual void didShowMenuListPopup(LayoutMenuList*) override;
97 virtual void didHideMenuListPopup(LayoutMenuList*) override; 98 virtual void didHideMenuListPopup(LayoutMenuList*) override;
98 virtual void handleLoadComplete(Document*) override; 99 virtual void handleLoadComplete(Document*) override;
99 virtual void handleLayoutComplete(Document*) override; 100 virtual void handleLayoutComplete(Document*) override;
100 101
101 virtual void setCanvasObjectBounds(Element*, const LayoutRect&) override; 102 virtual void setCanvasObjectBounds(Element*, const LayoutRect&) override;
102 103
103 virtual void clearWeakMembers(Visitor*) override;
104
105 virtual void inlineTextBoxesUpdated(LayoutObject*) override; 104 virtual void inlineTextBoxesUpdated(LayoutObject*) override;
106 105
107 // Called when the scroll offset changes. 106 // Called when the scroll offset changes.
108 virtual void handleScrollPositionChanged(FrameView*) override; 107 virtual void handleScrollPositionChanged(FrameView*) override;
109 virtual void handleScrollPositionChanged(LayoutObject*) override; 108 virtual void handleScrollPositionChanged(LayoutObject*) override;
110 109
111 // Called when scroll bars are added / removed (as the view resizes). 110 // Called when scroll bars are added / removed (as the view resizes).
112 void handleScrollbarUpdate(FrameView*) override; 111 void handleScrollbarUpdate(FrameView*) override;
113 void handleLayoutComplete(LayoutObject*) override; 112 void handleLayoutComplete(LayoutObject*) override;
114 void handleScrolledToAnchor(const Node* anchorNode) override; 113 void handleScrolledToAnchor(const Node* anchorNode) override;
(...skipping 16 matching lines...) Expand all
131 130
132 // will only return the AXObject if it already exists 131 // will only return the AXObject if it already exists
133 AXObject* get(Node*); 132 AXObject* get(Node*);
134 AXObject* get(LayoutObject*); 133 AXObject* get(LayoutObject*);
135 AXObject* get(Widget*); 134 AXObject* get(Widget*);
136 AXObject* get(AbstractInlineTextBox*); 135 AXObject* get(AbstractInlineTextBox*);
137 136
138 AXObject* firstAccessibleObjectFromNode(const Node*); 137 AXObject* firstAccessibleObjectFromNode(const Node*);
139 138
140 void remove(AXID); 139 void remove(AXID);
141 void remove(AbstractInlineTextBox*);
142 140
143 void childrenChanged(AXObject*); 141 void childrenChanged(AXObject*);
144 142
145 void handleActiveDescendantChanged(Node*); 143 void handleActiveDescendantChanged(Node*);
146 void handleAriaRoleChanged(Node*); 144 void handleAriaRoleChanged(Node*);
147 void handleAriaExpandedChange(Node*); 145 void handleAriaExpandedChange(Node*);
148 void handleAriaSelectedChanged(Node*); 146 void handleAriaSelectedChanged(Node*);
149 147
150 void recomputeIsIgnored(LayoutObject*); 148 void recomputeIsIgnored(LayoutObject*);
151 149
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 protected: 191 protected:
194 void postPlatformNotification(AXObject*, AXNotification); 192 void postPlatformNotification(AXObject*, AXNotification);
195 void textChanged(AXObject*); 193 void textChanged(AXObject*);
196 void labelChanged(Element*); 194 void labelChanged(Element*);
197 195
198 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid. 196 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid.
199 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } 197 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); }
200 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } 198 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); }
201 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } 199 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
202 200
203 PassRefPtr<AXObject> createFromRenderer(LayoutObject*); 201 PassRefPtrWillBeRawPtr<AXObject> createFromRenderer(LayoutObject*);
204 PassRefPtr<AXObject> createFromNode(Node*); 202 PassRefPtrWillBeRawPtr<AXObject> createFromNode(Node*);
205 PassRefPtr<AXObject> createFromInlineTextBox(AbstractInlineTextBox*); 203 PassRefPtrWillBeRawPtr<AXObject> createFromInlineTextBox(AbstractInlineTextB ox*);
206 204
207 private: 205 private:
208 Document& m_document; 206
209 HashMap<AXID, RefPtr<AXObject>> m_objects; 207 RawPtrWillBeMember<Document> m_document;
208 WillBeHeapHashMap<AXID, RefPtrWillBeMember<AXObject>> m_objects;
209 // LayoutObject and AbstractInlineTextBox are not on the Oilpan heap so we
210 // do not use HeapHashMap for those mappings.
210 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; 211 HashMap<LayoutObject*, AXID> m_layoutObjectMapping;
211 HashMap<Widget*, AXID> m_widgetObjectMapping; 212 WillBeHeapHashMap<RawPtrWillBeMember<Widget>, AXID> m_widgetObjectMapping;
212 HashMap<Node*, AXID> m_nodeObjectMapping; 213 WillBeHeapHashMap<RawPtrWillBeMember<Node>, AXID> m_nodeObjectMapping;
213 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; 214 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping;
214 HashSet<Node*> m_textMarkerNodes; 215 WillBeHeapHashSet<RawPtrWillBeWeakMember<Node>> m_textMarkerNodes;
haraken 2015/06/24 13:27:20 I think this can be a Member as well, since the li
keishi 2015/06/24 15:05:26 Done. Just noticed I can't find setNodeInUse used
215 int m_modificationCount; 216 int m_modificationCount;
216 217
217 HashSet<AXID> m_idsInUse; 218 HashSet<AXID> m_idsInUse;
218 219
219 #if ENABLE(ASSERT) 220 #if ENABLE(ASSERT)
220 // Verified when finalizing. 221 // Verified when finalizing.
221 bool m_hasBeenDisposed; 222 bool m_hasBeenDisposed;
222 #endif 223 #endif
223 224
224 // 225 //
(...skipping 17 matching lines...) Expand all
242 // exist in the tree. 243 // exist in the tree.
243 HashMap<AXID, HashSet<String>> m_ariaOwnerToIdsMapping; 244 HashMap<AXID, HashSet<String>> m_ariaOwnerToIdsMapping;
244 245
245 // Map from an ID (the ID attribute of a DOM element) to the set of elements that 246 // Map from an ID (the ID attribute of a DOM element) to the set of elements that
246 // want to own that ID. This is *unvalidated*, it includes possible duplicat es. 247 // want to own that ID. This is *unvalidated*, it includes possible duplicat es.
247 // This is used so that when an element with an ID is added to the tree or c hanges 248 // This is used so that when an element with an ID is added to the tree or c hanges
248 // its ID, we can quickly determine if it affects an aria-owns relationship. 249 // its ID, we can quickly determine if it affects an aria-owns relationship.
249 HashMap<String, OwnPtr<HashSet<AXID>>> m_idToAriaOwnersMapping; 250 HashMap<String, OwnPtr<HashSet<AXID>>> m_idToAriaOwnersMapping;
250 251
251 Timer<AXObjectCacheImpl> m_notificationPostTimer; 252 Timer<AXObjectCacheImpl> m_notificationPostTimer;
252 Vector<pair<RefPtr<AXObject>, AXNotification>> m_notificationsToPost; 253 WillBeHeapVector<pair<RefPtrWillBeMember<AXObject>, AXNotification>> m_notif icationsToPost;
253 void notificationPostTimerFired(Timer<AXObjectCacheImpl>*); 254 void notificationPostTimerFired(Timer<AXObjectCacheImpl>*);
254 255
255 AXObject* focusedImageMapUIElement(HTMLAreaElement*); 256 AXObject* focusedImageMapUIElement(HTMLAreaElement*);
256 257
257 AXID getAXID(AXObject*); 258 AXID getAXID(AXObject*);
258 259
259 void textChanged(Node*); 260 void textChanged(Node*);
260 bool nodeIsTextControl(const Node*); 261 bool nodeIsTextControl(const Node*);
261 262
262 Settings* settings(); 263 Settings* settings();
263 }; 264 };
264 265
265 // This is the only subclass of AXObjectCache. 266 // This is the only subclass of AXObjectCache.
266 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); 267 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true);
267 268
268 bool nodeHasRole(Node*, const String& role); 269 bool nodeHasRole(Node*, const String& role);
269 // This will let you know if aria-hidden was explicitly set to false. 270 // This will let you know if aria-hidden was explicitly set to false.
270 bool isNodeAriaVisible(Node*); 271 bool isNodeAriaVisible(Node*);
271 272
272 } 273 }
273 274
274 #endif 275 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698