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

Side by Side Diff: Source/web/PopupMenuImpl.cpp

Issue 920433002: Gracefully handle a disconnected popup menu client on disposing open popup. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rework test, mac-friendly Created 5 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
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "web/PopupMenuImpl.h" 6 #include "web/PopupMenuImpl.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/css/CSSFontSelector.h" 9 #include "core/css/CSSFontSelector.h"
10 #include "core/dom/StyleEngine.h" 10 #include "core/dom/StyleEngine.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ASSERT(m_client); 227 ASSERT(m_client);
228 bool success; 228 bool success;
229 int listIndex = value.toInt(&success); 229 int listIndex = value.toInt(&success);
230 ASSERT(success); 230 ASSERT(success);
231 m_client->setTextFromItem(listIndex); 231 m_client->setTextFromItem(listIndex);
232 m_indexToSetOnClose = listIndex; 232 m_indexToSetOnClose = listIndex;
233 } 233 }
234 234
235 void PopupMenuImpl::didClosePopup() 235 void PopupMenuImpl::didClosePopup()
236 { 236 {
237 if (m_indexToSetOnClose >= 0) 237 if (m_client && m_indexToSetOnClose >= 0)
238 m_client->valueChanged(m_indexToSetOnClose); 238 m_client->valueChanged(m_indexToSetOnClose);
239 m_indexToSetOnClose = -1; 239 m_indexToSetOnClose = -1;
240 m_popup = nullptr; 240 m_popup = nullptr;
241 m_client->popupDidHide(); 241 if (m_client)
242 m_client->popupDidHide();
242 } 243 }
243 244
244 Element& PopupMenuImpl::ownerElement() 245 Element& PopupMenuImpl::ownerElement()
245 { 246 {
246 return m_client->ownerElement(); 247 return m_client->ownerElement();
247 } 248 }
248 249
249 Locale& PopupMenuImpl::locale() 250 Locale& PopupMenuImpl::locale()
250 { 251 {
251 return Locale::defaultLocale(); 252 return Locale::defaultLocale();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 #if ENABLE(OILPAN) 301 #if ENABLE(OILPAN)
301 // Cannot be done during finalization, so instead done when the 302 // Cannot be done during finalization, so instead done when the
302 // render object is destroyed and disconnected. 303 // render object is destroyed and disconnected.
303 // 304 //
304 // FIXME: do this always, regardless of ENABLE(OILPAN). 305 // FIXME: do this always, regardless of ENABLE(OILPAN).
305 dispose(); 306 dispose();
306 #endif 307 #endif
307 } 308 }
308 309
309 } // namespace blink 310 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698