| 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 25 matching lines...) Expand all Loading... |
| 36 #include "platform/Timer.h" | 36 #include "platform/Timer.h" |
| 37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 39 #include "wtf/HashSet.h" | 39 #include "wtf/HashSet.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class AbstractInlineTextBox; | 43 class AbstractInlineTextBox; |
| 44 class HTMLAreaElement; | 44 class HTMLAreaElement; |
| 45 class FrameView; | 45 class FrameView; |
| 46 class Widget; | |
| 47 | 46 |
| 48 // This class should only be used from inside the accessibility directory. | 47 // This class should only be used from inside the accessibility directory. |
| 49 class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { | 48 class MODULES_EXPORT AXObjectCacheImpl : public AXObjectCache { |
| 50 WTF_MAKE_NONCOPYABLE(AXObjectCacheImpl); | 49 WTF_MAKE_NONCOPYABLE(AXObjectCacheImpl); |
| 51 public: | 50 public: |
| 52 static AXObjectCache* create(Document&); | 51 static AXObjectCache* create(Document&); |
| 53 | 52 |
| 54 explicit AXObjectCacheImpl(Document&); | 53 explicit AXObjectCacheImpl(Document&); |
| 55 ~AXObjectCacheImpl(); | 54 ~AXObjectCacheImpl(); |
| 56 DECLARE_VIRTUAL_TRACE(); | 55 DECLARE_VIRTUAL_TRACE(); |
| 57 | 56 |
| 58 AXObject* focusedUIElementForPage(const Page*); | 57 AXObject* focusedUIElementForPage(const Page*); |
| 59 | 58 |
| 60 void dispose() override; | 59 void dispose() override; |
| 61 | 60 |
| 62 void selectionChanged(Node*) override; | 61 void selectionChanged(Node*) override; |
| 63 void childrenChanged(Node*) override; | 62 void childrenChanged(Node*) override; |
| 64 void childrenChanged(LayoutObject*) override; | 63 void childrenChanged(LayoutObject*) override; |
| 65 void checkedStateChanged(Node*) override; | 64 void checkedStateChanged(Node*) override; |
| 66 virtual void listboxOptionStateChanged(HTMLOptionElement*); | 65 virtual void listboxOptionStateChanged(HTMLOptionElement*); |
| 67 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); | 66 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); |
| 68 virtual void listboxActiveIndexChanged(HTMLSelectElement*); | 67 virtual void listboxActiveIndexChanged(HTMLSelectElement*); |
| 69 | 68 |
| 70 void remove(LayoutObject*) override; | 69 void remove(LayoutObject*) override; |
| 71 void remove(Node*) override; | 70 void remove(Node*) override; |
| 72 void remove(Widget*) override; | |
| 73 void remove(AbstractInlineTextBox*) override; | 71 void remove(AbstractInlineTextBox*) override; |
| 74 | 72 |
| 75 const Element* rootAXEditableElement(const Node*) override; | 73 const Element* rootAXEditableElement(const Node*) override; |
| 76 | 74 |
| 77 // Called by a node when text or a text equivalent (e.g. alt) attribute is c
hanged. | 75 // Called by a node when text or a text equivalent (e.g. alt) attribute is c
hanged. |
| 78 void textChanged(LayoutObject*) override; | 76 void textChanged(LayoutObject*) override; |
| 79 // Called when a node has just been attached, so we can make sure we have th
e right subclass of AXObject. | 77 // Called when a node has just been attached, so we can make sure we have th
e right subclass of AXObject. |
| 80 void updateCacheAfterNodeIsAttached(Node*) override; | 78 void updateCacheAfterNodeIsAttached(Node*) override; |
| 81 | 79 |
| 82 void handleAttributeChanged(const QualifiedName& attrName, Element*) overrid
e; | 80 void handleAttributeChanged(const QualifiedName& attrName, Element*) overrid
e; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 | 91 |
| 94 void setCanvasObjectBounds(Element*, const LayoutRect&) override; | 92 void setCanvasObjectBounds(Element*, const LayoutRect&) override; |
| 95 | 93 |
| 96 void inlineTextBoxesUpdated(LayoutObject*) override; | 94 void inlineTextBoxesUpdated(LayoutObject*) override; |
| 97 | 95 |
| 98 // Called when the scroll offset changes. | 96 // Called when the scroll offset changes. |
| 99 void handleScrollPositionChanged(FrameView*) override; | 97 void handleScrollPositionChanged(FrameView*) override; |
| 100 void handleScrollPositionChanged(LayoutObject*) override; | 98 void handleScrollPositionChanged(LayoutObject*) override; |
| 101 | 99 |
| 102 // Called when scroll bars are added / removed (as the view resizes). | 100 // Called when scroll bars are added / removed (as the view resizes). |
| 103 void handleScrollbarUpdate(FrameView*) override; | |
| 104 void handleLayoutComplete(LayoutObject*) override; | 101 void handleLayoutComplete(LayoutObject*) override; |
| 105 void handleScrolledToAnchor(const Node* anchorNode) override; | 102 void handleScrolledToAnchor(const Node* anchorNode) override; |
| 106 | 103 |
| 107 const AtomicString& computedRoleForNode(Node*) override; | 104 const AtomicString& computedRoleForNode(Node*) override; |
| 108 String computedNameForNode(Node*) override; | 105 String computedNameForNode(Node*) override; |
| 109 | 106 |
| 110 void onTouchAccessibilityHover(const IntPoint&) override; | 107 void onTouchAccessibilityHover(const IntPoint&) override; |
| 111 | 108 |
| 112 // Returns the root object for the entire document. | 109 // Returns the root object for the entire document. |
| 113 AXObject* rootObject(); | 110 AXObject* rootObject(); |
| 114 | 111 |
| 115 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } | 112 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } |
| 116 AXObject* root(); | 113 AXObject* root(); |
| 117 | 114 |
| 118 // used for objects without backing elements | 115 // used for objects without backing elements |
| 119 AXObject* getOrCreate(AccessibilityRole); | 116 AXObject* getOrCreate(AccessibilityRole); |
| 120 AXObject* getOrCreate(LayoutObject*); | 117 AXObject* getOrCreate(LayoutObject*); |
| 121 AXObject* getOrCreate(Widget*); | |
| 122 AXObject* getOrCreate(Node*); | 118 AXObject* getOrCreate(Node*); |
| 123 AXObject* getOrCreate(AbstractInlineTextBox*); | 119 AXObject* getOrCreate(AbstractInlineTextBox*); |
| 124 | 120 |
| 125 // will only return the AXObject if it already exists | 121 // will only return the AXObject if it already exists |
| 126 AXObject* get(Node*); | 122 AXObject* get(Node*); |
| 127 AXObject* get(LayoutObject*); | 123 AXObject* get(LayoutObject*); |
| 128 AXObject* get(Widget*); | |
| 129 AXObject* get(AbstractInlineTextBox*); | 124 AXObject* get(AbstractInlineTextBox*); |
| 130 | 125 |
| 131 AXObject* firstAccessibleObjectFromNode(const Node*); | 126 AXObject* firstAccessibleObjectFromNode(const Node*); |
| 132 | 127 |
| 133 void remove(AXID); | 128 void remove(AXID); |
| 134 | 129 |
| 135 void childrenChanged(AXObject*); | 130 void childrenChanged(AXObject*); |
| 136 | 131 |
| 137 void handleActiveDescendantChanged(Node*); | 132 void handleActiveDescendantChanged(Node*); |
| 138 void handleAriaRoleChanged(Node*); | 133 void handleAriaRoleChanged(Node*); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 AXObject* createFromNode(Node*); | 183 AXObject* createFromNode(Node*); |
| 189 AXObject* createFromInlineTextBox(AbstractInlineTextBox*); | 184 AXObject* createFromInlineTextBox(AbstractInlineTextBox*); |
| 190 | 185 |
| 191 private: | 186 private: |
| 192 | 187 |
| 193 RawPtrWillBeMember<Document> m_document; | 188 RawPtrWillBeMember<Document> m_document; |
| 194 HeapHashMap<AXID, Member<AXObject>> m_objects; | 189 HeapHashMap<AXID, Member<AXObject>> m_objects; |
| 195 // LayoutObject and AbstractInlineTextBox are not on the Oilpan heap so we | 190 // LayoutObject and AbstractInlineTextBox are not on the Oilpan heap so we |
| 196 // do not use HeapHashMap for those mappings. | 191 // do not use HeapHashMap for those mappings. |
| 197 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; | 192 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; |
| 198 WillBeHeapHashMap<RawPtrWillBeMember<Widget>, AXID> m_widgetObjectMapping; | |
| 199 WillBeHeapHashMap<RawPtrWillBeMember<Node>, AXID> m_nodeObjectMapping; | 193 WillBeHeapHashMap<RawPtrWillBeMember<Node>, AXID> m_nodeObjectMapping; |
| 200 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; | 194 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; |
| 201 int m_modificationCount; | 195 int m_modificationCount; |
| 202 | 196 |
| 203 HashSet<AXID> m_idsInUse; | 197 HashSet<AXID> m_idsInUse; |
| 204 | 198 |
| 205 #if ENABLE(ASSERT) | 199 #if ENABLE(ASSERT) |
| 206 // Verified when finalizing. | 200 // Verified when finalizing. |
| 207 bool m_hasBeenDisposed; | 201 bool m_hasBeenDisposed; |
| 208 #endif | 202 #endif |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // This is the only subclass of AXObjectCache. | 245 // This is the only subclass of AXObjectCache. |
| 252 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); | 246 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); |
| 253 | 247 |
| 254 bool nodeHasRole(Node*, const String& role); | 248 bool nodeHasRole(Node*, const String& role); |
| 255 // This will let you know if aria-hidden was explicitly set to false. | 249 // This will let you know if aria-hidden was explicitly set to false. |
| 256 bool isNodeAriaVisible(Node*); | 250 bool isNodeAriaVisible(Node*); |
| 257 | 251 |
| 258 } | 252 } |
| 259 | 253 |
| 260 #endif | 254 #endif |
| OLD | NEW |