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 listBox()->abandon(); | 235 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 page | |
| 245 // is still available -- if the popup menu is left in an | |
| 246 // open/shown state when finalized, the PopupMenu implementation | |
| 247 // of this container's listbox may attempt to hide itself when | |
| 248 // destructed. That may happen longer after the FrameView has been | |
| 249 // closed and detached from its Frame (and Page), hence the need to check. | |
|
haraken
2014/09/08 07:25:59
Actually I don't fully understand the lifetime rel
sof
2014/09/08 21:17:46
There are quite a number of objects and abstractio
| |
| 250 if (WebViewImpl* webView = WebViewImpl::fromPage(m_frameView->frame().page() )) | |
| 251 webView->popupClosed(this); | |
| 244 } | 252 } |
| 245 | 253 |
| 246 void PopupContainer::fitToListBox() | 254 void PopupContainer::fitToListBox() |
| 247 { | 255 { |
| 248 // Place the listbox within our border. | 256 // Place the listbox within our border. |
| 249 m_listBox->move(borderSize, borderSize); | 257 m_listBox->move(borderSize, borderSize); |
| 250 | 258 |
| 251 // Size ourselves to contain listbox + border. | 259 // Size ourselves to contain listbox + border. |
| 252 resize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize * 2); | 260 resize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize * 2); |
| 253 invalidate(); | 261 invalidate(); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 } | 516 } |
| 509 | 517 |
| 510 info->itemHeight = menuItemHeight(); | 518 info->itemHeight = menuItemHeight(); |
| 511 info->itemFontSize = menuItemFontSize(); | 519 info->itemFontSize = menuItemFontSize(); |
| 512 info->selectedIndex = selectedIndex(); | 520 info->selectedIndex = selectedIndex(); |
| 513 info->items.swap(outputItems); | 521 info->items.swap(outputItems); |
| 514 info->rightAligned = menuStyle().textDirection() == RTL; | 522 info->rightAligned = menuStyle().textDirection() == RTL; |
| 515 } | 523 } |
| 516 | 524 |
| 517 } // namespace blink | 525 } // namespace blink |
| OLD | NEW |