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 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 |
| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 527 } |
509 | 528 |
510 info->itemHeight = menuItemHeight(); | 529 info->itemHeight = menuItemHeight(); |
511 info->itemFontSize = menuItemFontSize(); | 530 info->itemFontSize = menuItemFontSize(); |
512 info->selectedIndex = selectedIndex(); | 531 info->selectedIndex = selectedIndex(); |
513 info->items.swap(outputItems); | 532 info->items.swap(outputItems); |
514 info->rightAligned = menuStyle().textDirection() == RTL; | 533 info->rightAligned = menuStyle().textDirection() == RTL; |
515 } | 534 } |
516 | 535 |
517 } // namespace blink | 536 } // namespace blink |
OLD | NEW |