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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); | 67 virtual void listboxSelectedChildrenChanged(HTMLSelectElement*); |
68 virtual void listboxActiveIndexChanged(HTMLSelectElement*); | 68 virtual void listboxActiveIndexChanged(HTMLSelectElement*); |
69 virtual void radiobuttonRemovedFromGroup(HTMLInputElement*); | 69 virtual void radiobuttonRemovedFromGroup(HTMLInputElement*); |
70 | 70 |
71 void remove(LayoutObject*) override; | 71 void remove(LayoutObject*) override; |
72 void remove(Node*) override; | 72 void remove(Node*) override; |
73 void remove(AbstractInlineTextBox*) override; | 73 void remove(AbstractInlineTextBox*) override; |
74 | 74 |
75 const Element* rootAXEditableElement(const Node*) override; | 75 const Element* rootAXEditableElement(const Node*) override; |
76 | 76 |
77 // Called by a node when text or a text equivalent (e.g. alt) attribute is cha
nged. | 77 // Called by a node when text or a text equivalent (e.g. alt) attribute is |
| 78 // changed. |
78 void textChanged(LayoutObject*) override; | 79 void textChanged(LayoutObject*) override; |
79 // Called when a node has just been attached, so we can make sure we have the
right subclass of AXObject. | 80 // Called when a node has just been attached, so we can make sure we have the |
| 81 // right subclass of AXObject. |
80 void updateCacheAfterNodeIsAttached(Node*) override; | 82 void updateCacheAfterNodeIsAttached(Node*) override; |
81 | 83 |
82 void handleAttributeChanged(const QualifiedName& attrName, Element*) override; | 84 void handleAttributeChanged(const QualifiedName& attrName, Element*) override; |
83 void handleFocusedUIElementChanged(Node* oldFocusedNode, | 85 void handleFocusedUIElementChanged(Node* oldFocusedNode, |
84 Node* newFocusedNode) override; | 86 Node* newFocusedNode) override; |
85 void handleInitialFocus() override; | 87 void handleInitialFocus() override; |
86 void handleTextFormControlChanged(Node*) override; | 88 void handleTextFormControlChanged(Node*) override; |
87 void handleEditableTextContentChanged(Node*) override; | 89 void handleEditableTextContentChanged(Node*) override; |
88 void handleValueChanged(Node*) override; | 90 void handleValueChanged(Node*) override; |
89 void handleUpdateActiveMenuOption(LayoutMenuList*, int optionIndex) override; | 91 void handleUpdateActiveMenuOption(LayoutMenuList*, int optionIndex) override; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void handleAriaExpandedChange(Node*); | 142 void handleAriaExpandedChange(Node*); |
141 void handleAriaSelectedChanged(Node*); | 143 void handleAriaSelectedChanged(Node*); |
142 | 144 |
143 bool accessibilityEnabled(); | 145 bool accessibilityEnabled(); |
144 bool inlineTextBoxAccessibilityEnabled(); | 146 bool inlineTextBoxAccessibilityEnabled(); |
145 | 147 |
146 void removeAXID(AXObject*); | 148 void removeAXID(AXObject*); |
147 | 149 |
148 AXID platformGenerateAXID() const; | 150 AXID platformGenerateAXID() const; |
149 | 151 |
150 // Counts the number of times the document has been modified. Some attribute v
alues are cached | 152 // Counts the number of times the document has been modified. Some attribute |
151 // as long as the modification count hasn't changed. | 153 // values are cached as long as the modification count hasn't changed. |
152 int modificationCount() const { return m_modificationCount; } | 154 int modificationCount() const { return m_modificationCount; } |
153 | 155 |
154 void postNotification(LayoutObject*, AXNotification); | 156 void postNotification(LayoutObject*, AXNotification); |
155 void postNotification(Node*, AXNotification); | 157 void postNotification(Node*, AXNotification); |
156 void postNotification(AXObject*, AXNotification); | 158 void postNotification(AXObject*, AXNotification); |
157 | 159 |
158 // | 160 // |
159 // Aria-owns support. | 161 // Aria-owns support. |
160 // | 162 // |
161 | 163 |
162 // Returns true if the given object's position in the tree was due to aria-own
s. | 164 // Returns true if the given object's position in the tree was due to |
| 165 // aria-owns. |
163 bool isAriaOwned(const AXObject*) const; | 166 bool isAriaOwned(const AXObject*) const; |
164 | 167 |
165 // Returns the parent of the given object due to aria-owns. | 168 // Returns the parent of the given object due to aria-owns. |
166 AXObject* getAriaOwnedParent(const AXObject*) const; | 169 AXObject* getAriaOwnedParent(const AXObject*) const; |
167 | 170 |
168 // Given an object that has an aria-owns attributes, and a vector of ids from
the value of | 171 // Given an object that has an aria-owns attributes, and a vector of ids from |
169 // that attribute, updates the internal state to reflect the new set of childr
en owned by | 172 // the value of that attribute, updates the internal state to reflect the new |
170 // this object, returning the result in |ownedChildren|. The result is validat
ed - illegal, | 173 // set of children owned by this object, returning the result in |
171 // duplicate, or cyclical references have been removed. | 174 // |ownedChildren|. The result is validated - illegal, duplicate, or cyclical |
| 175 // references have been removed. |
172 // | 176 // |
173 // If one or more ids aren't found, they're added to a lookup table so that if
an | 177 // If one or more ids aren't found, they're added to a lookup table so that if |
174 // element with that id appears later, it can be added when you call updateTre
eIfElementIdIsAriaOwned. | 178 // an element with that id appears later, it can be added when you call |
| 179 // updateTreeIfElementIdIsAriaOwned. |
175 void updateAriaOwns(const AXObject* owner, | 180 void updateAriaOwns(const AXObject* owner, |
176 const Vector<String>& idVector, | 181 const Vector<String>& idVector, |
177 HeapVector<Member<AXObject>>& ownedChildren); | 182 HeapVector<Member<AXObject>>& ownedChildren); |
178 | 183 |
179 // Given an element in the DOM tree that was either just added or whose id jus
t changed, | 184 // Given an element in the DOM tree that was either just added or whose id |
180 // check to see if another object wants to be its parent due to aria-owns. If
so, update | 185 // just changed, check to see if another object wants to be its parent due to |
181 // the tree by calling childrenChanged() on the potential owner, possibly repa
renting | 186 // aria-owns. If so, update the tree by calling childrenChanged() on the |
182 // this element. | 187 // potential owner, possibly reparenting this element. |
183 void updateTreeIfElementIdIsAriaOwned(Element*); | 188 void updateTreeIfElementIdIsAriaOwned(Element*); |
184 | 189 |
185 protected: | 190 protected: |
186 void postPlatformNotification(AXObject*, AXNotification); | 191 void postPlatformNotification(AXObject*, AXNotification); |
187 void textChanged(AXObject*); | 192 void textChanged(AXObject*); |
188 void labelChanged(Element*); | 193 void labelChanged(Element*); |
189 | 194 |
190 AXObject* createFromRenderer(LayoutObject*); | 195 AXObject* createFromRenderer(LayoutObject*); |
191 AXObject* createFromNode(Node*); | 196 AXObject* createFromNode(Node*); |
192 AXObject* createFromInlineTextBox(AbstractInlineTextBox*); | 197 AXObject* createFromInlineTextBox(AbstractInlineTextBox*); |
(...skipping 21 matching lines...) Expand all Loading... |
214 | 219 |
215 // Map from the AXID of the owner to the AXIDs of the children. | 220 // Map from the AXID of the owner to the AXIDs of the children. |
216 // This is a validated map, it doesn't contain illegal, duplicate, | 221 // This is a validated map, it doesn't contain illegal, duplicate, |
217 // or cyclical matches, or references to IDs that don't exist. | 222 // or cyclical matches, or references to IDs that don't exist. |
218 HashMap<AXID, Vector<AXID>> m_ariaOwnerToChildrenMapping; | 223 HashMap<AXID, Vector<AXID>> m_ariaOwnerToChildrenMapping; |
219 | 224 |
220 // Map from the AXID of a child to the AXID of the parent that owns it. | 225 // Map from the AXID of a child to the AXID of the parent that owns it. |
221 HashMap<AXID, AXID> m_ariaOwnedChildToOwnerMapping; | 226 HashMap<AXID, AXID> m_ariaOwnedChildToOwnerMapping; |
222 | 227 |
223 // Map from the AXID of a child to the AXID of its real parent in the tree if | 228 // Map from the AXID of a child to the AXID of its real parent in the tree if |
224 // we ignored aria-owns. This is needed in case the owner no longer wants to o
wn it. | 229 // we ignored aria-owns. This is needed in case the owner no longer wants to |
| 230 // own it. |
225 HashMap<AXID, AXID> m_ariaOwnedChildToRealParentMapping; | 231 HashMap<AXID, AXID> m_ariaOwnedChildToRealParentMapping; |
226 | 232 |
227 // Map from the AXID of any object with an aria-owns attribute to the set of i
ds | 233 // Map from the AXID of any object with an aria-owns attribute to the set of |
228 // of its children. This is *unvalidated*, it includes ids that may not curren
tly | 234 // ids of its children. This is *unvalidated*, it includes ids that may not |
229 // exist in the tree. | 235 // currently exist in the tree. |
230 HashMap<AXID, HashSet<String>> m_ariaOwnerToIdsMapping; | 236 HashMap<AXID, HashSet<String>> m_ariaOwnerToIdsMapping; |
231 | 237 |
232 // Map from an ID (the ID attribute of a DOM element) to the set of elements t
hat | 238 // Map from an ID (the ID attribute of a DOM element) to the set of elements |
233 // want to own that ID. This is *unvalidated*, it includes possible duplicates
. | 239 // that want to own that ID. This is *unvalidated*, it includes possible |
234 // This is used so that when an element with an ID is added to the tree or cha
nges | 240 // duplicates. This is used so that when an element with an ID is added to |
235 // its ID, we can quickly determine if it affects an aria-owns relationship. | 241 // the tree or changes its ID, we can quickly determine if it affects an |
| 242 // aria-owns relationship. |
236 HashMap<String, std::unique_ptr<HashSet<AXID>>> m_idToAriaOwnersMapping; | 243 HashMap<String, std::unique_ptr<HashSet<AXID>>> m_idToAriaOwnersMapping; |
237 | 244 |
238 Timer<AXObjectCacheImpl> m_notificationPostTimer; | 245 Timer<AXObjectCacheImpl> m_notificationPostTimer; |
239 HeapVector<std::pair<Member<AXObject>, AXNotification>> m_notificationsToPost; | 246 HeapVector<std::pair<Member<AXObject>, AXNotification>> m_notificationsToPost; |
240 void notificationPostTimerFired(TimerBase*); | 247 void notificationPostTimerFired(TimerBase*); |
241 | 248 |
242 AXObject* focusedImageMapUIElement(HTMLAreaElement*); | 249 AXObject* focusedImageMapUIElement(HTMLAreaElement*); |
243 | 250 |
244 AXID getAXID(AXObject*); | 251 AXID getAXID(AXObject*); |
245 | 252 |
246 void textChanged(Node*); | 253 void textChanged(Node*); |
247 bool nodeIsTextControl(const Node*); | 254 bool nodeIsTextControl(const Node*); |
248 | 255 |
249 Settings* settings(); | 256 Settings* settings(); |
250 }; | 257 }; |
251 | 258 |
252 // This is the only subclass of AXObjectCache. | 259 // This is the only subclass of AXObjectCache. |
253 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); | 260 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); |
254 | 261 |
255 bool nodeHasRole(Node*, const String& role); | 262 bool nodeHasRole(Node*, const String& role); |
256 // This will let you know if aria-hidden was explicitly set to false. | 263 // This will let you know if aria-hidden was explicitly set to false. |
257 bool isNodeAriaVisible(Node*); | 264 bool isNodeAriaVisible(Node*); |
258 | 265 |
259 } // namespace blink | 266 } // namespace blink |
260 | 267 |
261 #endif | 268 #endif |
OLD | NEW |