| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 PopupMenuChromium::PopupMenuChromium(LocalFrame& frame, PopupMenuClient* client) | 42 PopupMenuChromium::PopupMenuChromium(LocalFrame& frame, PopupMenuClient* client) |
| 43 : m_popupClient(client) | 43 : m_popupClient(client) |
| 44 , m_frameView(frame.view()) | 44 , m_frameView(frame.view()) |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 PopupMenuChromium::~PopupMenuChromium() | 48 PopupMenuChromium::~PopupMenuChromium() |
| 49 { | 49 { |
| 50 #if ENABLE(OILPAN) |
| 51 // Verify that dispose() has been called when disconnecting. |
| 52 ASSERT(!m_popupClient); |
| 53 #else |
| 54 dispose(); |
| 55 #endif |
| 56 } |
| 57 |
| 58 void PopupMenuChromium::dispose() |
| 59 { |
| 50 // When the PopupMenuChromium is destroyed, the client could already have be
en deleted. | 60 // When the PopupMenuChromium is destroyed, the client could already have be
en deleted. |
| 51 if (m_popup) | 61 if (m_popup) |
| 52 m_popup->disconnectClient(); | 62 m_popup->disconnectClient(); |
| 53 hide(); | 63 hide(); |
| 54 } | 64 } |
| 55 | 65 |
| 66 void PopupMenuChromium::trace(Visitor* visitor) |
| 67 { |
| 68 visitor->trace(m_frameView); |
| 69 visitor->trace(m_popup); |
| 70 PopupMenu::trace(visitor); |
| 71 } |
| 72 |
| 56 void PopupMenuChromium::show(const FloatQuad& controlPosition, const IntSize& co
ntrolSize, int index) | 73 void PopupMenuChromium::show(const FloatQuad& controlPosition, const IntSize& co
ntrolSize, int index) |
| 57 { | 74 { |
| 58 if (!m_popup) { | 75 if (!m_popup) { |
| 59 bool deviceSupportsTouch = m_frameView->frame().settings()->deviceSuppor
tsTouch(); | 76 bool deviceSupportsTouch = m_frameView->frame().settings()->deviceSuppor
tsTouch(); |
| 60 m_popup = PopupContainer::create(m_popupClient, deviceSupportsTouch); | 77 m_popup = PopupContainer::create(m_popupClient, deviceSupportsTouch); |
| 61 } | 78 } |
| 62 m_popup->showInRect(controlPosition, controlSize, m_frameView.get(), index); | 79 m_popup->showInRect(controlPosition, controlSize, m_frameView.get(), index); |
| 63 } | 80 } |
| 64 | 81 |
| 65 void PopupMenuChromium::hide() | 82 void PopupMenuChromium::hide() |
| 66 { | 83 { |
| 67 if (m_popup) | 84 if (m_popup) |
| 68 m_popup->hide(); | 85 m_popup->hide(); |
| 69 } | 86 } |
| 70 | 87 |
| 71 void PopupMenuChromium::updateFromElement() | 88 void PopupMenuChromium::updateFromElement() |
| 72 { | 89 { |
| 73 m_popup->updateFromElement(); | 90 m_popup->updateFromElement(); |
| 74 } | 91 } |
| 75 | 92 |
| 76 | 93 |
| 77 void PopupMenuChromium::disconnectClient() | 94 void PopupMenuChromium::disconnectClient() |
| 78 { | 95 { |
| 79 m_popupClient = 0; | 96 m_popupClient = 0; |
| 97 #if ENABLE(OILPAN) |
| 98 // Cannot be done during finalization, so instead done when the |
| 99 // render object is destroyed and disconnected. |
| 100 // |
| 101 // FIXME: do this always, regardless of ENABLE(OILPAN). |
| 102 dispose(); |
| 103 #endif |
| 80 } | 104 } |
| 81 | 105 |
| 82 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |