Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp

Issue 1841333002: Various fixes for aria-activedescendant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed some Blink tests. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXObject.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (toAXImageMapLink(child)->areaElement() == areaElement) 148 if (toAXImageMapLink(child)->areaElement() == areaElement)
149 return child; 149 return child;
150 } 150 }
151 151
152 return 0; 152 return 0;
153 } 153 }
154 154
155 AXObject* AXObjectCacheImpl::focusedObject() 155 AXObject* AXObjectCacheImpl::focusedObject()
156 { 156 {
157 if (!accessibilityEnabled()) 157 if (!accessibilityEnabled())
158 return 0; 158 return nullptr;
159 159
160 Node* focusedNode = m_document->focusedElement(); 160 Node* focusedNode = m_document->focusedElement();
161 if (!focusedNode) 161 if (!focusedNode)
162 focusedNode = m_document; 162 focusedNode = m_document;
163 163
164 // If it's an image map, get the focused link within the image map. 164 // If it's an image map, get the focused link within the image map.
165 if (isHTMLAreaElement(focusedNode)) 165 if (isHTMLAreaElement(focusedNode))
166 return focusedImageMapUIElement(toHTMLAreaElement(focusedNode)); 166 return focusedImageMapUIElement(toHTMLAreaElement(focusedNode));
167 167
168 // See if there's a page popup, for example a calendar picker. 168 // See if there's a page popup, for example a calendar picker.
169 Element* adjustedFocusedElement = m_document->adjustedFocusedElement(); 169 Element* adjustedFocusedElement = m_document->adjustedFocusedElement();
170 if (isHTMLInputElement(adjustedFocusedElement)) { 170 if (isHTMLInputElement(adjustedFocusedElement)) {
171 if (AXObject* axPopup = toHTMLInputElement(adjustedFocusedElement)->popu pRootAXObject()) { 171 if (AXObject* axPopup = toHTMLInputElement(adjustedFocusedElement)->popu pRootAXObject()) {
172 if (Element* focusedElementInPopup = axPopup->getDocument()->focused Element()) 172 if (Element* focusedElementInPopup = axPopup->getDocument()->focused Element())
173 focusedNode = focusedElementInPopup; 173 focusedNode = focusedElementInPopup;
174 } 174 }
175
176 } 175 }
177 176
178 AXObject* obj = getOrCreate(focusedNode); 177 AXObject* obj = getOrCreate(focusedNode);
179 if (!obj) 178 if (!obj)
180 return 0; 179 return nullptr;
181
182 if (obj->shouldFocusActiveDescendant()) {
183 if (AXObject* descendant = obj->activeDescendant())
184 obj = descendant;
185 }
186 180
187 // the HTML element, for example, is focusable but has an AX object that is ignored 181 // the HTML element, for example, is focusable but has an AX object that is ignored
188 if (obj->accessibilityIsIgnored()) 182 if (obj->accessibilityIsIgnored())
189 obj = obj->parentObjectUnignored(); 183 obj = obj->parentObjectUnignored();
190 184
191 return obj; 185 return obj;
192 } 186 }
193 187
194 AXObject* AXObjectCacheImpl::get(LayoutObject* layoutObject) 188 AXObject* AXObjectCacheImpl::get(LayoutObject* layoutObject)
195 { 189 {
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 1127
1134 return equalIgnoringCase(toElement(node)->getAttribute(aria_hiddenAttr), "fa lse"); 1128 return equalIgnoringCase(toElement(node)->getAttribute(aria_hiddenAttr), "fa lse");
1135 } 1129 }
1136 1130
1137 void AXObjectCacheImpl::postPlatformNotification(AXObject* obj, AXNotification n otification) 1131 void AXObjectCacheImpl::postPlatformNotification(AXObject* obj, AXNotification n otification)
1138 { 1132 {
1139 if (!obj || !obj->getDocument() || !obj->documentFrameView() || !obj->docume ntFrameView()->frame().page()) 1133 if (!obj || !obj->getDocument() || !obj->documentFrameView() || !obj->docume ntFrameView()->frame().page())
1140 return; 1134 return;
1141 1135
1142 ChromeClient& client = obj->getDocument()->axObjectCacheOwner().page()->chro meClient(); 1136 ChromeClient& client = obj->getDocument()->axObjectCacheOwner().page()->chro meClient();
1143
1144 if (notification == AXActiveDescendantChanged
1145 && obj->getDocument()->focusedElement()
1146 && obj->getNode() == obj->getDocument()->focusedElement()) {
1147 // Calling handleFocusedUIElementChanged will focus the new active
1148 // descendant and send the AXFocusedUIElementChanged notification.
1149 handleFocusedUIElementChanged(0, obj->getDocument()->focusedElement());
1150 }
1151
1152 client.postAccessibilityNotification(obj, notification); 1137 client.postAccessibilityNotification(obj, notification);
1153 } 1138 }
1154 1139
1155 void AXObjectCacheImpl::handleFocusedUIElementChanged(Node* oldFocusedNode, Node * newFocusedNode) 1140 void AXObjectCacheImpl::handleFocusedUIElementChanged(Node* oldFocusedNode, Node * newFocusedNode)
1156 { 1141 {
1157 if (!newFocusedNode) 1142 if (!newFocusedNode)
1158 return; 1143 return;
1159 1144
1160 Page* page = newFocusedNode->document().page(); 1145 Page* page = newFocusedNode->document().page();
1161 if (!page) 1146 if (!page)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 visitor->trace(m_document); 1272 visitor->trace(m_document);
1288 visitor->trace(m_nodeObjectMapping); 1273 visitor->trace(m_nodeObjectMapping);
1289 1274
1290 visitor->trace(m_objects); 1275 visitor->trace(m_objects);
1291 visitor->trace(m_notificationsToPost); 1276 visitor->trace(m_notificationsToPost);
1292 1277
1293 AXObjectCache::trace(visitor); 1278 AXObjectCache::trace(visitor);
1294 } 1279 }
1295 1280
1296 } // namespace blink 1281 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698