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

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

Issue 179163004: Have Document::topDocument() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/accessibility/AXObjectCache.h ('k') | Source/core/accessibility/AXRenderObject.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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 void AXComputedObjectAttributeCache::clear() 102 void AXComputedObjectAttributeCache::clear()
103 { 103 {
104 m_idMapping.clear(); 104 m_idMapping.clear();
105 } 105 }
106 106
107 bool AXObjectCache::gAccessibilityEnabled = false; 107 bool AXObjectCache::gAccessibilityEnabled = false;
108 bool AXObjectCache::gInlineTextBoxAccessibility = false; 108 bool AXObjectCache::gInlineTextBoxAccessibility = false;
109 109
110 AXObjectCache::AXObjectCache(const Document* doc) 110 AXObjectCache::AXObjectCache(Document& document)
111 : m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired) 111 : m_document(document)
112 , m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired)
112 { 113 {
113 m_document = const_cast<Document*>(doc);
adamk 2014/02/26 17:30:52 Ha! Thanks for getting rid of this const_cast
114 m_computedObjectAttributeCache = AXComputedObjectAttributeCache::create(); 114 m_computedObjectAttributeCache = AXComputedObjectAttributeCache::create();
115 } 115 }
116 116
117 AXObjectCache::~AXObjectCache() 117 AXObjectCache::~AXObjectCache()
118 { 118 {
119 m_notificationPostTimer.stop(); 119 m_notificationPostTimer.stop();
120 120
121 HashMap<AXID, RefPtr<AXObject> >::iterator end = m_objects.end(); 121 HashMap<AXID, RefPtr<AXObject> >::iterator end = m_objects.end();
122 for (HashMap<AXID, RefPtr<AXObject> >::iterator it = m_objects.begin(); it ! = end; ++it) { 122 for (HashMap<AXID, RefPtr<AXObject> >::iterator it = m_objects.begin(); it ! = end; ++it) {
123 AXObject* obj = (*it).value.get(); 123 AXObject* obj = (*it).value.get();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 newObj->setLastKnownIsIgnoredValue(newObj->accessibilityIsIgnored()); 440 newObj->setLastKnownIsIgnoredValue(newObj->accessibilityIsIgnored());
441 441
442 return newObj.get(); 442 return newObj.get();
443 } 443 }
444 444
445 AXObject* AXObjectCache::rootObject() 445 AXObject* AXObjectCache::rootObject()
446 { 446 {
447 if (!gAccessibilityEnabled) 447 if (!gAccessibilityEnabled)
448 return 0; 448 return 0;
449 449
450 return getOrCreate(m_document->view()); 450 return getOrCreate(m_document.view());
451 } 451 }
452 452
453 AXObject* AXObjectCache::getOrCreate(AccessibilityRole role) 453 AXObject* AXObjectCache::getOrCreate(AccessibilityRole role)
454 { 454 {
455 RefPtr<AXObject> obj = nullptr; 455 RefPtr<AXObject> obj = nullptr;
456 456
457 // will be filled in... 457 // will be filled in...
458 switch (role) { 458 switch (role) {
459 case ListBoxOptionRole: 459 case ListBoxOptionRole:
460 obj = AXListBoxOption::create(); 460 obj = AXListBoxOption::create();
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 { 1034 {
1035 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); 1035 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged);
1036 } 1036 }
1037 1037
1038 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) 1038 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject)
1039 { 1039 {
1040 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged) ; 1040 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged) ;
1041 } 1041 }
1042 1042
1043 } // namespace WebCore 1043 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXObjectCache.h ('k') | Source/core/accessibility/AXRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698