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

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

Issue 1589623002: Keep track of accessibility focus across windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 10 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
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if (!child->isImageMapLink()) 142 if (!child->isImageMapLink())
143 continue; 143 continue;
144 144
145 if (toAXImageMapLink(child)->areaElement() == areaElement) 145 if (toAXImageMapLink(child)->areaElement() == areaElement)
146 return child; 146 return child;
147 } 147 }
148 148
149 return 0; 149 return 0;
150 } 150 }
151 151
152 AXObject* AXObjectCacheImpl::focusedUIElementForPage(const Page* page) 152 AXObject* AXObjectCacheImpl::focusedObject()
153 { 153 {
154 if (!page->settings().accessibilityEnabled()) 154 if (!accessibilityEnabled())
155 return 0; 155 return 0;
156 156
157 // Cross-process accessibility is not yet implemented. 157 // Cross-process accessibility is not yet implemented.
158 Page* page = m_document->page();
158 if (!page->focusController().focusedOrMainFrame()->isLocalFrame()) 159 if (!page->focusController().focusedOrMainFrame()->isLocalFrame())
159 return 0; 160 return 0;
160 161
161 // get the focused node in the page 162 // get the focused node in the page
162 Document* focusedDocument = toLocalFrame(page->focusController().focusedOrMa inFrame())->document(); 163 Document* focusedDocument = toLocalFrame(page->focusController().focusedOrMa inFrame())->document();
163 Node* focusedNode = focusedDocument->focusedElement(); 164 Node* focusedNode = focusedDocument->focusedElement();
164 if (!focusedNode) 165 if (!focusedNode)
165 focusedNode = focusedDocument; 166 focusedNode = focusedDocument;
166 167
167 if (isHTMLAreaElement(*focusedNode)) 168 if (isHTMLAreaElement(*focusedNode))
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1108
1108 void AXObjectCacheImpl::handleFocusedUIElementChanged(Node* oldFocusedNode, Node * newFocusedNode) 1109 void AXObjectCacheImpl::handleFocusedUIElementChanged(Node* oldFocusedNode, Node * newFocusedNode)
1109 { 1110 {
1110 if (!newFocusedNode) 1111 if (!newFocusedNode)
1111 return; 1112 return;
1112 1113
1113 Page* page = newFocusedNode->document().page(); 1114 Page* page = newFocusedNode->document().page();
1114 if (!page) 1115 if (!page)
1115 return; 1116 return;
1116 1117
1117 AXObject* focusedObject = focusedUIElementForPage(page); 1118 AXObject* focusedObject = this->focusedObject();
1118 if (!focusedObject) 1119 if (!focusedObject)
1119 return; 1120 return;
1120 1121
1121 AXObject* oldFocusedObject = get(oldFocusedNode); 1122 AXObject* oldFocusedObject = get(oldFocusedNode);
1122 1123
1123 postPlatformNotification(oldFocusedObject, AXBlur); 1124 postPlatformNotification(oldFocusedObject, AXBlur);
1124 postPlatformNotification(focusedObject, AXFocusedUIElementChanged); 1125 postPlatformNotification(focusedObject, AXFocusedUIElementChanged);
1125 } 1126 }
1126 1127
1127 void AXObjectCacheImpl::handleInitialFocus() 1128 void AXObjectCacheImpl::handleInitialFocus()
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 visitor->trace(m_nodeObjectMapping); 1243 visitor->trace(m_nodeObjectMapping);
1243 #endif 1244 #endif
1244 1245
1245 visitor->trace(m_objects); 1246 visitor->trace(m_objects);
1246 visitor->trace(m_notificationsToPost); 1247 visitor->trace(m_notificationsToPost);
1247 1248
1248 AXObjectCache::trace(visitor); 1249 AXObjectCache::trace(visitor);
1249 } 1250 }
1250 1251
1251 } // namespace blink 1252 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698