Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 132 |
| 132 // will only return the AXObject if it already exists | 133 // will only return the AXObject if it already exists |
| 133 AXObject* get(Node*); | 134 AXObject* get(Node*); |
| 134 AXObject* get(LayoutObject*); | 135 AXObject* get(LayoutObject*); |
| 135 AXObject* get(Widget*); | 136 AXObject* get(Widget*); |
| 136 AXObject* get(AbstractInlineTextBox*); | 137 AXObject* get(AbstractInlineTextBox*); |
| 137 | 138 |
| 138 AXObject* firstAccessibleObjectFromNode(const Node*); | 139 AXObject* firstAccessibleObjectFromNode(const Node*); |
| 139 | 140 |
| 140 void remove(AXID); | 141 void remove(AXID); |
| 141 void remove(AbstractInlineTextBox*); | |
| 142 | 142 |
| 143 void childrenChanged(AXObject*); | 143 void childrenChanged(AXObject*); |
| 144 | 144 |
| 145 void handleActiveDescendantChanged(Node*); | 145 void handleActiveDescendantChanged(Node*); |
| 146 void handleAriaRoleChanged(Node*); | 146 void handleAriaRoleChanged(Node*); |
| 147 void handleAriaExpandedChange(Node*); | 147 void handleAriaExpandedChange(Node*); |
| 148 void handleAriaSelectedChanged(Node*); | 148 void handleAriaSelectedChanged(Node*); |
| 149 | 149 |
| 150 void recomputeIsIgnored(LayoutObject*); | 150 void recomputeIsIgnored(LayoutObject*); |
| 151 | 151 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 protected: | 193 protected: |
| 194 void postPlatformNotification(AXObject*, AXNotification); | 194 void postPlatformNotification(AXObject*, AXNotification); |
| 195 void textChanged(AXObject*); | 195 void textChanged(AXObject*); |
| 196 void labelChanged(Element*); | 196 void labelChanged(Element*); |
| 197 | 197 |
| 198 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid. | 198 // 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); } | 199 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } |
| 200 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } | 200 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } |
| 201 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } | 201 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } |
| 202 | 202 |
| 203 PassRefPtr<AXObject> createFromRenderer(LayoutObject*); | 203 PassRefPtrWillBeRawPtr<AXObject> createFromRenderer(LayoutObject*); |
| 204 PassRefPtr<AXObject> createFromNode(Node*); | 204 PassRefPtrWillBeRawPtr<AXObject> createFromNode(Node*); |
| 205 PassRefPtr<AXObject> createFromInlineTextBox(AbstractInlineTextBox*); | 205 PassRefPtrWillBeRawPtr<AXObject> createFromInlineTextBox(AbstractInlineTextB ox*); |
| 206 | 206 |
| 207 private: | 207 private: |
| 208 Document& m_document; | 208 |
| 209 HashMap<AXID, RefPtr<AXObject>> m_objects; | 209 RawPtrWillBeMember<Document> m_document; |
| 210 WillBeHeapHashMap<AXID, RefPtrWillBeMember<AXObject>> m_objects; | |
| 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; |
|
dmazzoni
2015/06/08 15:25:49
Why not a HeapHashMap for this?
Would it make sen
haraken
2015/06/09 02:25:45
Worth having a comment. The reason is that LayoutO
keishi
2015/06/09 05:51:19
Added comment.
| |
| 214 HashSet<Node*> m_textMarkerNodes; | 215 WillBeHeapHashSet<RawPtrWillBeWeakMember<Node>> m_textMarkerNodes; |
| 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 Loading... | |
| 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 |
| OLD | NEW |