Changeset 62251 in webkit
- Timestamp:
- Jul 1, 2010 5:17:13 AM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/ChangeLog
r62249 r62251 1 2010-07-01 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Create QComboBoxes when clicked and destroy on hide. 6 https://bugs.webkit.org/show_bug.cgi?id=41451 7 8 Currently a QComboBox is created for each RenderMenuList and 9 it gets destroyed either when the RenderMenuList or the 10 QWebView (its Qt parent) is destroyed. This cause a crash 11 when the QWebView is destroyed before the render tree (which 12 is kept in cache). 13 14 This patch aim to destroy the QComboBox as soon as its popup 15 gets hidden, and likewise, create it only when the popup is 16 requested to be shown. 17 It also removes the unneeded reference to the QGraphicsProxyWidget, 18 destroying the QComboBox automatically destroys its bound 19 proxywidget. 20 21 * WebCoreSupport/QtFallbackWebPopup.cpp: 22 (WebCore::QtFallbackWebPopupCombo::hidePopup): 23 (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): 24 (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): 25 (WebCore::QtFallbackWebPopup::show): 26 (WebCore::QtFallbackWebPopup::hide): 27 (WebCore::QtFallbackWebPopup::destroyPopup): 28 (WebCore::QtFallbackWebPopup::populate): 29 * WebCoreSupport/QtFallbackWebPopup.h: 30 1 31 2010-07-01 Satish Sampath <satish@chromium.org> 2 32 -
trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
r62193 r62251 76 76 QComboBox::hidePopup(); 77 77 78 if (QGraphicsProxyWidget* proxy = graphicsProxyWidget())79 proxy->setVisible(false);80 81 78 if (!m_ownerPopup.m_popupVisible) 82 79 return; … … 84 81 m_ownerPopup.m_popupVisible = false; 85 82 m_ownerPopup.popupDidHide(); 83 m_ownerPopup.destroyPopup(); 86 84 } 87 85 … … 103 101 : QtAbstractWebPopup() 104 102 , m_popupVisible(false) 105 , m_combo(new QtFallbackWebPopupCombo(*this)) 106 , m_proxy(0) 107 { 108 connect(m_combo, SIGNAL(activated(int)), 109 SLOT(activeChanged(int)), Qt::QueuedConnection); 103 , m_combo(0) 104 { 110 105 } 111 106 112 107 QtFallbackWebPopup::~QtFallbackWebPopup() 113 108 { 114 // If we create a proxy, then the deletion of the proxy and the 115 // combo will be done by the proxy's parent (QGraphicsWebView) 116 if (!m_proxy && m_combo) 117 m_combo->deleteLater(); 109 destroyPopup(); 118 110 } 119 111 … … 126 118 TRAP_IGNORE(showS60BrowserDialog()); 127 119 #else 120 121 destroyPopup(); 122 m_combo = new QtFallbackWebPopupCombo(*this); 123 connect(m_combo, SIGNAL(activated(int)), 124 SLOT(activeChanged(int)), Qt::QueuedConnection); 125 128 126 populate(); 129 127 m_combo->setCurrentIndex(currentIndex()); … … 131 129 QRect rect = geometry(); 132 130 if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) { 133 if (!m_proxy) { 134 m_proxy = new QGraphicsProxyWidget(webView); 135 m_proxy->setWidget(m_combo); 136 } else 137 m_proxy->setVisible(true); 138 m_proxy->setGeometry(rect); 131 QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); 132 proxy->setWidget(m_combo); 133 proxy->setGeometry(rect); 139 134 } else { 140 135 m_combo->setParent(pageClient()->ownerWidget()); … … 205 200 void QtFallbackWebPopup::hide() 206 201 { 207 m_combo->hidePopup(); 202 // Destroying the QComboBox here cause problems if the popup is in the 203 // middle of its show animation. Instead we rely on the fact that the 204 // Qt::Popup window will hide itself on mouse events outside its window. 205 } 206 207 void QtFallbackWebPopup::destroyPopup() 208 { 209 if (m_combo) { 210 m_combo->deleteLater(); 211 m_combo = 0; 212 } 208 213 } 209 214 210 215 void QtFallbackWebPopup::populate() 211 216 { 212 m_combo->clear();213 214 217 QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_combo->model()); 215 218 Q_ASSERT(model); -
trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
r62193 r62251 43 43 virtual void hide(); 44 44 45 void destroyPopup(); 46 45 47 private slots: 46 48 void activeChanged(int); … … 50 52 bool m_popupVisible; 51 53 QtFallbackWebPopupCombo* m_combo; 52 QGraphicsProxyWidget* m_proxy;53 54 54 55 void populate();
Note: See TracChangeset
for help on using the changeset viewer.