[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:49:55 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 30b337baac1ea3cb565c33efa9559ff5d04e04da
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 15 16:13:51 2009 +0000
2009-12-15 Luiz Agostini <luiz.agostini at openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
Moving list populate methods from PopupMenuQt to QWebPopup.
In preparation to future implementation of a delegation API for the combobox.
* platform/PopupMenu.h:
* platform/qt/PopupMenuQt.cpp:
(WebCore::PopupMenu::show):
(WebCore::PopupMenu::hide):
* platform/qt/QWebPopup.cpp:
(WebCore::QWebPopup::show):
(WebCore::QWebPopup::populate):
* platform/qt/QWebPopup.h:
(WebCore::QWebPopup::hide):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e5f3bd7..3f0d209 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-12-15 Luiz Agostini <luiz.agostini at openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Moving list populate methods from PopupMenuQt to QWebPopup.
+
+ In preparation to future implementation of a delegation API for the combobox.
+
+ * platform/PopupMenu.h:
+ * platform/qt/PopupMenuQt.cpp:
+ (WebCore::PopupMenu::show):
+ (WebCore::PopupMenu::hide):
+ * platform/qt/QWebPopup.cpp:
+ (WebCore::QWebPopup::show):
+ (WebCore::QWebPopup::populate):
+ * platform/qt/QWebPopup.h:
+ (WebCore::QWebPopup::hide):
+
2009-12-15 Alexander Pavlov <apavlov at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h
index 2315f02..4c4d3d2 100644
--- a/WebCore/platform/PopupMenu.h
+++ b/WebCore/platform/PopupMenu.h
@@ -144,8 +144,6 @@ private:
RetainPtr<NSPopUpButtonCell> m_popup;
#elif PLATFORM(QT)
- void clear();
- void populate(const IntRect&);
QWebPopup* m_popup;
#elif PLATFORM(WIN)
// ScrollBarClient
diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp
index f6ec4f7..d3d71df 100644
--- a/WebCore/platform/qt/PopupMenuQt.cpp
+++ b/WebCore/platform/qt/PopupMenuQt.cpp
@@ -26,22 +26,10 @@
#include "config.h"
#include "PopupMenu.h"
-#include "Frame.h"
#include "FrameView.h"
-#include "HostWindow.h"
#include "PopupMenuClient.h"
-#include "QWebPageClient.h"
#include "QWebPopup.h"
-#include <QAction>
-#include <QDebug>
-#include <QListWidget>
-#include <QListWidgetItem>
-#include <QMenu>
-#include <QPoint>
-#include <QStandardItemModel>
-#include <QWidgetAction>
-
namespace WebCore {
PopupMenu::PopupMenu(PopupMenuClient* client)
@@ -55,52 +43,16 @@ PopupMenu::~PopupMenu()
delete m_popup;
}
-void PopupMenu::clear()
-{
- m_popup->clear();
-}
-
-void PopupMenu::populate(const IntRect&)
-{
- clear();
- Q_ASSERT(client());
-
- QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_popup->model());
- Q_ASSERT(model);
-
- int size = client()->listSize();
- for (int i = 0; i < size; i++) {
- if (client()->itemIsSeparator(i))
- m_popup->insertSeparator(i);
- else {
- m_popup->insertItem(i, client()->itemText(i));
-
- if (model && !client()->itemIsEnabled(i))
- model->item(i)->setEnabled(false);
-
- if (client()->itemIsSelected(i))
- m_popup->setCurrentIndex(i);
- }
- }
-}
-
void PopupMenu::show(const IntRect& r, FrameView* v, int index)
{
- QWebPageClient* client = v->hostWindow()->platformPageClient();
- populate(r);
QRect rect = r;
rect.moveTopLeft(v->contentsToWindow(r.topLeft()));
- rect.setHeight(m_popup->sizeHint().height());
-
- m_popup->setParent(client->ownerWidget());
- m_popup->setGeometry(rect);
- m_popup->setCurrentIndex(index);
- m_popup->exec();
+ m_popup->show(rect, index);
}
void PopupMenu::hide()
{
- m_popup->hidePopup();
+ m_popup->hide();
}
void PopupMenu::updateFromElement()
diff --git a/WebCore/platform/qt/QWebPopup.cpp b/WebCore/platform/qt/QWebPopup.cpp
index d077079..707c69a 100644
--- a/WebCore/platform/qt/QWebPopup.cpp
+++ b/WebCore/platform/qt/QWebPopup.cpp
@@ -20,12 +20,15 @@
*/
#include "config.h"
#include "QWebPopup.h"
+#include "HostWindow.h"
#include "PopupMenuStyle.h"
+#include "QWebPageClient.h"
#include <QAbstractItemView>
#include <QApplication>
#include <QInputContext>
#include <QMouseEvent>
+#include <QStandardItemModel>
namespace WebCore {
@@ -41,13 +44,44 @@ QWebPopup::QWebPopup(PopupMenuClient* client)
}
-void QWebPopup::exec()
+void QWebPopup::show(const QRect& geometry, int selectedIndex)
{
+ populate();
+ setCurrentIndex(selectedIndex);
+
+ QWidget* parent = 0;
+ if (m_client->hostWindow() && m_client->hostWindow()->platformPageClient())
+ parent = m_client->hostWindow()->platformPageClient()->ownerWidget();
+
+ setParent(parent);
+ setGeometry(QRect(geometry.left(), geometry.top(), geometry.width(), sizeHint().height()));
+
QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(this, &event);
}
+void QWebPopup::populate()
+{
+ clear();
+ Q_ASSERT(m_client);
+
+ QStandardItemModel* model = qobject_cast<QStandardItemModel*>(QComboBox::model());
+ Q_ASSERT(model);
+
+ int size = m_client->listSize();
+ for (int i = 0; i < size; i++) {
+ if (m_client->itemIsSeparator(i))
+ insertSeparator(i);
+ else {
+ insertItem(i, m_client->itemText(i));
+
+ if (model && !m_client->itemIsEnabled(i))
+ model->item(i)->setEnabled(false);
+ }
+ }
+}
+
void QWebPopup::showPopup()
{
QComboBox::showPopup();
diff --git a/WebCore/platform/qt/QWebPopup.h b/WebCore/platform/qt/QWebPopup.h
index 36d6781..3718f2b 100644
--- a/WebCore/platform/qt/QWebPopup.h
+++ b/WebCore/platform/qt/QWebPopup.h
@@ -27,21 +27,25 @@
namespace WebCore {
-class QWebPopup : public QComboBox {
+class QWebPopup : private QComboBox {
Q_OBJECT
public:
QWebPopup(PopupMenuClient* client);
- void exec();
-
- virtual void showPopup();
- virtual void hidePopup();
+ void show(const QRect& geometry, int selectedIndex);
+ void hide() { hidePopup(); }
private slots:
void activeChanged(int);
+
private:
PopupMenuClient* m_client;
bool m_popupVisible;
+
+ void populate();
+
+ virtual void showPopup();
+ virtual void hidePopup();
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list