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

Side by Side Diff: Source/core/accessibility/AXObjectCache.cpp

Issue 14763003: HashTraits<RefPtr<P> >::PeekType should be raw pointer for better performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 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 | « Source/core/accessibility/AXObjectCache.h ('k') | Source/core/css/CSSImageGeneratorValue.cpp » ('j') | 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) 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010 Apple 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 AccessibilityObject* AXObjectCache::get(Widget* widget) 185 AccessibilityObject* AXObjectCache::get(Widget* widget)
186 { 186 {
187 if (!widget) 187 if (!widget)
188 return 0; 188 return 0;
189 189
190 AXID axID = m_widgetObjectMapping.get(widget); 190 AXID axID = m_widgetObjectMapping.get(widget);
191 ASSERT(!HashTraits<AXID>::isDeletedValue(axID)); 191 ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
192 if (!axID) 192 if (!axID)
193 return 0; 193 return 0;
194 194
195 return m_objects.get(axID).get(); 195 return m_objects.get(axID);
196 } 196 }
197 197
198 AccessibilityObject* AXObjectCache::get(RenderObject* renderer) 198 AccessibilityObject* AXObjectCache::get(RenderObject* renderer)
199 { 199 {
200 if (!renderer) 200 if (!renderer)
201 return 0; 201 return 0;
202 202
203 AXID axID = m_renderObjectMapping.get(renderer); 203 AXID axID = m_renderObjectMapping.get(renderer);
204 ASSERT(!HashTraits<AXID>::isDeletedValue(axID)); 204 ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
205 if (!axID) 205 if (!axID)
206 return 0; 206 return 0;
207 207
208 return m_objects.get(axID).get(); 208 return m_objects.get(axID);
209 } 209 }
210 210
211 AccessibilityObject* AXObjectCache::get(Node* node) 211 AccessibilityObject* AXObjectCache::get(Node* node)
212 { 212 {
213 if (!node) 213 if (!node)
214 return 0; 214 return 0;
215 215
216 AXID renderID = node->renderer() ? m_renderObjectMapping.get(node->renderer( )) : 0; 216 AXID renderID = node->renderer() ? m_renderObjectMapping.get(node->renderer( )) : 0;
217 ASSERT(!HashTraits<AXID>::isDeletedValue(renderID)); 217 ASSERT(!HashTraits<AXID>::isDeletedValue(renderID));
218 218
219 AXID nodeID = m_nodeObjectMapping.get(node); 219 AXID nodeID = m_nodeObjectMapping.get(node);
220 ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID)); 220 ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID));
221 221
222 if (node->renderer() && nodeID && !renderID) { 222 if (node->renderer() && nodeID && !renderID) {
223 // This can happen if an AccessibilityNodeObject is created for a node t hat's not 223 // This can happen if an AccessibilityNodeObject is created for a node t hat's not
224 // rendered, but later something changes and it gets a renderer (like if it's 224 // rendered, but later something changes and it gets a renderer (like if it's
225 // reparented). 225 // reparented).
226 remove(nodeID); 226 remove(nodeID);
227 return 0; 227 return 0;
228 } 228 }
229 229
230 if (renderID) 230 if (renderID)
231 return m_objects.get(renderID).get(); 231 return m_objects.get(renderID);
232 232
233 if (!nodeID) 233 if (!nodeID)
234 return 0; 234 return 0;
235 235
236 return m_objects.get(nodeID).get(); 236 return m_objects.get(nodeID);
237 } 237 }
238 238
239 // FIXME: This probably belongs on Node. 239 // FIXME: This probably belongs on Node.
240 // FIXME: This should take a const char*, but one caller passes nullAtom. 240 // FIXME: This should take a const char*, but one caller passes nullAtom.
241 bool nodeHasRole(Node* node, const String& role) 241 bool nodeHasRole(Node* node, const String& role)
242 { 242 {
243 if (!node || !node->isElementNode()) 243 if (!node || !node->isElementNode())
244 return false; 244 return false;
245 245
246 return equalIgnoringCase(toElement(node)->getAttribute(roleAttr), role); 246 return equalIgnoringCase(toElement(node)->getAttribute(roleAttr), role);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 attachWrapper(obj.get()); 458 attachWrapper(obj.get());
459 return obj.get(); 459 return obj.get();
460 } 460 }
461 461
462 void AXObjectCache::remove(AXID axID) 462 void AXObjectCache::remove(AXID axID)
463 { 463 {
464 if (!axID) 464 if (!axID)
465 return; 465 return;
466 466
467 // first fetch object to operate some cleanup functions on it 467 // first fetch object to operate some cleanup functions on it
468 AccessibilityObject* obj = m_objects.get(axID).get(); 468 AccessibilityObject* obj = m_objects.get(axID);
469 if (!obj) 469 if (!obj)
470 return; 470 return;
471 471
472 detachWrapper(obj); 472 detachWrapper(obj);
473 obj->detach(); 473 obj->detach();
474 removeAXID(obj); 474 removeAXID(obj);
475 475
476 // finally remove the object 476 // finally remove the object
477 if (!m_objects.take(axID)) 477 if (!m_objects.take(axID))
478 return; 478 return;
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode) 1026 void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode)
1027 { 1027 {
1028 // The anchor node may not be accessible. Post the notification for the 1028 // The anchor node may not be accessible. Post the notification for the
1029 // first accessible object. 1029 // first accessible object.
1030 postPlatformNotification(AccessibilityObject::firstAccessibleObjectFromNode( anchorNode), AXScrolledToAnchor); 1030 postPlatformNotification(AccessibilityObject::firstAccessibleObjectFromNode( anchorNode), AXScrolledToAnchor);
1031 } 1031 }
1032 1032
1033 } // namespace WebCore 1033 } // namespace WebCore
1034 1034
1035 #endif // HAVE(ACCESSIBILITY) 1035 #endif // HAVE(ACCESSIBILITY)
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXObjectCache.h ('k') | Source/core/css/CSSImageGeneratorValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698