Chromium Code Reviews| 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 this | |
| 251 // notifyPopupHidden() notification in the process. Should the | |
| 252 // LocalFrame have become detached first (when its | |
| 253 // HTMLFrameOwnerElement frame owner is detached as part of being | |
| 254 // finalized), 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 object owning the PopupMenu and | |
|
haraken
2014/09/11 14:47:26
Just help me understand: What's "the object"?
sof
2014/09/15 16:46:42
A RenderMenuList would be what's controller/owner
| |
| 258 // this PopupContainer is torn down and destructed before the | |
| 259 // frame and frame owner, hence the page will always be available | |
| 260 // here.) | |
| 261 if (WebViewImpl* webView = WebViewImpl::fromPage(m_frameView->frame().page() )) | |
| 262 webView->popupClosed(this); | |
| 244 } | 263 } |
| 245 | 264 |
| 246 void PopupContainer::fitToListBox() | 265 void PopupContainer::fitToListBox() |
| 247 { | 266 { |
| 248 // Place the listbox within our border. | 267 // Place the listbox within our border. |
| 249 m_listBox->move(borderSize, borderSize); | 268 m_listBox->move(borderSize, borderSize); |
| 250 | 269 |
| 251 // Size ourselves to contain listbox + border. | 270 // Size ourselves to contain listbox + border. |
| 252 resize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize * 2); | 271 resize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize * 2); |
| 253 invalidate(); | 272 invalidate(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 if (HostWindow* h = hostWindow()) | 538 if (HostWindow* h = hostWindow()) |
| 520 h->invalidateContentsAndRootView(rect); | 539 h->invalidateContentsAndRootView(rect); |
| 521 } | 540 } |
| 522 | 541 |
| 523 HostWindow* PopupContainer::hostWindow() const | 542 HostWindow* PopupContainer::hostWindow() const |
| 524 { | 543 { |
| 525 return const_cast<PopupContainerClient*>(m_client); | 544 return const_cast<PopupContainerClient*>(m_client); |
| 526 } | 545 } |
| 527 | 546 |
| 528 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |