| 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*); | |
| 59 | |
| 60 void dispose() override; | 57 void dispose() override; |
| 61 | 58 |
| 62 void selectionChanged(Node*) override; | 59 void selectionChanged(Node*) override; |
| 63 void childrenChanged(Node*) override; | 60 void childrenChanged(Node*) override; |
| 64 void childrenChanged(LayoutObject*) override; | 61 void childrenChanged(LayoutObject*) override; |
| 65 void checkedStateChanged(Node*) override; | 62 void checkedStateChanged(Node*) override; |
| 66 virtual void listboxOptionStateChanged(HTMLOptionElement*); | 63 virtual void listboxOptionStateChanged(HTMLOptionElement*); |
| 67 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); | 64 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); |
| 68 virtual void listboxActiveIndexChanged(HTMLSelectElement*); | 65 virtual void listboxActiveIndexChanged(HTMLSelectElement*); |
| 69 | 66 |
| 70 void remove(LayoutObject*) override; | 67 void remove(LayoutObject*) override; |
| 71 void remove(Node*) override; | 68 void remove(Node*) override; |
| 72 void remove(Widget*) override; | |
| 73 void remove(AbstractInlineTextBox*) override; | 69 void remove(AbstractInlineTextBox*) override; |
| 74 | 70 |
| 75 const Element* rootAXEditableElement(const Node*) override; | 71 const Element* rootAXEditableElement(const Node*) override; |
| 76 | 72 |
| 77 // Called by a node when text or a text equivalent (e.g. alt) attribute is c
hanged. | 73 // Called by a node when text or a text equivalent (e.g. alt) attribute is c
hanged. |
| 78 void textChanged(LayoutObject*) override; | 74 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. | 75 // 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; | 76 void updateCacheAfterNodeIsAttached(Node*) override; |
| 81 | 77 |
| 82 void handleAttributeChanged(const QualifiedName& attrName, Element*) overrid
e; | 78 void handleAttributeChanged(const QualifiedName& attrName, Element*) overrid
e; |
| 83 void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNod
e) override; | 79 void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNod
e) override; |
| 84 void handleInitialFocus() override; | 80 void handleInitialFocus() override; |
| 85 void handleTextFormControlChanged(Node*) override; | 81 void handleTextFormControlChanged(Node*) override; |
| 86 void handleEditableTextContentChanged(Node*) override; | 82 void handleEditableTextContentChanged(Node*) override; |
| 87 void handleValueChanged(Node*) override; | 83 void handleValueChanged(Node*) override; |
| 88 void handleUpdateActiveMenuOption(LayoutMenuList*, int optionIndex) override
; | 84 void handleUpdateActiveMenuOption(LayoutMenuList*, int optionIndex) override
; |
| 89 void didShowMenuListPopup(LayoutMenuList*) override; | 85 void didShowMenuListPopup(LayoutMenuList*) override; |
| 90 void didHideMenuListPopup(LayoutMenuList*) override; | 86 void didHideMenuListPopup(LayoutMenuList*) override; |
| 91 void handleLoadComplete(Document*) override; | 87 void handleLoadComplete(Document*) override; |
| 92 void handleLayoutComplete(Document*) override; | 88 void handleLayoutComplete(Document*) override; |
| 93 | 89 |
| 94 void setCanvasObjectBounds(Element*, const LayoutRect&) override; | 90 void setCanvasObjectBounds(Element*, const LayoutRect&) override; |
| 95 | 91 |
| 96 void inlineTextBoxesUpdated(LayoutObject*) override; | 92 void inlineTextBoxesUpdated(LayoutObject*) override; |
| 97 | 93 |
| 98 // Called when the scroll offset changes. | 94 // Called when the scroll offset changes. |
| 99 void handleScrollPositionChanged(FrameView*) override; | 95 void handleScrollPositionChanged(FrameView*) override; |
| 100 void handleScrollPositionChanged(LayoutObject*) override; | 96 void handleScrollPositionChanged(LayoutObject*) override; |
| 101 | 97 |
| 102 // Called when scroll bars are added / removed (as the view resizes). | |
| 103 void handleScrollbarUpdate(FrameView*) override; | |
| 104 void handleLayoutComplete(LayoutObject*) override; | 98 void handleLayoutComplete(LayoutObject*) override; |
| 105 void handleScrolledToAnchor(const Node* anchorNode) override; | 99 void handleScrolledToAnchor(const Node* anchorNode) override; |
| 106 | 100 |
| 107 const AtomicString& computedRoleForNode(Node*) override; | 101 const AtomicString& computedRoleForNode(Node*) override; |
| 108 String computedNameForNode(Node*) override; | 102 String computedNameForNode(Node*) override; |
| 109 | 103 |
| 110 // Returns the root object for the entire document. | 104 // Returns the root object for the entire document. |
| 111 AXObject* rootObject(); | 105 AXObject* rootObject(); |
| 112 | 106 |
| 113 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } | 107 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } |
| 114 AXObject* root(); | 108 AXObject* root(); |
| 115 | 109 |
| 116 // used for objects without backing elements | 110 // used for objects without backing elements |
| 117 AXObject* getOrCreate(AccessibilityRole); | 111 AXObject* getOrCreate(AccessibilityRole); |
| 118 AXObject* getOrCreate(LayoutObject*); | 112 AXObject* getOrCreate(LayoutObject*); |
| 119 AXObject* getOrCreate(Widget*); | |
| 120 AXObject* getOrCreate(Node*); | 113 AXObject* getOrCreate(Node*); |
| 121 AXObject* getOrCreate(AbstractInlineTextBox*); | 114 AXObject* getOrCreate(AbstractInlineTextBox*); |
| 122 | 115 |
| 123 // will only return the AXObject if it already exists | 116 // will only return the AXObject if it already exists |
| 124 AXObject* get(Node*); | 117 AXObject* get(Node*); |
| 125 AXObject* get(LayoutObject*); | 118 AXObject* get(LayoutObject*); |
| 126 AXObject* get(Widget*); | |
| 127 AXObject* get(AbstractInlineTextBox*); | 119 AXObject* get(AbstractInlineTextBox*); |
| 128 | 120 |
| 129 AXObject* firstAccessibleObjectFromNode(const Node*); | 121 AXObject* firstAccessibleObjectFromNode(const Node*); |
| 130 | 122 |
| 131 void remove(AXID); | 123 void remove(AXID); |
| 132 | 124 |
| 133 void childrenChanged(AXObject*); | 125 void childrenChanged(AXObject*); |
| 134 | 126 |
| 135 void handleActiveDescendantChanged(Node*); | 127 void handleActiveDescendantChanged(Node*); |
| 136 void handleAriaRoleChanged(Node*); | 128 void handleAriaRoleChanged(Node*); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 AXObject* createFromNode(Node*); | 181 AXObject* createFromNode(Node*); |
| 190 AXObject* createFromInlineTextBox(AbstractInlineTextBox*); | 182 AXObject* createFromInlineTextBox(AbstractInlineTextBox*); |
| 191 | 183 |
| 192 private: | 184 private: |
| 193 | 185 |
| 194 RawPtrWillBeMember<Document> m_document; | 186 RawPtrWillBeMember<Document> m_document; |
| 195 HeapHashMap<AXID, Member<AXObject>> m_objects; | 187 HeapHashMap<AXID, Member<AXObject>> m_objects; |
| 196 // LayoutObject and AbstractInlineTextBox are not on the Oilpan heap so we | 188 // LayoutObject and AbstractInlineTextBox are not on the Oilpan heap so we |
| 197 // do not use HeapHashMap for those mappings. | 189 // do not use HeapHashMap for those mappings. |
| 198 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; | 190 HashMap<LayoutObject*, AXID> m_layoutObjectMapping; |
| 199 WillBeHeapHashMap<RawPtrWillBeMember<Widget>, AXID> m_widgetObjectMapping; | |
| 200 WillBeHeapHashMap<RawPtrWillBeMember<Node>, AXID> m_nodeObjectMapping; | 191 WillBeHeapHashMap<RawPtrWillBeMember<Node>, AXID> m_nodeObjectMapping; |
| 201 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; | 192 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; |
| 202 int m_modificationCount; | 193 int m_modificationCount; |
| 203 | 194 |
| 204 HashSet<AXID> m_idsInUse; | 195 HashSet<AXID> m_idsInUse; |
| 205 | 196 |
| 206 #if ENABLE(ASSERT) | 197 #if ENABLE(ASSERT) |
| 207 // Verified when finalizing. | 198 // Verified when finalizing. |
| 208 bool m_hasBeenDisposed; | 199 bool m_hasBeenDisposed; |
| 209 #endif | 200 #endif |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // This is the only subclass of AXObjectCache. | 243 // This is the only subclass of AXObjectCache. |
| 253 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); | 244 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); |
| 254 | 245 |
| 255 bool nodeHasRole(Node*, const String& role); | 246 bool nodeHasRole(Node*, const String& role); |
| 256 // This will let you know if aria-hidden was explicitly set to false. | 247 // This will let you know if aria-hidden was explicitly set to false. |
| 257 bool isNodeAriaVisible(Node*); | 248 bool isNodeAriaVisible(Node*); |
| 258 | 249 |
| 259 } | 250 } |
| 260 | 251 |
| 261 #endif | 252 #endif |
| OLD | NEW |