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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 struct TextMarkerData { | 49 struct TextMarkerData { |
| 50 AXID axID; | 50 AXID axID; |
| 51 Node* node; | 51 Node* node; |
| 52 int offset; | 52 int offset; |
| 53 EAffinity affinity; | 53 EAffinity affinity; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // This class should only be used from inside the accessibility directory. | 56 // This class should only be used from inside the accessibility directory. |
| 57 class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { | 57 class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { |
| 58 WTF_MAKE_NONCOPYABLE(AXObjectCacheImpl); WTF_MAKE_FAST_ALLOCATED(AXObjectCac heImpl); | 58 WTF_MAKE_NONCOPYABLE(AXObjectCacheImpl); |
| 59 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(AXObjectCacheImpl); | |
| 59 public: | 60 public: |
| 60 static AXObjectCache* create(Document&); | 61 static PassOwnPtrWillBeRawPtr<AXObjectCache> create(Document&); |
| 61 | 62 |
| 62 explicit AXObjectCacheImpl(Document&); | 63 explicit AXObjectCacheImpl(Document&); |
| 63 ~AXObjectCacheImpl(); | 64 ~AXObjectCacheImpl(); |
| 65 DECLARE_VIRTUAL_TRACE(); | |
| 64 | 66 |
| 65 AXObject* focusedUIElementForPage(const Page*); | 67 AXObject* focusedUIElementForPage(const Page*); |
| 66 | 68 |
| 69 virtual void dispose() override; | |
| 70 | |
| 67 virtual void selectionChanged(Node*) override; | 71 virtual void selectionChanged(Node*) override; |
| 68 virtual void childrenChanged(Node*) override; | 72 virtual void childrenChanged(Node*) override; |
| 69 virtual void childrenChanged(LayoutObject*) override; | 73 virtual void childrenChanged(LayoutObject*) override; |
| 70 virtual void checkedStateChanged(Node*) override; | 74 virtual void checkedStateChanged(Node*) override; |
| 71 virtual void listboxOptionStateChanged(HTMLOptionElement*); | 75 virtual void listboxOptionStateChanged(HTMLOptionElement*); |
| 72 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); | 76 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); |
| 73 virtual void listboxActiveIndexChanged(HTMLSelectElement*); | 77 virtual void listboxActiveIndexChanged(HTMLSelectElement*); |
| 74 | 78 |
| 75 virtual void remove(LayoutObject*) override; | 79 virtual void remove(LayoutObject*) override; |
| 76 virtual void remove(Node*) override; | 80 virtual void remove(Node*) override; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 AXObject* getOrCreate(AbstractInlineTextBox*); | 131 AXObject* getOrCreate(AbstractInlineTextBox*); |
| 128 | 132 |
| 129 // will only return the AXObject if it already exists | 133 // will only return the AXObject if it already exists |
| 130 AXObject* get(Node*); | 134 AXObject* get(Node*); |
| 131 AXObject* get(LayoutObject*); | 135 AXObject* get(LayoutObject*); |
| 132 AXObject* get(Widget*); | 136 AXObject* get(Widget*); |
| 133 AXObject* get(AbstractInlineTextBox*); | 137 AXObject* get(AbstractInlineTextBox*); |
| 134 | 138 |
| 135 AXObject* firstAccessibleObjectFromNode(const Node*); | 139 AXObject* firstAccessibleObjectFromNode(const Node*); |
| 136 | 140 |
| 141 #if ENABLE(OILPAN) | |
| 142 void remove(AXObject*); | |
|
dmazzoni
2015/04/28 06:53:25
Can we make this change for the non-oilpan compile
keishi
2015/05/28 06:49:19
Done.
| |
| 143 #else | |
| 137 void remove(AXID); | 144 void remove(AXID); |
| 145 #endif | |
| 138 void remove(AbstractInlineTextBox*); | 146 void remove(AbstractInlineTextBox*); |
| 139 | 147 |
| 140 void childrenChanged(AXObject*); | 148 void childrenChanged(AXObject*); |
| 141 | 149 |
| 142 void handleActiveDescendantChanged(Node*); | 150 void handleActiveDescendantChanged(Node*); |
| 143 void handleAriaRoleChanged(Node*); | 151 void handleAriaRoleChanged(Node*); |
| 144 void handleAriaExpandedChange(Node*); | 152 void handleAriaExpandedChange(Node*); |
| 145 void handleAriaSelectedChanged(Node*); | 153 void handleAriaSelectedChanged(Node*); |
| 146 | 154 |
| 147 void recomputeIsIgnored(LayoutObject*); | 155 void recomputeIsIgnored(LayoutObject*); |
| 148 | 156 |
| 149 bool accessibilityEnabled(); | 157 bool accessibilityEnabled(); |
| 150 bool inlineTextBoxAccessibilityEnabled(); | 158 bool inlineTextBoxAccessibilityEnabled(); |
| 151 | 159 |
| 160 #if !ENABLE(OILPAN) | |
| 152 void removeAXID(AXObject*); | 161 void removeAXID(AXObject*); |
| 162 #endif | |
| 153 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } | 163 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } |
| 154 | 164 |
| 155 AXID platformGenerateAXID() const; | 165 AXID platformGenerateAXID() const; |
| 156 | 166 |
| 157 // Counts the number of times the document has been modified. Some attribute values are cached | 167 // Counts the number of times the document has been modified. Some attribute values are cached |
| 158 // as long as the modification count hasn't changed. | 168 // as long as the modification count hasn't changed. |
| 159 int modificationCount() const { return m_modificationCount; } | 169 int modificationCount() const { return m_modificationCount; } |
| 160 | 170 |
| 161 void postNotification(LayoutObject*, AXNotification); | 171 void postNotification(LayoutObject*, AXNotification); |
| 162 void postNotification(Node*, AXNotification); | 172 void postNotification(Node*, AXNotification); |
| 163 void postNotification(AXObject*, AXNotification); | 173 void postNotification(AXObject*, AXNotification); |
| 164 | 174 |
| 165 protected: | 175 protected: |
| 166 void postPlatformNotification(AXObject*, AXNotification); | 176 void postPlatformNotification(AXObject*, AXNotification); |
| 167 void textChanged(AXObject*); | 177 void textChanged(AXObject*); |
| 168 void labelChanged(Element*); | 178 void labelChanged(Element*); |
| 169 | 179 |
| 170 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid. | 180 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid. |
| 171 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } | 181 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } |
| 172 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } | 182 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } |
| 173 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } | 183 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } |
| 174 | 184 |
| 175 PassRefPtr<AXObject> createFromRenderer(LayoutObject*); | 185 PassRefPtrWillBeRawPtr<AXObject> createFromRenderer(LayoutObject*); |
| 176 PassRefPtr<AXObject> createFromNode(Node*); | 186 PassRefPtrWillBeRawPtr<AXObject> createFromNode(Node*); |
| 177 PassRefPtr<AXObject> createFromInlineTextBox(AbstractInlineTextBox*); | 187 PassRefPtrWillBeRawPtr<AXObject> createFromInlineTextBox(AbstractInlineTextB ox*); |
| 178 | 188 |
| 179 private: | 189 private: |
| 190 void removeAXID(AXID); | |
| 191 | |
| 180 Document& m_document; | 192 Document& m_document; |
| 193 | |
| 194 #if ENABLE(OILPAN) | |
| 195 HeapHashMap<AXID, WeakMember<AXObject>> m_objects; | |
| 196 HeapHashMap<LayoutObject*, Member<AXObject>> m_layoutObjectMapping; | |
| 197 HeapHashMap<WeakMember<Widget>, Member<AXObject>> m_widgetObjectMapping; | |
| 198 HeapHashMap<WeakMember<Node>, Member<AXObject>> m_nodeObjectMapping; | |
|
dmazzoni
2015/04/28 06:53:25
I'm worried about WeakMember<Node> here. We rely o
keishi
2015/05/28 06:49:19
HeapHashMap with WeakMember entries will automatic
| |
| 199 HeapHashMap<AbstractInlineTextBox*, Member<AXObject>> m_inlineTextBoxObjectM apping; | |
| 200 #else | |
| 181 HashMap<AXID, RefPtr<AXObject>> m_objects; | 201 HashMap<AXID, RefPtr<AXObject>> m_objects; |
| 182 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; | 202 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; |
| 183 HashMap<Widget*, AXID> m_widgetObjectMapping; | 203 HashMap<Widget*, AXID> m_widgetObjectMapping; |
| 184 HashMap<Node*, AXID> m_nodeObjectMapping; | 204 HashMap<Node*, AXID> m_nodeObjectMapping; |
| 185 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; | 205 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; |
| 186 HashSet<Node*> m_textMarkerNodes; | 206 #endif |
| 207 WillBeHeapHashSet<RawPtrWillBeWeakMember<Node>> m_textMarkerNodes; | |
| 187 int m_modificationCount; | 208 int m_modificationCount; |
| 188 | 209 |
| 189 HashSet<AXID> m_idsInUse; | 210 HashSet<AXID> m_idsInUse; |
| 190 | 211 |
| 191 Timer<AXObjectCacheImpl> m_notificationPostTimer; | 212 Timer<AXObjectCacheImpl> m_notificationPostTimer; |
| 192 Vector<pair<RefPtr<AXObject>, AXNotification>> m_notificationsToPost; | 213 WillBeHeapVector<pair<RefPtrWillBeMember<AXObject>, AXNotification>> m_notif icationsToPost; |
| 193 void notificationPostTimerFired(Timer<AXObjectCacheImpl>*); | 214 void notificationPostTimerFired(Timer<AXObjectCacheImpl>*); |
| 194 | 215 |
| 195 AXObject* focusedImageMapUIElement(HTMLAreaElement*); | 216 AXObject* focusedImageMapUIElement(HTMLAreaElement*); |
| 196 | 217 |
| 197 AXID getAXID(AXObject*); | 218 AXID getAXID(AXObject*); |
| 198 | 219 |
| 199 void textChanged(Node*); | 220 void textChanged(Node*); |
| 200 bool nodeIsTextControl(const Node*); | 221 bool nodeIsTextControl(const Node*); |
| 201 | 222 |
| 202 Settings* settings(); | 223 Settings* settings(); |
| 203 }; | 224 }; |
| 204 | 225 |
| 205 // This is the only subclass of AXObjectCache. | 226 // This is the only subclass of AXObjectCache. |
| 206 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); | 227 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); |
| 207 | 228 |
| 208 bool nodeHasRole(Node*, const String& role); | 229 bool nodeHasRole(Node*, const String& role); |
| 209 // This will let you know if aria-hidden was explicitly set to false. | 230 // This will let you know if aria-hidden was explicitly set to false. |
| 210 bool isNodeAriaVisible(Node*); | 231 bool isNodeAriaVisible(Node*); |
| 211 | 232 |
| 212 } | 233 } |
| 213 | 234 |
| 214 #endif | 235 #endif |
| OLD | NEW |