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

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

Issue 1059503002: Re-land: Don't keep recreating AXMenuListPopup (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@suppress_extra_events
Patch Set: Clean up code Created 5 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 bool AXMenuList::press() const 53 bool AXMenuList::press() const
54 { 54 {
55 LayoutMenuList* menuList = toLayoutMenuList(m_layoutObject); 55 LayoutMenuList* menuList = toLayoutMenuList(m_layoutObject);
56 if (menuList->popupIsVisible()) 56 if (menuList->popupIsVisible())
57 menuList->hidePopup(); 57 menuList->hidePopup();
58 else 58 else
59 menuList->showPopup(); 59 menuList->showPopup();
60 return true; 60 return true;
61 } 61 }
62 62
63 void AXMenuList::updateChildrenIfNecessary()
64 {
65 if (m_children.isEmpty()) {
66 addChildren();
67 return;
68 }
69
70 // There's no reason to update our AXMenuListPopup child. If we get a
71 // call to updateChildrenIfNecessary, it's because the options might have
72 // changed, so call it on our popup.
73 ASSERT(m_children.size() == 1);
74 m_children[0]->updateChildrenIfNecessary();
75 }
76
63 void AXMenuList::clearChildren() 77 void AXMenuList::clearChildren()
64 { 78 {
65 if (m_children.isEmpty()) 79 if (m_children.isEmpty())
66 return; 80 return;
67 81
68 // There's no reason to clear our AXMenuListPopup child. If we get a 82 // There's no reason to clear our AXMenuListPopup child. If we get a
69 // call to clearChildren, it's because the options might have changed, 83 // call to clearChildren, it's because the options might have changed,
70 // so call it on our popup. 84 // so call it on our popup.
71 ASSERT(m_children.size() == 1); 85 ASSERT(m_children.size() == 1);
72 m_children[0]->clearChildren(); 86 m_children[0]->clearChildren();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return; 168 return;
155 169
156 AXMenuListPopup* popup = toAXMenuListPopup(children()[0].get()); 170 AXMenuListPopup* popup = toAXMenuListPopup(children()[0].get());
157 popup->didHide(); 171 popup->didHide();
158 172
159 if (node() && node()->focused()) 173 if (node() && node()->focused())
160 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXFocusedUIEl ementChanged); 174 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXFocusedUIEl ementChanged);
161 } 175 }
162 176
163 } // namespace blink 177 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698