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

Side by Side Diff: Source/modules/accessibility/AXMenuList.cpp

Issue 1175533004: Refactor: Clear m_axObjectCache when AXObject detaches (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added ASSERT Created 5 years, 6 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) 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/accessibility/AXMenuList.h" 27 #include "modules/accessibility/AXMenuList.h"
28 28
29 #include "core/layout/LayoutMenuList.h" 29 #include "core/layout/LayoutMenuList.h"
30 #include "modules/accessibility/AXMenuListPopup.h" 30 #include "modules/accessibility/AXMenuListPopup.h"
31 #include "modules/accessibility/AXObjectCacheImpl.h" 31 #include "modules/accessibility/AXObjectCacheImpl.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 AXMenuList::AXMenuList(LayoutMenuList* layoutObject, AXObjectCacheImpl* axObject Cache) 35 AXMenuList::AXMenuList(LayoutMenuList* layoutObject, AXObjectCacheImpl& axObject Cache)
36 : AXLayoutObject(layoutObject, axObjectCache) 36 : AXLayoutObject(layoutObject, axObjectCache)
37 { 37 {
38 } 38 }
39 39
40 PassRefPtr<AXMenuList> AXMenuList::create(LayoutMenuList* layoutObject, AXObject CacheImpl* axObjectCache) 40 PassRefPtr<AXMenuList> AXMenuList::create(LayoutMenuList* layoutObject, AXObject CacheImpl& axObjectCache)
41 { 41 {
42 return adoptRef(new AXMenuList(layoutObject, axObjectCache)); 42 return adoptRef(new AXMenuList(layoutObject, axObjectCache));
43 } 43 }
44 44
45 AccessibilityRole AXMenuList::determineAccessibilityRole() 45 AccessibilityRole AXMenuList::determineAccessibilityRole()
46 { 46 {
47 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) 47 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
48 return m_ariaRole; 48 return m_ariaRole;
49 49
50 return PopUpButtonRole; 50 return PopUpButtonRole;
(...skipping 22 matching lines...) Expand all
73 // so call it on our popup. 73 // so call it on our popup.
74 ASSERT(m_children.size() == 1); 74 ASSERT(m_children.size() == 1);
75 m_children[0]->clearChildren(); 75 m_children[0]->clearChildren();
76 m_childrenDirty = false; 76 m_childrenDirty = false;
77 } 77 }
78 78
79 void AXMenuList::addChildren() 79 void AXMenuList::addChildren()
80 { 80 {
81 m_haveChildren = true; 81 m_haveChildren = true;
82 82
83 AXObjectCacheImpl* cache = axObjectCache(); 83 AXObjectCacheImpl& cache = axObjectCache();
84 84
85 AXObject* list = cache->getOrCreate(MenuListPopupRole); 85 AXObject* list = cache.getOrCreate(MenuListPopupRole);
86 if (!list) 86 if (!list)
87 return; 87 return;
88 88
89 toAXMockObject(list)->setParent(this); 89 toAXMockObject(list)->setParent(this);
90 if (list->accessibilityIsIgnored()) { 90 if (list->accessibilityIsIgnored()) {
91 cache->remove(list->axObjectID()); 91 cache.remove(list->axObjectID());
92 return; 92 return;
93 } 93 }
94 94
95 m_children.append(list); 95 m_children.append(list);
96 96
97 list->addChildren(); 97 list->addChildren();
98 } 98 }
99 99
100 bool AXMenuList::isCollapsed() const 100 bool AXMenuList::isCollapsed() const
101 { 101 {
(...skipping 27 matching lines...) Expand all
129 if (!childObjects.isEmpty()) { 129 if (!childObjects.isEmpty()) {
130 ASSERT(childObjects.size() == 1); 130 ASSERT(childObjects.size() == 1);
131 ASSERT(childObjects[0]->isMenuListPopup()); 131 ASSERT(childObjects[0]->isMenuListPopup());
132 132
133 if (childObjects[0]->isMenuListPopup()) { 133 if (childObjects[0]->isMenuListPopup()) {
134 if (AXMenuListPopup* popup = toAXMenuListPopup(childObjects[0].get() )) 134 if (AXMenuListPopup* popup = toAXMenuListPopup(childObjects[0].get() ))
135 popup->didUpdateActiveOption(optionIndex); 135 popup->didUpdateActiveOption(optionIndex);
136 } 136 }
137 } 137 }
138 138
139 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXMenuListValueCh anged); 139 axObjectCache().postNotification(this, AXObjectCacheImpl::AXMenuListValueCha nged);
140 } 140 }
141 141
142 void AXMenuList::didShowPopup() 142 void AXMenuList::didShowPopup()
143 { 143 {
144 if (children().size() != 1) 144 if (children().size() != 1)
145 return; 145 return;
146 146
147 AXMenuListPopup* popup = toAXMenuListPopup(children()[0].get()); 147 AXMenuListPopup* popup = toAXMenuListPopup(children()[0].get());
148 popup->didShow(); 148 popup->didShow();
149 } 149 }
150 150
151 void AXMenuList::didHidePopup() 151 void AXMenuList::didHidePopup()
152 { 152 {
153 if (children().size() != 1) 153 if (children().size() != 1)
154 return; 154 return;
155 155
156 AXMenuListPopup* popup = toAXMenuListPopup(children()[0].get()); 156 AXMenuListPopup* popup = toAXMenuListPopup(children()[0].get());
157 popup->didHide(); 157 popup->didHide();
158 158
159 if (node() && node()->focused()) 159 if (node() && node()->focused())
160 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXFocusedUIEl ementChanged); 160 axObjectCache().postNotification(this, AXObjectCacheImpl::AXFocusedUIEle mentChanged);
161 } 161 }
162 162
163 } // namespace blink 163 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXMenuList.h ('k') | Source/modules/accessibility/AXMenuListOption.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698