OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void PopupContainer::hidePopup() | 233 void PopupContainer::hidePopup() |
234 { | 234 { |
235 m_listBox->abandon(); | 235 m_listBox->abandon(); |
236 } | 236 } |
237 | 237 |
238 void PopupContainer::notifyPopupHidden() | 238 void PopupContainer::notifyPopupHidden() |
239 { | 239 { |
240 if (!m_popupOpen) | 240 if (!m_popupOpen) |
241 return; | 241 return; |
242 m_popupOpen = false; | 242 m_popupOpen = false; |
243 WebViewImpl::fromPage(m_frameView->frame().page())->popupClosed(this); | 243 |
| 244 // With Oilpan, we cannot assume that the FrameView's LocalFrame's |
| 245 // page is still available, as the LocalFrame itself may have been |
| 246 // detached from its FrameHost by now. |
| 247 // |
| 248 // So, if a popup menu is left in an open/shown state when |
| 249 // finalized, the PopupMenu implementation of this container's |
| 250 // listbox will hide itself when destructed, delivering the |
| 251 // notifyPopupHidden() notification in the process & ending up here. |
| 252 // If the LocalFrame has been detached already -- done when its |
| 253 // HTMLFrameOwnerElement frame owner is detached as part of being |
| 254 // torn down -- the connection to the FrameHost has been snipped & |
| 255 // there's no page. Hence the null check. |
| 256 // |
| 257 // In a non-Oilpan setting, the RenderMenuList that controls/owns |
| 258 // the PopupMenuChromium object and this PopupContainer is torn |
| 259 // down and destructed before the frame and frame owner, hence the |
| 260 // page will always be available in that setting and this will |
| 261 // not be an issue. |
| 262 if (WebViewImpl* webView = WebViewImpl::fromPage(m_frameView->frame().page()
)) |
| 263 webView->popupClosed(this); |
244 } | 264 } |
245 | 265 |
246 void PopupContainer::fitToListBox() | 266 void PopupContainer::fitToListBox() |
247 { | 267 { |
248 // Place the listbox within our border. | 268 // Place the listbox within our border. |
249 m_listBox->move(borderSize, borderSize); | 269 m_listBox->move(borderSize, borderSize); |
250 | 270 |
251 // Size ourselves to contain listbox + border. | 271 // Size ourselves to contain listbox + border. |
252 resize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize
* 2); | 272 resize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize
* 2); |
253 invalidate(); | 273 invalidate(); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (HostWindow* h = hostWindow()) | 539 if (HostWindow* h = hostWindow()) |
520 h->invalidateContentsAndRootView(rect); | 540 h->invalidateContentsAndRootView(rect); |
521 } | 541 } |
522 | 542 |
523 HostWindow* PopupContainer::hostWindow() const | 543 HostWindow* PopupContainer::hostWindow() const |
524 { | 544 { |
525 return const_cast<PopupContainerClient*>(m_client); | 545 return const_cast<PopupContainerClient*>(m_client); |
526 } | 546 } |
527 | 547 |
528 } // namespace blink | 548 } // namespace blink |
OLD | NEW |