[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:38:25 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 0e54da2fde5f1197e8ee6e3303bb3f9130887cdb
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 16 17:27:09 2009 +0000

    2009-12-16  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Implement combobox delegate for Qt
            https://bugs.webkit.org/show_bug.cgi?id=32550
    
            Refactoring of class QWebPopup.
    
            Class QWebPopup has been split in QtAbstractWebPopup and QtFallbackWebPopup.
            Both new classes are now in corresponding files and files QWebPopup.* have been removed.
    
            Custom combo popup classes will inherit from QtAbstractWebPopup. It is not the public API as it is
            in WebCore and will not be visible by users of QtWebKit. It will be used in implementation of
            public QtWebKit combobox popup delegation API.
    
            Class QtFallbackWebPopup inherits from QtAbstractWebPopup and implements the currently used combobox popup.
            It needs to be improved to provide standard features that are missing like style or indentation.
    
            No behavior changes.
    
            * WebCore.pro:
            * platform/PopupMenu.h:
            * platform/qt/PopupMenuQt.cpp:
            (WebCore::PopupMenu::PopupMenu):
            * platform/qt/QWebPopup.cpp: Removed.
            * platform/qt/QWebPopup.h: Removed.
            * platform/qt/QtAbstractWebPopup.cpp: Added.
            (WebCore::QtAbstractWebPopup::QtAbstractWebPopup):
            (WebCore::QtAbstractWebPopup::~QtAbstractWebPopup):
            (WebCore::QtAbstractWebPopup::client):
            * platform/qt/QtAbstractWebPopup.h: Added.
            * platform/qt/QtFallbackWebPopup.cpp: Added.
            (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
            (WebCore::QtFallbackWebPopup::show):
            (WebCore::QtFallbackWebPopup::populate):
            (WebCore::QtFallbackWebPopup::showPopup):
            (WebCore::QtFallbackWebPopup::hidePopup):
            (WebCore::QtFallbackWebPopup::activeChanged):
            * platform/qt/QtFallbackWebPopup.h: Added.
            (WebCore::QtFallbackWebPopup::hide):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52199 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3b36c11..90f301f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2009-12-16  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Implement combobox delegate for Qt
+        https://bugs.webkit.org/show_bug.cgi?id=32550
+
+        Refactoring of class QWebPopup.
+
+        Class QWebPopup has been split in QtAbstractWebPopup and QtFallbackWebPopup.
+        Both new classes are now in corresponding files and files QWebPopup.* have been removed.
+
+        Custom combo popup classes will inherit from QtAbstractWebPopup. It is not the public API as it is
+        in WebCore and will not be visible by users of QtWebKit. It will be used in implementation of
+        public QtWebKit combobox popup delegation API.
+
+        Class QtFallbackWebPopup inherits from QtAbstractWebPopup and implements the currently used combobox popup.
+        It needs to be improved to provide standard features that are missing like style or indentation.
+
+        No behavior changes.
+
+        * WebCore.pro:
+        * platform/PopupMenu.h:
+        * platform/qt/PopupMenuQt.cpp:
+        (WebCore::PopupMenu::PopupMenu):
+        * platform/qt/QWebPopup.cpp: Removed.
+        * platform/qt/QWebPopup.h: Removed.
+        * platform/qt/QtAbstractWebPopup.cpp: Added.
+        (WebCore::QtAbstractWebPopup::QtAbstractWebPopup):
+        (WebCore::QtAbstractWebPopup::~QtAbstractWebPopup):
+        (WebCore::QtAbstractWebPopup::client):
+        * platform/qt/QtAbstractWebPopup.h: Added.
+        * platform/qt/QtFallbackWebPopup.cpp: Added.
+        (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
+        (WebCore::QtFallbackWebPopup::show):
+        (WebCore::QtFallbackWebPopup::populate):
+        (WebCore::QtFallbackWebPopup::showPopup):
+        (WebCore::QtFallbackWebPopup::hidePopup):
+        (WebCore::QtFallbackWebPopup::activeChanged):
+        * platform/qt/QtFallbackWebPopup.h: Added.
+        (WebCore::QtFallbackWebPopup::hide):
+
 2009-12-15  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 1798c84..0c3fed1 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1966,7 +1966,8 @@ HEADERS += \
     platform/PlatformTouchPoint.h \
     platform/qt/ClipboardQt.h \
     platform/qt/QWebPageClient.h \
-    platform/qt/QWebPopup.h \
+    platform/qt/QtAbstractWebPopup.h \
+    platform/qt/QtFallbackWebPopup.h \
     platform/qt/RenderThemeQt.h \
     platform/qt/ScrollbarThemeQt.h \
     platform/Scrollbar.h \
@@ -2425,7 +2426,8 @@ SOURCES += \
     platform/qt/PlatformTouchEventQt.cpp \
     platform/qt/PlatformTouchPointQt.cpp \
     platform/qt/PopupMenuQt.cpp \
-    platform/qt/QWebPopup.cpp \
+    platform/qt/QtAbstractWebPopup.cpp \
+    platform/qt/QtFallbackWebPopup.cpp \
     platform/qt/RenderThemeQt.cpp \
     platform/qt/ScrollbarQt.cpp \
     platform/qt/ScrollbarThemeQt.cpp \
diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h
index 4c4d3d2..dbd2c93 100644
--- a/WebCore/platform/PopupMenu.h
+++ b/WebCore/platform/PopupMenu.h
@@ -42,7 +42,7 @@ typedef struct HDC__* HDC;
 typedef struct HBITMAP__* HBITMAP;
 #elif PLATFORM(QT)
 namespace WebCore {
-    class QWebPopup;
+class QtAbstractWebPopup;
 }
 #elif PLATFORM(GTK)
 typedef struct _GtkMenu GtkMenu;
@@ -144,7 +144,7 @@ private:
 
     RetainPtr<NSPopUpButtonCell> m_popup;
 #elif PLATFORM(QT)
-    QWebPopup* m_popup;
+    QtAbstractWebPopup* m_popup;
 #elif PLATFORM(WIN)
     // ScrollBarClient
     virtual void valueChanged(Scrollbar*);
diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp
index d3d71df..bae27e6 100644
--- a/WebCore/platform/qt/PopupMenuQt.cpp
+++ b/WebCore/platform/qt/PopupMenuQt.cpp
@@ -1,7 +1,7 @@
 /*
  * This file is part of the popup menu implementation for <select> elements in WebCore.
  *
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies)
  * Copyright (C) 2006 Apple Computer, Inc.
  * Copyright (C) 2006 Michael Emmel mike.emmel at gmail.com 
  * Coypright (C) 2006 Nikolas Zimmermann <zimmermann at kde.org>
@@ -28,14 +28,15 @@
 
 #include "FrameView.h"
 #include "PopupMenuClient.h"
-#include "QWebPopup.h"
+#include "QtAbstractWebPopup.h"
+#include "QtFallbackWebPopup.h"
 
 namespace WebCore {
 
 PopupMenu::PopupMenu(PopupMenuClient* client)
     : m_popupClient(client)
 {
-    m_popup = new QWebPopup(client);
+    m_popup = new QtFallbackWebPopup(client);
 }
 
 PopupMenu::~PopupMenu()
diff --git a/WebCore/platform/qt/QWebPopup.cpp b/WebCore/platform/qt/QWebPopup.cpp
deleted file mode 100644
index 707c69a..0000000
--- a/WebCore/platform/qt/QWebPopup.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-#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 {
-
-QWebPopup::QWebPopup(PopupMenuClient* client)
-    : m_client(client)
-    , m_popupVisible(false)
-{
-    Q_ASSERT(m_client);
-
-    setFont(m_client->menuStyle().font().font());
-    connect(this, SIGNAL(activated(int)),
-            SLOT(activeChanged(int)), Qt::QueuedConnection);
-}
-
-
-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();
-    m_popupVisible = true;
-}
-
-void QWebPopup::hidePopup()
-{
-    QWidget* activeFocus = QApplication::focusWidget();
-    if (activeFocus && activeFocus == view()
-        && activeFocus->testAttribute(Qt::WA_InputMethodEnabled)) {
-        QInputContext* qic = activeFocus->inputContext();
-        if (qic) {
-            qic->reset();
-            qic->setFocusWidget(0);
-        }
-    }
-
-    QComboBox::hidePopup();
-    if (!m_popupVisible)
-        return;
-
-    m_popupVisible = false;
-    m_client->popupDidHide();
-}
-
-void QWebPopup::activeChanged(int index)
-{
-    if (index < 0)
-        return;
-
-    m_client->valueChanged(index);
-}
-
-} // namespace WebCore
-
-#include "moc_QWebPopup.cpp"
diff --git a/WebCore/platform/qt/QWebPopup.h b/WebCore/platform/qt/QWebPopup.h
deleted file mode 100644
index 3718f2b..0000000
--- a/WebCore/platform/qt/QWebPopup.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-#ifndef QWebPopup_h
-#define QWebPopup_h
-
-#include <QComboBox>
-
-#include "PopupMenuClient.h"
-
-namespace WebCore {
-
-class QWebPopup : private QComboBox {
-    Q_OBJECT
-public:
-    QWebPopup(PopupMenuClient* client);
-
-    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();
-};
-
-}
-
-#endif
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.cpp b/WebCore/platform/qt/QtAbstractWebPopup.cpp
new file mode 100644
index 0000000..b16c6cb
--- /dev/null
+++ b/WebCore/platform/qt/QtAbstractWebPopup.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "config.h"
+#include "QtAbstractWebPopup.h"
+
+#include "PopupMenuStyle.h"
+
+
+namespace WebCore {
+
+// QAbstractWebPopup
+
+QtAbstractWebPopup::QtAbstractWebPopup(PopupMenuClient* client)
+    : m_client(client)
+{
+    Q_ASSERT(m_client);
+}
+
+QtAbstractWebPopup::~QtAbstractWebPopup()
+{
+}
+
+PopupMenuClient* QtAbstractWebPopup::client()
+{
+    return m_client;
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.h b/WebCore/platform/qt/QtAbstractWebPopup.h
new file mode 100644
index 0000000..3131e55
--- /dev/null
+++ b/WebCore/platform/qt/QtAbstractWebPopup.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef QtAbstractWebPopup_h
+#define QtAbstractWebPopup_h
+
+#include "PopupMenuClient.h"
+#include <QComboBox>
+
+namespace WebCore {
+
+class QtAbstractWebPopup {
+public:
+    QtAbstractWebPopup(PopupMenuClient* client);
+    virtual ~QtAbstractWebPopup();
+
+    virtual void show(const QRect& geometry, int selectedIndex) = 0;
+    virtual void hide() = 0;
+
+protected:
+    PopupMenuClient* client();
+
+private:
+    PopupMenuClient* m_client;
+};
+
+}
+
+#endif // QtAbstractWebPopup_h
diff --git a/WebCore/platform/qt/QtFallbackWebPopup.cpp b/WebCore/platform/qt/QtFallbackWebPopup.cpp
new file mode 100644
index 0000000..cf7cbb8
--- /dev/null
+++ b/WebCore/platform/qt/QtFallbackWebPopup.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "config.h"
+#include "QtFallbackWebPopup.h"
+
+#include "HostWindow.h"
+#include "QWebPageClient.h"
+#include <QAbstractItemView>
+#include <QApplication>
+#include <QInputContext>
+#include <QMouseEvent>
+#include <QStandardItemModel>
+
+namespace WebCore {
+
+// QtFallbackWebPopup
+
+QtFallbackWebPopup::QtFallbackWebPopup(PopupMenuClient* client)
+    : QtAbstractWebPopup(client)
+    , m_popupVisible(false)
+{
+    setFont(QtAbstractWebPopup::client()->menuStyle().font().font());
+    connect(this, SIGNAL(activated(int)),
+            SLOT(activeChanged(int)), Qt::QueuedConnection);
+}
+
+
+void QtFallbackWebPopup::show(const QRect& geometry, int selectedIndex)
+{
+    populate();
+    setCurrentIndex(selectedIndex);
+
+    QWidget* parent = 0;
+    if (client()->hostWindow() && client()->hostWindow()->platformPageClient())
+       parent = 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 QtFallbackWebPopup::populate()
+{
+    clear();
+
+    QStandardItemModel* model = qobject_cast<QStandardItemModel*>(QComboBox::model());
+    Q_ASSERT(model);
+
+    int size = client()->listSize();
+    for (int i = 0; i < size; i++) {
+        if (client()->itemIsSeparator(i))
+            insertSeparator(i);
+        else {
+            insertItem(i, client()->itemText(i));
+
+            if (model && !client()->itemIsEnabled(i))
+                model->item(i)->setEnabled(false);
+        }
+    }
+}
+
+void QtFallbackWebPopup::showPopup()
+{
+    QComboBox::showPopup();
+    m_popupVisible = true;
+}
+
+void QtFallbackWebPopup::hidePopup()
+{
+    QWidget* activeFocus = QApplication::focusWidget();
+    if (activeFocus && activeFocus == view()
+        && activeFocus->testAttribute(Qt::WA_InputMethodEnabled)) {
+        QInputContext* qic = activeFocus->inputContext();
+        if (qic) {
+            qic->reset();
+            qic->setFocusWidget(0);
+        }
+    }
+
+    QComboBox::hidePopup();
+    if (!m_popupVisible)
+        return;
+
+    m_popupVisible = false;
+    client()->popupDidHide();
+}
+
+void QtFallbackWebPopup::activeChanged(int index)
+{
+    if (index < 0)
+        return;
+
+    client()->valueChanged(index);
+}
+
+}
diff --git a/WebCore/platform/qt/QtFallbackWebPopup.h b/WebCore/platform/qt/QtFallbackWebPopup.h
new file mode 100644
index 0000000..039270c
--- /dev/null
+++ b/WebCore/platform/qt/QtFallbackWebPopup.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef QtFallbackWebPopup_h
+#define QtFallbackWebPopup_h
+
+#include "QtAbstractWebPopup.h"
+#include <QComboBox>
+
+namespace WebCore {
+
+class QtFallbackWebPopup : private QComboBox, public QtAbstractWebPopup {
+    Q_OBJECT
+public:
+    QtFallbackWebPopup(PopupMenuClient* client);
+
+    virtual void show(const QRect& geometry, int selectedIndex);
+    virtual void hide() { hidePopup(); }
+
+private slots:
+    void activeChanged(int);
+
+private:
+    bool m_popupVisible;
+
+    void populate();
+
+    virtual void showPopup();
+    virtual void hidePopup();
+};
+
+}
+
+#endif // QtFallbackWebPopup_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list